resonance 1.0.1
Loading...
Searching...
No Matches
transformable.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "rnd/object.h"
6
7class MetRenderer;
8
9namespace Rnd {
10
12constexpr int kXfmRowCount = 4;
13
15constexpr int kXfmRowFloatCount = 4;
16
38class Transformable : public virtual Object {
39 // CollectChildren() in rnd/collectchildren.h walks mTransList directly, and the image has no
40 // accessor for it.
41 friend void CollectChildren(std::list<Object *> &objects, Transformable *pTransformable);
42 // MetRenderer::AddScreenView() and AddBackgroundView() search mTransList directly before
43 // AddTrans(), and the image has no accessor for it.
44 friend class ::MetRenderer;
45
46public:
70
81
88 virtual ~Transformable();
89
100 void AddTrans(Transformable *pTrans);
101
112
120
132 virtual void DumpText(Dbg &sink);
133
143 virtual void Save(Stream &stream);
144
156 virtual void Load(Stream &stream);
157
169 virtual void Replace(Object *pFrom, Object *pTo);
170
182 virtual void Copy(const Object *pSource, unsigned nFlags);
183
196
206 virtual void SetBillboard(int nBillboard);
207
226 virtual int UpdateWorldXfm(Transformable *pParent, int nForce);
227
237 void SetOrigin(const float *pOrigin);
238
255 float *GetDrawXfm();
256
257protected:
272 void AdoptXfmFrom(const Transformable &owner);
273
285
286 // Declared in recovered offset order, with the access specifiers interleaved.
287
288public:
300
311
312protected:
313 float mOrigin[kXfmRowFloatCount]; // +0x90
314
315public:
326
327protected:
328 int mBillboard; // +0xa4
329
330private:
339 void AcquireTransRefs();
340
341 std::list<Transformable *> mTransList; // +0x04
342 int mReserved08; // +0x08
343 int mReserved0c; // +0x0c
344};
345
356
357} // namespace Rnd
Front-end renderer that owns the screen stack and drives every MetScreen.
Definition metrenderer.h:68
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Object()
Construct an unnamed object.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
Billboard
Mode mBillboard selects, recovered from the name dumper at 0x004f26f0.
Definition transformable.h:54
@ kBillboardScaleXYZ
Definition transformable.h:67
@ kBillboardScaleY
Definition transformable.h:64
@ kBillboardLocalRotate
Definition transformable.h:62
@ kBillboardXZ
Definition transformable.h:59
@ kBillboardScaleSimpleXYZ
Definition transformable.h:68
@ kBillboardScaleX
Definition transformable.h:63
@ kBillboardSimpleXYZ
Definition transformable.h:61
@ kBillboardZ
Definition transformable.h:58
@ kBillboardXYZ
Definition transformable.h:60
@ kBillboardX
Definition transformable.h:56
@ kBillboardNone
Definition transformable.h:55
@ kBillboardScaleXZ
Definition transformable.h:66
@ kBillboardScaleZ
Definition transformable.h:65
@ kBillboardY
Definition transformable.h:57
Transformable * Parent()
Report the transformable that positions this one.
virtual void DumpText(Dbg &sink)
Write a description of this object to sink.
void RemoveTrans(Transformable *pTrans)
Erase pTrans from mTransList.
float mWorldXfm[kXfmRowCount][kXfmRowFloatCount]
Composed world transform.
Definition transformable.h:310
virtual void SetBillboard(int nBillboard)
Set the billboard mode and mark the transform dirty.
float mLocalXfm[kXfmRowCount][kXfmRowFloatCount]
Transform this object is positioned by, before the parent transform is applied.
Definition transformable.h:299
void AddTrans(Transformable *pTrans)
Append pTrans to mTransList and mark it dirty.
void RemoveAllTranses()
Drop this object's reference on every mTransList entry and empty the list.
virtual int UpdateWorldXfm(Transformable *pParent, int nForce)
Compose mWorldXfm from mLocalXfm and the parent's world transform.
friend void CollectChildren(std::list< Object * > &objects, Transformable *pTransformable)
Append every transform descendant of a transformable.
Definition collectchildren.h:86
virtual void Save(Stream &stream)
Write the revision, both transforms, mTransList, mBillboard, and mOrigin to stream.
void SetOrigin(const float *pOrigin)
Set the origin row and mark the transform dirty.
void AdoptXfmFrom(const Transformable &owner)
Adopt the transform of an owner this object is being detached from.
virtual void Load(Stream &stream)
Replace both transforms, mTransList, mBillboard, and mOrigin from stream.
Transformable()
Construct a dirty transformable with identity transforms and no children.
virtual void Replace(Object *pFrom, Object *pTo)
Retarget every mTransList entry equal to pFrom at pTo.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy both transforms, mBillboard, and mOrigin from pSource.
virtual ~Transformable()
Drop this object's references on its children.
int mBillboard
Definition transformable.h:328
float mOrigin[kXfmRowFloatCount]
Definition transformable.h:313
int mDirty
Set by every writer of a transform field and cleared once UpdateWorldXfm has recomposed.
Definition transformable.h:325
float * GetDrawXfm()
Build the transform this object draws with and return it.
void ReleaseTransRefs()
Drop this object's reference on every mTransList entry without emptying the list.
The rendering engine.
Definition animhelper.h:3
constexpr int kXfmRowFloatCount
Floats in one transform row.
Definition transformable.h:15
constexpr int kXfmRowCount
Rows in one transform.
Definition transformable.h:12
float g_drawXfm[kXfmRowCount][kXfmRowFloatCount]
Scratch transform GetDrawXfm() returns.