コード例 #1
0
 public bool GetNodeBounds(ref UWB_SceneNode pSearchNode,
                           ref UWB_BoundingBox box,
                           ref UWB_DrawHelper helper,
                           bool bDraw)
 {
     return(GetNodeBoundsHelper(ref pSearchNode, ref box, ref helper, 0, bDraw));
 }
コード例 #2
0
 public UWB_PrimitiveCircle()
 {
     mCenter = Vector3.Zero;
     mRadius = 0;
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(
         new Vector3(mCenter.X - mRadius, mCenter.Y - mRadius, mCenter.Z),
         new Vector3(mCenter.X + mRadius, mCenter.Y + mRadius, mCenter.Z));
 }
コード例 #3
0
 public UWB_PrimitiveCircle()
 {
     mCenter = Vector3.Zero;
     mRadius = 0;
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(
         new Vector3(mCenter.X - mRadius, mCenter.Y - mRadius, mCenter.Z),
         new Vector3(mCenter.X + mRadius, mCenter.Y + mRadius, mCenter.Z));
 }
コード例 #4
0
        public override bool intersects(UWB_BoundingVolume other)
        {
            eVolumeType vt = other.getType();

            if (eVolumeType.box == vt)
            {
                UWB_BoundingBox otherBox = other as UWB_BoundingBox;
                return(intesectBoxBox(mMin, mMax, otherBox.getMin(), otherBox.getMax()));
            }

            return(false);
        }
コード例 #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);
        }
コード例 #6
0
 public override void add(UWB_BoundingVolume other)
 {
     if (other != null)
     {
         eVolumeType vt = other.getType();
         if (eVolumeType.box == vt)
         {
             UWB_BoundingBox box = other as UWB_BoundingBox;
             add(box);
         }
     }
 }
コード例 #7
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;
        }
コード例 #8
0
        public void add(UWB_BoundingBox box)
        {
            if (!box.isValid())
                return;

            if (!isValid())
                setCorners(box.getMax(), box.getMin());
            else
            {
                mMin.X = mMin.X < box.mMin.X ? mMin.X : box.mMin.X;
                mMin.Y = mMin.Y < box.mMin.Y ? mMin.Y : box.mMin.Y;
                mMin.Z = mMin.Z < box.mMin.Z ? mMin.Z : box.mMin.Z;
                mMax.X = mMax.X > box.mMax.X ? mMax.X : box.mMax.X;
                mMax.Y = mMax.Y > box.mMax.Y ? mMax.Y : box.mMax.Y;
                mMax.Z = mMax.Z > box.mMax.Z ? mMax.Z : box.mMax.Z;
            }
        }
コード例 #9
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);
        }
コード例 #10
0
        public void add(UWB_BoundingBox box)
        {
            if (!box.isValid())
            {
                return;
            }

            if (!isValid())
            {
                setCorners(box.getMax(), box.getMin());
            }
            else
            {
                mMin.X = mMin.X < box.mMin.X ? mMin.X : box.mMin.X;
                mMin.Y = mMin.Y < box.mMin.Y ? mMin.Y : box.mMin.Y;
                mMin.Z = mMin.Z < box.mMin.Z ? mMin.Z : box.mMin.Z;
                mMax.X = mMax.X > box.mMax.X ? mMax.X : box.mMax.X;
                mMax.Y = mMax.Y > box.mMax.Y ? mMax.Y : box.mMax.Y;
                mMax.Z = mMax.Z > box.mMax.Z ? mMax.Z : box.mMax.Z;
            }
        }
コード例 #11
0
 public UWB_WindowHandler()
 {
     m_WCWindow = new UWB_BoundingBox();
     m_Camera = new UWB_Camera();
 }
コード例 #12
0
 public UWB_PrimitiveList()
 {
     mBounds = new UWB_BoundingBox();
     mList   = new UWB_Array <UWB_Primitive>();
 }
コード例 #13
0
 public void setWCWindow(ref UWB_BoundingBox w)
 {
     m_WCWindow = w;
 }
コード例 #14
0
 public UWB_WindowHandler()
 {
     m_WCWindow = new UWB_BoundingBox();
     m_Camera   = new UWB_Camera();
 }
コード例 #15
0
 public UWB_PrimitivePoint()
 {
     mPoint = Vector3.Zero;
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(mPoint, mPoint);
 }
コード例 #16
0
        //protected Model mesh;

        public UWB_XNAPrimitiveMesh(string fn)
        {
            filename = fn;
            m_bounds = new UWB_BoundingBox();
        }
コード例 #17
0
 //protected Model mesh;
 public UWB_XNAPrimitiveMesh(string fn)
 {
     filename = fn;
     m_bounds = new UWB_BoundingBox();
 }
コード例 #18
0
 public UWB_PrimitivePoint(float x, float y, float z)
 {
     mPoint  = new Vector3(x, y, z);
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(mPoint, mPoint);
 }
コード例 #19
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;
        }
コード例 #20
0
 public bool GetNodeBounds( ref UWB_SceneNode pSearchNode,
                                    ref UWB_BoundingBox box,
                                    ref UWB_DrawHelper helper,
                                    bool bDraw)
 {
     return GetNodeBoundsHelper(ref pSearchNode, ref box, ref helper, 0, bDraw );
 }
コード例 #21
0
 public UWB_PrimitivePoint(float x, float y, float z)
 {
     mPoint = new Vector3(x, y, z);
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(mPoint, mPoint);
 }
コード例 #22
0
 public UWB_PrimitiveRectangle()
 {
     m_width  = m_height = 0;
     m_bounds = new UWB_BoundingBox();
 }
コード例 #23
0
 public UWB_PrimitiveList()
 {
     mBounds = new UWB_BoundingBox();
     mList = new UWB_Array<UWB_Primitive>();
 }
コード例 #24
0
 public UWB_PrimitiveLine()
 {
     mStart  = Vector3.Zero;
     mEnd    = Vector3.Zero;
     mBounds = new UWB_BoundingBox();
 }
コード例 #25
0
 public UWB_PrimitivePoint()
 {
     mPoint  = Vector3.Zero;
     mBounds = new UWB_BoundingBox();
     mBounds.setCorners(mPoint, mPoint);
 }
コード例 #26
0
 public void setWCWindow(ref UWB_BoundingBox w)
 {
     m_WCWindow = w;
 }
コード例 #27
0
 public UWB_PrimitiveLine()
 {
     mStart = Vector3.Zero;
     mEnd = Vector3.Zero;
     mBounds = new UWB_BoundingBox();
 }
コード例 #28
0
 public UWB_PrimitiveRectangle()
 {
     m_width = m_height = 0;
     m_bounds = new UWB_BoundingBox();
 }