Isle
Loading...
Searching...
No Matches
legovertex.h
Go to the documentation of this file.
1#ifndef __LEGOVERTEX_H
2#define __LEGOVERTEX_H
3
4#include "misc/legotypes.h"
5
6class LegoStorage;
7
12public:
14 LegoVertex();
15
20
24 void SetCoordinate(LegoU32 p_i, LegoFloat p_coordinate) { m_coordinates[p_i] = p_coordinate; }
25
27 LegoFloat GetX() { return m_coordinates[0]; }
28
31 void SetX(LegoFloat p_x) { m_coordinates[0] = p_x; }
32
34 LegoFloat GetY() { return m_coordinates[1]; }
35
38 void SetY(LegoFloat p_y) { m_coordinates[1] = p_y; }
39
41 LegoFloat GetZ() { return m_coordinates[2]; }
42
45 void SetZ(LegoFloat p_z) { m_coordinates[2] = p_z; }
46
50 LegoBool IsOrigin() { return m_coordinates[0] == 0.0 && m_coordinates[1] == 0.0 && m_coordinates[2] == 0.0; }
51
56 LegoResult Read(LegoStorage* p_storage);
57
61 LegoFloat& operator[](int i) { return m_coordinates[i]; }
62
66 LegoFloat operator[](int i) const { return m_coordinates[i]; }
67
68protected:
70 LegoFloat m_coordinates[3]; // 0x00 [AI]
71};
72
73#endif // __LEGOVERTEX_H
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
[AI] Represents a 3D vertex with floating point coordinates.
Definition: legovertex.h:11
void SetCoordinate(LegoU32 p_i, LegoFloat p_coordinate)
[AI] Sets the value of one of the xyz coordinates by index (0=x, 1=y, 2=z).
Definition: legovertex.h:24
LegoFloat GetCoordinate(LegoU32 p_i)
[AI] Gets the value of one of the xyz coordinates by index (0=x, 1=y, 2=z).
Definition: legovertex.h:19
LegoFloat operator[](int i) const
[AI] Provides direct access to a coordinate by index (read-only).
Definition: legovertex.h:66
LegoFloat m_coordinates[3]
[AI] The x, y, and z coordinates of the vertex. [AI]
Definition: legovertex.h:70
void SetY(LegoFloat p_y)
[AI] Sets the Y coordinate.
Definition: legovertex.h:38
LegoFloat & operator[](int i)
[AI] Provides direct access to a coordinate by index (read/write).
Definition: legovertex.h:61
LegoVertex()
[AI] Constructs a LegoVertex at the origin (0, 0, 0).
Definition: legovertex.cpp:9
void SetZ(LegoFloat p_z)
[AI] Sets the Z coordinate.
Definition: legovertex.h:45
void SetX(LegoFloat p_x)
[AI] Sets the X coordinate.
Definition: legovertex.h:31
LegoFloat GetZ()
[AI] Gets the Z coordinate.
Definition: legovertex.h:41
LegoResult Read(LegoStorage *p_storage)
[AI] Reads the coordinates from a storage object (usually a file/buffer).
Definition: legovertex.cpp:17
LegoBool IsOrigin()
[AI] Checks whether the vertex is located at the origin (0,0,0).
Definition: legovertex.h:50
LegoFloat GetX()
[AI] Gets the X coordinate.
Definition: legovertex.h:27
LegoFloat GetY()
[AI] Gets the Y coordinate.
Definition: legovertex.h:34
[AI] Defines basic fixed-width data types and platform-neutral constants for LEGO Island codebase.
unsigned long LegoU32
[AI] Unsigned 32-bit integer type for cross-platform compatibility.
Definition: legotypes.h:71
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
Definition: legotypes.h:101
float LegoFloat
[AI] Floating point type used throughout LEGO Island.
Definition: legotypes.h:77
LegoU8 LegoBool
[AI] Boolean value used throughout the codebase.
Definition: legotypes.h:89