コード例 #1
0
        /// <summary>
        /// Constructs a new basic material from a <see cref="Rhino.DocObjects.Material">Material</see>.
        /// </summary>
        /// <param name="material">(optional)The material to create the basic material from.</param>
        /// <returns>A new basic material.</returns>
        public static RenderMaterial CreateBasicMaterial(Rhino.DocObjects.Material material)
        {
            IntPtr pConstSourceMaterial      = (material == null ? IntPtr.Zero : material.ConstPointer());
            IntPtr pNewMaterial              = UnsafeNativeMethods.Rdk_Globals_NewBasicMaterial(pConstSourceMaterial);
            NativeRenderMaterial newMaterial = RenderContent.FromPointer(pNewMaterial) as NativeRenderMaterial;

            if (newMaterial != null)
            {
                newMaterial.AutoDelete = true;
            }
            return(newMaterial);
        }
コード例 #2
0
        /// <summary>Modify material settings.</summary>
        /// <param name="newSettings">This information is copied.</param>
        /// <param name="materialIndex">
        /// zero based index of material to set.  This must be in the range 0 &lt;= layerIndex &lt; MaterialTable.Count.
        /// </param>
        /// <param name="quiet">if true, information message boxes pop up when illegal changes are attempted.</param>
        /// <returns>
        /// true if successful. false if materialIndex is out of range or the settings attempt
        /// to lock or hide the current material.
        /// </returns>
        public bool Modify(Rhino.DocObjects.Material newSettings, int materialIndex, bool quiet)
        {
            IntPtr pConstMaterial = newSettings.ConstPointer();

            return(UnsafeNativeMethods.CRhinoMaterialTable_ModifyMaterial(m_doc.m_docId, pConstMaterial, materialIndex, quiet));
        }