![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A material for mapping UV texture coordinates to image colors. More...
#include <UVMap.h>


Public Member Functions | |
| UVMap (const uint8_t *data, const uint8_t *rgbColors, uint16_t xPixels, uint16_t yPixels, uint8_t colors) | |
| Constructs a UVMap with the given image data and color palette. | |
| RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
| Retrieves the RGB color at a given 3D position using UV mapping. | |
Public Member Functions inherited from Image | |
| Image (const uint8_t *data, const uint8_t *rgbColors, unsigned int xPixels, unsigned int yPixels, uint8_t colors) | |
Constructs an Image material. | |
| ~Image () | |
Destructor for Image. | |
| void | SetData (const uint8_t *data) |
| Sets the image data. | |
| void | SetColorPalette (const uint8_t *rgbColors) |
| Sets the color palette. | |
| void | SetSize (Vector2D size) |
| Sets the size of the image. | |
| void | SetPosition (Vector2D offset) |
| Sets the position offset of the image. | |
| void | SetRotation (float angle) |
| Sets the rotation angle of the image. | |
| void | SetHueAngle (float hueAngle) |
| Sets the hue adjustment angle of the image. | |
Public Member Functions inherited from Material | |
| virtual | ~Material ()=default |
| Virtual destructor for proper cleanup in derived classes. | |
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... | |
Public Attributes inherited from Image | |
| Vector2D | size |
| The size of the image. | |
| Vector2D | offset |
| The offset position of the image. | |
| float | angle = 0.0f |
| The rotation angle of the image in degrees. | |
| float | hueAngle = 0.0f |
| The hue adjustment angle of the image. | |
| unsigned int | xPixels = 0 |
| The width of the image in pixels. | |
| unsigned int | yPixels = 0 |
| The height of the image in pixels. | |
| const uint8_t * | data |
| Pointer to the image data. | |
| const uint8_t * | rgbColors |
| Pointer to the color palette. | |
| uint8_t | colors |
| The number of colors in the palette. | |
A material for mapping UV texture coordinates to image colors.
The UVMap class uses UV coordinates to sample colors from a specified image, providing a way to texture surfaces in 3D space.
| UVMap | ( | const uint8_t * | data, |
| const uint8_t * | rgbColors, | ||
| uint16_t | xPixels, | ||
| uint16_t | yPixels, | ||
| uint8_t | colors | ||
| ) |
Constructs a UVMap with the given image data and color palette.
| data | Pointer to the image data (pixel indices). |
| rgbColors | Pointer to the RGB color palette. |
| xPixels | Width of the image in pixels. |
| yPixels | Height of the image in pixels. |
| colors | Number of colors in the palette. |
Definition at line 3 of file UVMap.cpp.
References Image::size.
|
overridevirtual |
Retrieves the RGB color at a given 3D position using UV mapping.
| position | 3D position in the scene. |
| normal | Normal vector at the position (not used in UV mapping). |
| uvw | UV texture coordinates at the position. |
Reimplemented from Image.
Definition at line 8 of file UVMap.cpp.
References Image::colors, Image::data, Image::hueAngle, RGBColor::HueShift(), Mathematics::Map(), Image::rgbColors, Image::size, Vector2D::X, Vector3D::X, Image::xPixels, Vector2D::Y, Vector3D::Y, and Image::yPixels.