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;
        }
Exemplo 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;
    }