20 if (
opacity > 0.97f && isInShape) {
Defines the MaterialMask class, which blends materials with a mask defined by a shape.
Material * materialOuter
The material rendered outside the mask shape.
Shape * shape
Defines the masked area for blending the materials.
void SetOpacity(float opacity)
Sets the opacity of the mask effect.
MaterialMask(Material *materialShape, Material *materialOuter, Shape *shape)
Constructs a MaterialMask with given materials and shape.
float opacity
Controls the opacity of the mask effect.
Material * materialShape
The material rendered inside the mask shape.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Retrieves the color at a specific position based on the mask.
float * GetOpacityReference()
Provides a reference to the opacity value.
Abstract base class for rendering materials.
virtual RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw)=0
Pure virtual function to calculate color based on surface parameters.
static T Constrain(T value, T minimum, T maximum)
Constrains a value between minimum and maximum.
Represents an RGB color and provides methods for manipulation.
static RGBColor InterpolateColors(const RGBColor &a, const RGBColor &b, const float &ratio)
Interpolates between two colors based on a ratio.
Abstract base class for 2D geometric shapes.
virtual bool IsInShape(Vector2D point)=0
Checks if a given point lies within the shape's boundaries.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.