MaterialX 1.39.1
|
A converter class for linear units that require only a scalar multiplication. More...
#include <Unit.h>
Public Member Functions | |
const string & | getUnitType () const |
Return the unit type string. | |
void | write (DocumentPtr doc) const override |
Create unit definitions in a document based on the converter. More... | |
Conversion | |
const std::unordered_map< string, float > & | getUnitScale () const |
Return the mappings from unit names to the scale value defined by a linear converter. | |
float | conversionRatio (const string &inputUnit, const string &outputUnit) const |
Ratio between the given unit to a desired unit. More... | |
float | convert (float input, const string &inputUnit, const string &outputUnit) const override |
Convert a given value in a given unit to a desired unit. More... | |
Vector2 | convert (const Vector2 &input, const string &inputUnit, const string &outputUnit) const override |
Convert a given value in a given unit to a desired unit. More... | |
Vector3 | convert (const Vector3 &input, const string &inputUnit, const string &outputUnit) const override |
Convert a given value in a given unit to a desired unit. More... | |
Vector4 | convert (const Vector4 &input, const string &inputUnit, const string &outputUnit) const override |
Convert a given value in a given unit to a desired unit. More... | |
Shader Mapping | |
int | getUnitAsInteger (const string &unitName) const override |
Given a unit name return a value that it can map to as an integer. More... | |
virtual string | getUnitFromInteger (int index) const override |
Given an integer index return the unit name in the map used by the converter. More... | |
virtual float | convert (float input, const string &inputUnit, const string &outputUnit) const =0 |
Convert a given value in a given unit to a desired unit. More... | |
virtual int | getUnitAsInteger (const string &) const |
Given a unit name return a value that it can map to as an integer Returns -1 value if not found. More... | |
virtual string | getUnitFromInteger (int) const |
Given an integer index return the unit name in the map used by the converter Returns Empty string if not found. More... | |
virtual Vector2 | convert (const Vector2 &input, const string &inputUnit, const string &outputUnit) const =0 |
Convert a given value in a given unit to a desired unit. More... | |
virtual Vector3 | convert (const Vector3 &input, const string &inputUnit, const string &outputUnit) const =0 |
Convert a given value in a given unit to a desired unit. More... | |
virtual Vector4 | convert (const Vector4 &input, const string &inputUnit, const string &outputUnit) const =0 |
Convert a given value in a given unit to a desired unit. More... | |
virtual void | write (DocumentPtr doc) const =0 |
Create unit definitions in a document based on the converter. More... | |
Static Public Member Functions | |
static LinearUnitConverterPtr | create (UnitTypeDefPtr UnitDef) |
Creator. | |
A converter class for linear units that require only a scalar multiplication.
float conversionRatio | ( | const string & | inputUnit, |
const string & | outputUnit | ||
) | const |
|
overridevirtual |
Convert a given value in a given unit to a desired unit.
Implements UnitConverter.
|
overridevirtual |
Convert a given value in a given unit to a desired unit.
Implements UnitConverter.
|
overridevirtual |
Convert a given value in a given unit to a desired unit.
Implements UnitConverter.
|
overridevirtual |
Convert a given value in a given unit to a desired unit.
Implements UnitConverter.
|
overridevirtual |
Given a unit name return a value that it can map to as an integer.
Returns -1 value if not found
Reimplemented from UnitConverter.
|
overridevirtual |
Given an integer index return the unit name in the map used by the converter.
Returns Empty string if not found
Reimplemented from UnitConverter.
|
overridevirtual |
Create unit definitions in a document based on the converter.
Implements UnitConverter.