예제 #1
0
 public void Render(List <Light> lights, Camera camera)
 {
     Prepare();
     entityShader.Start();
     entityShader.LoadFogColour(R, G, B);
     entityShader.LoadLights(lights);
     entityShader.LoadViewMatrix(camera);
     renderer.Render(entities);
     entityShader.Stop();
     terrainShader.Start();
     terrainShader.LoadFogColour(R, G, B);
     terrainShader.LoadLights(lights);
     terrainShader.LoadViewMatrix(camera);
     terrainRenderer.Render(terrains);
     terrainShader.Stop();
     terrains.Clear();
     entities.Clear();
 }
예제 #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();
        }