/// <summary>
        ///
        /// </summary>
        /// <param name="plugInId">
        /// The Id of the plug-in creating the iterator.
        /// </param>
        /// <param name="viewport">
        /// The rendering view camera.
        /// </param>
        /// <param name="forceTriangleMeshes">
        /// If true quad meshes will be triangulated
        /// </param>
        public RenderPrimitiveEnumerator(Guid plugInId, DocObjects.ViewportInfo viewport, bool forceTriangleMeshes)
        {
            var viewport_pointer = null == viewport ? IntPtr.Zero : viewport.ConstPointer();
            var iterator_pointer = UnsafeNativeMethods.Rdk_RenderMeshIterator_New(plugInId, forceTriangleMeshes, viewport_pointer);

            if (iterator_pointer != IntPtr.Zero)
            {
                m_iterator_pointer = iterator_pointer;
            }
        }
Ejemplo n.º 2
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;
        }
 public RenderPrimitiveEnumerable(Guid plugInId, DocObjects.ViewportInfo viewport, bool forceTriangleMeshes)
 {
     m_plugin_id       = plugInId;
     m_viewport        = viewport;
     m_force_triangles = forceTriangleMeshes;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Get ON_Viewport* from a ViewportInfo instance
 /// </summary>
 /// <param name="viewport"></param>
 /// <returns></returns>
 /// <since>5.1</since>
 public static IntPtr NativeNonConstPointer(DocObjects.ViewportInfo viewport)
 {
     return(viewport.NonConstPointer());
 }