Rhino C++ API  8.14
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_Texture Class Reference

#include <opennurbs_texture.h>

Inheritance diagram for ON_Texture:
ON_Object

Public Types

enum  FILTER : unsigned int { FILTER::nearest_filter = 0, FILTER::linear_filter = 1 }
 
enum  MAPPING_CHANNEL : unsigned int {
  MAPPING_CHANNEL::tc_channel = 0U, MAPPING_CHANNEL::default_channel = 1U, MAPPING_CHANNEL::screen_based_channel = 0xFFFFFFF1U, MAPPING_CHANNEL::wcs_channel = 0xFFFFFFF2U,
  MAPPING_CHANNEL::wcs_box_channel = 0xFFFFFFF3U, MAPPING_CHANNEL::environment_map_box_channel = 0xFFFFFFF4U, MAPPING_CHANNEL::environment_map_light_probe_channel = 0xFFFFFFF5U, MAPPING_CHANNEL::environment_map_spherical_channel = 0xFFFFFFF6U,
  MAPPING_CHANNEL::environment_map_cube_map_channel = 0xFFFFFFF7U, MAPPING_CHANNEL::environment_map_vcross_cube_map_channel = 0xFFFFFFF8U, MAPPING_CHANNEL::environment_map_hcross_cube_map_channel = 0xFFFFFFF9U, MAPPING_CHANNEL::environment_map_hemispherical_channel = 0xFFFFFFFAU,
  MAPPING_CHANNEL::environment_map_emap_channel = 0xFFFFFFFFU, MAPPING_CHANNEL::srfp_channel = 0xFFFFFFFEU, MAPPING_CHANNEL::emap_channel = 0xFFFFFFFFU
}
 list of pre-defined channel ids More...
 
enum  MODE : unsigned int { MODE::no_texture_mode = 0, MODE::modulate_texture = 1, MODE::decal_texture = 2, MODE::blend_texture = 3 }
 
enum  TYPE : unsigned int {
  TYPE::no_texture_type = 0U, TYPE::bitmap_texture = 1U, TYPE::diffuse_texture = 1U, TYPE::bump_texture = 2U,
  TYPE::transparency_texture = 3U, TYPE::opacity_texture = 3U, TYPE::pbr_base_color_texture = 1U, TYPE::pbr_subsurface_texture = 10U,
  TYPE::pbr_subsurface_scattering_texture = 11U, TYPE::pbr_subsurface_scattering_color_texture = 11U, TYPE::pbr_subsurface_scattering_radius_texture = 12U, TYPE::pbr_metallic_texture = 13U,
  TYPE::pbr_specular_texture = 14U, TYPE::pbr_specular_tint_texture = 15U, TYPE::pbr_roughness_texture = 16U, TYPE::pbr_anisotropic_texture = 17U,
  TYPE::pbr_anisotropic_rotation_texture = 18U, TYPE::pbr_sheen_texture = 19U, TYPE::pbr_sheen_tint_texture = 20U, TYPE::pbr_clearcoat_texture = 21U,
  TYPE::pbr_clearcoat_roughness_texture = 22U, TYPE::pbr_opacity_ior_texture = 23U, TYPE::pbr_opacity_roughness_texture = 24U, TYPE::pbr_emission_texture = 25U,
  TYPE::pbr_ambient_occlusion_texture = 26U, TYPE::pbr_displacement_texture = 28U, TYPE::pbr_clearcoat_bump_texture = 29U, TYPE::pbr_alpha_texture = 30U,
  TYPE::pbr_opacity_texture = 3U, TYPE::pbr_bump_texture = 2U, TYPE::emap_texture = 86U
}
 
enum  WRAP : unsigned int { WRAP::repeat_wrap = 0, WRAP::clamp_wrap = 1 }
 
