protected override void DrawPrimitive(eLevelofDetail lod, UWB_DrawHelper draw_helper)
        {
            draw_helper.pushModelTransform();
            {
                m_xaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();

            UWB_XFormInfo yrot = new UWB_XFormInfo();
            yrot.UpdateRotationZByDegree(-90.0f);
            draw_helper.pushModelTransform();
            {
                yrot.setupModelStack(draw_helper);
                m_yaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();

            UWB_XFormInfo zrot = new UWB_XFormInfo();
            zrot.UpdateRotationYByDegree(90.0f);
            draw_helper.pushModelTransform();
            {
                zrot.setupModelStack(draw_helper);
                m_zaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();
        }
        protected override void DrawPrimitive(eLevelofDetail lod, UWB_DrawHelper draw_helper)
        {
            draw_helper.pushModelTransform();
            {
                m_xaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();

            UWB_XFormInfo yrot = new UWB_XFormInfo();

            yrot.UpdateRotationZByDegree(-90.0f);
            draw_helper.pushModelTransform();
            {
                yrot.setupModelStack(draw_helper);
                m_yaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();

            UWB_XFormInfo zrot = new UWB_XFormInfo();

            zrot.UpdateRotationYByDegree(90.0f);
            draw_helper.pushModelTransform();
            {
                zrot.setupModelStack(draw_helper);
                m_zaxis.Draw(lod, draw_helper);
            }
            draw_helper.popModelTransform();
        }
        protected override void DrawPrimitive(eLevelofDetail lod, UWB_DrawHelper draw_helper)
        {
            UWB_XNAGraphicsDevice graphics = UWB_XNAGraphicsDevice.m_TheAPI;
            UWB_XNAPrimitiveMesh pCylinderMesh = new UWB_XNAPrimitiveMesh("cylinder");
            UWB_XNAPrimitiveMesh pConeMesh = new UWB_XNAPrimitiveMesh("cone");

            if (pCylinderMesh != null && pConeMesh != null)
            {
                pCylinderMesh.Material = Material;
                pConeMesh.Material = Material;
                draw_helper.pushModelTransform();
                {
                    // Need to add support for finding the bounding box of a mesh
                    // the Z value is hard coded until then
                    //UWB_BoundingBox box = (pCylinderMesh.getBoundingVolume(draw_helper.getLod()) as UWB_BoundingBox);
                    UWB_XFormInfo cylinder_xform = new UWB_XFormInfo();
                    cylinder_xform.SetScale(new Vector3(0.025f, 0.025f, 0.2666666666f));
                    cylinder_xform.UpdateRotationYByDegree(-90.0f);
                    cylinder_xform.SetTranslation(new Vector3(0.4f, 0.0f, 0.0f));
                    cylinder_xform.setupModelStack(draw_helper);
                    try
                    {
                        pCylinderMesh.setMesh(graphics.mResources.Load<Model>("cylinder"));
                        pCylinderMesh.DrawMesh(true, mFlatColor, draw_helper);
                    }
                    catch (Exception e) { UWBGL_XNA_Lib.UWB_Utility.echoToStatusArea((e.Message)); }
                    //pCylinderMesh.DrawMesh(false, mFlatColor,draw_helper);
                }
                draw_helper.popModelTransform();

                draw_helper.pushModelTransform();
                {
                    //const UWB_BoundingBox box = pConeMesh.getBoundingBox();
                    UWB_XFormInfo cone_xform = new UWB_XFormInfo();
                    cone_xform.SetScale(new Vector3(0.08f,0.08f, 0.1f));
                    cone_xform.UpdateRotationYByDegree(-90.0f);
                    cone_xform.SetTranslation(new Vector3(0.85f,0.0f,0.0f));
                    cone_xform.setupModelStack(draw_helper);
                    try
                    {
                        pConeMesh.setMesh(graphics.mResources.Load<Model>("cone"));
                        pConeMesh.DrawMesh(true, mFlatColor, draw_helper);
                    }
                    catch (Exception e) { UWBGL_XNA_Lib.UWB_Utility.echoToStatusArea((e.Message)); }
                    //pConeMesh.DrawMesh(false, mFlatColor, draw_helper);
                }
                draw_helper.popModelTransform();

            }
        }
Beispiel #4
0
        protected override void DrawPrimitive(eLevelofDetail lod, UWB_DrawHelper draw_helper)
        {
            UWB_XNAGraphicsDevice graphics      = UWB_XNAGraphicsDevice.m_TheAPI;
            UWB_XNAPrimitiveMesh  pCylinderMesh = new UWB_XNAPrimitiveMesh("cylinder");
            UWB_XNAPrimitiveMesh  pConeMesh     = new UWB_XNAPrimitiveMesh("cone");

            if (pCylinderMesh != null && pConeMesh != null)
            {
                pCylinderMesh.Material = Material;
                pConeMesh.Material     = Material;
                draw_helper.pushModelTransform();
                {
                    // Need to add support for finding the bounding box of a mesh
                    // the Z value is hard coded until then
                    //UWB_BoundingBox box = (pCylinderMesh.getBoundingVolume(draw_helper.getLod()) as UWB_BoundingBox);
                    UWB_XFormInfo cylinder_xform = new UWB_XFormInfo();
                    cylinder_xform.SetScale(new Vector3(0.025f, 0.025f, 0.2666666666f));
                    cylinder_xform.UpdateRotationYByDegree(-90.0f);
                    cylinder_xform.SetTranslation(new Vector3(0.4f, 0.0f, 0.0f));
                    cylinder_xform.setupModelStack(draw_helper);
                    try
                    {
                        pCylinderMesh.setMesh(graphics.mResources.Load <Model>("cylinder"));
                        pCylinderMesh.DrawMesh(true, mFlatColor, draw_helper);
                    }
                    catch (Exception e) { UWBGL_XNA_Lib.UWB_Utility.echoToStatusArea((e.Message)); }
                    //pCylinderMesh.DrawMesh(false, mFlatColor,draw_helper);
                }
                draw_helper.popModelTransform();

                draw_helper.pushModelTransform();
                {
                    //const UWB_BoundingBox box = pConeMesh.getBoundingBox();
                    UWB_XFormInfo cone_xform = new UWB_XFormInfo();
                    cone_xform.SetScale(new Vector3(0.08f, 0.08f, 0.1f));
                    cone_xform.UpdateRotationYByDegree(-90.0f);
                    cone_xform.SetTranslation(new Vector3(0.85f, 0.0f, 0.0f));
                    cone_xform.setupModelStack(draw_helper);
                    try
                    {
                        pConeMesh.setMesh(graphics.mResources.Load <Model>("cone"));
                        pConeMesh.DrawMesh(true, mFlatColor, draw_helper);
                    }
                    catch (Exception e) { UWBGL_XNA_Lib.UWB_Utility.echoToStatusArea((e.Message)); }
                    //pConeMesh.DrawMesh(false, mFlatColor, draw_helper);
                }
                draw_helper.popModelTransform();
            }
        }
Beispiel #5
0
        public UWB_BoundingBox GetBounds(ref UWB_DrawHelper helper, bool bDraw)
        {
            UWB_BoundingBox box = new UWB_BoundingBox();

            box.makeInvalid();
            if (mPrimitive != null)
            {
                box.add(mPrimitive.getBoundingVolume(eLevelofDetail.lodLow));
            }

            helper.pushModelTransform();
            {
                mXFormInfo.setupModelStack(helper);
                //Draw the box for debugging
                if (bDraw)
                {
                    box.Draw(ref helper);
                }
                Vector3 minPt = box.getMin();
                Vector3 maxPt = box.getMax();
                Vector3 pt1   = new Vector3(minPt.X, minPt.Y, minPt.Z);
                Vector3 pt2   = new Vector3(maxPt.X, minPt.Y, minPt.Z);
                Vector3 pt3   = new Vector3(maxPt.X, maxPt.Y, minPt.Z);
                Vector3 pt4   = new Vector3(minPt.X, maxPt.Y, minPt.Z);
                Vector3 pt5   = new Vector3(minPt.X, minPt.Y, maxPt.Z);
                Vector3 pt6   = new Vector3(maxPt.X, minPt.Y, maxPt.Z);
                Vector3 pt7   = new Vector3(maxPt.X, maxPt.Y, maxPt.Z);
                Vector3 pt8   = new Vector3(minPt.X, maxPt.Y, maxPt.Z);
                helper.transformPoint(ref pt1);
                helper.transformPoint(ref pt2);
                helper.transformPoint(ref pt3);
                helper.transformPoint(ref pt4);
                helper.transformPoint(ref pt5);
                helper.transformPoint(ref pt6);
                helper.transformPoint(ref pt7);
                helper.transformPoint(ref pt8);

                box.makeInvalid();
                box.add(new UWB_BoundingBox(pt1, pt2));
                box.add(new UWB_BoundingBox(pt3, pt4));
                box.add(new UWB_BoundingBox(pt5, pt6));
                box.add(new UWB_BoundingBox(pt7, pt8));

                int count = mChildNodes.count();
                for (int i = 0; i < count; i++)
                {
                    box.add(mChildNodes.getItem(i).GetBounds(ref helper, bDraw));
                }
            }
            helper.popModelTransform();

            return(box);
        }
Beispiel #6
0
        protected bool GetNodeBoundsHelper(ref UWB_SceneNode pSearchNode,
                                           ref UWB_BoundingBox box,
                                           ref UWB_DrawHelper helper, int level, bool bDraw)
        {
            bool found = false;

            if (Object.ReferenceEquals(this, pSearchNode))
            {
                box   = this.GetBounds(ref helper, bDraw);
                found = true;
            }
            else
            {
                helper.pushModelTransform();
                {
                    level++;
                    this.getXFormInfo().setupModelStack(helper);

                    int count = this.numChildren();
                    for (int i = 0; i < count; i++)
                    {
                        UWB_SceneNode pChildNode = this.getChildNode(i);
                        if (pChildNode.GetNodeBoundsHelper(ref pSearchNode, ref box, ref helper, level, bDraw))
                        {
                            found = true;
                            break;
                        }
                    }
                    level--;
                }
                helper.popModelTransform();
            }
            if (0 == level && found && bDraw)
            {
                helper.resetAttributes();
                helper.setColor1(new Color(0, 0, 255));
                helper.setShadeMode(eShadeMode.smFlat);
                helper.setFillMode(eFillMode.fmWireframe);
                box.Draw(ref helper);
            }

            return(found);
        }
        public void Draw(eLevelofDetail lod, UWB_DrawHelper drawHelper)
        {
            drawHelper.pushModelTransform();
            mXFormInfo.setupModelStack(drawHelper);

            if (mPrimitive != null)
            {
                mPrimitive.Draw(lod, drawHelper);
            }

            int count = mChildNodes.count();
            for (int i = 0; i < count; i++)
            {
                mChildNodes.getItem(i).Draw(lod, drawHelper);
            }

            if (mPivotVisible)
            {
                mXFormInfo.drawPivot(drawHelper, .2f);
            }

            drawHelper.popModelTransform();
        }
Beispiel #8
0
        public void Draw(eLevelofDetail lod, UWB_DrawHelper drawHelper)
        {
            drawHelper.pushModelTransform();
            mXFormInfo.setupModelStack(drawHelper);

            if (mPrimitive != null)
            {
                mPrimitive.Draw(lod, drawHelper);
            }

            int count = mChildNodes.count();

            for (int i = 0; i < count; i++)
            {
                mChildNodes.getItem(i).Draw(lod, drawHelper);
            }

            if (mPivotVisible)
            {
                mXFormInfo.drawPivot(drawHelper, .2f);
            }

            drawHelper.popModelTransform();
        }
        public UWB_BoundingBox GetBounds(ref UWB_DrawHelper helper, bool bDraw)
        {
            UWB_BoundingBox box = new UWB_BoundingBox();
            box.makeInvalid();
            if (mPrimitive != null)
                box.add(mPrimitive.getBoundingVolume(eLevelofDetail.lodLow));

            helper.pushModelTransform();
            {
                mXFormInfo.setupModelStack(helper);
                //Draw the box for debugging
                if (bDraw)
                    box.Draw(ref helper);
                Vector3 minPt = box.getMin();
                Vector3 maxPt = box.getMax();
                Vector3 pt1 = new Vector3(minPt.X, minPt.Y, minPt.Z);
                Vector3 pt2 = new Vector3(maxPt.X, minPt.Y, minPt.Z);
                Vector3 pt3 = new Vector3(maxPt.X, maxPt.Y, minPt.Z);
                Vector3 pt4 = new Vector3(minPt.X, maxPt.Y, minPt.Z);
                Vector3 pt5 = new Vector3(minPt.X, minPt.Y, maxPt.Z);
                Vector3 pt6 = new Vector3(maxPt.X, minPt.Y, maxPt.Z);
                Vector3 pt7 = new Vector3(maxPt.X, maxPt.Y, maxPt.Z);
                Vector3 pt8 = new Vector3(minPt.X, maxPt.Y, maxPt.Z);
                helper.transformPoint(ref pt1);
                helper.transformPoint(ref pt2);
                helper.transformPoint(ref pt3);
                helper.transformPoint(ref pt4);
                helper.transformPoint(ref pt5);
                helper.transformPoint(ref pt6);
                helper.transformPoint(ref pt7);
                helper.transformPoint(ref pt8);

                box.makeInvalid();
                box.add(new UWB_BoundingBox(pt1, pt2));
                box.add(new UWB_BoundingBox(pt3, pt4));
                box.add(new UWB_BoundingBox(pt5, pt6));
                box.add(new UWB_BoundingBox(pt7, pt8));

                int count = mChildNodes.count();
                for (int i = 0; i < count; i++)
                    box.add(mChildNodes.getItem(i).GetBounds(ref helper, bDraw));
            }
            helper.popModelTransform();

            return box;
        }
        protected bool GetNodeBoundsHelper(ref UWB_SceneNode pSearchNode,
                                         ref UWB_BoundingBox box,
                                         ref UWB_DrawHelper helper, int level, bool bDraw)
        {
            bool found = false;
              if( Object.ReferenceEquals(this, pSearchNode))
              {
            box = this.GetBounds( ref helper, bDraw );
            found = true;
              }
              else
              {
            helper.pushModelTransform();
            {
              level++;
              this.getXFormInfo().setupModelStack(helper);

              int count = this.numChildren();
              for(int i=0; i<count; i++)
              {
                UWB_SceneNode pChildNode = this.getChildNode( i );
                if( pChildNode.GetNodeBoundsHelper(  ref pSearchNode, ref box, ref helper, level, bDraw ) )
                {
                  found = true;
                  break;
                }
              }
              level--;
            }
            helper.popModelTransform();
              }
              if (0 == level && found && bDraw)
              {
              helper.resetAttributes();
              helper.setColor1(new Color(0,0,255));
              helper.setShadeMode(eShadeMode.smFlat);
              helper.setFillMode(eFillMode.fmWireframe);
              box.Draw(ref helper);
              }

              return found;
        }