Untitled

mail@pastecode.io avatar
unknown
java
2 months ago
1.2 kB
2
Indexable
Never
```java
public class SceneService extends SceneManager {

    private final Array<RenderableProvider> nonShadowRenderableProviders;

    public SceneService(ShaderProvider shaderProvider, DepthShaderProvider depthShaderProvider) {
        super(shaderProvider, depthShaderProvider);
        this.nonShadowRenderableProviders = new Array<>();
    }

    @Override
    public void renderColors() {
        ModelBatch batch = this.getBatch();
        batch.begin(camera);
        batch.render(this.nonShadowRenderableProviders, computedEnvironement);
        batch.render(this.getRenderableProviders(), computedEnvironement);
        batch.end();
    }

    public void addSceneWithoutShadows(Scene scene, boolean appendLights) {
        this.nonShadowRenderableProviders.add(scene);
        if (appendLights) {
            for (ObjectMap.Entry<Node, BaseLight> e : scene.lights) {
                environment.add(e.value);
            }
        }
    }

    public void removeSceneWithoutShadows(Scene scene) {
        this.nonShadowRenderableProviders.removeValue(scene, false);
    }

    public Array<RenderableProvider> getNonShadowRenderableProviders() {
        return this.nonShadowRenderableProviders;
    }
}
```
Leave a Comment