Rhino C++ API
8.14
|
#include <opennurbs_material.h>
Public Member Functions | |
ON_Material () ON_NOEXCEPT | |
ON_Material (const ON_Material &src) | |
~ON_Material ()=default | |
int | AddTexture (const ON_Texture &tx) |
int | AddTexture (const wchar_t *filename, ON_Texture::TYPE type) |
ON_Color | Ambient () const |
Interface. More... | |
int | DeleteTexture (const wchar_t *filename, ON_Texture::TYPE type) |
ON_Color | Diffuse () const |
bool | DisableLighting () const |
void | Dump (ON_TextLog &text_log) const override |
ON_Color | Emission () const |
int | FindTexture (const wchar_t *filename, ON_Texture::TYPE type, int i0=-1) const |
int | FindTexture (ON_UUID texture_id) const |
double | FresnelReflectionCoefficient (ON_3dVector N, ON_3dVector R) const |
bool | FresnelReflections () const |
bool | IsPhysicallyBased (void) const |
bool | IsValid (class ON_TextLog *text_log=nullptr) const override |
ON_Object overrides. More... | |
const ON_UUID | MaterialChannelIdFromIndex (int material_channel_index) const |
int | MaterialChannelIndexFromId (ON_UUID material_channel_id) const |
int | MaterialChannelIndexFromId (ON_UUID material_channel_id, bool bAddIdIfNotPresent) |
ON_UUID | MaterialPlugInId () const |
ID of the last plug-in to modify this material. More... | |
ON::object_type | ObjectType () const override |
ON_Material & | operator= (const ON_Material &src)=default |
std::shared_ptr< ON_PhysicallyBasedMaterial > | PhysicallyBased (void) |
const std::shared_ptr< ON_PhysicallyBasedMaterial > | PhysicallyBased (void) const |
ON_Color | PreviewColor () const |
ON_UUID | RdkMaterialInstanceId () const |
bool | RdkMaterialInstanceIdIsNil () const |
bool | RdkMaterialInstanceIdIsNotNil () const |
bool | Read (ON_BinaryArchive &archive) override |
double | Reflectivity () const |
Transparency values are in range 0.0 = opaque to 1.0 = transparent. More... | |
void | SetAmbient (ON_Color) |
void | SetDiffuse (ON_Color) |
void | SetDisableLighting (bool bDisableLighting) |
void | SetEmission (ON_Color) |
void | SetFresnelReflections (bool bFresnelReflections) |
void | SetMaterialPlugInId (ON_UUID plugin_id) |
void | SetRdkMaterialInstanceId (ON_UUID rdk_material_instance_id) |
void | SetReflectivity (double) |
0.0 = opaque, 1.0 = transparent More... | |
void | SetShareable (bool bShareable) |
void | SetShine (double) |
0 to ON_Material::MaxShine More... | |
void | SetSpecular (ON_Color) |
void | SetTransparency (double) |
0.0 = opaque, 1.0 = transparent More... | |
void | SetUseDiffuseTextureAlphaForObjectTransparencyTexture (bool bUseDiffuseTextureAlphaForObjectTransparencyTexture) |
bool | Shareable () const |
double | Shine () const |
Shine values are in range 0.0 to ON_Material::MaxShine. More... | |
ON_Color | Specular () const |
void | ToPhysicallyBased (void) |
double | Transparency () const |
Transparency values are in range 0.0 = opaque to 1.0 = transparent. More... | |
bool | UseDiffuseTextureAlphaForObjectTransparencyTexture () const |
bool | Write (ON_BinaryArchive &archive) const override |
Public Member Functions inherited from ON_ModelComponent | |
ON_ModelComponent () ON_NOEXCEPT | |
ON_ModelComponent (const ON_ModelComponent &source) | |
ON_ModelComponent (ON_ModelComponent::Type component_type) ON_NOEXCEPT | |
ON_ModelComponent (ON_ModelComponent::Type component_type, const ON_ModelComponent &source) ON_NOEXCEPT | |
Locked status of source attributes is not copied to permit copy and modify operations. More... | |
~ON_ModelComponent ()=default | |
bool | ChangeName (const wchar_t *new_name, class ON_ComponentManifest *manifest) |
bool | ClearComponentType () |
bool | ClearId () |
bool | ClearIndex () |
unsigned int | ClearModelComponentAttributes (unsigned int attributes_filter) |
bool | ClearModelComponentStatus () |
bool | ClearModelSerialNumber () |
bool | ClearName () |
bool | ClearParentId () |
int | CompareName (const ON_UUID &other_parent_id, const wchar_t *other_name) const |
int | CompareName (const wchar_t *other_name) const |
int | CompareNameExact (const ON_UUID &other_parent_id, const wchar_t *other_name) const |
int | CompareNameExact (const wchar_t *other_name) const |
ON_ModelComponent::Type | ComponentType () const |
bool | ComponentTypeIsLocked () const |
bool | ComponentTypeIsSet () const |
ON__UINT64 | ContentVersionNumber () const |
unsigned int | CopyFrom (const ON_ModelComponent &src, unsigned int attributes_filter) |
ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const override |
const ON_wString | DeletedName () const |
const ON_NameHash & | DeletedNameHash () const |
bool | DeletedNameIsSet () const |
bool | DeleteName () |
void | Dump (ON_TextLog &) const override |
bool | EraseIdentification (bool bIgnoreLocks) |
const wchar_t * | GetName (ON_wString &component_name) const |
const ON_UUID & | Id () const |
bool | IdIsLocked () const |
bool | IdIsNil () const |
bool | IdIsNotNil () const |
bool | IdIsSet () const |
const ON_UUID & | IfIdIsNilSetId () |
int | Index () const |
int | Index (int unset_index_value) const |
bool | IndexIsLocked () const |
bool | IndexIsSet () const |
unsigned int | InstanceDefinitionModelSerialNumber () const |
bool | IsDeleted () const |
bool | IsHidden () const |
bool | IsLocked () const |
bool | IsReferenceComponent () const |
bool | IsSystemComponent () const |
bool | IsValid (class ON_TextLog *text_log=nullptr) const override |
void | LockAllSettingsExceptName () |
void | LockComponentType () |
void | LockId () |
void | LockIndex () |
void | LockModelComponentStatus () |
void | LockModelSerialNumber () |
void | LockName () |
void | LockParentId () |
ON_ComponentStatus | ModelComponentStatus () const |
bool | ModelComponentStatusIsLocked () const |
bool | ModelComponentStatusIsSet () const |
ON_UUID | ModelObjectId () const override |
unsigned int | ModelSerialNumber () const |
bool | ModelSerialNumberIsLocked () const |
bool | ModelSerialNumberIsSet () const |
const ON_wString | Name () const |
const wchar_t * | NameAsPointer () const |
const ON_NameHash & | NameHash () const |
bool | NameIsEmpty () const |
bool | NameIsLocked () const |
bool | NameIsNotEmpty () const |
bool | NameIsSet () const |
const ON_NameHash | NewNameHash (const wchar_t *new_name) const |
ON_ModelComponent & | operator= (const ON_ModelComponent &source) |
const ON_UUID & | ParentId () const |
bool | ParentIdIsLocked () const |
bool | ParentIdIsNil () const |
bool | ParentIdIsNotNil () const |
bool | ParentIdIsSet () const |
bool | ReadModelComponentAttributes (class ON_BinaryArchive &archive) |
unsigned int | ReferenceModelSerialNumber () const |
ON__UINT64 | RuntimeSerialNumber () const |
const ON_UUID & | SetAndLockId () |
bool | SetAsSystemComponent () |
bool | SetAsUnsetSystemComponent () |
bool | SetComponentType (ON_ModelComponent::Type component_component_type) |
bool | SetDeletedModelComponentState (bool bDeleted, class ON_ComponentManifest *manifest) |
void | SetHiddenModelComponentState (bool bHidden) |
const ON_UUID & | SetId () |
bool | SetId (const ON_UUID &component_id) |
bool | SetIdentification (const class ON_ComponentManifestItem &manifest_item, const wchar_t *manifest_name, bool bSetId, bool bParentId, bool bSetName, bool bSetIndex) |
bool | SetIndex (int component_index) |
bool | SetLocalizedSystemComponentName (const wchar_t *system_component_localized_name) |
void | SetLockedModelComponentState (bool bLocked) |
bool | SetModelComponentStatus (ON_ComponentStatus component_status) |
bool | SetModelSerialNumber (unsigned int model_serial_number) |
bool | SetModelSerialNumber (unsigned int model_serial_number, unsigned int reference_model_serial_number, unsigned int instance_definition_model_serial_number) |
bool | SetName (const wchar_t *component_name) |
bool | SetParentId (const ON_UUID &parent_id) |
unsigned int | SizeOf () const override |
bool | UndeleteName () |
bool | WriteModelComponentAttributes (class ON_BinaryArchive &archive, unsigned int attributes_filter) const |
Public Member Functions inherited from ON_Object | |
ON_Object () ON_NOEXCEPT | |
ON_Object (const ON_Object &) | |
virtual | ~ON_Object () |
virtual ON_AggregateComponentStatus | AggregateComponentStatus () const |
bool | AttachUserData (class ON_UserData *pUserData) |
unsigned int | ClearAllComponentStates () const |
virtual unsigned int | ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const |
virtual unsigned int | ClearComponentStates (ON_ComponentStatus states_to_clear) const |
void | CopyUserData (const ON_Object &source_object) |
unsigned int | CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution) |
virtual bool | DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count) |
virtual void | DestroyRuntimeCache (bool bDelete=true) |
bool | DetachUserData (class ON_UserData *pUserData) |
void | EmergencyDestroy () |
class ON_UserData * | FirstUserData () const |
virtual unsigned int | GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const |
class ON_UserData * | GetUserData (const ON_UUID &userdata_uuid) const |
bool | GetUserString (const wchar_t *key, ON_wString &string_value) const |
int | GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const |
int | GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const |
bool | IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) const |
bool | IsKindOf (const ON_ClassId *pClassId) const |
virtual void | MarkAggregateComponentStatusAsNotCurrent () const |
virtual void | MemoryRelocate () |
void | MoveUserData (ON_Object &source_object) |
unsigned int | MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems) |
ON_Object & | operator= (const ON_Object &) |
void | PurgeUserData () |
virtual unsigned int | SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const |
virtual unsigned int | SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const |
bool | SetUserString (const wchar_t *key, const wchar_t *string_value) |
int | SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace) |
bool | ThisIsNullptr (bool bSilentError) const |
void | TransformUserData (const class ON_Xform &xform) |
virtual bool | UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map) |
int | UserStringCount () const |
Static Public Member Functions | |
static int | Compare (const ON_Material &a, const ON_Material &b) |
compare everything except Index() value. More... | |
static int | CompareAppearance (const ON_Material &a, const ON_Material &b) |
static int | CompareColorAttributes (const ON_Material &a, const ON_Material &b) |
static int | CompareNameAndIds (const ON_Material &a, const ON_Material &b) |
compare Id(), Name(), m_rdk_material_instance_id More... | |
static int | CompareReflectionAttributes (const ON_Material &a, const ON_Material &b) |
static int | CompareTextureAttributes (const ON_Material &a, const ON_Material &b) |
static int | CompareTextureAttributesAppearance (const ON_Material &a, const ON_Material &b) |
static double | FresnelReflectionCoefficient (double fresnel_index_of_refraction, const double N[3], const double R[3]) |
static const ON_Material * | FromModelComponentRef (const class ON_ModelComponentReference &model_component_reference, const ON_Material *none_return_value) |
static ON_UUID | PhysicallyBasedUserdataId (void) |
Internal use only. More... | |
Static Public Member Functions inherited from ON_ModelComponent | |
static int | CompareId (const ON_ModelComponent &a, const ON_ModelComponent &b) |
static int | CompareIdAndName (const ON_ModelComponent &a, const ON_ModelComponent &b) |
static int | CompareName (const ON_ModelComponent &a, const ON_ModelComponent &b) |
static int | CompareNameAndId (const ON_ModelComponent &a, const ON_ModelComponent &b) |
static int | CompareNameExact (const ON_ModelComponent &a, const ON_ModelComponent &b) |
static ON_ModelComponent::Type | ComponentTypeFromUnsigned (unsigned int component_type_as_unsigned) |
static bool | ComponentTypeIsValid (ON_ModelComponent::Type component_type) |
static bool | ComponentTypeIsValidAndNotMixed (ON_ModelComponent::Type component_type) |
static const ON_wString | ComponentTypeToString (ON_ModelComponent::Type) |
static bool | IndexRequired (ON_ModelComponent::Type component_type) |
static unsigned int | Internal_SystemComponentHelper () |
For internal use. Never call this function. More... | |
static const wchar_t * | IsNamePathSeparator (const wchar_t *s) |
*static const wchar_t * | IsReferencePrefixDelimiter (const wchar_t *s) |
static const wchar_t * | IsReferencePrefixSeparator (const wchar_t *s) |
static bool | IsValidComponentName (const class ON_ComponentManifest &model_manfest, const ON_ModelComponent &model_component, bool bPermitReferencePrefix, ON_wString &valid_name) |
static bool | IsValidComponentName (const ON_wString &candidate_component_name) |
static bool | IsValidComponentName (const wchar_t *candidate_component_name) |
static bool | IsValidComponentName (size_t length, const wchar_t *candidate_component_name) |
static bool | IsValidComponentNameFirstCodePoint (int length, const wchar_t *candidate_component_name) |
static bool | IsValidComponentNameFirstCodePoint (ON__UINT32 unicode_code_point) |
static const ON_wString | NameLeaf (const wchar_t *name) |
static const ON_wString | NameParent (const wchar_t *name, bool bIncludeReference) |
static const ON_wString | NameReferencePrefix (const wchar_t *name) |
static ON__UINT64 | NextRuntimeSerialNumber () |
static const ON_wString | RemoveAllReferencePrefixDelimiters (const wchar_t *name) |
static const ON_wString | RemoveReferencePrefix (const wchar_t *name) |
static const ON_wString | RemoveTrailingNamePathSeparator (const wchar_t *name) |
static const ON_wString | RemoveTrailingReferencePrefixDelimiter (const wchar_t *name) |
static const ON_wString | RemoveTrailingReferencePrefixSeparator (const wchar_t *name) |
static void | SplitName (const wchar_t *name, ON_wString &reference_prefix, ON_wString &name_parent, ON_wString &name_leaf) |
static bool | UniqueNameIgnoresCase (ON_ModelComponent::Type component_type) |
static bool | UniqueNameIncludesParent (ON_ModelComponent::Type component_type) |
static bool | UniqueNameRequired (ON_ModelComponent::Type component_type) |
Public Attributes | |
ON_Color | m_ambient = ON_Color::Black |
ON_Color | m_diffuse = ON_Color::Gray126 |
ON_Color | m_emission = ON_Color::Black |
double | m_fresnel_index_of_refraction = 1.56 |
double | m_index_of_refraction = 1.0 |
ON_SimpleArray< ON_UuidIndex > | m_material_channel |
ON_Color | m_reflection = ON_Color::White |
double | m_reflection_glossiness = 0.0 |
double | m_reflectivity = 0.0 |
0.0 = none, 1.0 = 100% More... | |
double | m_refraction_glossiness = 0.0 |
double | m_shine = 0.0 |
0.0 = none to GetMaxShine()=maximum More... | |
ON_Color | m_specular = ON_Color::White |
ON_ObjectArray< ON_Texture > | m_textures |
double | m_transparency = 0.0 |
0.0 = opaque to 1.0 = transparent (1.0-alpha) More... | |
ON_Color | m_transparent = ON_Color::White |
Static Public Attributes | |
static const ON_Material | Default |
index = -1, persistent id More... | |
static const ON_Material | DefaultLockedObject |
Default material for locked objects. More... | |
static const double | MaxShine |
maximum value of shine exponent = 255.0 More... | |
static const ON_Material | Unset |
nil id More... | |
Static Public Attributes inherited from ON_ModelComponent | |
static const ON_wString | NamePathSeparator |
static const ON_wString | ReferencePrefixDelimiter |
static const ON_wString | ReferencePrefixSeparator |
static const ON_ModelComponent | Unset |
*static const ON_wString WorksessionReferencePrefix *const | wchar_t |
Additional Inherited Members | |
Protected Member Functions inherited from ON_ModelComponent | |
void | IncrementContentVersionNumber () const |
Class ON_Material
anonymous enum : int |
Enumerator | |
---|---|
MaximumMaterialChannelIndex | summary> Material channel index values stored in the ON_UuidIndex.m_i field of elements in the m_material_channel[] array must be between 0 and ON_Material::MaximumMaterialChannelIndex, inclusive. /summary> |
ON_Material::ON_Material | ( | ) |
ON_Material::ON_Material | ( | const ON_Material & | src | ) |
|
default |
int ON_Material::AddTexture | ( | const ON_Texture & | tx | ) |
Description: If there is already a texture with the same file name and type, then that texture is modified, otherwise a new texture is added. If tx has user data, the user data is copied to the m_textures[] element. Parameters: tx - [in] Returns: Index of the added texture in the m_textures[] array. Remarks: This is intended to be a quick and simple way to add textures to the material. If you need to do something different, then just work on the m_textures[] array.
int ON_Material::AddTexture | ( | const wchar_t * | filename, |
ON_Texture::TYPE | type | ||
) |
Description: If there is a texture with a matching type, that texture's filename is modified, otherwise a new texture is added. Parameters: filename - [in] new filename type - [in] Returns: Index of the added texture in the m_textures[] array. Remarks: This is intended to be a quick and simple way to add textures to the material. If you need to do something different, then just work on the m_textures[] array.
ON_Color ON_Material::Ambient | ( | ) | const |
Interface.
|
static |
compare everything except Index() value.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int ON_Material::DeleteTexture | ( | const wchar_t * | filename, |
ON_Texture::TYPE | type | ||
) |
Description: Deletes all textures with matching filenames and types. Parameters: filename - [in] If nullptr, then any filename matches. type - [in] If ON_Texture::no_texture_type, then any texture type matches. Returns: Number of textures deleted.
ON_Color ON_Material::Diffuse | ( | ) | const |
bool ON_Material::DisableLighting | ( | ) | const |
Returns: True if lighting is disabled. Remarks: True means render this object without applying any modulation based on lights. Basically, the diffuse, ambient, specular and emissive channels get combined additively, clamped, and then get treated as an emissive channel. Another way to think about it is when m_bDisableLighting is true, render the same way OpenGL does when ::glDisable( GL_LIGHTING ) is called.
|
overridevirtual |
ON_Color ON_Material::Emission | ( | ) | const |
int ON_Material::FindTexture | ( | const wchar_t * | filename, |
ON_Texture::TYPE | type, | ||
int | i0 = -1 |
||
) | const |
Description: Searches for a texture with matching filename and type. If more than one texture matches, the first match is returned. Parameters: filename - [in] If nullptr, then any filename matches. type - [in] If ON_Texture::no_texture_type, then any texture type matches. i0 - [in] If i0 is < 0, the search begins at m_textures[0], if i0 >= m_textures.Count(), -1 is returned, otherwise, the search begins at m_textures[i0+1]. Example: Iterate through all the the bitmap textures on a material.
ON_Material& mat = ...; int ti = -1; int bitmap_texture_count = 0; for(;;) { ti = mat.FindTexture( nullptr, ON_Texture::TYPE::bitmap_texture, ti ); if ( ti < 0 ) {
/ no more bitmap textures break; }
/ we have a bitmap texture bitmap_texture_count++; const ON_Texture& bitmap_texture = mat.m_textures[ti]; ... }
Returns: >=0 m_textures[] index of matching texture -1 if no match is found.
int ON_Material::FindTexture | ( | ON_UUID | texture_id | ) | const |
Description: Searches for a texture with matching texture_id. If more than one texture matches, the first match is returned. Parameters: texture_id - [in] Returns: >=0 m_textures[] index of matching texture -1 if no match is found.
|
static |
Parameters: fresnel_index_of_refraction - [in] ON_Material::Material::Default.m_fresnel_index_of_refraction is a good default N - [in] 3d surface normal R - [in] 3d reflection direction Returns: 1.0: The input values were not valid or the calculation failed due to a divide by zero or some other numerical arithmetic failure. fresnel reflection coefficient 1/2 * ((g-c)/(g+c))^2 * (1 + ( (c*(g+c) -1)/(c*(g+c) + 1) )^2) where c = N o (N-R); ///< c = 3d vector dot product of N and (N-R) and g = sqrt(fresnel_index_of_refraction*fresnel_index_of_refraction + c*c - 1.0).
double ON_Material::FresnelReflectionCoefficient | ( | ON_3dVector | N, |
ON_3dVector | R | ||
) | const |
Parameters: N - [in] 3d surface normal R - [in] 3d reflection direction Returns: If m_bFresnelReflections is false, then 1.0 is returned. If m_bFresnelReflections is true, then the value of the fresnel reflection coefficient is returned. In typical rendering applications, the reflection term is multiplied by the fresnel reflection coefficient before it is added to the diffuse color. If any input is not valid or the calculation fails, then 1.0 is returned. Remarks: When m_bFresnelReflections is true, the calculation is performed by calling ON_FresnelReflectionCoefficient() with m_fresnel_index_of_refraction as the fresnel index of refraction.
bool ON_Material::FresnelReflections | ( | ) | const |
Reflection and Refraction settings The bool m_bFresnelReflections enables fresnel scaling of reflection contributions to the diffuse color. True: The fresnel term is used to scale the reflection contribution before addition to the diffuse component. False: The reflection contribution is simply added to the diffuse component.
|
static |
Parameters: model_component_reference - [in] none_return_value - [in] value to return if ON_Material::Cast(model_component_ref.ModelComponent()) is nullptr Returns: If ON_Material::Cast(model_component_ref.ModelComponent()) is not nullptr, that pointer is returned. Otherwise, none_return_value is returned.
bool ON_Material::IsPhysicallyBased | ( | void | ) | const |
Call this function to determine if the material should be treated as Physically Based (ie - a PBR material) If this function returns true, the call to PhysicallyBased will return a non-null pointer. If the function returns false, use the legacy interface (Diffuse etc). Conversion of a non-PBR material to PBR is possible by calling ConvertToPhysicallyBased.
|
overridevirtual |
const ON_UUID ON_Material::MaterialChannelIdFromIndex | ( | int | material_channel_index | ) | const |
Parameters: material_channel_index - [in]
Returns: If material_channel_index > 0, the m_id ON_UUID value of the first element in the m_material_channel[] array with material_channel_index = ON_Uuid_index.m_i is returned. This id identifies an ON_Material. Otherwise ON_nil_uuid is returned.
int ON_Material::MaterialChannelIndexFromId | ( | ON_UUID | material_channel_id | ) | const |
Parameters: material_channel_id - [in] Returns: If material_channel_id is not nil, the m_i index value of the first element in the m_material_channel[] array with material_channel_id = ON_Uuid_index.m_id is returned. Otherwise 0 is returned.
int ON_Material::MaterialChannelIndexFromId | ( | ON_UUID | material_channel_id, |
bool | bAddIdIfNotPresent | ||
) |
Parameters: material_channel_id - [in] bAddIdIfNotPresent - [in] Returns: If material_channel_id is not nil, the m_i index value of the first element in the m_material_channel[] array with material_channel_id = ON_Uuid_index.m_id is returned. If material_channel_id is not nil an no element of the m_material_channel[] array has a matching id, a new element is added with a unique channel index > 0 and that index is returned. Otherwise 0 is returned.
ON_UUID ON_Material::MaterialPlugInId | ( | ) | const |
ID of the last plug-in to modify this material.
|
overridevirtual |
Description: Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.
Returns: ON::object_type enum value.
Remarks: The default implementation of this virtual function returns ON::unknown_object_type
Reimplemented from ON_Object.
|
default |
std::shared_ptr<ON_PhysicallyBasedMaterial> ON_Material::PhysicallyBased | ( | void | ) |
const std::shared_ptr<ON_PhysicallyBasedMaterial> ON_Material::PhysicallyBased | ( | void | ) | const |
Physically based material interface. Use this interface to set and get PBR parameters and to check if this material supports PBR. Note - it is very important that the lifetime of the returned pointer is the same as the ON_Material it was called on. Once the material is deleted, this pointer is no longer valid.
|
static |
Internal use only.
ON_Color ON_Material::PreviewColor | ( | ) | const |
Returns a color that can be used as a simple preview of the material in GUIs. This is the function that the layer manager uses to color the little material swatch, for example.
ON_UUID ON_Material::RdkMaterialInstanceId | ( | ) | const |
Description: Get the RDK material id. Returns: The RDK material id for this material. Remarks: The RDK material id identifies a material definition managed by the RDK (rendering development kit). Multiple materials in a Rhino or opennurbs model can reference the same RDK material.
bool ON_Material::RdkMaterialInstanceIdIsNil | ( | ) | const |
bool ON_Material::RdkMaterialInstanceIdIsNotNil | ( | ) | const |
|
overridevirtual |
Description: Low level archive writing tool used by ON_BinaryArchive::ReadObject(). Parameters: binary_archive - archive to read from Returns: Returns true if the read is successful. Remarks: Use ON_BinaryArchive::ReadObject() to read objects. This Read() function should read the objects definition back into its data members.
The default implementation of this virtual function returns false and does nothing.
Reimplemented from ON_Object.
double ON_Material::Reflectivity | ( | ) | const |
Transparency values are in range 0.0 = opaque to 1.0 = transparent.
void ON_Material::SetAmbient | ( | ON_Color | ) |
void ON_Material::SetDiffuse | ( | ON_Color | ) |
void ON_Material::SetDisableLighting | ( | bool | bDisableLighting | ) |
void ON_Material::SetEmission | ( | ON_Color | ) |
void ON_Material::SetFresnelReflections | ( | bool | bFresnelReflections | ) |
void ON_Material::SetMaterialPlugInId | ( | ON_UUID | plugin_id | ) |
void ON_Material::SetRdkMaterialInstanceId | ( | ON_UUID | rdk_material_instance_id | ) |
Description: Set this material's RDK material id. Parameters: rdk_material_id - [in] RDK material id value. Remarks: The RDK material id identifies a material definition managed by the RDK (rendering development kit). Multiple materials in a Rhino or opennurbs model can reference the same RDK material. When setting this value, it is necessary to also set this material's plug-in id to ON_UniversalRenderEngineId. See SetMaterialPlugInId().
void ON_Material::SetReflectivity | ( | double | ) |
0.0 = opaque, 1.0 = transparent
void ON_Material::SetShareable | ( | bool | bShareable | ) |
void ON_Material::SetShine | ( | double | ) |
void ON_Material::SetSpecular | ( | ON_Color | ) |
void ON_Material::SetTransparency | ( | double | ) |
0.0 = opaque, 1.0 = transparent
void ON_Material::SetUseDiffuseTextureAlphaForObjectTransparencyTexture | ( | bool | bUseDiffuseTextureAlphaForObjectTransparencyTexture | ) |
bool ON_Material::Shareable | ( | ) | const |
Returns: True if the material can be shared. Remarks: If true, when an object using this material is copied, the copy references the same material.
double ON_Material::Shine | ( | ) | const |
Shine values are in range 0.0 to ON_Material::MaxShine.
ON_Color ON_Material::Specular | ( | ) | const |
void ON_Material::ToPhysicallyBased | ( | void | ) |
Convert a legacy material to a PBR material that is the best approximation of the original. After calling this function, the material is guaranteed to return true to material.IsPhysicallyBased()
double ON_Material::Transparency | ( | ) | const |
Transparency values are in range 0.0 = opaque to 1.0 = transparent.
bool ON_Material::UseDiffuseTextureAlphaForObjectTransparencyTexture | ( | ) | const |
If m_bUseDiffuseTextureAlphaForObjectTransparencyTexture is true, the alpha channel of the texture in m_textures with m_type=bitmap_texture is used in addition to any textures with m_type=transparency_texture.
|
overridevirtual |
Description: Low level archive writing tool used by ON_BinaryArchive::WriteObject(). Parameters: binary_archive - archive to write to Returns: Returns true if the write is successful. Remarks: Use ON_BinaryArchive::WriteObject() to write objects. This Write() function should just write the specific definition of this object. It should not write and any chunk typecode or length information.
The default implementation of this virtual function returns false and does nothing.
Reimplemented from ON_Object.
|
static |
index = -1, persistent id
|
static |
Default material for locked objects.
index = -2, persistent id
ON_Color ON_Material::m_ambient = ON_Color::Black |
ON_Color ON_Material::m_diffuse = ON_Color::Gray126 |
ON_Color ON_Material::m_emission = ON_Color::Black |
double ON_Material::m_fresnel_index_of_refraction = 1.56 |
m_fresnel_index_of_refraction: Default is 1.56. This is the value ON:Material::FresnelReflectionCoefficient() passes as the first parameter to ON_FresnelReflectionCoefficient().
double ON_Material::m_index_of_refraction = 1.0 |
m_index_of_refraction: Default is 1.0. Physically, the index of refraction is >= 1.0 and is the value (speed of light in vacuum)/(speed of light in material). Some rendering algorithms set m_index_of_refraction to zero or values < 1.0 to generate desirable effects.
ON_SimpleArray<ON_UuidIndex> ON_Material::m_material_channel |
Description: The m_material_channel[] array is used to provide per face rendering material support for ON_SubD and ON_Brep objects. ON_Mesh objects to not support per face render materials. The application specifies a base ON_Material for rendering the subd or brep and a way to find materials from ON_UUID values. ON_Material.Id() returns the id for any given material.
ON_BrepFace::MaterialChannelIndex() and ON_SubDFace::MaterialChannelIndex() specify a material channel index. If this value is 0, then the base material is used to render the face. Otherwise the material with id = base.MaterialChannelIdFromIndex( face.MaterialChannelIndex() ) is used to render the face.
ON_Color ON_Material::m_reflection = ON_Color::White |
double ON_Material::m_reflection_glossiness = 0.0 |
m_reflection_glossiness: Default is 0.0. Values from 0.0 to 1.0 make sense.
double ON_Material::m_reflectivity = 0.0 |
0.0 = none, 1.0 = 100%
double ON_Material::m_refraction_glossiness = 0.0 |
m_refraction_glossiness: Default is 0.0. Values from 0.0 to 1.0 make sense.
double ON_Material::m_shine = 0.0 |
0.0 = none to GetMaxShine()=maximum
ON_Color ON_Material::m_specular = ON_Color::White |
ON_ObjectArray<ON_Texture> ON_Material::m_textures |
double ON_Material::m_transparency = 0.0 |
0.0 = opaque to 1.0 = transparent (1.0-alpha)
ON_Color ON_Material::m_transparent = ON_Color::White |
|
static |
maximum value of shine exponent = 255.0
|
static |
nil id