![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Maps depth along a specified axis to an RGB color using a gradient. More...
#include <DepthMaterial.h>
Public Types | |
enum | Axis { X , Y , Z } |
Specifies the axis along which depth is calculated. More... | |
![]() | |
enum | Method { Base , Add , Subtract , Multiply , Divide , Darken , Lighten , Screen , Overlay , SoftLight , Replace , EfficientMask , Bypass } |
Defines blending methods for combining colors. More... | |
Public Member Functions | |
DepthMaterial (Axis axis, float depth, float zOffset) | |
Constructs a DepthMaterial instance. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Calculates the RGB color at a given position based on depth. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
RGBColor | spectrum [4] = { RGBColor(0, 255, 0), RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255) } |
Gradient spectrum for depth mapping. | |
GradientMaterial< 4 > | gNoiseMat = GradientMaterial<4>(spectrum, 2.0f, false) |
Gradient material for depth mapping. | |
Axis | axis |
Axis along which depth is calculated. | |
float | depth = 0.0f |
Depth scaling factor. | |
float | zOffset = 0.0f |
Z-axis offset for depth calculation. | |
Maps depth along a specified axis to an RGB color using a gradient.
The DepthMaterial
class converts spatial depth data into RGB colors based on a gradient. It supports customization of the depth axis and offset for precise visualization.
Definition at line 25 of file DepthMaterial.h.
Specifies the axis along which depth is calculated.
Enumerator | |
---|---|
X | Depth along the X-axis. |
Y | Depth along the Y-axis. |
Z | Depth along the Z-axis. |
Definition at line 31 of file DepthMaterial.h.
DepthMaterial | ( | Axis | axis, |
float | depth, | ||
float | zOffset | ||
) |
Constructs a DepthMaterial instance.
axis | The axis along which depth is calculated. |
depth | The scaling factor for depth. |
zOffset | The offset along the Z-axis for depth calculation. |
Definition at line 3 of file DepthMaterial.cpp.
|
overridevirtual |
Calculates the RGB color at a given position based on depth.
position | The position in 3D space. |
normal | The surface normal vector. |
uvw | The texture coordinates. |
Implements Material.
Definition at line 9 of file DepthMaterial.cpp.
References axis, depth, GradientMaterial< colorCount >::GetRGB(), gNoiseMat, Mathematics::Map(), X, Vector3D::X, Y, Vector3D::Y, Z, Vector3D::Z, and zOffset.
|
private |
Axis along which depth is calculated.
Definition at line 40 of file DepthMaterial.h.
Referenced by DepthMaterial(), and GetRGB().
|
private |
Depth scaling factor.
Definition at line 41 of file DepthMaterial.h.
Referenced by DepthMaterial(), and GetRGB().
|
private |
Gradient material for depth mapping.
Definition at line 39 of file DepthMaterial.h.
Referenced by GetRGB().
|
private |
Gradient spectrum for depth mapping.
Definition at line 38 of file DepthMaterial.h.
|
private |
Z-axis offset for depth calculation.
Definition at line 42 of file DepthMaterial.h.
Referenced by DepthMaterial(), and GetRGB().