ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Image Class Reference

Represents an image-based material with support for transformations and palette adjustments. More...

#include <Image.h>

Inheritance diagram for Image:
Collaboration diagram for Image:

Public Member Functions

 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.
 
RGBColor GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
 Calculates the RGB color at a specific position.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Public Attributes

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_tdata
 Pointer to the image data.
 
const uint8_trgbColors
 Pointer to the color palette.
 
uint8_t colors
 The number of colors in the palette.
 

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

Represents an image-based material with support for transformations and palette adjustments.

Definition at line 23 of file Image.h.

Constructor & Destructor Documentation

◆ Image()

Image ( const uint8_t data,
const uint8_t rgbColors,
unsigned int  xPixels,
unsigned int  yPixels,
uint8_t  colors 
)

Constructs an Image material.

Parameters
dataPointer to the image data.
rgbColorsPointer to the color palette.
xPixelsWidth of the image in pixels.
yPixelsHeight of the image in pixels.
colorsNumber of colors in the palette.

Definition at line 3 of file Image.cpp.

References colors, data, rgbColors, xPixels, and yPixels.

◆ ~Image()

~Image ( )
inline

Destructor for Image.

Definition at line 49 of file Image.h.

Member Function Documentation

◆ GetRGB()

RGBColor GetRGB ( const Vector3D position,
const Vector3D normal,
const Vector3D uvw 
)
overridevirtual

Calculates the RGB color at a specific position.

Parameters
position3D position in the image.
normalNormal vector at the position.
uvwTexture coordinates at the position.
Returns
The calculated RGB color.

Implements Material.

Reimplemented in UVMap.

Definition at line 35 of file Image.cpp.

References angle, colors, data, hueAngle, RGBColor::HueShift(), Mathematics::Map(), offset, rgbColors, Vector2D::Rotate(), size, Vector2D::X, Vector3D::X, xPixels, Vector2D::Y, Vector3D::Y, and yPixels.

◆ SetColorPalette()

void SetColorPalette ( const uint8_t rgbColors)

Sets the color palette.

Parameters
rgbColorsPointer to the new color palette.

Definition at line 15 of file Image.cpp.

References rgbColors.

◆ SetData()

void SetData ( const uint8_t data)

Sets the image data.

Parameters
dataPointer to the new image data.

Definition at line 11 of file Image.cpp.

References data.

◆ SetHueAngle()

void SetHueAngle ( float  hueAngle)

Sets the hue adjustment angle of the image.

Parameters
hueAngleThe new hue adjustment angle in degrees.

Definition at line 31 of file Image.cpp.

References hueAngle.

◆ SetPosition()

void SetPosition ( Vector2D  offset)

Sets the position offset of the image.

Parameters
offsetThe new offset as a Vector2D.

Definition at line 23 of file Image.cpp.

References offset.

◆ SetRotation()

void SetRotation ( float  angle)

Sets the rotation angle of the image.

Parameters
angleThe new rotation angle in degrees.

Definition at line 27 of file Image.cpp.

References angle.

◆ SetSize()

void SetSize ( Vector2D  size)

Sets the size of the image.

Parameters
sizeThe new size as a Vector2D.

Definition at line 19 of file Image.cpp.

References size.

Member Data Documentation

◆ angle

float angle = 0.0f

The rotation angle of the image in degrees.

Definition at line 27 of file Image.h.

Referenced by GetRGB(), and SetRotation().

◆ colors

uint8_t colors

The number of colors in the palette.

Definition at line 33 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), and Image().

◆ data

const uint8_t* data

Pointer to the image data.

Definition at line 31 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), Image(), and SetData().

◆ hueAngle

float hueAngle = 0.0f

The hue adjustment angle of the image.

Definition at line 28 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), and SetHueAngle().

◆ offset

Vector2D offset

The offset position of the image.

Definition at line 26 of file Image.h.

Referenced by GetRGB(), and SetPosition().

◆ rgbColors

const uint8_t* rgbColors

Pointer to the color palette.

Definition at line 32 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), Image(), and SetColorPalette().

◆ size

Vector2D size

The size of the image.

Definition at line 25 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), SetSize(), and UVMap::UVMap().

◆ xPixels

unsigned int xPixels = 0

The width of the image in pixels.

Definition at line 29 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), and Image().

◆ yPixels

unsigned int yPixels = 0

The height of the image in pixels.

Definition at line 30 of file Image.h.

Referenced by GetRGB(), UVMap::GetRGB(), and Image().


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