![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Combines two materials using a shape as a mask. More...
#include <MaterialMask.h>


Public Member Functions | |
| MaterialMask (Material *materialShape, Material *materialOuter, Shape *shape) | |
Constructs a MaterialMask with given materials and shape. | |
| void | SetOpacity (float opacity) |
| Sets the opacity of the mask effect. | |
| float * | GetOpacityReference () |
| Provides a reference to the opacity value. | |
| RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
| Retrieves the color at a specific position based on the mask. | |
Public Member Functions inherited from Material | |
| virtual | ~Material ()=default |
| Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
| Material * | materialShape |
| The material rendered inside the mask shape. | |
| Material * | materialOuter |
| The material rendered outside the mask shape. | |
| Shape * | shape |
| Defines the masked area for blending the materials. | |
| float | opacity = 1.0f |
| Controls the opacity of the mask effect. | |
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... | |
Combines two materials using a shape as a mask.
The MaterialMask class provides functionality to blend two materials—one within a defined shape and another for the outer region. Opacity can be adjusted for blending effects.
Definition at line 26 of file MaterialMask.h.
| MaterialMask | ( | Material * | materialShape, |
| Material * | materialOuter, | ||
| Shape * | shape | ||
| ) |
Constructs a MaterialMask with given materials and shape.
| materialShape | Pointer to the material rendered within the shape. |
| materialOuter | Pointer to the material rendered outside the shape. |
| shape | Pointer to the shape used as the mask. |
Definition at line 3 of file MaterialMask.cpp.
References materialOuter, materialShape, and shape.
| float * GetOpacityReference | ( | ) |
Provides a reference to the opacity value.
Useful for dynamically modifying opacity during runtime.
Definition at line 13 of file MaterialMask.cpp.
References opacity.
Referenced by StrawberryAnimation::LinkEasyEase().
|
overridevirtual |
Retrieves the color at a specific position based on the mask.
Determines if the position lies within the mask shape and blends the materials accordingly.
| position | The 3D position to sample the color. |
| normal | The normal vector at the position. |
| uvw | UVW coordinates at the position. |
Implements Material.
Definition at line 17 of file MaterialMask.cpp.
References Mathematics::Constrain(), Material::GetRGB(), RGBColor::InterpolateColors(), Shape::IsInShape(), materialOuter, materialShape, opacity, shape, Vector3D::X, and Vector3D::Y.
Sets the opacity of the mask effect.
Definition at line 9 of file MaterialMask.cpp.
References opacity.
Referenced by GalaxyAnimation::Update().
|
private |
The material rendered outside the mask shape.
Definition at line 29 of file MaterialMask.h.
Referenced by GetRGB(), and MaterialMask().
|
private |
The material rendered inside the mask shape.
Definition at line 28 of file MaterialMask.h.
Referenced by GetRGB(), and MaterialMask().
|
private |
Controls the opacity of the mask effect.
Definition at line 31 of file MaterialMask.h.
Referenced by GetOpacityReference(), GetRGB(), and SetOpacity().
|
private |
Defines the masked area for blending the materials.
Definition at line 30 of file MaterialMask.h.
Referenced by GetRGB(), and MaterialMask().