예제 #1
0
 public SpriteRenderer(SpriteShader _shader)
 {
     UIQuad = Loader.LoadToVAO(Geometry.GetVertex(Geometries.Quad), Geometry.GetVertexName(Geometries.Quad));
     shader = _shader;
     shader.Start();
     shader.Stop();
 }
예제 #2
0
        public void Render(Light sun, Camera camera)
        {
            foreach (var gameObject in Game.GetSceneGameObjects())
            {
                gameObject.ProccessRender <Entity>(ProcessEntity);
                gameObject.ProccessRender <Terrain>(ProcessTerrain);
                gameObject.ProccessRender <Sprite>(ProcessSprite);
                gameObject.ProccessRender <Text>(ProcessText);
            }

            skyboxRenderer.Render(camera);

            entityShader.Start();
            entityShader.UpdateCamera(camera);
            entityRenderer.Render(CreateEntityRenderList());
            entityShader.LoadLight(sun);
            entityShader.Stop();

            terrainShader.Start();
            terrainShader.UpdateCamera(camera);
            terrainRenderer.Render(terrains);
            terrainShader.LoadLight(sun);
            terrainShader.Stop();

            shaderUI.Start();
            shaderUI.UpdateCamera(camera);
            spriteRenderer.Render(sprites, camera.gameObject.transform.position);
            shaderUI.Stop();

            textShader.Start();
            textShader.UpdateCamera(camera);
            textRenderer.Render(texts, camera.gameObject.transform.position);
            textShader.Stop();

            terrains.Clear();
            entities.Clear();
            sprites.Clear();
            texts.Clear();
        }