|
resonance 1.0.1
|
Lighting and fog a subtree is drawn under. More...
#include <environ.h>


Public Member Functions | |
| Environ (const HxStr &name) | |
| Construct an environment with no lights and no fog. | |
| virtual | ~Environ () |
| virtual const HxStr & | ClassName () const |
| Report the class key a .rnd file writes for an environment. | |
| virtual void | DumpText (Dbg &sink) |
| Write a description of this environment to sink. | |
| virtual void | Save (Stream &stream) |
| Write this environment's serialised form to stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Repoint a light entry when the object it addressed is replaced. | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy the state of pSource into this environment. | |
| virtual void | Load (Stream &stream) |
| Read this environment's serialised form from stream. | |
| void | AddLight (Light *pLight) |
| Append a light to mLights. | |
| void | RemoveLight (Light *pLight) |
| Remove a light from mLights. | |
| void | RemoveAllLights () |
| Drop this environment's reference on every light and empty mLights. | |
| Public Member Functions inherited from Rnd::Drawable | |
| Drawable () | |
| Construct a visible drawable with no children. | |
| virtual | ~Drawable () |
| Drop this object's references on its children. | |
| void | Draw () |
| Draw this object followed by each of its children. | |
| Drawable * | Parent () |
| Report the drawable that draws this one. | |
| void | AddDraw (Drawable *pDraw, Drawable *pBefore) |
| Insert pDraw into mDraws in front of pBefore. | |
| void | AddDraw (Drawable *pDraw) |
| Insert pDraw at the front of mDraws. | |
| void | RemoveDraw (Drawable *pDraw) |
| Erase pDraw from mDraws. | |
| void | RemoveAllDraws () |
| Empty mDraws, dropping this object's reference on every entry. | |
| void | MoveDraw (Drawable *pDraw, int nSteps) |
| Move pDraw nSteps places later in mDraws, or earlier for a negative count. | |
| virtual void | SetShowing (int nShowing) |
| Set whether this object draws at all. | |
| void | SetShowingRecursive (int nShowing) |
| Set whether this object and every drawable beneath it in mDraws draw at all. | |
| virtual void | SetHighlight (int nHighlight) |
| Set whether this object draws with its highlight treatment. | |
| int | GetHighlight () const |
| Report the highlight flag. | |
| int | GetShowing () const |
| Report the showing flag. | |
| std::list< Drawable * > & | GetDraws () |
| Report the child list. | |
| 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 Environ * | NewEnviron (const HxStr &name) |
| Build an environment the class registry vends. | |
| static void * | operator new (size_t nSize) |
| Allocate an environment block under the tag "Rnd::Environ". | |
| static void | operator delete (void *pBlock) |
| Release a block operator new() allocated. | |
| Static Public Member Functions inherited from Rnd::Drawable | |
| static Drawable * | Find (const HxStr &name) |
| Resolve a registry key to a drawable. | |
Public Attributes | |
| std::list< Light * > | mLights |
| Lights this environment applies to the subtree below it. | |
| Color | mAmbient |
| Light every vertex receives regardless of the lights above. | |
| float | mFogStart |
| Distance fog starts at. | |
| float | mFogEnd |
| Distance fog arrives at its full strength. | |
| float | mFogDensity |
| Strength the exponential modes raise fog to. | |
| Color | mFogColor |
| Colour a fully fogged pixel becomes. | |
| FogMode | mFogMode |
| Which fog model applies, or None for no fog at all. | |
| Public Attributes inherited from Rnd::Drawable | |
| int | mShowing |
| Public Attributes inherited from Rnd::Object | |
| HxStr | mName |
| int | mInternal |
Static Public Attributes | |
| static HxStr | sClassName |
| Registered class name of Rnd::Environ, the string "Environ". | |
| static Environ * | sCurrent |
| Environment the subtree being drawn is under. | |
Protected Member Functions | |
| virtual int | DrawShowing () |
| Make this environment the one the subtree below is drawn under. | |
| Protected Member Functions inherited from Rnd::Drawable | |
| void | ReleaseDrawsRefs () |
| Drop this object's reference on every mDraws entry without emptying the list. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
Additional Inherited Members | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Lighting and fog a subtree is drawn under.
Its RTTI descriptor is at 0x008ef500. It has Rnd::Drawable as its only public non-virtual base at offset 0. The allocator at 0x00519308 proves the class is 0x80 bytes by requesting exactly that much under the tag "Rnd::Environ". The constructor places the virtual Rnd::Object subobject at 0x60 by writing that address into the virtual-base pointer, and the four bytes after the subobject are tail padding.
Both colour members are quadword aligned in the original, which is what produces the reserved runs at 0x18 and 0x3c.
The member titles come from the text DumpText() writes: "lights:", "ambient:", " fogStart:", "fogEnd:", " fogDensity:", "fogColor:", and " fogMode:".
Two vtables belong to the class. The four-entry table at 0x00826d28 is addressed by the Rnd::Drawable vptr at 0x10 and declares no virtual of its own, and the eight-entry table at 0x00826ce0 is addressed by the Rnd::Object subobject vptr with a -0x60 adjustment on every entry.
Two routines that serve DumpText() are free functions rather than members, because each returns the sink it was handed. The one at 0x00519470 writes the name of a fog mode and the one at 0x005185b0 writes mLights, and both are declared beside the implementation rather than here because no code outside environ.cpp calls either.
The class has the tagged allocation pair every class in this tree gets from the allocation macro, under the tag "Rnd::Environ". The allocation is inlined into NewEnviron(), its one call site at 0x00519324, and no out-of-line copy of either half survives. Neither is declared here, for the same reason APalette declares neither: the macro generates them rather than a programmer writing them.
|
explicit |
Construct an environment with no lights and no fog.
The ambient colour starts fully transparent black, the fog colour fully opaque white, the fog start at 0.0, the fog end and the fog density at 1.0, and the fog mode at None.
| name | The registry key for this object. |
|
virtual |
|
virtual |
Report the class key a .rnd file writes for an environment.
The returned string is the global at 0x00718d18, which the class registration fills with "Environ".
Implements Rnd::Object.
|
virtual |
Write a description of this environment 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::Drawable.
|
virtual |
Write this environment's serialised form to stream.
The revision word is 0, which is also the highest Load() accepts, so the format never changed.
| stream | The stream to write to. |
Reimplemented from Rnd::Drawable.
Repoint a light entry when the object it addressed is replaced.
An entry that already addresses pTo produces the report "%s already in %s" and is then replaced regardless. A replacement that is not a light empties the entry, and an empty entry is erased from the list rather than retained as a hole.
| pFrom | The object going away. |
| pTo | The object to store instead, or null. |
Reimplemented from Rnd::Drawable.
|
virtual |
Copy the state of pSource into this environment.
The light list is copied only while bit 0 of nFlags is clear, and there is no disagreement with kCopyChildLists. The two are different bits of one word with opposite polarity. Bit 0 is an opt-out for the light list, tested here at 0x00516560 by exclusive-or against one followed by a mask. Bit 9 is an opt-in for the child draw list, tested by Rnd::Drawable::Copy() at 0x00506af0. This routine passes the same word into the base copy first, so one call tests both.
| pSource | The environment to copy from. |
| nFlags | The set of fields to copy. |
Reimplemented from Rnd::Drawable.
|
virtual |
Read this environment's serialised form from stream.
A revision above 0 is rejected with "Can't load new Environ". The fog mode arrives as a plain word and is assigned to the enumeration afterwards.
| stream | The stream to read from. |
Reimplemented from Rnd::Drawable.
Build an environment the class registry vends.
| name | The registry key for the new environment. |
|
static |
Allocate an environment block under the tag "Rnd::Environ".
| nSize | The block size. |
|
static |
Release a block operator new() allocated.
| pBlock | The block. |
| void Rnd::Environ::AddLight | ( | Light * | pLight | ) |
Append a light to mLights.
A light already in the list is reported to Rnd::TheDbg as "<light> already in <environment>" and is not added again. Otherwise this environment registers as a referrer of the light, when it is not null, and the light is appended.
| pLight | The light to add. |
| void Rnd::Environ::RemoveLight | ( | Light * | pLight | ) |
Remove a light from mLights.
The first matching entry is erased, and this environment's reference on the light is dropped when the light is not null. A light not in the list is ignored. No call site survives in the shipped program, and the name is inferred from AddLight().
| pLight | The light to remove. |
| void Rnd::Environ::RemoveAllLights | ( | ) |
Drop this environment's reference on every light and empty mLights.
AppTunnel's constructor calls it on "tunnel.env". The title is inferred.
|
protectedvirtual |
Make this environment the one the subtree below is drawn under.
Vtable slot 3 of the Rnd::Drawable table. Rnd::PsEnviron overrides it with the routine that also programs the fog registers and builds the light records.
Reimplemented from Rnd::Drawable.
Reimplemented in Rnd::PsEnviron.
|
static |
Registered class name of Rnd::Environ, the string "Environ".
|
static |
Environment the subtree being drawn is under.
Rnd::Environ::DrawShowing() stores itself here, and Rnd::PsEnviron::DrawShowing() stores its own environment the same way.
| std::list<Light *> Rnd::Environ::mLights |
Lights this environment applies to the subtree below it.
+0x14
| float Rnd::Environ::mFogStart |
Distance fog starts at.
+0x30
| float Rnd::Environ::mFogEnd |
Distance fog arrives at its full strength.
+0x34
| float Rnd::Environ::mFogDensity |
Strength the exponential modes raise fog to.
The PlayStation 2 renderer does not read it. +0x38
| Color Rnd::Environ::mFogColor |
Colour a fully fogged pixel becomes.
+0x40
| FogMode Rnd::Environ::mFogMode |
Which fog model applies, or None for no fog at all.
+0x50