Example #1
0
        public void ApplyViewToShader_Skybox <T>(IGFXShader <T> shader)
            where T : Effect
        {
            Matrix m = Matrix.Identity;

            //if (TaeInterop.CameraFollowsRootMotion)
            //    m *= Matrix.CreateTranslation(-TaeInterop.CurrentRootMotionDisplacement.XYZ());

            shader.ApplyWorldView(m * Matrix_World, Matrix_View_Skybox, Matrix_Projection_Skybox);
        }
Example #2
0
        //public void ApplyViewToShader<T>(IGFXShader<T> shader)
        //    where T : Effect
        //{
        //    Matrix m = Matrix.Identity;

        //    if (TaeInterop.CameraFollowsRootMotion)
        //        m *= Matrix.CreateTranslation(-TaeInterop.CurrentRootMotionDisplacement.XYZ());

        //    shader.ApplyWorldView(m, CameraTransform.CameraViewMatrix * Matrix.Invert(MatrixWorld), MatrixProjection);
        //}

        public void ApplyViewToShader_Skybox <T>(IGFXShader <T> shader)
            where T : Effect
        {
            Matrix m = Matrix.Identity;

            //if (TaeInterop.CameraFollowsRootMotion)
            //    m *= Matrix.CreateTranslation(-TaeInterop.CurrentRootMotionDisplacement.XYZ());

            shader.ApplyWorldView(m, CameraTransform.RotationMatrixNeg * Matrix.CreateScale(-1), MatrixProjection);
        }
Example #3
0
        public void Draw <T>(int lod, IGFXShader <T> shader, bool forceNoBackfaceCulling = false)
            where T : Effect
        {
            if (!IsVisible)
            {
                return;
            }

            if (GFX.EnableTextures && shader == GFX.FlverShader)
            {
                GFX.FlverShader.Effect.ColorMap    = TexDataDiffuse ?? Main.DEFAULT_TEXTURE_DIFFUSE;
                GFX.FlverShader.Effect.SpecularMap = TexDataSpecular ?? Main.DEFAULT_TEXTURE_SPECULAR;
                GFX.FlverShader.Effect.NormalMap   = TexDataNormal ?? Main.DEFAULT_TEXTURE_NORMAL;
                //GFX.FlverShader.Effect.LightMap2 = TexDataDOL2 ?? Main.DEFAULT_TEXTURE_DIFFUSE;
            }

            //if (GFX.EnableLightmapping /*&& !GFX.EnableLighting*/)
            //{
            //    GFX.FlverShader.Effect.LightMap1 = TexDataDOL1 ?? Main.DEFAULT_TEXTURE_DIFFUSE;
            //}

            GFX.Device.SetVertexBuffers(VertBufferBinding, Parent.InstanceBufferBinding);

            //foreach (var technique in shader.Effect.Techniques)
            //{
            //    shader.Effect.CurrentTechnique = technique;
            foreach (EffectPass pass in shader.Effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                foreach (var faceSet in MeshFacesets)
                {
                    if (!HasNoLODs && faceSet.LOD != lod)
                    {
                        continue;
                    }

                    GFX.Device.Indices = faceSet.IndexBuffer;

                    GFX.BackfaceCulling = forceNoBackfaceCulling ? false : faceSet.BackfaceCulling;

                    GFX.Device.DrawInstancedPrimitives(faceSet.IsTriangleStrip ? PrimitiveType.TriangleStrip : PrimitiveType.TriangleList, 0, 0,
                                                       faceSet.IsTriangleStrip ? (faceSet.IndexCount - 2) : (faceSet.IndexCount / 3), Parent.InstanceCount);
                }
            }
            //}
        }
Example #4
0
 public void ApplyViewToShader <T>(IGFXShader <T> shader, Transform modelTransform)
     where T : Effect
 {
     ApplyViewToShader(shader, modelTransform.WorldMatrix);
 }
Example #5
0
 public void ApplyViewToShader <T>(IGFXShader <T> shader, Matrix modelMatrix)
     where T : Effect
 {
     shader.ApplyWorldView(modelMatrix * Matrix_World, Matrix_View, Matrix_Projection);
 }
Example #6
0
 public void ApplyViewToShader <T>(IGFXShader <T> shader, Transform modelTransform)
     where T : Effect
 {
     shader.ApplyWorldView(modelTransform.WorldMatrix, CameraTransform.CameraViewMatrix * Matrix.Invert(MatrixWorld), MatrixProjection);
 }
Example #7
0
 public void ApplyViewToShader <T>(IGFXShader <T> shader)
     where T : Effect
 {
     shader.ApplyWorldView(Matrix.Identity, CameraTransform.CameraViewMatrix * Matrix.Invert(MatrixWorld), MatrixProjection);
 }
 public void ApplyViewToShader <T>(IGFXShader <T> shader)
     where T : Effect
 {
     shader.ApplyWorldView(MatrixWorld, CameraTransform.CameraViewMatrix, MatrixProjection);
 }