Beispiel #1
0
        public void RenderBones()
        {
            if (VBN != null)
            {
                RenderTools.DrawVBN(VBN);
            }

            if (Bch != null)
            {
                foreach (BCH_Model mo in Bch.Models.Nodes)
                {
                    RenderTools.DrawVBN(mo.skeleton);
                }
            }

            if (Bfres != null)
            {
                foreach (var mo in Bfres.models)
                {
                    RenderTools.DrawVBN(mo.skeleton);
                }
            }

            if (DatMelee != null)
            {
                RenderTools.DrawVBN(DatMelee.bones);
            }
        }
Beispiel #2
0
        public void RenderBones()
        {
            if (VBN != null)
            {
                RenderTools.DrawVBN(VBN);
            }

            if (BCH != null)
            {
                foreach (BCH_Model mo in BCH.Models.Nodes)
                {
                    RenderTools.DrawVBN(mo.skeleton);
                }
            }
            if (BFRES != null)
            {
                foreach (var mo in BFRES.models)
                {
                    RenderTools.DrawVBN(mo.skeleton);
                }
            }

            if (DAT_MELEE != null)
            {
                RenderTools.DrawVBN(DAT_MELEE.bones);
            }
        }
Beispiel #3
0
        public void RenderBones()
        {
            if (VBN != null)
            {
                RenderTools.DrawVBN(VBN);
            }

            if (BCH != null)
            {
                foreach (BCH_Model mo in BCH.Models.Nodes)
                {
                    RenderTools.DrawVBN(mo.skeleton);
                }
            }

            if (dat_melee != null)
            {
                RenderTools.DrawVBN(dat_melee.bones);
            }
        }
Beispiel #4
0
        // Rendering
        private void Render()
        {
            if (!render)
            {
                return;
            }

            glViewport.MakeCurrent();

            GL.LoadIdentity();
            GL.Viewport(glViewport.ClientRectangle);

            // Push all attributes so we don't have to clean up later
            GL.PushAttrib(AttribMask.AllAttribBits);
            // clear the gf buffer
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            if (Runtime.renderBackGround)
            {
                GL.Begin(PrimitiveType.Quads);
                GL.Color3(back1);
                GL.Vertex2(1.0, 1.0);
                GL.Vertex2(-1.0, 1.0);
                GL.Color3(back2);
                GL.Vertex2(-1.0, -1.0);
                GL.Vertex2(1.0, -1.0);
                GL.End();
            }

            // set up the viewport projection and send it to GPU
            GL.MatrixMode(MatrixMode.Projection);

            if (glViewport.Focused && glViewport.ClientRectangle.Contains(PointToClient(Cursor.Position)))
            {
                cam.Update();
                view = cam.getViewMatrix() * perspective;
            }
            cam.TrackMouse();

            GL.Enable(EnableCap.DepthTest);
            GL.ClearDepth(1.0);

            GL.LoadMatrix(ref view);
            // ready to start drawing model stuff
            GL.MatrixMode(MatrixMode.Modelview);

            RenderTools.drawFloor(Matrix4.CreateTranslation(Vector3.Zero));

            GL.Enable(EnableCap.Normalize);  // These is critical to have
            GL.Enable(EnableCap.RescaleNormal);

            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Lequal);

            GL.Enable(EnableCap.AlphaTest);
            GL.AlphaFunc(AlphaFunction.Gequal, 0.1f);

            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Front);

            GL.Enable(EnableCap.LineSmooth);

            foreach (ModelContainer m in draw)
            {
                RenderTools.DrawModel(m, view);
            }

            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.DepthFunc(DepthFunction.Less);
            GL.AlphaFunc(AlphaFunction.Gequal, 0.1f);
            GL.Disable(EnableCap.CullFace);

            GL.UseProgram(0);
            // clear the buffer bit so the skeleton
            // will be drawn on top of everything
            GL.Clear(ClearBufferMask.DepthBufferBit);

            // drawing the bones
            foreach (ModelContainer m in draw)
            {
                if (m.vbn != null)
                {
                    RenderTools.DrawVBN(m.vbn);
                }
            }

            GL.PopAttrib();
            glViewport.SwapBuffers();
        }
