Exemplo n.º 1
0
 /// <summary>
 /// Crea un`istanza del MasterRenderer
 /// </summary>
 /// <param name="camera">La camper usata nella scena</param>
 /// <param name="width">Larghezza in pixel della finestra</param>
 /// <param name="height">Altezza in pixel della finestra</param>
 public ShadowMapMasterRenderer(Camera camera, int width, int height)
 {
     shader         = new ShadowShader();
     shadowBox      = new ShadowBox(lightViewMatrix, camera, width, height);
     shadowFbo      = new ShadowFrameBuffer(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE);
     entityRenderer = new ShadowMapEntityRenderer(shader, projectionViewMatrix);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Preparazione prima del rendering
 /// </summary>
 /// <param name="lightDirection">La direzione dei raggi del sole</param>
 /// <param name="box">Informazioni riguardo il "view cuboid"</param>
 private void Prepare(Vector3 lightDirection, ShadowBox box)
 {
     UpdateOrthoProjectionMatrix(box.GetWidth(), box.GetHeight(), box.GetLength());
     UpdateLightViewMatrix(lightDirection, box.GetCenter());
     /////////////////
     projectionMatrix = lightViewMatrix * projectionViewMatrix;
     shadowFbo.BindFrameBuffer();
     GL.Enable(EnableCap.DepthTest);
     GL.Clear(ClearBufferMask.DepthBufferBit);
     shader.Start();
 }