![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Renders a real-time clock and date as a material. More...
#include <Clock.h>
Public Member Functions | |
Clock (bool hour24) | |
Constructs a Clock instance with a specified time format. | |
void | SetMaterial (Material *material) |
Sets the material to be used for rendering the clock. | |
void | SetTime (uint8_t hour, uint8_t minute, uint8_t second) |
Sets the current time for the clock. | |
void | SetDate (uint8_t day, uint8_t month, uint8_t year, uint8_t wDay) |
Sets the current date for the clock. | |
void | SetSize (Vector2D size) |
Sets the size of the clock's rendered area. | |
void | SetPosition (Vector2D position) |
Sets the position of the clock in the rendered scene. | |
void | SetRotation (float rotation) |
Sets the rotation of the clock in the rendered scene. | |
void | Update () |
Updates the clock's time and date. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Computes the color at a given position in the clock's material. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
TextEngine< 3, 12 > | tE = TextEngine<3, 12>(false) |
Text engine for rendering time and date. | |
SimpleMaterial | mat = SimpleMaterial(RGBColor(255, 255, 255)) |
Default material for the clock. | |
uint8_t | hour |
Current hour. | |
uint8_t | minute |
Current minute. | |
uint8_t | second |
Current second. | |
uint8_t | day |
Current day. | |
uint8_t | month |
Current month. | |
uint8_t | year |
Current year (last two digits). | |
uint8_t | wDay |
Current weekday. | |
bool | hour24 = false |
Flag for 24-hour format (true) or 12-hour format (false). | |
Additional Inherited Members | |
![]() | |
enum | Method { Base , Add , Subtract , Multiply , Divide , Darken , Lighten , Screen , Overlay , SoftLight , Replace , EfficientMask , Bypass } |
Defines blending methods for combining colors. More... | |
Renders a real-time clock and date as a material.
The Clock
class uses a TextEngine
to display formatted time and date, along with a customizable material for rendering.
Constructs a Clock instance with a specified time format.
hour24 | If true, uses 24-hour format; otherwise, uses 12-hour format. |
Definition at line 3 of file Clock.cpp.
References hour24, mat, TextEngine< lineCount, characterWidth >::SetBlinkTime(), TextEngine< lineCount, characterWidth >::SetMaterial(), and tE.
|
overridevirtual |
Computes the color at a given position in the clock's material.
This method is used for rendering the clock and applying effects.
position | The position in 3D space. |
normal | The surface normal vector. |
uvw | The texture coordinates. |
RGBColor
. Implements Material.
Definition at line 80 of file Clock.cpp.
References TextEngine< lineCount, characterWidth >::GetRGB(), and tE.
Sets the current date for the clock.
day | The day value (1-31). |
month | The month value (1-12). |
year | The last two digits of the year (e.g., 24 for 2024). |
wDay | The weekday value (0-6, where 0 = Sunday). |
Definition at line 21 of file Clock.cpp.
References day, month, wDay, and year.
Referenced by ClockAnimation::Update().
Sets the material to be used for rendering the clock.
material | Pointer to a custom material. |
Definition at line 11 of file Clock.cpp.
References TextEngine< lineCount, characterWidth >::SetMaterial(), and tE.
Referenced by ClockAnimation::ClockAnimation().
Sets the position of the clock in the rendered scene.
position | A Vector2D representing the position. |
Definition at line 32 of file Clock.cpp.
References TextEngine< lineCount, characterWidth >::SetPositionOffset(), and tE.
Referenced by ClockAnimation::Update().
Sets the rotation of the clock in the rendered scene.
rotation | The rotation angle in degrees. |
Definition at line 36 of file Clock.cpp.
References TextEngine< lineCount, characterWidth >::SetRotationAngle(), and tE.
Referenced by ClockAnimation::Update().
Sets the size of the clock's rendered area.
size | A Vector2D representing the size (width and height). |
Definition at line 28 of file Clock.cpp.
References TextEngine< lineCount, characterWidth >::SetSize(), and tE.
Referenced by ClockAnimation::Update().
void Update | ( | ) |
Updates the clock's time and date.
This function is called to refresh the displayed time and date values.
Definition at line 40 of file Clock.cpp.
References day, hour, minute, month, second, TextEngine< lineCount, characterWidth >::SetText(), tE, wDay, and year.
Referenced by ClockAnimation::Update().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Text engine for rendering time and date.
Definition at line 28 of file Clock.h.
Referenced by Clock(), GetRGB(), SetMaterial(), SetPosition(), SetRotation(), SetSize(), and Update().
|
private |
|
private |