ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
DepthMaterial Class Reference

Maps depth along a specified axis to an RGB color using a gradient. More...

#include <DepthMaterial.h>

Inheritance diagram for DepthMaterial:
Collaboration diagram for DepthMaterial:

Public Types

enum  Axis { X , Y , Z }
 Specifies the axis along which depth is calculated. More...
 
- Public Types inherited from Material
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.
 
- Public Member Functions inherited from Material
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.
 

Detailed Description

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.

Member Enumeration Documentation

◆ Axis

Specifies the axis along which depth is calculated.

Enumerator

Depth along the X-axis.

Depth along the Y-axis.

Depth along the Z-axis.

Definition at line 31 of file DepthMaterial.h.

Constructor & Destructor Documentation

◆ DepthMaterial()

DepthMaterial ( Axis  axis,
float  depth,
float  zOffset 
)

Constructs a DepthMaterial instance.

Parameters
axisThe axis along which depth is calculated.
depthThe scaling factor for depth.
zOffsetThe offset along the Z-axis for depth calculation.

Definition at line 3 of file DepthMaterial.cpp.

References axis, depth, and zOffset.

Member Function Documentation

◆ GetRGB()

RGBColor GetRGB ( const Vector3D position,
const Vector3D normal,
const Vector3D uvw 
)
overridevirtual

Calculates the RGB color at a given position based on depth.

Parameters
positionThe position in 3D space.
normalThe surface normal vector.
uvwThe texture coordinates.
Returns
The calculated RGB color based on depth.

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.

Member Data Documentation

◆ axis

Axis axis
private

Axis along which depth is calculated.

Definition at line 40 of file DepthMaterial.h.

Referenced by DepthMaterial(), and GetRGB().

◆ depth

float depth = 0.0f
private

Depth scaling factor.

Definition at line 41 of file DepthMaterial.h.

Referenced by DepthMaterial(), and GetRGB().

◆ gNoiseMat

GradientMaterial<4> gNoiseMat = GradientMaterial<4>(spectrum, 2.0f, false)
private

Gradient material for depth mapping.

Definition at line 39 of file DepthMaterial.h.

Referenced by GetRGB().

◆ spectrum

RGBColor spectrum[4] = { RGBColor(0, 255, 0), RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255) }
private

Gradient spectrum for depth mapping.

Definition at line 38 of file DepthMaterial.h.

◆ zOffset

float zOffset = 0.0f
private

Z-axis offset for depth calculation.

Definition at line 42 of file DepthMaterial.h.

Referenced by DepthMaterial(), and GetRGB().


The documentation for this class was generated from the following files: