コード例 #1
0
        public override void RenderBound(ref Matrix4 projectionMatrix, ref Matrix4 viewMatrix, Color4 color)
        {
            PostConstructor();

            Matrix4 worldMatrix = Matrix4.Identity;

            if ((Bound.GetBoundType() & BoundBase.BoundType.AABB) == BoundBase.BoundType.AABB)
            {
                worldMatrix = (Bound as AABB).ScalePlusTranslation;
            }
            else
            {
                worldMatrix = (Bound as OBB).TransformationMatrix;
            }

            Matrix4 modelViewMatrix = worldMatrix * viewMatrix;

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projectionMatrix);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref modelViewMatrix);
            GL.Color4(color);
            GL.EnableClientState(ArrayCap.VertexArray);
            GL.VertexPointer(3, VertexPointerType.Float, 0, (float[, ])skin.Buffer.GetVertexBufferArray().First().GetBufferData());
            GL.DrawArrays(PrimitiveType.LineStrip, 0, skin.Buffer.GetVertexBufferArray().First().GetBufferVerticesCount());
            GL.DisableClientState(ArrayCap.VertexArray);

            base.RenderBound(ref projectionMatrix, ref viewMatrix, color);
        }