ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
NormalMaterial.h
Go to the documentation of this file.
1/**
2 * @file NormalMaterial.h
3 * @brief A material class that visualizes surface normals.
4 *
5 * The `NormalMaterial` class provides a simple visualization of surface normals,
6 * where RGB values represent the x, y, and z components of the normal vector.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../Material.h" // Base class for materials.
15#include "../../../Utils/Math/Vector2D.h" // Vector utilities.
16#include "GradientMaterial.h" // Optional gradient utilities for advanced extensions.
17
18/**
19 * @class NormalMaterial
20 * @brief A material that visualizes surface normals as RGB colors.
21 *
22 * This class maps the components of a normal vector (x, y, z) directly to the RGB color channels,
23 * providing an intuitive representation of surface orientations.
24 */
25class NormalMaterial : public Material {
26public:
27 /**
28 * @brief Constructs a `NormalMaterial` object.
29 */
31
32 /**
33 * @brief Calculates the RGB color based on the surface normal vector.
34 *
35 * @param position 3D position in the scene (not used for this material).
36 * @param normal Normal vector at the position, used for RGB mapping.
37 * @param uvw Texture coordinates at the position (not used for this material).
38 * @return The RGB color corresponding to the normal vector.
39 */
40 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
41};
Defines a material for creating gradient color effects in 3D rendering.
Abstract base class for rendering materials.
Definition Material.h:27
A material that visualizes surface normals as RGB colors.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Calculates the RGB color based on the surface normal vector.
NormalMaterial()
Constructs a NormalMaterial object.
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26