Esempio n. 1
0
        /// <summary>
        /// Constructs a subclass of this object on the stack in your Rhino plug-in's Render() or RenderWindow() implementation.
        /// </summary>
        /// <param name="doc">A Rhino document.</param>
        /// <param name="mode">A command running mode, such as scripted or interactive.</param>
        /// <param name="plugin">A plug-in.</param>
        /// <param name="sizeRendering">The width and height of the rendering.</param>
        /// <param name="caption">The caption to display in the frame window.</param>
        /// <param name="channels">The color channel or channels.</param>
        /// <param name="reuseRenderWindow">true if the rendering window should be reused; otherwise, a new one will be instanciated.</param>
        /// <param name="clearLastRendering">true if the last rendering should be removed.</param>
        protected RenderPipeline(RhinoDoc doc,
                                 Rhino.Commands.RunMode mode,
                                 Rhino.PlugIns.PlugIn plugin,
                                 System.Drawing.Size sizeRendering,
                                 string caption,
                                 Rhino.Render.RenderWindow.StandardChannels channels,
                                 bool reuseRenderWindow,
                                 bool clearLastRendering
                                 )
        {
            Debug.Assert(Rhino.PlugIns.RenderPlugIn.RenderCommandContextPointer != IntPtr.Zero);

            m_serial_number = m_current_serial_number++;
            m_all_render_pipelines.Add(m_serial_number, this);
            m_size     = sizeRendering;
            m_channels = channels;

            m_pSdkRender = UnsafeNativeMethods.Rdk_SdkRender_New(m_serial_number, Rhino.PlugIns.RenderPlugIn.RenderCommandContextPointer, plugin.NonConstPointer(), caption, reuseRenderWindow, clearLastRendering);
            m_plugin     = plugin;

            UnsafeNativeMethods.Rdk_RenderWindow_Initialize(m_pSdkRender, (int)channels, m_size.Width, m_size.Height);
        }
Esempio n. 2
0
        /*
         *  public static Rhino.Geometry.Curve TryCopyFromOnCurve(object source)
         *  {
         *    if (source != null)
         *    {
         *      try
         *      {
         *        Type base_type = Type.GetType("RMA.OpenNURBS.OnCurve");
         *        System.Type t = source.GetType();
         *        if (t.IsAssignableFrom(base_type))
         *        {
         *          System.Reflection.PropertyInfo pi = t.GetProperty("InternalPointer");
         *          IntPtr ptr = (IntPtr)pi.GetValue(source, null);
         *          Rhino.Geometry.Curve crv = Rhino.Geometry.Curve.CreateCurveHelper(ptr, null);
         *          crv.NonConstPointer();
         *          return crv;
         *        }
         *      }
         *      catch (Exception)
         *      {
         *      }
         *    }
         *    return null;
         *  }
         *
         *  /// <summary>
         *  /// Do not hold on to the returned class outside the scope of your current function.
         *  /// </summary>
         *  /// <param name="source">-</param>
         *  /// <returns>-</returns>
         *  public static Rhino.Display.DisplayPipeline ConvertFromMRhinoDisplayPipeline(object source)
         *  {
         *    if (source != null)
         *    {
         *      try
         *      {
         *        Type base_type = Type.GetType("RMA.Rhino.MRhinoDisplayPipeline");
         *        System.Type t = source.GetType();
         *        if (t.IsAssignableFrom(base_type))
         *        {
         *          System.Reflection.PropertyInfo pi = t.GetProperty("InternalPointer");
         *          IntPtr ptr = (IntPtr)pi.GetValue(source, null);
         *          return new Rhino.Display.DisplayPipeline(ptr);
         *        }
         *      }
         *      catch (Exception)
         *      {
         *      }
         *    }
         *    return null;
         *  }
         */
#if RHINO_SDK
        /// <summary>
        /// Gets a C++ plug-in pointer for a given RhinoCommon plug-in.
        /// <para>This is a Rhino SDK function.</para>
        /// </summary>
        /// <param name="plugin">A plug-in.</param>
        /// <returns>A pointer.</returns>
        public static IntPtr PlugInPointer(Rhino.PlugIns.PlugIn plugin)
        {
            return(null == plugin ? IntPtr.Zero : plugin.NonConstPointer());
        }