|
resonance 1.0.1
|
#include <light.h>


Public Types | |
| enum | Type { kLightTypePoint = 0 , kLightTypeDirectional = 1 , kLightTypeSpot = 2 } |
| Which lighting model a light applies. More... | |
| Public Types inherited from Rnd::Transformable | |
| enum | Billboard { kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 , kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 , kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160 } |
| Mode mBillboard selects, recovered from the name dumper at 0x004f26f0. More... | |
Public Member Functions | |
| Light (const HxStr &name) | |
| Construct a white directional light. | |
| virtual | ~Light () |
| virtual void | SetColors (const Color &ambient, const Color &diffuse, const Color &specular) |
| Set all three colours at once. | |
| virtual void | SetType (Type type) |
| Set which lighting model this light applies. | |
| virtual void | SetRange (float flRange) |
| Set the distance a point light illuminates over. | |
| virtual void | SetAngles (float flInner, float flOuter) |
| Set the two cone angles of a spot light. | |
| virtual void | SetAttenuation (float flConstant, float flLinear, float flQuadratic) |
| Set the three attenuation terms of a point light. | |
| virtual void | SyncLight () |
| Hook run after the whole state of the light changes at once. | |
| virtual const HxStr & | ClassName () const |
| Report the class key a .rnd file writes for a light. | |
| virtual void | DumpText (Dbg &sink) |
| Write a description of this light to sink. | |
| virtual void | Save (Stream &stream) |
| Write the revision, the base, the three colours, the six scalars, and the type to stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Retarget the references of the base at pTo. | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy the three colours, the six scalars, and the type from pSource. | |
| virtual void | Load (Stream &stream) |
| Replace the three colours, the six scalars, and the type from stream. | |
| Public Member Functions inherited from Rnd::Transformable | |
| Transformable () | |
| Construct a dirty transformable with identity transforms and no children. | |
| virtual | ~Transformable () |
| Drop this object's references on its children. | |
| void | AddTrans (Transformable *pTrans) |
| Append pTrans to mTransList and mark it dirty. | |
| void | RemoveTrans (Transformable *pTrans) |
| Erase pTrans from mTransList. | |
| void | RemoveAllTranses () |
| Drop this object's reference on every mTransList entry and empty the list. | |
| Transformable * | Parent () |
| Report the transformable that positions this one. | |
| virtual void | SetBillboard (int nBillboard) |
| Set the billboard mode and mark the transform dirty. | |
| virtual int | UpdateWorldXfm (Transformable *pParent, int nForce) |
| Compose mWorldXfm from mLocalXfm and the parent's world transform. | |
| void | SetOrigin (const float *pOrigin) |
| Set the origin row and mark the transform dirty. | |
| float * | GetDrawXfm () |
| Build the transform this object draws with and return it. | |
| Public Member Functions inherited from Rnd::Object | |
| Object () | |
| Construct an unnamed object. | |
| Object (const HxStr &name) | |
| Construct an object and register it under name. | |
| virtual | ~Object () |
| Erase the registry entry and release the name buffer. | |
| void | SetName (const HxStr &name) |
| Re-register this object under a different name. | |
| void | AddRef (Object *pReferrer) |
| Register pReferrer as a store of a pointer to this object. | |
| void | RemoveRef (Object *pReferrer) |
| Drop one registration made by AddRef(). | |
Static Public Member Functions | |
| static void * | operator new (size_t nSize) |
| Allocate a light block under the tag "Rnd::Light". | |
| static void | operator delete (void *pBlock) |
| Release a block operator new() allocated. | |
Public Attributes | |
| Color | mDiffuse |
| Light a vertex receives in proportion to its normal. | |
| Color | mAmbient |
| Light every vertex receives from this light regardless of its normal. | |
| Color | mSpecular |
| Highlight colour the light contributes. | |
| float | mRange |
| Distance a point light illuminates over. | |
| Type | mType |
| Which lighting model this light applies. | |
| Public Attributes inherited from Rnd::Transformable | |
| float | mLocalXfm [kXfmRowCount][kXfmRowFloatCount] |
| Transform this object is positioned by, before the parent transform is applied. | |
| float | mWorldXfm [kXfmRowCount][kXfmRowFloatCount] |
| Composed world transform. | |
| int | mDirty |
| Set by every writer of a transform field and cleared once UpdateWorldXfm has recomposed. | |
| Public Attributes inherited from Rnd::Object | |
| HxStr | mName |
| int | mInternal |
Additional Inherited Members | |
| Protected Member Functions inherited from Rnd::Transformable | |
| void | AdoptXfmFrom (const Transformable &owner) |
| Adopt the transform of an owner this object is being detached from. | |
| void | ReleaseTransRefs () |
| Drop this object's reference on every mTransList entry without emptying the list. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
| Protected Attributes inherited from Rnd::Transformable | |
| float | mOrigin [kXfmRowFloatCount] |
| int | mBillboard |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Light in a scene.
Its RTTI descriptor is at 0x008efe60. It has Rnd::Transformable as its only public non-virtual base at offset 0. The class is 0x120 bytes and the virtual Rnd::Object subobject sits at 0x100. The constructor proves the offset by writing that address into the virtual-base pointer. The four bytes between the last member and that subobject are a reserved run rather than a field.
Each colour member is quadword aligned in the original, which is what places the first one at 0xb0 rather than at the 0xac the base subobject ends on.
The member titles come from the text DumpText() writes: "diffuse:", " ambient:", "specular:", " innerAng:", "outerAng:", " range:", "constantAtten:", " linearAtten:", " quadraticAtten:", and "type:".
Two vtables belong to the class. The nine-entry table at 0x00829500 is addressed by the Rnd::Transformable vptr at 0xa8 and stores the six virtuals declared here after the two Rnd::Transformable ones, and the eight-entry table at 0x008294b8 is addressed by the Rnd::Object subobject vptr with a -0x100 adjustment on every entry. Both Rnd::Transformable virtuals are inherited unchanged.
The position a point light is placed at is the translation row of the world transform of the base, and the direction a directional light points along is the second basis row negated. The light therefore stores neither.
| enum Rnd::Light::Type |
Which lighting model a light applies.
The three names come from the routine at 0x005454a0. The routine writes 'Point', 'Directional', and 'Spot' for the values below. Rnd::PsEnviron::DrawShowing() handles the first two and skips a spot light entirely.
| Enumerator | |
|---|---|
| kLightTypePoint | |
| kLightTypeDirectional | |
| kLightTypeSpot | |
|
explicit |
Construct a white directional light.
The diffuse colour starts fully opaque white, the ambient colour a tenth of that, and the specular colour fully opaque black. Both cone angles start at a right angle halved, the range at 1000.0, the constant attenuation at 1.0, both other attenuations at 0.0, and the type at Directional.
| name | The registry key for this object. |
|
virtual |
|
static |
Allocate a light block under the tag "Rnd::Light".
| nSize | The block size. |
|
static |
Release a block operator new() allocated.
| pBlock | The block. |
|
virtual |
Set all three colours at once.
Vtable slot 3 of the Rnd::Transformable table. The parameter order is the recovered one and it is not the order the text dump writes the three colours in.
| ambient | The light every vertex receives from this light regardless of its normal. |
| diffuse | The light a vertex receives in proportion to its normal. |
| specular | The highlight colour. |
|
virtual |
Set which lighting model this light applies.
Vtable slot 4 of the Rnd::Transformable table.
| type | The lighting model. |
|
virtual |
Set the distance a point light illuminates over.
Vtable slot 5 of the Rnd::Transformable table.
| flRange | The distance. |
|
virtual |
Set the two cone angles of a spot light.
Vtable slot 6 of the Rnd::Transformable table.
| flInner | Angle the cone is at full strength within. |
| flOuter | Angle the cone falls to nothing at. |
|
virtual |
Set the three attenuation terms of a point light.
Vtable slot 7 of the Rnd::Transformable table. The three terms scale one, the distance, and the squared distance.
| flConstant | The constant term. |
| flLinear | The term the distance scales. |
| flQuadratic | The term the squared distance scales. |
|
virtual |
Hook run after the whole state of the light changes at once.
Vtable slot 8 of the Rnd::Transformable table. The body is empty and no class overrides it. Two call sites are recovered, and both are a tail call on this with no argument. Load() ends with one at 0x00540e80 and Copy() ends with another at 0x0054545c, which fixes the signature as a no-argument void. The title is inferred from those two call sites, and every subclass that would supply a body is absent from this build.
|
virtual |
Report the class key a .rnd file writes for a light.
The returned string is the global at 0x00720bd0, which the class registration fills with "Light".
Implements Rnd::Object.
|
virtual |
Write a description of this light to sink.
The base description comes first, and everything below is produced only at a positive dump level.
| sink | The diagnostic sink to write to. |
Reimplemented from Rnd::Transformable.
|
virtual |
Write the revision, the base, the three colours, the six scalars, and the type to stream.
The revision is 1. Every colour goes out as its four components in turn rather than as one quadword.
| stream | The stream to write to. |
Reimplemented from Rnd::Transformable.
Retarget the references of the base at pTo.
The body forwards to Rnd::Transformable::Replace() and does nothing else, because a light stores no object reference of its own. The forwarding body has its own address rather than sharing the base entry. The override was therefore declared even though it adds nothing.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Reimplemented from Rnd::Transformable.
|
virtual |
Copy the three colours, the six scalars, and the type from pSource.
The three colours move as one quadword each. The source is narrowed through dynamic_cast and the result is used with no null test. A pSource that is not a light therefore faults here. SyncLight() finishes the routine.
| pSource | The object to copy from. |
| nFlags | The set of fields to copy, passed straight to the base. |
Reimplemented from Rnd::Transformable.
|
virtual |
Replace the three colours, the six scalars, and the type from stream.
A revision above 1 produces the report "Can't load new Light" and no further reading. A revision of 0 predates the type word and retains mType unchanged. SyncLight() finishes the routine.
| stream | The stream to read from. |
Reimplemented from Rnd::Transformable.
| Color Rnd::Light::mAmbient |
Light every vertex receives from this light regardless of its normal.
+0xc0
| Color Rnd::Light::mSpecular |
Highlight colour the light contributes.
+0xd0
Public for the same reason as its two siblings. Rnd::LightAnim::SetFrameSelf() at 0x005418f8 reads all three through a Rnd::Light pointer it stores, and Rnd::LightAnim does not derive from Rnd::Light, so protected access would not cover it. A friend declaration fits the image equally well. The three stack quadwords that routine builds become the three arguments of SetColors(), which confirms both this offset and that parameter order.
| float Rnd::Light::mRange |
Distance a point light illuminates over.
+0xe8
| Type Rnd::Light::mType |
Which lighting model this light applies.
+0xf8