예제 #1
0
        public static void SetMaterial(string materialName)
        {
            Material mat = materials[materialName];

            if (mat != null)
            {
                mat.SetMaterial();
            }
        }
예제 #2
0
파일: OgreMesh.cs 프로젝트: Keilerr/csat
        public void RenderMesh()
        {
            if (Vbo == null)
            {
                return;
            }

            if (DoubleSided)
            {
                GL.Disable(EnableCap.CullFace);
            }
            if (VBO.FastRenderPass)
            {
                if (CastShadow)
                {
                    Vbo.Render();
                }
            }
            else
            {
                Material.SetMaterial();
                if (WorldMatrix != null)
                {
                    GLExt.MatrixMode(MatrixMode.Texture);
                    GLExt.PushMatrix();
                    GLExt.MultMatrix(ref WorldMatrix);
                    GLExt.MatrixMode(MatrixMode.Modelview);
                }

                Vbo.Render();

                if (WorldMatrix != null)
                {
                    GLExt.MatrixMode(MatrixMode.Texture);
                    GLExt.PopMatrix();
                    GLExt.MatrixMode(MatrixMode.Modelview);
                }
            }
            if (DoubleSided)
            {
                GL.Enable(EnableCap.CullFace);
            }
        }
예제 #3
0
        public void RenderMesh()
        {
            if (DoubleSided)
            {
                GL.Disable(EnableCap.CullFace);
            }

            if (VBO.FastRenderPass == false)
            {
                Material.SetMaterial();
                GLExt.MatrixMode(MatrixMode.Texture);
                GL.ActiveTexture(TextureUnit.Texture0 + Settings.SHADOW_TEXUNIT);
                GLExt.PushMatrix();
                if (WorldMatrix != null)
                {
                    GLExt.MultMatrix(ref WorldMatrix);
                }
                GLExt.RotateX(-90);
                GLExt.MatrixMode(MatrixMode.Modelview);
            }

            if (VBO.FastRenderPass == false || CastShadow == true)
            {
                GLExt.RotateX(-90);

                for (int i = 0; i < model.Length; i++)
                {
                    if (model[i].vbo == null)
                    {
                        continue;
                    }

                    if (VBO.FastRenderPass == false)
                    {
                        model[i].texture.Bind(0);
                    }

                    // lasketaanko uusi asento (jos ei olla laskettu jo shadowpassis)
                    if (animCalculated == false)
                    {
                        // Interpolate skeletons between two frames
                        InterpolateSkeletons(ref curAnim.skelFrames, curAnim.curFrame, curAnim.nextFrame, curAnim.numJoints, curAnim.lastTime * curAnim.frameRate);
                        PrepareMesh();
                        animCalculated = true;
                    }
                    model[i].vbo.Render();
                }

                if (VBO.FastRenderPass == false)
                {
                    GLExt.MatrixMode(MatrixMode.Texture);
                    GL.ActiveTexture(TextureUnit.Texture0 + Settings.SHADOW_TEXUNIT);
                    GLExt.PopMatrix();
                    GLExt.MatrixMode(MatrixMode.Modelview);
                    animCalculated = false;
                }
            }
            if (DoubleSided)
            {
                GL.Enable(EnableCap.CullFace);
            }
        }