Beispiel #1
0
        public void draw(GraphicsInterface gi, ref Transform transform, byte drawLayers, ref RenderCamera camTrs, DrawOptions options = 0)
        {
            GeoNode  NodeIter;
            GeoModel ModelIter;
            GeoMesh  MeshIter;
            uint     NodeIterPos;
            uint     ModelIterPos;
            uint     MeshIterPos;
            var      new_transform = Local * transform;

            GL.PushMatrix();
            Local.GL_Load();
            if (this.forceBillboard)
            {
                camTrs.MakeBillboardAndRotateGL(ref transform);
            }
            if (0 != (SelfDrawLayerMask & drawLayers))
            {
                for (ModelIter = FirstModel, ModelIterPos = ModelCount; 0 != ModelIterPos; ModelIter = ModelIter.Next, --ModelIterPos)
                {
                    if (0 != (ModelIter.DrawLayerMask & drawLayers))
                    {
                        for (MeshIter = ModelIter.First, MeshIterPos = ModelIter.Count; 0 != MeshIterPos; MeshIter = MeshIter.Next, --MeshIterPos)
                        {
                            if (0 != (MeshIter.DrawLayerMask & drawLayers))
                            {
                                gi.Draw(ref MeshIter.State, Options: options);
                            }
                        }
                    }
                }
            }

            for (NodeIter = FirstChild, NodeIterPos = NumImmediate; 0 != NodeIterPos; NodeIter = NodeIter.Sibling, --NodeIterPos)
            {
                if (0 != (NodeIter.DrawLayerMask & drawLayers))
                {
                    NodeIter.draw(gi, ref new_transform, drawLayers, ref camTrs, options);
                }
            }

            GL.PopMatrix();
        }
Beispiel #2
0
        public bool draw(
            GraphicsInterface gi,
            Transform transform,
            byte drawLayers,
            ref RenderCamera camTrs)
        {
            GeoNode NodeIter;
            uint    NodeIterPos;

            for (NodeIterPos = NumImmediate, NodeIter = FirstChild; 0 != NodeIterPos; NodeIter = NodeIter.Sibling, --NodeIterPos)
            {
                if (0 == (NodeIter.DrawLayerMask & drawLayers))
                {
                    continue;
                }

                GL.PushMatrix();
                transform.GL_Load();
                do
                {
                    NodeIter.draw(gi, ref transform, drawLayers, ref camTrs);
                    while (0 != --NodeIterPos &&
                           0 == ((NodeIter = NodeIter.Sibling).DrawLayerMask & drawLayers))
                    {
                        continue;
                    }
                } while (0 != NodeIterPos);
                GL.DisableClientState(ArrayCap.ColorArray);
                GL.DisableClientState(ArrayCap.NormalArray);
                GL.DisableClientState(ArrayCap.TextureCoordArray);
                GL.DisableClientState(ArrayCap.VertexArray);
                GL.PopMatrix();
                return(true);
            }
            return(false);
        }