LightsprintSDK 2021.08.08
|
#include <RRMaterial.h>
Public Member Functions | |
Property () | |
void | multiplyAdd (RRVec4 multiplier, RRVec4 addend) |
RRReal | updateColorFromTexture (const RRColorSpace *colorSpace, bool isTransmittanceInAlpha, UniformTextureAction uniformTextureAction, bool updateEvenFromStub) |
unsigned | createTextureFromColor (bool isTransmittance) |
bool | operator== (const RRMaterial::Property &a) const |
Public Attributes | |
RRVec3 | color |
RRVec3 | colorLinear |
RRBuffer * | texture |
unsigned | texcoord |
Part of material description.
|
inline |
Clears property to default zeroes.
Changes property to property*multiplier+addend. Both color and texture are changed. 8bit texture may be changed to floats to avoid clamping.
RRReal rr::RRMaterial::Property::updateColorFromTexture | ( | const RRColorSpace * | colorSpace, |
bool | isTransmittanceInAlpha, | ||
UniformTextureAction | uniformTextureAction, | ||
bool | updateEvenFromStub | ||
) |
If texture exists, updates color to average color in texture and returns standard deviation of color in texture.
unsigned rr::RRMaterial::Property::createTextureFromColor | ( | bool | isTransmittance | ) |
If texture does not exist, creates 1x1 stub texture from color. Returns number of textures created, 0 or 1.
bool rr::RRMaterial::Property::operator== | ( | const RRMaterial::Property & | a | ) | const |
Returns true if both properties are identical (including using the same texture).
RRVec3 rr::RRMaterial::Property::color |
Material property expressed as 3 floats. If texture is present, this is average color of the texture.
It is color in custom (usually sRGB) scale. Used by importers, exporters and realtime renderes (except for our pathtracer). We don't enforce any kind of color validation, so you can create unrealistic materials.
RRVec3 rr::RRMaterial::Property::colorLinear |
Validated linear color. Used by GI solvers and our pathtracer.
Solver needs it filled, but usually it happens automatically. To keep colorLinear synchronized with color, solver calls RRObjects::updateColorLinear() on incoming objects. Only if you modify color already passed to solver, you need to call RRMaterial::convertToLinear() to update colorLinear.
RRBuffer* rr::RRMaterial::Property::texture |
Material property expressed as a texture or video.
Texture is owned and deleted by RRMaterial, so in order to change texture, delete old one before assigning new one. Assignment and copy constructor in Property make only shallow copy, ~Property() doesn't delete texture. Assignment and copy constructor in RRMaterial are disabled, ~RRMaterial() deletes textures.
Note: When you set material textures, you need to set also minimalQualityForPointMaterials or call updateColorsFromTexture() which does it for you (otherwise pathtracer/baking won't use the textures).
unsigned rr::RRMaterial::Property::texcoord |
Texcoord channel used by texture. Call RRMesh::getTriangleMapping(texcoord) to get mapping for texture.