Beispiel #5
0
        // Rendering
        private void Render()
        {
            if (!render)
            {
                return;
            }

            glViewport.MakeCurrent();

            GL.LoadIdentity();
            GL.Viewport(glViewport.ClientRectangle);

            // Push all attributes so we don't have to clean up later
            GL.PushAttrib(AttribMask.AllAttribBits);
            // clear the gf buffer
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            if (Runtime.renderBackGround)
            {
                GL.Begin(PrimitiveType.Quads);
                GL.Color3(Runtime.back1);
                GL.Vertex2(1.0, 1.0);
                GL.Vertex2(-1.0, 1.0);
                GL.Color3(Runtime.back2);
                GL.Vertex2(-1.0, -1.0);
                GL.Vertex2(1.0, -1.0);
                GL.End();
            }

            // set up the viewport projection and send it to GPU

            if (!OpenTK.Input.Keyboard.GetState().IsKeyDown(OpenTK.Input.Key.S))
            {
                selecting = false;
                if (glViewport.Focused && glViewport.ClientRectangle.Contains(PointToClient(Cursor.Position)))
                {
                    cam.Update();
                    view = cam.getModelViewMatrix() * perspective;
                }
                cam.TrackMouse();
            }
            else
            {
                if (OpenTK.Input.Mouse.GetState().IsButtonDown(OpenTK.Input.MouseButton.Left) && !selecting)
                {
                    selecting = true;
                    Vector2 m = getMouseOnViewPort();
                    sx1 = m.X;
                    sy1 = m.Y;
                }
            }

            GL.Enable(EnableCap.DepthTest);
            GL.ClearDepth(1.0);

            GL.LoadMatrix(ref view);
            // ready to start drawing model stuff
            GL.MatrixMode(MatrixMode.Modelview);

            if (Runtime.renderFloor)
            {
                RenderTools.drawFloor();
            }

            GL.Enable(EnableCap.Normalize);  // These is critical to have
            GL.Enable(EnableCap.RescaleNormal);

            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Lequal);

            GL.Enable(EnableCap.AlphaTest);
            GL.AlphaFunc(AlphaFunction.Gequal, 0.1f);

            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Front);

            GL.Enable(EnableCap.LineSmooth);

            GL.Enable(EnableCap.StencilTest);
            GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Replace);

            // draw renderable objects

            foreach (ModelContainer m in draw)
            {
                RenderTools.DrawModel(m, view);
            }

            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.DepthFunc(DepthFunction.Less);
            GL.AlphaFunc(AlphaFunction.Gequal, 0.1f);
            GL.Disable(EnableCap.CullFace);

            // clear the buffer bit so the skeleton
            // will be drawn on top of everything
            GL.UseProgram(0);
            GL.Clear(ClearBufferMask.DepthBufferBit);

            // drawing the bones
            foreach (ModelContainer m in draw)
            {
                if (m.vbn != null)
                {
                    RenderTools.DrawVBN(m.vbn);
                }
            }

            // Mouse selection
            if (selecting)
            {
                GL.MatrixMode(MatrixMode.Projection);
                GL.LoadIdentity();
                GL.Clear(ClearBufferMask.DepthBufferBit);

                if (OpenTK.Input.Mouse.GetState().IsButtonDown(OpenTK.Input.MouseButton.Right))
                {
                    selecting = false;
                }

                Vector2 m = getMouseOnViewPort();
                GL.Color3(Color.AliceBlue);
                GL.LineWidth(2f);
                GL.Begin(PrimitiveType.LineLoop);
                GL.Vertex2(sx1, sy1);
                GL.Vertex2(m.X, sy1);
                GL.Vertex2(m.X, m.Y);
                GL.Vertex2(sx1, m.Y);
                GL.End();
            }

            GL.PopAttrib();
            glViewport.SwapBuffers();
        }