- Public Types inherited from ON_Object
enum  UserDataConflictResolution : unsigned char {
  UserDataConflictResolution::destination_object = 0, UserDataConflictResolution::source_object = 1, UserDataConflictResolution::source_copycount_gt = 2, UserDataConflictResolution::source_copycount_ge = 3,
  UserDataConflictResolution::destination_copycount_gt = 4, UserDataConflictResolution::destination_copycount_ge = 5, UserDataConflictResolution::delete_item = 6
}
 

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_Textureoperator= (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
 
- 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 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_UserDataFirstUserData () const
 
virtual unsigned int GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const
 
class ON_UserDataGetUserData (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_Objectoperator= (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)
 

Public Attributes

double m_blend_A0 = 1.0
 
double m_blend_A1 = 1.0
 
double m_blend_A2 = 0.0
 
double m_blend_A3 = 0.0
 
double m_blend_constant_A = 1.0
 
ON_Color m_blend_constant_RGB = ON_Color::Black
 
int m_blend_order = 0
 
double m_blend_RGB0 = 1.0
 
double m_blend_RGB1 = 1.0
 
double m_blend_RGB2 = 0.0
 
double m_blend_RGB3 = 0.0
 
bool m_bOn = true
 
ON_Color m_border_color = ON_UNSET_COLOR
 
bool m_bTreatAsLinear = false
 
ON_Interval m_bump_scale = ON_Interval::ZeroToOne
 
ON_FileReference m_image_file_reference = ON_FileReference::Unset
 
ON_Texture::FILTER m_magfilter = ON_Texture::FILTER::linear_filter
 
unsigned int m_mapping_channel_id = 1
 
ON_Texture::FILTER m_minfilter = ON_Texture::FILTER::linear_filter
 
ON_Texture::MODE m_mode = ON_Texture::MODE::modulate_texture
 
ON_UUID m_texture_id = ON_nil_uuid
 
ON_UUID m_transparency_texture_id = ON_nil_uuid
 
ON_Color m_transparent_color = ON_UNSET_COLOR
 
ON_Texture::TYPE m_type = ON_Texture::TYPE::bitmap_texture
 
ON_Xform m_uvw = ON_Xform::IdentityTransformation
 Texture coordinate transformation. More...
 
WRAP m_wrapu = ON_Texture::WRAP::repeat_wrap
 
WRAP m_wrapv = ON_Texture::WRAP::repeat_wrap
 
WRAP m_wrapw = ON_Texture::WRAP::repeat_wrap
 
bool reserved2 = false
 
bool reserved3 = false
 

Static Public Attributes

static const ON_Texture Default
 

Detailed Description

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

Member Enumeration Documentation

◆ FILTER

enum ON_Texture::FILTER : unsigned int
strong
Enumerator
nearest_filter 

nearest texture pixel is used

linear_filter 

weighted average of corresponding texture pixels

◆ MAPPING_CHANNEL

enum ON_Texture::MAPPING_CHANNEL : unsigned int
strong

list of pre-defined channel ids

Enumerator
tc_channel 

Deprecated. Use 'default_channel' instead.

default_channel 

Use either default mapping, or the "Custom" mapping applied to the object.

screen_based_channel 
wcs_channel 
wcs_box_channel 
environment_map_box_channel 
environment_map_light_probe_channel 
environment_map_spherical_channel 
environment_map_cube_map_channel 
environment_map_vcross_cube_map_channel 
environment_map_hcross_cube_map_channel 
environment_map_hemispherical_channel 
environment_map_emap_channel 
srfp_channel 

Use surface parameterization.

emap_channel 

Environment map the geometric object - deprecated. Use environment_map_emap_channel instead.

◆ MODE

enum ON_Texture::MODE : unsigned int
strong

m_mode determines how the texture is do not change MODE enum values - they are saved in 3dm files.

Enumerator
no_texture_mode 
modulate_texture 

modulate with material diffuse color

decal_texture 

decal

blend_texture 

blend texture with others in the material To "add" a texture, set m_blend_amount = +1 To "subtract" a texture, set m_blend_amount = -1

◆ TYPE

enum ON_Texture::TYPE : unsigned int
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.

◆ WRAP

enum ON_Texture::WRAP : unsigned int
strong
Enumerator
repeat_wrap 
clamp_wrap 

Constructor & Destructor Documentation

◆ ON_Texture() [1/2]

ON_Texture::ON_Texture ( )
default

◆ ~ON_Texture()

ON_Texture::~ON_Texture ( )
default

◆ ON_Texture() [2/2]

ON_Texture::ON_Texture ( const ON_Texture )
default

Member Function Documentation

◆ BuiltInMappingChannelFromUnsigned()

static ON_Texture::MAPPING_CHANNEL ON_Texture::BuiltInMappingChannelFromUnsigned ( unsigned int  mapping_channel_as_unsigned)
static

◆ Compare()

static int ON_Texture::Compare ( const ON_Texture a,
const ON_Texture b 
)
static

◆ CompareAppearance()

static int ON_Texture::CompareAppearance ( const ON_Texture a,
const ON_Texture b 
)
static

◆ ContentHash()

const ON_SHA1_Hash ON_Texture::ContentHash ( ) const

◆ Dump()

void ON_Texture::Dump ( ON_TextLog ) const
overridevirtual

Description: Creates a text dump of the object. Remarks: Dump() is intended for debugging and is not suitable for creating high quality text descriptions of an object.

The default implementations of this virtual function prints the class's name.

Reimplemented from ON_Object.

◆ FilterFromUnsigned()

static ON_Texture::FILTER ON_Texture::FilterFromUnsigned ( unsigned int  filter_as_unsigned)
static

◆ GetPictureShrinkSurfaceTransformation() [1/3]

static ON_Xform ON_Texture::GetPictureShrinkSurfaceTransformation ( const class ON_Brep original,
const class ON_Brep shrunk,
const ON_Xform error_return 
)
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;

◆ GetPictureShrinkSurfaceTransformation() [2/3]

static ON_Xform ON_Texture::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

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;

◆ GetPictureShrinkSurfaceTransformation() [3/3]

static ON_Xform ON_Texture::GetPictureShrinkSurfaceTransformation ( const class ON_Surface original,
const class ON_Surface shrunk,
const ON_Xform error_return 
)
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;

◆ IsBuiltInMappingChannel()

static bool ON_Texture::IsBuiltInMappingChannel ( unsigned int  mapping_channel_id)
static

◆ IsTiled()

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.

◆ IsValid()

bool ON_Texture::IsValid ( class ON_TextLog text_log = nullptr) const
overridevirtual

ON_Object overrides.

Reimplemented from ON_Object.

◆ IsWcsBoxProjected()

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.

◆ IsWcsProjected()

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.

◆ ModeFromUnsigned()

static ON_Texture::MODE ON_Texture::ModeFromUnsigned ( unsigned int  mode_as_unsigned)
static

◆ Offset()

ON_2dVector ON_Texture::Offset ( ) const

◆ operator=()

ON_Texture& ON_Texture::operator= ( const ON_Texture )
default

◆ Read()

bool ON_Texture::Read ( ON_BinaryArchive binary_archive)
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.

◆ Repeat()

ON_2dVector ON_Texture::Repeat ( ) const

◆ ReverseTextureCoordinate()

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.

◆ Rotation()

double ON_Texture::Rotation ( ) const

◆ SetBuiltInMappingChannel()

void ON_Texture::SetBuiltInMappingChannel ( ON_Texture::MAPPING_CHANNEL  built_in_mapping_channel_as_unsigned)

◆ SetMappingChannel()

void ON_Texture::SetMappingChannel ( unsigned int  mapping_channel_id)

◆ SetOffset()

void ON_Texture::SetOffset ( const ON_2dVector )

◆ SetRepeat()

void ON_Texture::SetRepeat ( const ON_2dVector )

These functions are helpers for m_uvw.

◆ SetRotation()

void ON_Texture::SetRotation ( double  )

◆ SizeOf()

unsigned int ON_Texture::SizeOf ( ) const
overridevirtual

Returns: An estimate of the amount of memory the class uses in bytes.

Reimplemented from ON_Object.

◆ SwapTextureCoordinate()

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.

◆ TileTextureCoordinate()

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.

◆ TypeFromUnsigned()

static ON_Texture::TYPE ON_Texture::TypeFromUnsigned ( unsigned int  type_as_unsigned)
static

◆ WcsBoxMapping()

static ON_3dPoint ON_Texture::WcsBoxMapping ( const ON_3dPoint pt,
const ON_3dVector n 
)
static

Description: Evaluates WCS box projection at point pt with normal n.

◆ WrapFromUnsigned()

static ON_Texture::WRAP ON_Texture::WrapFromUnsigned ( unsigned int  wrap_as_unsigned)
static

◆ Write()

bool ON_Texture::Write ( ON_BinaryArchive binary_archive) const
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.

Member Data Documentation

◆ Default

const ON_Texture ON_Texture::Default
static

◆ m_blend_A0

double ON_Texture::m_blend_A0 = 1.0

◆ m_blend_A1

double ON_Texture::m_blend_A1 = 1.0

◆ m_blend_A2

double ON_Texture::m_blend_A2 = 0.0

◆ m_blend_A3

double ON_Texture::m_blend_A3 = 0.0

◆ m_blend_constant_A

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

  • m_blend_A[0]*(current alpha)
  • m_blend_A[1]*(texture alpha)
  • m_blend_A[2]*min(current alpha,texture alpha)
  • m_blend_A[3]*max(current alpha,texture alpha) new rgb = m_blend_constant_RGB
  • m_blend_RGB[0]*(current RGB)
  • m_blend_RGB[1]*(texture RGB)
  • m_blend_RGB[2]*min(current RGB,texture RGB)
  • m_blend_RGB[3]*max(current RGB,texture RGB)

Results are clamped to handle underflow or overflow.

◆ m_blend_constant_RGB

ON_Color ON_Texture::m_blend_constant_RGB = ON_Color::Black

◆ m_blend_order

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.

◆ m_blend_RGB0

double ON_Texture::m_blend_RGB0 = 1.0

◆ m_blend_RGB1

double ON_Texture::m_blend_RGB1 = 1.0

◆ m_blend_RGB2

double ON_Texture::m_blend_RGB2 = 0.0

◆ m_blend_RGB3

double ON_Texture::m_blend_RGB3 = 0.0

◆ m_bOn

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.

◆ m_border_color

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.

◆ m_bTreatAsLinear

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.

◆ m_bump_scale

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.

◆ m_image_file_reference

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.

◆ m_magfilter

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.

◆ m_mapping_channel_id

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.

◆ m_minfilter

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.

◆ m_mode

◆ m_texture_id

ON_UUID ON_Texture::m_texture_id = ON_nil_uuid

◆ m_transparency_texture_id

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.

◆ m_transparent_color

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.

◆ m_type

◆ m_uvw

Texture coordinate transformation.

◆ m_wrapu

WRAP ON_Texture::m_wrapu = ON_Texture::WRAP::repeat_wrap

◆ m_wrapv

WRAP ON_Texture::m_wrapv = ON_Texture::WRAP::repeat_wrap

◆ m_wrapw

WRAP ON_Texture::m_wrapw = ON_Texture::WRAP::repeat_wrap

◆ reserved2

bool ON_Texture::reserved2 = false

◆ reserved3

bool ON_Texture::reserved3 = false