public void BuildMesh(MeshTypes meshType) { if (meshType == MeshTypes.AdvancingFront) { this.Mesh = new AdvancingFrontMesh(this); } else if (meshType == MeshTypes.Delaunay) { // TODO: delaunay mesh } this.Mesh.BuildMesh(); }
private void CreateInstancedObjects() { MainViewport.Children.Clear(); _currentMeshType = (MeshTypes)Enum.Parse(typeof(MeshTypes), (string)ObjectsTypeComboBox.SelectedItem); _screenSize = (float)ScreenSizeComboBox.SelectedItem; MeshGeometry3D mesh; switch (_currentMeshType) { case MeshTypes.Box: mesh = new Ab3d.Meshes.BoxMesh3D(new Point3D(0, 0, 0), new Size3D(1, 1, 1), 1, 1, 1).Geometry; break; case MeshTypes.Sphere: mesh = new Ab3d.Meshes.SphereMesh3D(new Point3D(0, 0, 0), 0.5, 30).Geometry; break; case MeshTypes.Arrow: mesh = new Ab3d.Meshes.ArrowMesh3D(new Point3D(-0.5, 0, 0), new Point3D(0.5, 0, 0), 0.1, 0.2, 45, 30, false).Geometry; break; default: mesh = null; break; } var instancedData = GetInstancedData(_currentMeshType, _screenSize); _instancedMeshGeometryVisual3D = new InstancedMeshGeometryVisual3D(mesh); _instancedMeshGeometryVisual3D.InstancesData = instancedData; // To enable screen-space scaling, set the UseScreenSpaceScaling to true. // // IMPORTANT: // For this to work correctly, the size of the instance mesh must be 1 and the center of the mesh must be at (0, 0, 0). // In this case the mesh will be scaled correctly to the screen size that is defined in the instance matrix's scale component. _instancedMeshGeometryVisual3D.UseScreenSpaceScaling = UseScreenSpaceScaleCheckBox.IsChecked ?? false; MainViewport.Children.Add(_instancedMeshGeometryVisual3D); _instanceWorldPositions = null; // Reset array of instance positions that is used for finding the closest instance in screen coordinates _selectedInstanceIndex = -1; // Because we have cleared all MainViewport.Children, this also removed the camera's light. // Call Refresh to recreate the light Camera1.Refresh(); }
private InstanceData[] GetInstancedData(MeshTypes currentMeshType, float screenSize) { InstanceData[] instancedData; if (currentMeshType == MeshTypes.Arrow) { instancedData = CreateRotatedInstancesData(new Point3D(0, 0, 0), new Size3D(1000, 1000, 2000), modelScaleFactor: screenSize, xCount: 5, yCount: 5, zCount: 5, rotationTargetPosition: new Point3D(0, 0, 0)); } else { instancedData = DXEnginePerformance.InstancedMeshGeometry3DTest.CreateInstancesData(new Point3D(0, -100, -1000), new Size3D(500, 0, 3000), modelScaleFactor: screenSize, xCount: 5, yCount: 1, zCount: 8, useTransparency: false); } return(instancedData); }
public MeshGraph GetMyMeshGraph(MeshTypes meshType) { if (meshType == MeshTypes.interceptor) { return(interceptorMeshGraph); } if (meshType == MeshTypes.ace) { return(aceMeshGraph); } if (meshType == MeshTypes.bomber) { return(bomberMeshGraph); } if (meshType == MeshTypes.bike) { return(bikeMeshGraph); } else { return(interceptorMeshGraph); } }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Rhino.Geometry.Point3d min = new Geometry.Point3d(); Rhino.Geometry.Point3d max = new Geometry.Point3d(); Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBox(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) { bb.Min = min; bb.Max = max; } return(bb); }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <param name="soleProviderId">the sole provider to call.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBoxSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId, ref min, ref max)) { Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); return(bb); } return(new Geometry.BoundingBox()); }
/// <summary> /// Determines if custom render meshes will be built for a particular object. /// </summary> /// <param name="vp">the viewport being rendered.</param> /// <param name="obj">the Rhino object of interest.</param> /// <param name="requestingPlugIn">type of mesh to build.</param> /// <param name="meshType">UUID of the plug-in requesting the meshes.</param> /// <param name="soleProviderId">the UUID of the sole provider to call.</param> /// <returns>true if BuildCustomMeshes() will build custom render mesh(es) for the given object.</returns> public static bool WillBuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { return(UnsafeNativeMethods.Rdk_CRMManager_WillBuildCustomMeshSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId)); }
/// <summary> /// Build custom render mesh(es). /// </summary> /// <param name="vp">The viewport being rendered.</param> /// <param name="objMeshes">The meshes class to populate with custom meshes.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType">Type of mesh to build.</param> /// <returns>true if operation was successful.</returns> public abstract bool BuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, ObjectMeshes objMeshes, Guid requestingPlugIn, MeshTypes meshType);
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp">The viewport being rendered.</param> /// <param name="obj">The Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType">Type of mesh to build.</param> /// <returns>A bounding box value.</returns> public virtual Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_RMPBoundingBoxImpl(m_runtime_serial_number, vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) return new Rhino.Geometry.BoundingBox(min, max); return new Rhino.Geometry.BoundingBox(); }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp">The viewport being rendered.</param> /// <param name="obj">The Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType">Type of mesh to build.</param> /// <returns>A bounding box value.</returns> public virtual Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_RMPBoundingBoxImpl(m_runtime_serial_number, vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) { return(new Rhino.Geometry.BoundingBox(min, max)); } return(new Rhino.Geometry.BoundingBox()); }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Rhino.Geometry.Point3d min = new Geometry.Point3d(); Rhino.Geometry.Point3d max = new Geometry.Point3d(); Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBox(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) { bb.Min = min; bb.Max = max; } return bb; }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <param name="soleProviderId">the sole provider to call.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBoxSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId, ref min, ref max)) { Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); return bb; } return new Geometry.BoundingBox(); }
/// <summary> /// Determines if custom render meshes will be built for a particular object. /// </summary> /// <param name="vp">the viewport being rendered.</param> /// <param name="obj">the Rhino object of interest.</param> /// <param name="requestingPlugIn">type of mesh to build.</param> /// <param name="meshType">UUID of the plug-in requesting the meshes.</param> /// <param name="soleProviderId">the UUID of the sole provider to call.</param> /// <returns>true if BuildCustomMeshes() will build custom render mesh(es) for the given object.</returns> public static bool WillBuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { return UnsafeNativeMethods.Rdk_CRMManager_WillBuildCustomMeshSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId); }
public static string meshTypeName(MeshTypes x) { return x.ToString(); }
/// <summary> /// Build custom render mesh(es) for the given object. /// </summary> /// <param name="vp">the viewport being rendered.</param> /// <param name="objMeshes">The meshes object to fill with custom meshes - the Object property will already be set.</param> /// <param name="requestingPlugIn">the UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build.</param> /// <returns>true if successful.</returns> public static bool BuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, ObjectMeshes objMeshes, Guid requestingPlugIn, MeshTypes meshType) { return(UnsafeNativeMethods.Rdk_CRMManager_BuildCustomMeshes(vp.ConstPointer(), objMeshes.NonConstPointer(), requestingPlugIn, (int)meshType)); }
/// <summary> /// Determines if custom render meshes will be built for a particular object. /// </summary> /// <param name="vp">The viewport being rendered.</param> /// <param name="obj">The Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType">Type of mesh to build.</param> /// <returns>true if custom meshes will be built.</returns> public abstract bool WillBuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType);
/// <summary> /// Build custom render mesh(es) for the given object. /// </summary> /// <param name="vp">the viewport being rendered.</param> /// <param name="objMeshes">The meshes object to fill with custom meshes - the Object property will already be set.</param> /// <param name="requestingPlugIn">the UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build.</param> /// <returns>true if successful.</returns> public static bool BuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, ObjectMeshes objMeshes, Guid requestingPlugIn, MeshTypes meshType) { return UnsafeNativeMethods.Rdk_CRMManager_BuildCustomMeshes(vp.ConstPointer(), objMeshes.NonConstPointer(), requestingPlugIn, (int)meshType); }