@Override public void renderForeground(SpriteBatch batch) { floor.render(batch); fgRoots1.render(batch); fgRoots2.render(batch); renderDoorLight(batch); }
@Override public void render(ShapeRenderer shapes, SpriteBatch batch) { bossSleeps.render(batch); renderBossEyes(batch); bossSleepsGlow.render(batch); bossAngryGlow.render(batch); bossAngryGlowAdd.render(batch); bossAwake.render(batch); bossSleepsRoots.render(batch); renderShrine(shapes, batch); door_back.render(batch); leftTorch.render(batch); rightTorch.render(batch); BatchUtils.setBlendFuncAdd(batch); leftTorchFire.setTint(shrineGlowAlpha); leftTorchFire.render(batch); leftTorchGlow.setTint((shrineGlowAlpha) * (doorLightScale - (float) Math.random() * 0.1f)); leftTorchGlow.render(batch); rightTorchFire.setTint(shrineGlowAlpha); rightTorchFire.render(batch); rightTorchGlow.setTint((shrineGlowAlpha) * (doorLightScale - (float) Math.random() * 0.1f)); rightTorchGlow.render(batch); BatchUtils.setBlendFuncNormal(batch); }
private void renderShrine(ShapeRenderer shapes, SpriteBatch batch) { batch.end(); // 2. clear our depth buffer with 1.0 Gdx.gl.glClearDepthf(1f); Gdx.gl.glClear(GL20.GL_DEPTH_BUFFER_BIT); // 3. set the function to LESS Gdx.gl.glDepthFunc(GL20.GL_LESS); // 4. enable depth writing Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); // 5. Enable depth writing, disable RGBA color writing Gdx.gl.glDepthMask(true); Gdx.gl.glColorMask(false, false, false, false); // 6. render your primitive shapes shapes.begin(ShapeType.Filled); // TODO: remove setColor if not needed. shapes.setColor(1f, 0f, 0f, 0.5f); // shapes.circle(200, 200, 100); shapes.setColor(0f, 1f, 0f, 0.5f); // shapes.rect(200, 200, 100, 100); shapes.rect(-300, 0, 600, 500); shapes.rect(100, 100, 100, 100); shapes.end(); batch.begin(); // 8. Enable RGBA color writing // (SpriteBatch.begin() will disable depth mask) Gdx.gl.glColorMask(true, true, true, true); // 9. Make sure testing is enabled. Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); // 10. Now depth discards pixels outside our masked shapes Gdx.gl.glDepthFunc(GL20.GL_EQUAL); shrineOff.render(batch); shrineOn.setAlpha(shrineGlowAlpha); shrineOn.render(batch); batch.end(); Gdx.gl.glDepthFunc(GL20.GL_ALWAYS); batch.begin(); }
private void renderBossEyes(SpriteBatch batch) { if (bossStateTime > 7) { bossStateTime -= 7; } float alpha = 0; if (bossStateTime < 4) { if (relicTaken) bossStateTime = 0; alpha = 0; } else if (bossStateTime < 4.333f) { alpha = (bossStateTime - 4) / 0.333f; } else if (bossStateTime < 7f) { alpha = 1 - (bossStateTime - 4.333f) / 2.667f; } bossSleepsGlow.setAlpha(alpha); bossSleepsGlow.render(batch); }
@Override public void renderTop(SpriteBatch batch) { door.render(batch); }