Isle
Loading...
Searching...
No Matches
legoroi.h
Go to the documentation of this file.
1#ifndef LEGOROI_H
2#define LEGOROI_H
3
4#include "misc/legotypes.h"
6
15typedef unsigned char (*ColorOverride)(const char*, char*, unsigned int);
16
25typedef unsigned char (*TextureHandler)(const char*, unsigned char*, unsigned int);
26
27class LegoEntity;
29class LegoTextureInfo;
30class LegoStorage;
31class LegoAnim;
33class LegoTreeNode;
35
43class LegoROI : public ViewROI {
44public:
49 LegoROI(Tgl::Renderer* p_renderer);
50
56 LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList);
57
61 ~LegoROI() override;
62
74 OrientableROI* p_unk0xd4,
75 Tgl::Renderer* p_renderer,
76 ViewLODListManager* p_viewLODListManager,
77 LegoTextureContainer* p_textureContainer,
78 LegoStorage* p_storage
79 );
80
88 LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi);
89
98 LegoResult FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi);
99
107 static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap);
108
116 static void FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap);
117
124 LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
125
135 LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
136
143
150
159 LegoResult FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
160
167 LegoResult SetLodColor(const LegoChar* p_name);
168
174 LegoResult FUN_100a93b0(const LegoChar* p_name);
175
187 LegoU32 FUN_100a9410(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3, LegoBool p_collideBox);
188
193 void SetName(const LegoChar* p_name);
194
199 float IntrinsicImportance() const override; // vtable+0x04
200
205 void UpdateWorldBoundingVolumes() override; // vtable+0x18
206
210 void ClearMeshOffset();
211
216 void SetDisplayBB(int p_displayBB);
217
225 static LegoResult FUN_100a8cb0(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix);
226
232 static void FUN_100a81b0(const LegoChar* p_error, const LegoChar* p_name);
233
238 static void configureLegoROI(int p_roi);
239
244 static void SetColorOverride(ColorOverride p_colorOverride);
245
255 static LegoBool GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_green, float& p_blue, float& p_alpha);
256
267 const LegoChar* p_param,
268 float& p_red,
269 float& p_green,
270 float& p_blue,
271 float& p_alpha
272 );
273
281 static LegoBool GetPaletteEntries(const LegoChar* p_name, unsigned char* paletteEntries, LegoU32 p_numEntries);
282
287 const LegoChar* GetName() const { return m_name; }
288
293 LegoEntity* GetEntity() { return m_entity; }
294
299 BoundingSphere& GetBoundingSphere() { return m_sphere; }
300
305 void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }
306
311 void SetComp(CompoundObject* p_comp) { comp = p_comp; }
312
317 void SetBoundingSphere(const BoundingSphere& p_sphere) { m_sphere = m_world_bounding_sphere = p_sphere; }
318
323 void SetUnknown0x80(const BoundingBox& p_unk0x80) { m_unk0x80 = p_unk0x80; }
324
325 // SYNTHETIC: LEGO1 0x100a82b0
326 // LegoROI::`scalar deleting destructor' [AI] Standard C++ scalar-deleting destructor
327
328private:
329 LegoChar* m_name;
330 BoundingSphere m_sphere;
331 undefined m_unk0x100;
332 LegoEntity* m_entity;
333};
334
342class TimeROI : public LegoROI {
343public:
350 TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_time);
351
352 // SYNTHETIC: LEGO1 0x100a9ad0
353 // TimeROI::`scalar deleting destructor' [AI] Standard C++ scalar-deleting destructor
354
360 void FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time);
361
362private:
363 LegoTime m_time; // 0x108
364};
365
366#endif // LEGOROI_H
[AI] Represents an axis-aligned bounding box in 3D space, using minimum and maximum points.
Definition: roi.h:20
[AI] Represents a bounding sphere in 3D space with center and radius.
Definition: roi.h:56
[AI] Holds per-node animation data for a model's animation tree.
Definition: legoanim.h:144
[AI] Root class for all node-based animation blending/structure.
Definition: legoanim.h:356
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
LegoResult FUN_100a8da0(LegoTreeNode *p_node, const Matrix4 &p_matrix, LegoTime p_time, LegoROI *p_roi)
[AI] [Unknown function.
Definition: legoroi.cpp:382
LegoU32 FUN_100a9410(Vector3 &p_v1, Vector3 &p_v2, float p_f1, float p_f2, Vector3 &p_v3, LegoBool p_collideBox)
[AI] Tests for collision along or within sphere/box, and computes intersection point as needed.
Definition: legoroi.cpp:594
void SetUnknown0x80(const BoundingBox &p_unk0x80)
[AI] Sets the local bounding box from read data.
Definition: legoroi.h:323
LegoResult FUN_100a93b0(const LegoChar *p_name)
[AI] Like SetLodColor, but uses a different implementation or legacy style.
Definition: legoroi.cpp:582
static void FUN_100a8e80(LegoTreeNode *p_node, Matrix4 &p_matrix, LegoTime p_time, LegoROI **p_roiMap)
[AI] [Static] Recursively evaluates animation nodes, updating the transformation matrices and visibil...
Definition: legoroi.cpp:414
~LegoROI() override
[AI] Destroys the LegoROI, cleaning up children and name resources.
Definition: legoroi.cpp:88
void SetBoundingSphere(const BoundingSphere &p_sphere)
[AI] Sets the local and world bounding spheres.
Definition: legoroi.h:317
static void configureLegoROI(int p_roi)
[AI] [Static] Configures the global ROI loading limit, controlling max LODs at load time.
Definition: legoroi.cpp:66
LegoResult GetTextureInfo(LegoTextureInfo *&p_textureInfo)
[AI] Attempts to retrieve a texture info pointer used by any LOD in this ROI or its children.
Definition: legoroi.cpp:537
LegoResult SetTextureInfo(LegoTextureInfo *p_textureInfo)
[AI] Associates every LOD in this ROI (and sub-ROIs) with a given texture (palette/material informati...
Definition: legoroi.cpp:510
static void SetColorOverride(ColorOverride p_colorOverride)
[AI] [Static] Sets the global color override callback function to allow palette remapping or customiz...
Definition: legoroi.cpp:808
void SetEntity(LegoEntity *p_entity)
[AI] Associates a LegoEntity with this ROI (typically called by parent entity/logic).
Definition: legoroi.h:305
LegoROI * FindChildROI(const LegoChar *p_name, LegoROI *p_roi)
[AI] Recursively searches for a child ROI by name, starting at the given ROI.
Definition: legoroi.cpp:349
void ClearMeshOffset()
[AI] Resets mesh offset for all LODs in this ROI.
Definition: legoroi.cpp:832
static LegoResult FUN_100a8cb0(LegoAnimNodeData *p_data, LegoTime p_time, Matrix4 &p_matrix)
[AI] [Static] Sets the transform matrix for a given animation node at a specific time.
Definition: legoroi.cpp:340
LegoResult FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
[AI] Alias to SetLodColor; applies color to all LODs and children.
Definition: legoroi.cpp:563
LegoResult SetFrame(LegoAnim *p_anim, LegoTime p_time)
[AI] Sets the current animation frame for this ROI based on a parsed animation structure.
Definition: legoroi.cpp:471
static LegoBool ColorAliasLookup(const LegoChar *p_param, float &p_red, float &p_green, float &p_blue, float &p_alpha)
[AI] [Static] Looks up a color alias in the static alias table and sets p_red/p_green/p_blue/p_alpha ...
Definition: legoroi.cpp:776
void UpdateWorldBoundingVolumes() override
[AI] Updates this ROI's world-space bounding volumes based on its local-to-world transform.
Definition: legoroi.cpp:854
LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
[AI] Sets the RGBA color for all LODs and recursively for all children.
Definition: legoroi.cpp:484
static void FUN_100a8fd0(LegoTreeNode *p_node, Matrix4 &p_matrix, LegoTime p_time, LegoROI **p_roiMap)
[AI] [Static] Similar to FUN_100a8e80, but only updates transformation matrices, not visibility or in...
Definition: legoroi.cpp:445
void SetComp(CompoundObject *p_comp)
[AI] Attaches a new CompoundObject pointer (container for child ROIs).
Definition: legoroi.h:311
static void FUN_100a81b0(const LegoChar *p_error, const LegoChar *p_name)
[AI] [Static] Prints or logs an error message about missing ROI for animation (no-op in release).
Definition: legoroi.cpp:61
static LegoBool GetPaletteEntries(const LegoChar *p_name, unsigned char *paletteEntries, LegoU32 p_numEntries)
[AI] [Static] Fetches palette entries for a named texture using current texture handler.
Definition: legoroi.cpp:792
float IntrinsicImportance() const override
[AI] Returns the importance rating for LOD/visibility management (fixed value).
Definition: legoroi.cpp:848
LegoResult Read(OrientableROI *p_unk0xd4, Tgl::Renderer *p_renderer, ViewLODListManager *p_viewLODListManager, LegoTextureContainer *p_textureContainer, LegoStorage *p_storage)
[AI] Reads and initializes this ROI from a LEGO project resource stream, populating geometry,...
Definition: legoroi.cpp:108
void SetDisplayBB(int p_displayBB)
[AI] Sets whether to display or hide the bounding box.
Definition: legoroi.cpp:842
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
BoundingSphere & GetBoundingSphere()
[AI] Accesses the local bounding sphere object.
Definition: legoroi.h:299
LegoEntity * GetEntity()
[AI] Gets the entity associated with this ROI (or NULL).
Definition: legoroi.h:293
void SetName(const LegoChar *p_name)
[AI] Sets this ROI's name, replacing the previous (converted to lower-case).
Definition: legoroi.cpp:814
static LegoBool GetRGBAColor(const LegoChar *p_name, float &p_red, float &p_green, float &p_blue, float &p_alpha)
[AI] [Static] Resolves a logical color alias into RGBA floats.
Definition: legoroi.cpp:758
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching.
[AI] Contains DirectDraw and Direct3DRM handles and metadata for a texture used in the LEGO Island re...
[AI] Represents a node within a general, N-ary tree structure.
Definition: legotree.h:44
4x4 Matrix class with virtual interface for manipulation and transformation.
Definition: matrix.h:24
[AI] Represents an ROI (Real-time Object Instance) that can be oriented in world space,...
Definition: orientableroi.h:29
BoundingBox m_unk0x80
An unknown bounding box; usage unclear, could be related to extended collision or volume testing.
BoundingSphere m_world_bounding_sphere
The object's bounding sphere in world space, recalculated from m_local2world.
CompoundObject * comp
[AI] List of sub-ROIs composing this ROI (compound object), or NULL. [AI]
Definition: roi.h:241
[AI] Main interface/factory for rendering resources and scene graphs.
Definition: tgl.h:188
[AI] An extension of LegoROI that adds support for keeping and applying a base time reference (used f...
Definition: legoroi.h:342
void FUN_100a9b40(Matrix4 &p_matrix, LegoTime p_time)
[AI] Updates animated position/offset by integrating movement since last update (applying time delta)...
Definition: legoroi.cpp:740
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
[AI] Manages the lifecycle, lookup, and sharing of ViewLODList instances for different ROI names.
Definition: viewlodlist.h:111
[AI] Reference-counted list of Level-of-Detail (LOD) objects associated with a single ROI (Realtime O...
Definition: viewlodlist.h:30
[AI] ViewROI objects represent viewable and placeable objects in the scene, each holding their own tr...
Definition: viewroi.h:13
unsigned char undefined
Definition: decomp.h:26
unsigned char(* ColorOverride)(const char *, char *, unsigned int)
[AI] Function pointer type for overriding color.
Definition: legoroi.h:15
unsigned char(* TextureHandler)(const char *, unsigned char *, unsigned int)
[AI] Function pointer type for custom palette lookup or texture palette fetching.
Definition: legoroi.h:25
[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 LegoTime
[AI] Time value, typically used for tick counts, durations, or timing; defined as a signed 32-bit int...
Definition: legotypes.h:95
char LegoChar
[AI] Alias for char, for use in character/byte data and string handling.
Definition: legotypes.h:83
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
list< ROI * > CompoundObject
Definition: roi.h:135
[AI] Describes a single actor or model referenced by an animation.
Definition: legoanim.h:313