public RenderMeshIterator(Guid plugInId, Rhino.DocObjects.ViewportInfo vp, bool needTriangleMesh) { IntPtr pIt = UnsafeNativeMethods.Rdk_RenderMeshIterator_New(plugInId, needTriangleMesh, vp.ConstPointer()); if (pIt != IntPtr.Zero) { m_pIterator = pIt; } }
/// <summary> /// A new render mesh iterator. /// <para>The caller shall dispose the iterator. /// Meshes created by the iterator are accessible up till when the iterator is disposed.</para> /// </summary> /// <param name="forceTriMesh">true if quad meshes should be triangulated.</param> /// <param name="vp">The rendering view camera.</param> /// <returns>A render mesh iterator.</returns> /// //TODO - ON_Viewport public RenderMeshIterator NewRenderMeshIterator(Rhino.DocObjects.ViewportInfo vp, bool forceTriMesh) { IntPtr pIterator = UnsafeNativeMethods.Rdk_SdkRender_NewRenderMeshIterator(ConstPointer(), vp.ConstPointer(), forceTriMesh); if (pIterator != IntPtr.Zero) { return(new RenderMeshIterator(pIterator)); } return(null); }
/// <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> /// <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> /// 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> /// 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> /// 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)); }
/// <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)); }
void Initialize() { IntPtr pSceneServer = m_pSceneServer; if (pSceneServer != IntPtr.Zero) { //Pull in the list of objects m_scene_objects = new List<SceneObject>(); UnsafeNativeMethods.Rdk_SceneServer_ResetObjectEnum(pSceneServer); IntPtr pObject = UnsafeNativeMethods.Rdk_SceneServer_NextObject(pSceneServer); while (pObject != IntPtr.Zero) { Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh(); IntPtr pMaterial = UnsafeNativeMethods.Rdk_SceneServer_ObjectDetails(pObject, mesh.NonConstPointer()); if (pMaterial != IntPtr.Zero) { SceneObject o = new SceneObject(mesh, RenderContent.FromPointer(pMaterial) as RenderMaterial); m_scene_objects.Add(o); } pObject = UnsafeNativeMethods.Rdk_SceneServer_NextObject(pSceneServer); } //Now get the lights m_scene_lights = new List<Rhino.Geometry.Light>(); UnsafeNativeMethods.Rdk_SceneServer_ResetLightEnum(pSceneServer); IntPtr pLight = UnsafeNativeMethods.Rdk_SceneServer_NextLight(pSceneServer); while (pLight != IntPtr.Zero) { Rhino.Geometry.Light light = new Rhino.Geometry.Light(); UnsafeNativeMethods.Rdk_SceneServer_LightDetails(pLight, light.NonConstPointer()); m_scene_lights.Add(light); pLight = UnsafeNativeMethods.Rdk_SceneServer_NextLight(pSceneServer); } //And then fill in the blanks IntPtr pEnvironment = UnsafeNativeMethods.Rdk_SceneServer_Environment(pSceneServer); if (pEnvironment != IntPtr.Zero) { m_environment = RenderContent.FromPointer(pEnvironment) as RenderEnvironment; } else { m_environment = null; } m_content_instance_id = UnsafeNativeMethods.Rdk_SceneServer_InstanceId(pSceneServer); m_sig = UnsafeNativeMethods.Rdk_SceneServer_Signature(pSceneServer); //Just the view left... m_viewport = new Rhino.DocObjects.ViewportInfo(); UnsafeNativeMethods.Rdk_SceneServer_View(pSceneServer, m_viewport.NonConstPointer()); } m_pSceneServer = IntPtr.Zero; }
/// <summary> /// A wireframe channel will not be added if none of the document properties settings /// indicate that one is needed. In other words, Rhino will not generate an empty wireframe channel /// just for the fun of it. /// </summary> /// <param name="doc">The document to display</param> /// <param name="viewport">The view to display</param> /// <param name="size">The size of the image without clipping (ie - if you have a region, it was the /// size of the image before you cut the region out.</param> /// <param name="region">The area of the rendering you want to display. This should match the size /// of the render window itself (ie - the one set using SetSize)</param> /// <returns>Returns true if the wireframe channel was successfully added.</returns> public bool AddWireframeChannel(Rhino.RhinoDoc doc, Rhino.DocObjects.ViewportInfo viewport, System.Drawing.Size size, System.Drawing.Rectangle region) { int[] xy = { size.Width, size.Height }; int[] lrtb = { region.Left, region.Right, region.Top, region.Bottom }; return(UnsafeNativeMethods.Rdk_RenderWindow_AddWireframeChannel(ConstPointer(), doc.DocumentId, viewport.ConstPointer(), ref xy[0], ref lrtb[0])); }
void Initialize() { IntPtr pSceneServer = m_pSceneServer; if (pSceneServer != IntPtr.Zero) { //Pull in the list of objects m_scene_objects = new List <SceneObject>(); UnsafeNativeMethods.Rdk_SceneServer_ResetObjectEnum(pSceneServer); IntPtr pObject = UnsafeNativeMethods.Rdk_SceneServer_NextObject(pSceneServer); while (pObject != IntPtr.Zero) { Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh(); IntPtr pMaterial = UnsafeNativeMethods.Rdk_SceneServer_ObjectDetails(pObject, mesh.NonConstPointer()); if (pMaterial != IntPtr.Zero) { SceneObject o = new SceneObject(mesh, RenderContent.FromPointer(pMaterial) as RenderMaterial); m_scene_objects.Add(o); } pObject = UnsafeNativeMethods.Rdk_SceneServer_NextObject(pSceneServer); } //Now get the lights m_scene_lights = new List <Rhino.Geometry.Light>(); UnsafeNativeMethods.Rdk_SceneServer_ResetLightEnum(pSceneServer); IntPtr pLight = UnsafeNativeMethods.Rdk_SceneServer_NextLight(pSceneServer); while (pLight != IntPtr.Zero) { Rhino.Geometry.Light light = new Rhino.Geometry.Light(); UnsafeNativeMethods.Rdk_SceneServer_LightDetails(pLight, light.NonConstPointer()); m_scene_lights.Add(light); pLight = UnsafeNativeMethods.Rdk_SceneServer_NextLight(pSceneServer); } //And then fill in the blanks IntPtr pEnvironment = UnsafeNativeMethods.Rdk_SceneServer_Environment(pSceneServer); if (pEnvironment != IntPtr.Zero) { m_environment = RenderContent.FromPointer(pEnvironment) as RenderEnvironment; } else { m_environment = null; } m_content_instance_id = UnsafeNativeMethods.Rdk_SceneServer_InstanceId(pSceneServer); m_sig = UnsafeNativeMethods.Rdk_SceneServer_Signature(pSceneServer); //Just the view left... m_viewport = new Rhino.DocObjects.ViewportInfo(); UnsafeNativeMethods.Rdk_SceneServer_View(pSceneServer, m_viewport.NonConstPointer()); } m_pSceneServer = IntPtr.Zero; }