Пример #1
0
        public MasterRenderer(Camera camera, Loader loader, DirectionalLight sun, int width, int height)
        {
            Gl.Enable(EnableCap.DepthTest);
            this.clientWidth      = width;
            this.clientHeight     = height;
            this.projectionMatrix = Maths.CreateProjectionMatrix(FOV, AspectRatio, NEAR_PLANE, FAR_PLANE);

            //Entities
            this.entityShader   = new StaticShader();
            this.entityRenderer = new EntityRenderer(entityShader, width, height, this.projectionMatrix);
            this.entities       = new Dictionary <TextureModel, List <Entity> >();

            //Skybox
            this.skyboxRenderer = new SkyboxRenderer(loader, this.projectionMatrix);

            //Shadow
            this.shadowDepthShader      = new ShadowDepthShader();
            this.shadowDepthFrameBuffer = new ShadowDepthFrameBuffer();
            this.shadowRenderer         = new ShadowRenderer(sun, shadowDepthShader, shadowDepthFrameBuffer);

            //Terrain
            this.terrainShader   = new TerrainShader();
            this.terrainRenderer = new TerrainRenderer(this.terrainShader, this.projectionMatrix, this.shadowRenderer);
            this.terrainList     = new List <Terrain>();
        }
Пример #2
0
 public TerrainRenderer(TerrainShader shader, Matrix4x4f projectionMatrix, ShadowRenderer shadowRenderer)
 {
     this.shadowRenderer = shadowRenderer;
     this.shader         = shader;
     this.shader.Start();
     this.shader.LoadProjectionMatrix(projectionMatrix);
     this.shader.ConnetTextureUnits();
     this.shader.Stop();
 }