コード例 #1
0
ファイル: Shadows.cs プロジェクト: johtela/Compose3D
 public static GLShader GeometryShaderCascaded()
 {
     return(GLShader.CreateGeometryShader <PerVertexOut> (3,
                                                          CascadedShadowUniforms.MapCount, PrimitiveType.Triangles,
                                                          PrimitiveType.TriangleStrip, () =>
                                                          from p in Shader.Inputs <Primitive> ()
                                                          from u in Shader.Uniforms <Shadows> ()
                                                          from c in Shader.Uniforms <CascadedShadowUniforms> ()
                                                          let viewLight = (!c.viewLightMatrices)[p.gl_InvocationID]
                                                                          select new PerVertexOut[3]
     {
         new PerVertexOut()
         {
             gl_Position = ShadowShaders.ClampToNearPlane(viewLight * p.gl_in[0].gl_Position),
             gl_Layer = p.gl_InvocationID
         },
         new PerVertexOut()
         {
             gl_Position = ShadowShaders.ClampToNearPlane(viewLight * p.gl_in[1].gl_Position),
             gl_Layer = p.gl_InvocationID
         },
         new PerVertexOut()
         {
             gl_Position = ShadowShaders.ClampToNearPlane(viewLight * p.gl_in[2].gl_Position),
             gl_Layer = p.gl_InvocationID
         }
     }
                                                          ));
 }
コード例 #2
0
 public static GLShader Passthrough <P, V> ()
     where P : Primitive
     where V : PerVertexOut, new ()
 {
     return(GLShader.CreateGeometryShader <V> (3, 0,
                                               PrimitiveType.Triangles, PrimitiveType.TriangleStrip, () =>
                                               from p in Shader.Inputs <P> ()
                                               select new V[3]
     {
         new V()
         {
             gl_Position = p.gl_in[0].gl_Position, gl_Layer = 0
         },
         new V()
         {
             gl_Position = p.gl_in[1].gl_Position, gl_Layer = 0
         },
         new V()
         {
             gl_Position = p.gl_in[2].gl_Position, gl_Layer = 0
         }
     }
                                               ));
 }