Example #1
0
 /// <summary>
 /// käytä fps kamerassa
 /// </summary>
 public void SetFPSCamera()
 {
     GLExt.LoadIdentity();
     GLExt.RotateX(-Rotation.X);
     GLExt.RotateY(-Rotation.Y);
     GLExt.RotateZ(-Rotation.Z);
     GLExt.Translate(-Position.X, -Position.Y, -Position.Z);
 }
Example #2
0
        void Translate(Node node)
        {
            Node obj = node;

            if (node == null)
            {
                obj = this;
            }

            GLExt.Translate(obj.Position.X, obj.Position.Y, obj.Position.Z);
            GLExt.RotateZ(Rotation.Z);
            GLExt.RotateY(Rotation.Y);
            GLExt.RotateX(Rotation.X);
            GLExt.MultMatrix(ref OrigOrientationMatrix);
            GLExt.Scale(obj.Scale.X, obj.Scale.Y, obj.Scale.Z);
        }
Example #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);
            }
        }