Support Forum G3D Web Page |
Common code for G3D::Component1, G3D::Component3, and G3D::Component4. More...
Public Member Functions | |
Component (const shared_ptr< MapComponent< Image > > &map=shared_ptr< MapComponent< Image > >()) | |
Assumes a map of nullptr if not specified. More... | |
Component (const shared_ptr< Image > &map) | |
Component (const shared_ptr< Texture > &map) | |
const shared_ptr< Image > & | image () const |
Causes the image to be created by downloading from GPU if necessary. More... | |
bool | isBlack () const |
Says nothing about the alpha channel. More... | |
const Color & | max () const |
Largest value per color channel. More... | |
const Color & | mean () const |
Average value per color channel. More... | |
const Color & | min () const |
Smallest value per color channel. More... | |
bool | nonUnitAlpha () const |
Returns true if there is non-unit alpha. More... | |
bool | notBlack () const |
Says nothing about the alpha channel. More... | |
bool | operator== (const Component< Color, Image > &other) const |
Color | sample (const Vector2 &pos) const |
Return map sampled at. More... | |
void | setStorage (ImageStorage s) const |
Does not change storage if the map is nullptr. More... | |
const shared_ptr< Texture > & | texture () const |
Causes the texture to be created by uploading from CPU if necessary. More... | |
Common code for G3D::Component1, G3D::Component3, and G3D::Component4.
Product of a constant and an image.
The image may be stored on either the GPU (G3D::Texture) or CPU (G3D::Map2D subclass), and both factors are optional. The details of this class are rarely needed to use UniversalMaterial, since it provides constructors from all combinations of data types.
Supports only floating point image formats because bilinear sampling of them is about 9x faster than sampling int formats.
|
inline |
Assumes a map of nullptr if not specified.
|
inline |
|
inline |
|
inline |
Causes the image to be created by downloading from GPU if necessary.
|
inline |
Says nothing about the alpha channel.
Referenced by G3D::UniversalBSDF::hasReflection(), G3D::UniversalBSDF::isZero(), and G3D::Component< Color3, Image3 >::notBlack().
|
inline |
Largest value per color channel.
Referenced by G3D::Component< Color3, Image3 >::isBlack().
|
inline |
Average value per color channel.
|
inline |
Smallest value per color channel.
Referenced by G3D::Component< Color3, Image3 >::nonUnitAlpha().
|
inline |
Returns true if there is non-unit alpha.
|
inline |
Says nothing about the alpha channel.
|
inline |
|
inline |
Return map sampled at.
pos. | Optimized to only perform as many operations as needed. |
If the component contains a texture map that has not been converted to a CPU image, that conversion is performed. Because that process is not threadsafe, when using sample() in a multithreaded environment, first invoke setStorage(COPY_TO_CPU) on every Component from a single thread to prime the CPU data structures.
Coordinates are normalized; will be scaled by the image width and height automatically.
|
inline |
Does not change storage if the map is nullptr.
|
inline |
Causes the texture to be created by uploading from CPU if necessary.