Rhino C++ API
8.17
|
#include <opennurbs_texture.h>
Public Member Functions | |
ON_Texture ()=default | |
ON_Texture (const ON_Texture &)=default | |
~ON_Texture ()=default | |
const ON_SHA1_Hash | ContentHash () const |
void | Dump (ON_TextLog &) const override |
bool | IsTiled (int dir, double *count, double *offset) const |
bool | IsValid (class ON_TextLog *text_log=nullptr) const override |
ON_Object overrides. More... | |
bool | IsWcsBoxProjected () const |
bool | IsWcsProjected () const |
ON_2dVector | Offset () const |
ON_Texture & | operator= (const ON_Texture &)=default |
bool | Read (ON_BinaryArchive &binary_archive) override |
ON_2dVector | Repeat () const |
bool | ReverseTextureCoordinate (int dir) |
double | Rotation () const |
void | SetBuiltInMappingChannel (ON_Texture::MAPPING_CHANNEL built_in_mapping_channel_as_unsigned) |
void | SetMappingChannel (unsigned int mapping_channel_id) |
void | SetOffset (const ON_2dVector &) |
void | SetRepeat (const ON_2dVector &) |
These functions are helpers for m_uvw. More... | |
void | SetRotation (double) |
unsigned int | SizeOf () const override |
bool | SwapTextureCoordinate (int i, int j) |
bool | TileTextureCoordinate (int dir, double count, double offset) |
bool | Write (ON_BinaryArchive &binary_archive) const override |
![]() | |
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 ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const |
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 () |
virtual ON_UUID | ModelObjectId () const |
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) |
virtual ON::object_type | ObjectType () const |
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 ON_Texture::MAPPING_CHANNEL | BuiltInMappingChannelFromUnsigned (unsigned int mapping_channel_as_unsigned) |
static int | Compare (const ON_Texture &a, const ON_Texture &b) |
static int | CompareAppearance (const ON_Texture &a, const ON_Texture &b) |
static ON_Texture::FILTER | FilterFromUnsigned (unsigned int filter_as_unsigned) |
static ON_Xform | GetPictureShrinkSurfaceTransformation (const class ON_Brep *original, const class ON_Brep *shrunk, const ON_Xform *error_return) |
static ON_Xform | GetPictureShrinkSurfaceTransformation (const class ON_Interval &original_udomain, const class ON_Interval &original_vdomain, const class ON_Interval &shrunk_udomain, const class ON_Interval &shrunk_vdomain, const ON_Xform *error_return) |
static ON_Xform | GetPictureShrinkSurfaceTransformation (const class ON_Surface *original, const class ON_Surface *shrunk, const ON_Xform *error_return) |
static bool | IsBuiltInMappingChannel (unsigned int mapping_channel_id) |
static ON_Texture::MODE | ModeFromUnsigned (unsigned int mode_as_unsigned) |
static ON_Texture::TYPE | TypeFromUnsigned (unsigned int type_as_unsigned) |
static ON_3dPoint | WcsBoxMapping (const ON_3dPoint &pt, const ON_3dVector &n) |
static ON_Texture::WRAP | WrapFromUnsigned (unsigned int wrap_as_unsigned) |
Static Public Attributes | |
static const ON_Texture | Default |
Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert McNeel & Associates.
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
For complete openNURBS copyright information see http://www.opennurbs.org. defines ON_Color and ON_Material Class ON_Texture
|
strong |
|
strong |
list of pre-defined channel ids
|
strong |
m_mode determines how the texture is do not change MODE enum values - they are saved in 3dm files.
|
strong |
do not change TYPE enum values - they are saved in 3dm files. The "TYPE" setting controls how the pixels in the bitmap are interpreted.
Enumerator | |
---|---|
no_texture_type | |
bitmap_texture | "standard" image texture. ///< Deprecated. Use Diffuse. |
diffuse_texture | ideally albedo. |
bump_texture | bump map - see m_bump_scale comment |
transparency_texture | value = alpha (see m_transparency_id) Deprecated. Use Opacity. No change needed to functionality - transparency in Rhino has always meant opacity. |
opacity_texture | value = alpha. |
pbr_base_color_texture | Reuse diffuse texture. The following textures are only for PBR materials They are not supported by the basic ON_Material definition, and should only be used when rendering physically based (PBR) materials. |
pbr_subsurface_texture | |
pbr_subsurface_scattering_texture | Deprecated |
pbr_subsurface_scattering_color_texture | |
pbr_subsurface_scattering_radius_texture | |
pbr_metallic_texture | |
pbr_specular_texture | |
pbr_specular_tint_texture | |
pbr_roughness_texture | |
pbr_anisotropic_texture | |
pbr_anisotropic_rotation_texture | |
pbr_sheen_texture | |
pbr_sheen_tint_texture | |
pbr_clearcoat_texture | |
pbr_clearcoat_roughness_texture | |
pbr_opacity_ior_texture | |
pbr_opacity_roughness_texture | |
pbr_emission_texture | |
pbr_ambient_occlusion_texture | |
pbr_displacement_texture | pbr_smudge_texture = 27U, |
pbr_clearcoat_bump_texture | |
pbr_alpha_texture | |
pbr_opacity_texture | |
pbr_bump_texture | |
emap_texture | emap_texture is OBSOLETE - set m_mapping_channel_id = ON_MappingChannel::emap_mapping spherical environment mapping. |
|
strong |
|
default |
|
default |
|
default |
|
static |
|
static |
|
static |
const ON_SHA1_Hash ON_Texture::ContentHash | ( | ) | const |
|
overridevirtual |
|
static |
|
static |
Parameters: original - [in] A brep used as a picture object (1 face with a bitmap texture applied) shrunk - [in] A copy of original with the face's surface shrunk in some way. The domain of the shrunk surface must be contained in the domain of the original surface. error_return - [in] value to return if the input parameters are not valid. If error_return is nullptr, then ON_Xform::Nan is returned when input parameters are not valid.
Returns: Texture transformation that will map a [0,1]x[0,1] to the appropriate sub rectangle of the picture image.
Example: ON_Brep original_picture = ...; ON_Brep shrunk_picture = original_picture; shrunk_picture.ShrinkSurfaces(); ON_Material original_material = ...; ON_Material new_material = original_material; ON_Texture& new_texture = new_material.m_textures[0]; new_texture.m_uvw = ON_Texture::GetPictureShrinkSurfaceTransformation( &original_picture, &shrunk_picture, &ON_Xform::IdentityXform)*new_texture.m_uvw;
|
static |
Parameters: original_udomain - [in] original_vdomain - [in] original picture surface domain shrunk_udomain - [in] shrunk_vdomain - [in] sub-domain of the original picture. error_return - [in] value to return if the input parameters are not valid. If error_return is nullptr, then ON_Xform::Nan is returned when input parameters are not valid.
Returns: Texture transformation that will map a [0,1]x[0,1] to the appropriate sub rectangle of the picture image.
Example: ON_Brep original_picture = ...; ON_Brep shrunk_picture = original_picture; shrunk_picture.ShrinkSurfaces(); ON_Material original_material = ...; ON_Material new_material = original_material; ON_Texture& new_texture = new_material.m_textures[0]; new_texture.m_uvw = ON_Texture::GetPictureShrinkSurfaceTransformation( &original_picture, &shrunk_picture, &ON_Xform::IdentityXform)*new_texture.m_uvw;
|
static |
Parameters: original - [in] A surface used as a picture object (1 face with a bitmap texture applied) shrunk - [in] A surface trimmed/split from the original error_return - [in] value to return if the input parameters are not valid. If error_return is nullptr, then ON_Xform::Nan is returned when input parameters are not valid.
Returns: Texture transformation that will map a [0,1]x[0,1] to the appropriate sub rectangle of the picture image.
Example: ON_Brep original_picture = ...; ON_Brep shrunk_picture = original_picture; shrunk_picture.ShrinkSurfaces(); ON_Material original_material = ...; ON_Material new_material = original_material; ON_Texture& new_texture = new_material.m_textures[0]; new_texture.m_uvw = ON_Texture::GetPictureShrinkSurfaceTransformation( &original_picture, &shrunk_picture, &ON_Xform::IdentityXform)*new_texture.m_uvw;
|
static |
bool ON_Texture::IsTiled | ( | int | dir, |
double * | count, | ||
double * | offset | ||
) | const |
Description: Examines the m_uvw matrix and harvests tiling constants. Parameters: dir - [in] 0 = reverse "u", 1 = reverse "v", 2 = reverse "w". count - [out] number of tiles offset - [out] offset of the tile Returns: True if if the m_uvw matrix had entries that were compatible with tiling.
|
overridevirtual |
bool ON_Texture::IsWcsBoxProjected | ( | ) | const |
Description: Returns true if this texture uses world coordinate system (WCS) box projection for texture mapping. Remarks: If this texture is used by an object that has an object coordinate system (OCS) frame defined on a mapping channel then that OCS frame is used instead of the WCS. Returns: True if this texture uses WCS box projection.
bool ON_Texture::IsWcsProjected | ( | ) | const |
Description: Returns true if this texture uses world coordinate system (WCS) projection for texture mapping. Remarks: If this texture is used by an object that has an object coordinate system (OCS) frame defined on a mapping channel then that OCS frame is used instead of the WCS. Returns: True if this texture uses WCS projection.
|
static |
ON_2dVector ON_Texture::Offset | ( | ) | const |
|
default |
|
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.
ON_2dVector ON_Texture::Repeat | ( | ) | const |
bool ON_Texture::ReverseTextureCoordinate | ( | int | dir | ) |
Description: Reverses the texture in the specified direction. Parameters: dir - [in] 0 = reverse "u", 1 = reverse "v", 2 = reverse "w". Remarks: Modifies m_uvw so that the specified direction transforms the texture coordinate t to 1-t. Returns: True if input is valid.
double ON_Texture::Rotation | ( | ) | const |
void ON_Texture::SetBuiltInMappingChannel | ( | ON_Texture::MAPPING_CHANNEL | built_in_mapping_channel_as_unsigned | ) |
void ON_Texture::SetMappingChannel | ( | unsigned int | mapping_channel_id | ) |
void ON_Texture::SetOffset | ( | const ON_2dVector & | ) |
void ON_Texture::SetRepeat | ( | const ON_2dVector & | ) |
These functions are helpers for m_uvw.
void ON_Texture::SetRotation | ( | double | ) |
|
overridevirtual |
Returns: An estimate of the amount of memory the class uses in bytes.
Reimplemented from ON_Object.
bool ON_Texture::SwapTextureCoordinate | ( | int | i, |
int | j | ||
) |
Description: Swaps the specified texture coordinates. Parameters: i - [in] j - [in] (0 <= i, j <= 3 and i != j) Remarks: Modifies m_uvw so that the specified texture coordinates are swapped. Returns: True if input is valid.
bool ON_Texture::TileTextureCoordinate | ( | int | dir, |
double | count, | ||
double | offset | ||
) |
Description: Tiles the specified texture coordinates. Parameters: dir - [in] 0 = reverse "u", 1 = reverse "v", 2 = reverse "w". count - [in] number of tiles (can be negative) offset - [in] offset of the tile (can be any number) Remarks: Modifies m_uvw so that the specified texture coordinate is tiled. Returns: True if input is valid.
|
static |
|
static |
Description: Evaluates WCS box projection at point pt with normal n.
|
static |
|
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 |
double ON_Texture::m_blend_A0 = 1.0 |
double ON_Texture::m_blend_A1 = 1.0 |
double ON_Texture::m_blend_A2 = 0.0 |
double ON_Texture::m_blend_A3 = 0.0 |
double ON_Texture::m_blend_constant_A = 1.0 |
If the m_mode is blend_texture, then m_blend_A[] and m_blend_RGB[] determine the blending function.
new alpha = m_blend_constant_A
Results are clamped to handle underflow or overflow.
ON_Color ON_Texture::m_blend_constant_RGB = ON_Color::Black |
int ON_Texture::m_blend_order = 0 |
If an ON_Material m_textures[] array has more than one texture, the textures are blended, and the textures have different m_blend_order values, the the texture with the smaller m_blend_order is first.
double ON_Texture::m_blend_RGB0 = 1.0 |
double ON_Texture::m_blend_RGB1 = 1.0 |
double ON_Texture::m_blend_RGB2 = 0.0 |
double ON_Texture::m_blend_RGB3 = 0.0 |
bool ON_Texture::m_bOn = true |
If false, texture is off and should be ignored. The intended use is to allow people to turn textures on and off without have to create/destroy or change other texture settings.
ON_Color ON_Texture::m_border_color = ON_UNSET_COLOR |
If ON_UNSET_COLOR != m_border_color, then this color is used when the texture coordinates are <=0 or >=1 and the m_wrap* value is clamp_wrap.
bool ON_Texture::m_bTreatAsLinear = false |
If false, the texture color values should be correctly by the linear workflow pre-process gamma value (in the document) if linear workflow is on. Otherwise, if the values is true, the values should be used raw from the texture.
ON_Interval ON_Texture::m_bump_scale = ON_Interval::ZeroToOne |
If the m_type is bump_texture, the height of the bump is m_bump_scale.ParameterAt(value), where value is in the HSV sense and normalized (black=0, white=1). The interval can be decreasing.
ON_FileReference ON_Texture::m_image_file_reference = ON_FileReference::Unset |
Image file If m_image_file_reference is set and m_image_file_reference.FullPath() exists, it is the image file being used. This is the common situation during runtime.
ON_Texture::FILTER ON_Texture::m_magfilter = ON_Texture::FILTER::linear_filter |
The magfilter setting controls how the color of the image pixel is calculated when the image pixel corresponds to a fraction of a texture bitmap pixel.
unsigned int ON_Texture::m_mapping_channel_id = 1 |
If the m_mapping_channel_id value is one of the built-in mappings listed in the MAPPING_CHANNEL enum, then that mapping is used. Otherwise, if an object has rendering attributes with an ON_MappingChannel entry that has a matching m_mapping_channel_id value, then the mapping identified by ON_MappingChannel::m_mapping_id is used. If a matching ON_MappingChannel::m_mapping_id is not found, then an attempt will be made to find a mapping with a ON_MappingChannel::m_mapping_id of 1. If that also fails, then surface parameter mapping will be used.
ON_Texture::FILTER ON_Texture::m_minfilter = ON_Texture::FILTER::linear_filter |
The value of m_minfilter determines how the color of the image pixel is calculated when the image pixel corresponds to multiple texture bitmap pixels.
ON_Texture::MODE ON_Texture::m_mode = ON_Texture::MODE::modulate_texture |
ON_UUID ON_Texture::m_texture_id = ON_nil_uuid |
ON_UUID ON_Texture::m_transparency_texture_id = ON_nil_uuid |
This field is used for textures with type bitmap_texture that reference bitmap files that do not have an alpha channel and is used to set runtime alpha values. It needs to be parsed when the texture is loaded and can be ignored at runtime.
If m_transparency_id is not nil, it is the id of another texture in the ON_Material.m_textures[] array that has type m_transparency_texture. The runtime bitmap_texture's alpha is set to (255-max(R,G,B)) (the "value" in the hue, saturation,value sense) of the corresponding transparency_texture pixel.
For example, if you had a bitmap texture that was green with purple dots saved in a RGB .bmp file and you wanted the purple dots to be semi-transparent, you could create another bitmap that was black, where the original was green, and gray, where the original was purple, have an transparency_texture reference the white/gray bitmap, and have the bitmap_texture's m_transparency_id reference the transparency map.
ON_Color ON_Texture::m_transparent_color = ON_UNSET_COLOR |
This field is used for textures with type bitmap_texture that reference bitmap files that do not have an alpha channel and is used to set runtime alpha values. It needs to be parsed when the texture is loaded and can be ignored at runtime.
If ON_UNSET_COLOR != m_transparent_color, then a pixel in the bitmap file with a matching RGB value is assigned the alpha value (ON_Color::Alpha) in m_transparent_color. The intended use is for non-rectangular decals defined by RGB bitmaps in files that don't save an alpha channel.
For example if the decal is a red number 7 with a white background, then you would set m_transparent_color's RGB to white and its A to zero.
ON_Texture::TYPE ON_Texture::m_type = ON_Texture::TYPE::bitmap_texture |
ON_Xform ON_Texture::m_uvw = ON_Xform::IdentityTransformation |
Texture coordinate transformation.
WRAP ON_Texture::m_wrapu = ON_Texture::WRAP::repeat_wrap |
WRAP ON_Texture::m_wrapv = ON_Texture::WRAP::repeat_wrap |
WRAP ON_Texture::m_wrapw = ON_Texture::WRAP::repeat_wrap |
bool ON_Texture::reserved2 = false |
bool ON_Texture::reserved3 = false |