Bugfix for alpha-masking sometimes not working.
This commit is contained in:
@@ -14,7 +14,7 @@ include (cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME JGL
|
||||
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-44.zip
|
||||
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-45.zip
|
||||
)
|
||||
|
||||
CPMAddPackage(
|
||||
|
BIN
assets/sprites/alpha_mask.png
Normal file
BIN
assets/sprites/alpha_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
@@ -10,5 +10,5 @@ class Game::Box final : public Engine::InstancedSprite {
|
||||
public:
|
||||
void Update() final;
|
||||
public:
|
||||
explicit Box(const Vector2& position, unsigned int depth = 0, float rad_rotation = 0.0f) : Engine::InstancedSprite(position, depth, "assets/sprites/Re3D.png", rad_rotation) {}
|
||||
explicit Box(const Vector2& position, unsigned int depth = 0, float rad_rotation = 0.0f) : Engine::InstancedSprite(position, depth, "assets/sprites/Re3D.png", rad_rotation, Colors::White, nullptr, "assets/sprites/alpha_mask.png") {}
|
||||
};
|
@@ -6,19 +6,14 @@ Texture* InstancedSprite::GetTexture() {
|
||||
auto* itx = Globals::CurrentScene->GetInstancedTexture(this);
|
||||
if (itx)
|
||||
return itx->GetTexture();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Texture* InstancedSprite::GetAlphaMask() {
|
||||
if (Sprite::GetAlphaMask())
|
||||
return Sprite::GetAlphaMask();
|
||||
|
||||
auto* ita = Globals::CurrentScene->GetInstancedAlphaMask(this);
|
||||
if (ita)
|
||||
return ita->GetTexture();
|
||||
|
||||
return nullptr;
|
||||
return Sprite::GetAlphaMask();
|
||||
}
|
||||
|
||||
InstancedSprite::~InstancedSprite() {
|
||||
|
@@ -167,8 +167,8 @@ InstancedTexture* Scene::GetInstancedAlphaMask(const InstancedSprite* user) {
|
||||
if (itx->InUseBy(user))
|
||||
return itx;
|
||||
|
||||
if (!user->GetAlphaMaskFilesystemPath().empty() && !instanced_alpha_masks.empty()) {
|
||||
auto *t = new Texture(user->GetTextureFilesystemPath());
|
||||
if (!user->GetAlphaMaskFilesystemPath().empty()) {
|
||||
auto *t = new Texture(user->GetAlphaMaskFilesystemPath());
|
||||
auto *itx = new InstancedTexture(t, user);
|
||||
instanced_alpha_masks.push_back(itx);
|
||||
return itx;
|
||||
|
Reference in New Issue
Block a user