IShaderContext class¶
<oceansdk/contexts.h>
Description¶
This class allows nodes to access to shading parameters such as world position, normals, uv coordinates…
Namespace¶
This class is in the namespace Ocean::Sdk
Members¶
-
class
IShaderContext
¶ -
-
const Vec2<float> &
uvs
(int index) const¶ [virtual]
- Parameters
i – uv set index
- Returns
the UV coordinates for set
i
Returns the UV coordinates for UV set index. Currently, only one UV set is supported in Ocean, so index will always be 0. Added for future use.
-
uint32_t
instanceId
() const¶ [virtual]
- Returns
the unique ID of the geometry instance
-
uint32_t
numWavelengths
() const¶ [virtual]
- Returns
the number of wavelengths in the shading context
-
uint32_t
getWavelengthIndex
(uint32_t i) const¶ [virtual]
- Parameters
i – Wavelength index between 0 and
numWavelengths() - 1
- Returns
the ith wavelength index
Returns the ith wavelength index of the shading context
The wavelength index varies from 0 to 232-1 between the low bound of the simulation range and the high bound of the simulation range.
Use
getWavelengthMeters()
for getting the actual wavelength.
-
float
getWavelengthMeters
(uint32_t i, float wlMin, float wlMax) const¶ [virtual]
- Parameters
i – Wavelength index between 0 and
numWavelengths() - 1
i – Lower bound of the simulation wavelength range
i – Upper bound of the simulation wavelength range
- Returns
the ith wavelength
Returns the ith wavelength of the shading context in meters.
The bounds of the simulation wavelength range should be retrieved in plugins
prepare()
overloads with the functionsIPrepareContext::wavelengthMin()
andIPrepareContext::wavelengthMax()
.
-
Vec2<float>
bumpNormalShiftTS
(const Vec2<float> &dHdUV) const¶ [virtual]
- Parameters
dHdUV – The texture space height differential
- Returns
the tangent space height differential
Converts a bump map height differential in texture space (dH/dU and dH/dV) to a differential in tangent space (dH/dX and dH/dY)
-
~IShaderContext
()¶ [virtual]
The destructor for IShaderContext
-
const Vec2<float> &