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)); }
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)); }
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); }
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); }
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); } } }
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; }
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; } }
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 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; } }
public UWB_WindowHandler() { m_WCWindow = new UWB_BoundingBox(); m_Camera = new UWB_Camera(); }
public UWB_PrimitiveList() { mBounds = new UWB_BoundingBox(); mList = new UWB_Array <UWB_Primitive>(); }
public void setWCWindow(ref UWB_BoundingBox w) { m_WCWindow = w; }
public UWB_PrimitivePoint() { mPoint = Vector3.Zero; mBounds = new UWB_BoundingBox(); mBounds.setCorners(mPoint, mPoint); }
//protected Model mesh; public UWB_XNAPrimitiveMesh(string fn) { filename = fn; m_bounds = new UWB_BoundingBox(); }
public UWB_PrimitivePoint(float x, float y, float z) { mPoint = new Vector3(x, y, z); mBounds = new UWB_BoundingBox(); mBounds.setCorners(mPoint, mPoint); }
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 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 ); }
public UWB_PrimitiveRectangle() { m_width = m_height = 0; m_bounds = new UWB_BoundingBox(); }
public UWB_PrimitiveList() { mBounds = new UWB_BoundingBox(); mList = new UWB_Array<UWB_Primitive>(); }
public UWB_PrimitiveLine() { mStart = Vector3.Zero; mEnd = Vector3.Zero; mBounds = new UWB_BoundingBox(); }