Rhino C++ API
8.18
|
#include <opennurbs_decals.h>
Public Types | |
enum | Mappings : ON__INT32 { Mappings::None = -1, Mappings::Planar = 0, Mappings::Cylindrical = 1, Mappings::Spherical = 2, Mappings::UV = 3 } |
enum | Projections : ON__INT32 { Projections::None = -1, Projections::Forward = 0, Projections::Backward = 1, Projections::Both = 2 } |
Public Member Functions | |
ON_Decal () | |
Construct a decal with all properties set to defaults. More... | |
ON_Decal (class ON_DecalCollection &coll, ON_XMLNode &node) | |
For internal use only. More... | |
ON_Decal (const ON_Decal &other) | |
Construct this decal as a copy of another decal. More... | |
ON_Decal (const ON_XMLNode &node) | |
Construct a decal passing the const XML node to be used for its storage. This decal is read only. More... | |
ON_Decal (ON_XMLNode &node) | |
Construct a decal passing the XML node to be used for its storage. More... | |
virtual | ~ON_Decal () |
void | AppendCustomXML (const ON_XMLNode &) |
ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const |
ON_DECAL_CRC | DecalCRC (void) const |
Returns the Decal CRC of the decal. More... | |
void | GetCustomXML (const ON_UUID &renderEngineId, ON_XMLNode &custom_param_node) const |
Get the custom XML for the specified render engine. The format of the XML is described below. More... | |
void | GetEntireCustomXML (ON_XMLNode &) const |
void | GetHorzSweep (double &sta, double &end) const |
bool | GetTextureMapping (ON_TextureMapping &tm) const |
void | GetUVBounds (double &min_u, double &min_v, double &max_u, double &max_v) const |
Returns the UV bounds of the decal. Only used when mapping is UV. More... | |
void | GetVertSweep (double &sta, double &end) const |
double | Height (void) const |
Returns the height of the decal. Only used when mapping is cylindrical. More... | |
ON_UUID | Id (void) const |
bool | IsVisible (void) const |
Returns true if the decal is visible in the rendering. More... | |
Mappings | Mapping (void) const |
Returns the decal's mapping. More... | |
bool | MapToInside (void) const |
virtual bool | operator!= (const ON_Decal &d) const |
virtual const ON_Decal & | operator= (const ON_Decal &d) |
virtual bool | operator== (const ON_Decal &d) const |
ON_3dPoint | Origin (void) const |
Returns the origin of the decal in world space. Not used when the mapping is UV. More... | |
Projections | Projection (void) const |
Returns the decal's projection. Used only when mapping is planar. More... | |
double | Radius (void) const |
Returns the radius of the decal. Only used when mapping is cylindrical or spherical. More... | |
bool | SetCustomXML (const ON_UUID &renderEngineId, const ON_XMLNode &custom_param_node) |
void | SetHeight (double d) |
Sets the height of the decal. Only used when mapping is cylindrical. More... | |
void | SetHorzSweep (double sta, double end) |
void | SetIsVisible (bool visible) |
Sets whether or not the decal is visible in the rendering. More... | |
void | SetMapping (Mappings m) |
Sets the decal's mapping. More... | |
void | SetMapToInside (bool b) |
void | SetOrigin (const ON_3dPoint &pt) |
Sets the origin of the decal in world space. Not used when the mapping is UV. More... | |
void | SetProjection (Projections p) |
Sets the decal's projection. Used only when mapping is planar. More... | |
void | SetRadius (double d) |
Sets the radius of the decal. Only used when mapping is cylindrical or spherical. More... | |
void | SetTextureInstanceId (const ON_UUID &id) |
Sets the decal texture's instance id. More... | |
void | SetTransparency (double d) |
Sets the decal's transparency (clamped to the range 0..1). More... | |
void | SetUVBounds (double min_u, double min_v, double max_u, double max_v) |
Sets the UV bounds of the decal. Only used when mapping is UV. More... | |
void | SetVectorAcross (const ON_3dVector &vec) |
Sets the 'across' vector of the decal. Not used when the mapping is UV. More... | |
void | SetVectorUp (const ON_3dVector &vec) |
Sets the 'up' vector of the decal. Not used when the mapping is UV. More... | |
void | SetVertSweep (double sta, double end) |
ON_UUID | TextureInstanceId (void) const |
Returns the decal texture's instance id. More... | |
double | Transparency (void) const |
Returns the decal's transparency in the range 0..1. More... | |
ON_3dVector | VectorAcross (void) const |
ON_3dVector | VectorUp (void) const |
Static Public Member Functions | |
static ON_DECAL_CRC | ComputeDecalCRC (ON__UINT32, const ON_XMLNode &) |
< For internal use only. More... | |
ON_Decal encapsulates a rendering decal which is an image that sticks to the surface of an object like a real-life decal does. Decals are identified by their CRC which is a value generated from the decal's current state. When a property changes, the CRC will also change.
Decals have a choice of mappings:
They also have a choice of projections:
Some of the properties are only used by certain mappings:
The class stores its data as XML but it is optimized with a built-in cache. As each property is requested, it is read from the XML and cached. Thereafter, the cached value is returned and the XML for that property is never read again. On writing to a property, the cache is updated and by default the XML is also updated. However, it is possible to inhibit the XML update for increased performance. See SetCacheOnly() below.
|
strong |
|
strong |
ON_Decal::ON_Decal | ( | ) |
Construct a decal with all properties set to defaults.
ON_Decal::ON_Decal | ( | ON_XMLNode & | node | ) |
Construct a decal passing the XML node to be used for its storage.
ON_Decal::ON_Decal | ( | const ON_XMLNode & | node | ) |
Construct a decal passing the const XML node to be used for its storage. This decal is read only.
ON_Decal::ON_Decal | ( | class ON_DecalCollection & | coll, |
ON_XMLNode & | node | ||
) |
For internal use only.
ON_Decal::ON_Decal | ( | const ON_Decal & | other | ) |
Construct this decal as a copy of another decal.
|
virtual |
void ON_Decal::AppendCustomXML | ( | const ON_XMLNode & | ) |
|
static |
< For internal use only.
ON__UINT32 ON_Decal::DataCRC | ( | ON__UINT32 | current_remainder | ) | const |
Returns the Data CRC of the decal. This is not necessarily the same as the decal CRC because it allows a starting current remainder.
ON_DECAL_CRC ON_Decal::DecalCRC | ( | void | ) | const |
Returns the Decal CRC of the decal.
void ON_Decal::GetCustomXML | ( | const ON_UUID & | renderEngineId, |
ON_XMLNode & | custom_param_node | ||
) | const |
Get the custom XML for the specified render engine. The format of the XML is described below.
void ON_Decal::GetEntireCustomXML | ( | ON_XMLNode & | ) | const |
void ON_Decal::GetHorzSweep | ( | double & | sta, |
double & | end | ||
) | const |
Gets the start and end angles of the decal's 'horizontal sweep' (these are angles of longitude in radians). Only used when mapping is cylindrical or spherical.
bool ON_Decal::GetTextureMapping | ( | ON_TextureMapping & | tm | ) | const |
Gets a texture mapping based on the properties of this decal. Only works and returns true if the decal mapping is Planar, Spherical or Cylindrical. Otherwise returns false.
void ON_Decal::GetUVBounds | ( | double & | min_u, |
double & | min_v, | ||
double & | max_u, | ||
double & | max_v | ||
) | const |
Returns the UV bounds of the decal. Only used when mapping is UV.
void ON_Decal::GetVertSweep | ( | double & | sta, |
double & | end | ||
) | const |
Gets the start and end angles of the decal's 'vertical sweep' (these are angles of latitude in radians). Only used when mapping is spherical.
double ON_Decal::Height | ( | void | ) | const |
Returns the height of the decal. Only used when mapping is cylindrical.
ON_UUID ON_Decal::Id | ( | void | ) | const |
Returns the unique id of the decal. This is a run-time id that is not persistent and is only used for looking decals up in the model.
bool ON_Decal::IsVisible | ( | void | ) | const |
Returns true if the decal is visible in the rendering.
Mappings ON_Decal::Mapping | ( | void | ) | const |
Returns the decal's mapping.
bool ON_Decal::MapToInside | ( | void | ) | const |
Returns true if the texture is mapped to inside of sphere or cylinder, else false. Used only when mapping is cylindrical or spherical.
|
virtual |
|
virtual |
ON_3dPoint ON_Decal::Origin | ( | void | ) | const |
Returns the origin of the decal in world space. Not used when the mapping is UV.
Projections ON_Decal::Projection | ( | void | ) | const |
Returns the decal's projection. Used only when mapping is planar.
double ON_Decal::Radius | ( | void | ) | const |
Returns the radius of the decal. Only used when mapping is cylindrical or spherical.
bool ON_Decal::SetCustomXML | ( | const ON_UUID & | renderEngineId, |
const ON_XMLNode & | custom_param_node | ||
) |
Set the custom XML for the specified render engine. This XML should have the following format:
<parameters> <param-name type="type"></param-name> ... </parameters>
Therefore 'custom_param_node' must have a tag name of "<parameters>". The easiest way to produce such XML is by using ON_XMLParameters.
void ON_Decal::SetHeight | ( | double | d | ) |
Sets the height of the decal. Only used when mapping is cylindrical.
void ON_Decal::SetHorzSweep | ( | double | sta, |
double | end | ||
) |
Sets the start and end angles of the decal's 'horizontal sweep' (these are angles of longitude in radians). Only used when mapping is cylindrical or spherical.
void ON_Decal::SetIsVisible | ( | bool | visible | ) |
Sets whether or not the decal is visible in the rendering.
void ON_Decal::SetMapping | ( | Mappings | m | ) |
Sets the decal's mapping.
void ON_Decal::SetMapToInside | ( | bool | b | ) |
Sets if the texture is mapped to inside of sphere or cylinder. Used only when mapping is cylindrical or spherical.
void ON_Decal::SetOrigin | ( | const ON_3dPoint & | pt | ) |
Sets the origin of the decal in world space. Not used when the mapping is UV.
void ON_Decal::SetProjection | ( | Projections | p | ) |
Sets the decal's projection. Used only when mapping is planar.
void ON_Decal::SetRadius | ( | double | d | ) |
Sets the radius of the decal. Only used when mapping is cylindrical or spherical.
void ON_Decal::SetTextureInstanceId | ( | const ON_UUID & | id | ) |
Sets the decal texture's instance id.
void ON_Decal::SetTransparency | ( | double | d | ) |
Sets the decal's transparency (clamped to the range 0..1).
void ON_Decal::SetUVBounds | ( | double | min_u, |
double | min_v, | ||
double | max_u, | ||
double | max_v | ||
) |
Sets the UV bounds of the decal. Only used when mapping is UV.
void ON_Decal::SetVectorAcross | ( | const ON_3dVector & | vec | ) |
Sets the 'across' vector of the decal. Not used when the mapping is UV.
void ON_Decal::SetVectorUp | ( | const ON_3dVector & | vec | ) |
Sets the 'up' vector of the decal. Not used when the mapping is UV.
void ON_Decal::SetVertSweep | ( | double | sta, |
double | end | ||
) |
Sets the start and end angles of the decal's 'vertical sweep' (these are angles of latitude in radians). Only used when mapping is spherical.
ON_UUID ON_Decal::TextureInstanceId | ( | void | ) | const |
Returns the decal texture's instance id.
double ON_Decal::Transparency | ( | void | ) | const |
Returns the decal's transparency in the range 0..1.
ON_3dVector ON_Decal::VectorAcross | ( | void | ) | const |
Returns the 'across' vector of the decal. For planar mapping the length of the vector is relevant. Not used when the mapping is UV. For cylindrical and spherical mapping, the vector is unitized.
ON_3dVector ON_Decal::VectorUp | ( | void | ) | const |
Returns the 'up' vector of the decal. For planar mapping the length of the vector is relevant. Not used when the mapping is UV. For cylindrical and spherical mapping, the vector is unitized.