ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
CombineMaterial< materialCount > Class Template Reference

Combines multiple materials with specified blending methods and opacities. More...

#include <CombineMaterial.h>

Inheritance diagram for CombineMaterial< materialCount >:
Collaboration diagram for CombineMaterial< materialCount >:

Public Member Functions

 CombineMaterial ()
 Constructs an empty CombineMaterial instance.
 
void AddMaterial (Method method, Material *material, float opacity)
 Adds a new material to the combination.
 
void SetMethod (uint8_t index, Method method)
 Sets the blending method for a specific material.
 
void SetOpacity (uint8_t index, float opacity)
 Sets the opacity for a specific material.
 
void SetMaterial (uint8_t index, Material *material)
 Replaces a material at a specific index.
 
RGBColor GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
 Calculates the resulting color by combining all materials.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Private Attributes

Method method [materialCount]
 Array of blending methods for each material.
 
Materialmaterials [materialCount]
 Array of pointers to materials.
 
float opacity [materialCount]
 Array of opacities for each material.
 
uint8_t materialsAdded = 0
 Counter for added materials.
 

Additional Inherited Members

- 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...
 

Detailed Description

template<size_t materialCount>
class CombineMaterial< materialCount >

Combines multiple materials with specified blending methods and opacities.

The CombineMaterial class allows for the creation of composite materials by blending multiple materials using different methods and opacities. Each material can have a unique blending method and opacity level.

Template Parameters
materialCountMaximum number of materials to combine.

Definition at line 29 of file CombineMaterial.h.

Constructor & Destructor Documentation

◆ CombineMaterial()

template<size_t materialCount>
CombineMaterial ( )

Constructs an empty CombineMaterial instance.

Member Function Documentation

◆ AddMaterial()

template<size_t materialCount>
void AddMaterial ( Method  method,
Material material,
float  opacity 
)

Adds a new material to the combination.

Parameters
methodThe blending method to use for the material.
materialA pointer to the material to add.
opacityThe opacity level of the material (0.0 to 1.0).

Referenced by Boot::Boot(), ClockAnimation::SetMaterialLayers(), ArtleckAnimationV2::SetMaterials(), ElGatoAnimation::SetMaterials(), LeonHuskyAnimation::SetMaterials(), MyntAnimation::SetMaterials(), ProtobottAnimation::SetMaterials(), VesperAnimation::SetMaterials(), WaffleDaProtoAnimation::SetMaterials(), and TVStatic::TVStatic().

◆ GetRGB()

template<size_t materialCount>
RGBColor GetRGB ( const Vector3D position,
const Vector3D normal,
const Vector3D uvw 
)
overridevirtual

Calculates the resulting color by combining all materials.

Parameters
positionThe position in 3D space.
normalThe normal vector at the position.
uvwThe UVW coordinates for texture mapping.
Returns
The resulting combined RGBColor.

Implements Material.

Referenced by TVStatic::GetRGB().

◆ SetMaterial()

template<size_t materialCount>
void SetMaterial ( uint8_t  index,
Material material 
)

Replaces a material at a specific index.

Parameters
indexThe index of the material to replace.
materialA pointer to the new material.

◆ SetMethod()

template<size_t materialCount>
void SetMethod ( uint8_t  index,
Method  method 
)

Sets the blending method for a specific material.

Parameters
indexThe index of the material.
methodThe new blending method.

◆ SetOpacity()

template<size_t materialCount>
void SetOpacity ( uint8_t  index,
float  opacity 
)

Sets the opacity for a specific material.

Parameters
indexThe index of the material.
opacityThe new opacity value (0.0 to 1.0).

Referenced by Boot::Update(), ArtleckAnimationV2::Update(), ElGatoAnimation::Update(), LeonHuskyAnimation::Update(), MyntAnimation::Update(), ProtobottAnimation::Update(), VesperAnimation::Update(), WaffleDaProtoAnimation::Update(), and ClockAnimation::Update().

Member Data Documentation

◆ materials

template<size_t materialCount>
Material* materials[materialCount]
private

Array of pointers to materials.

Definition at line 32 of file CombineMaterial.h.

◆ materialsAdded

template<size_t materialCount>
uint8_t materialsAdded = 0
private

Counter for added materials.

Definition at line 34 of file CombineMaterial.h.

◆ method

template<size_t materialCount>
Method method[materialCount]
private

Array of blending methods for each material.

Definition at line 31 of file CombineMaterial.h.

◆ opacity

template<size_t materialCount>
float opacity[materialCount]
private

Array of opacities for each material.

Definition at line 33 of file CombineMaterial.h.


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