/// <summary> /// Create the primitives to be drawed /// Z ---- length /// </summary> public override void Initialize( ) { if (roundMesh != null) { roundMesh.Dispose(); } model = source as RoundModel; //Create the mesh roundMesh = new AutoMesh(d3d, Mesh.Cylinder(d3d.Dx, model.Radius, model.Radius, 0.0f, Direct3dRender.DefaultSlices, Direct3dRender.DefaultStacks)); //Get the bounding box roundMesh.BoundingBox(out minVector3, out maxVector3); minVector3.TransformCoordinate(model.WorldMatrix); maxVector3.TransformCoordinate(model.WorldMatrix); Vector3 minClone = minVector3; Vector3 maxClone = maxVector3; minVector3.X = minClone.X < maxClone.X ? minClone.X : maxClone.X; minVector3.Y = minClone.Y < maxClone.Y ? minClone.Y : maxClone.Y; minVector3.Z = minClone.Z < maxClone.Z ? minClone.Z : maxClone.Z; maxVector3.X = minClone.X < maxClone.X ? maxClone.X : minClone.X; maxVector3.Y = minClone.Y < maxClone.Y ? maxClone.Y : minClone.Y; maxVector3.Z = minClone.Z < maxClone.Z ? maxClone.Z : minClone.Z; model.MinVector3 = minVector3; model.MaxVector3 = maxVector3; }
/// <summary> /// Create the primitives to be drawed /// X ---- Width /// Z ---- Height /// </summary> public override void Initialize( ) { if (rectangleMesh != null) { rectangleMesh.Dispose(); } model = base.source as RectangleModel; //Create the mesh rectangleMesh = new AutoMesh(d3d, Mesh.Box(d3d.Dx, model.Width, model.Height, 0.0f)); //Get the bounding box rectangleMesh.BoundingBox(out minVector3, out maxVector3); minVector3.TransformCoordinate(model.WorldMatrix); maxVector3.TransformCoordinate(model.WorldMatrix); Vector3 minClone = minVector3; Vector3 maxClone = maxVector3; minVector3.X = minClone.X < maxClone.X ? minClone.X : maxClone.X; minVector3.Y = minClone.Y < maxClone.Y ? minClone.Y : maxClone.Y; minVector3.Z = minClone.Z < maxClone.Z ? minClone.Z : maxClone.Z; maxVector3.X = minClone.X < maxClone.X ? maxClone.X : minClone.X; maxVector3.Y = minClone.Y < maxClone.Y ? maxClone.Y : minClone.Y; maxVector3.Z = minClone.Z < maxClone.Z ? maxClone.Z : minClone.Z; model.MaxVector3 = maxVector3; model.MinVector3 = minVector3; }
/// <summary> /// Create the primitives to be drawed /// </summary> public override void Initialize() { if (sphereMesh != null) { sphereMesh.Dispose(); } model = source as SphereModel; //Create the mesh sphereMesh = new AutoMesh(d3d, Mesh.Sphere(d3d.Dx, model.Radius, Direct3dRender.DefaultSlices, Direct3dRender.DefaultStacks)); //Get the bounding box sphereMesh.BoundingBox(out minVector3, out maxVector3); minVector3.TransformCoordinate(model.WorldMatrix); maxVector3.TransformCoordinate(model.WorldMatrix); model.MinVector3 = minVector3; model.MaxVector3 = maxVector3; }
/// <summary> /// Create the primitives to be drawed /// X ---- Width /// Y ---- Depth /// Z ---- Height /// </summary> public override void Initialize( ) { if (cuboidMesh != null) { cuboidMesh.Dispose(); } model = source as CuboidModel; //Create the mesh cuboidMesh = new AutoMesh(d3d, Mesh.Box(d3d.Dx, model.Width, model.Depth, model.Height)); //Get the bounding box cuboidMesh.BoundingBox(out minVector3, out maxVector3); minVector3.TransformCoordinate(model.WorldMatrix); maxVector3.TransformCoordinate(model.WorldMatrix); model.MinVector3 = minVector3; model.MaxVector3 = maxVector3; }