resonance 1.0.1
Loading...
Searching...
No Matches
environ.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <list>
5
6#include "math/color.h"
7#include "rnd/drawable.h"
8#include "rnd/manager.h"
9
10class HxStr;
11namespace Rnd {
12class Dbg;
13class Light;
14class Object;
15class Stream;
16} // namespace Rnd
17
18namespace Rnd {
19
37
69class Environ : public Drawable {
70public:
78
89
100 explicit Environ(const HxStr &name);
101
106 virtual ~Environ();
107
118 virtual const HxStr &ClassName() const;
119
130 virtual void DumpText(Dbg &sink);
131
142 virtual void Save(Stream &stream);
143
156 virtual void Replace(Object *pFrom, Object *pTo);
157
173 virtual void Copy(const Object *pSource, unsigned nFlags);
174
185 virtual void Load(Stream &stream);
186
195 static Environ *NewEnviron(const HxStr &name);
196
205 static void *operator new(size_t nSize);
206
214 static void operator delete(void *pBlock);
215
227 void AddLight(Light *pLight);
228
240 void RemoveLight(Light *pLight);
241
251
252 // Declared in recovered offset order. Every member is public because
253 // Rnd::PsEnviron::DrawShowing() reads mLights, mFogMode, the two fog distances, and mFogColor
254 // directly, and the image exposes no accessor for any of them.
255
257 std::list<Light *> mLights;
258
259private:
260 // A reserved run records a span that has not been recovered and is not a field. This one is
261 // consistent with the padding before a quadword-aligned colour.
262 unsigned char mReserved18[0x08];
263
264public:
267
270
272 float mFogEnd;
273
280
281private:
282 unsigned char mReserved3c[0x04];
283
284public:
287
290
291private:
292 unsigned char mReserved54[0x0c];
293
294protected:
305 virtual int DrawShowing();
306
307private:
316 void AcquireLightsRefs();
317
327 void ReleaseLightsRefs();
328};
329
340extern Environ *(*g_pfnNewEnviron)(const HxStr &name);
341
354
367
384
385} // namespace Rnd
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Drawable()
Construct a visible drawable with no children.
Lighting and fog a subtree is drawn under.
Definition environ.h:69
virtual ~Environ()
void RemoveAllLights()
Drop this environment's reference on every light and empty mLights.
FogMode mFogMode
Which fog model applies, or None for no fog at all.
Definition environ.h:289
std::list< Light * > mLights
Lights this environment applies to the subtree below it.
Definition environ.h:257
Color mFogColor
Colour a fully fogged pixel becomes.
Definition environ.h:286
float mFogEnd
Distance fog arrives at its full strength.
Definition environ.h:272
void AddLight(Light *pLight)
Append a light to mLights.
virtual void DumpText(Dbg &sink)
Write a description of this environment to sink.
virtual const HxStr & ClassName() const
Report the class key a .rnd file writes for an environment.
virtual int DrawShowing()
Make this environment the one the subtree below is drawn under.
static Environ * NewEnviron(const HxStr &name)
Build an environment the class registry vends.
float mFogStart
Distance fog starts at.
Definition environ.h:269
virtual void Save(Stream &stream)
Write this environment's serialised form to stream.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy the state of pSource into this environment.
static HxStr sClassName
Registered class name of Rnd::Environ, the string "Environ".
Definition environ.h:77
void RemoveLight(Light *pLight)
Remove a light from mLights.
static Environ * sCurrent
Environment the subtree being drawn is under.
Definition environ.h:88
Environ(const HxStr &name)
Construct an environment with no lights and no fog.
virtual void Replace(Object *pFrom, Object *pTo)
Repoint a light entry when the object it addressed is replaced.
Color mAmbient
Light every vertex receives regardless of the lights above.
Definition environ.h:266
float mFogDensity
Strength the exponential modes raise fog to.
Definition environ.h:279
virtual void Load(Stream &stream)
Read this environment's serialised form from stream.
Light in a scene.
Definition light.h:41
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3
Environ *(* g_pfnNewEnviron)(const HxStr &name)
Factory the registered environment creator dispatches through.
Environ * NewEnvironThroughHook(const HxStr &name)
Build an environment through the creator hook.
void RegisterEnvironClass()
Point g_pfnNewEnviron at Environ::NewEnviron() and register the "Environ" class with Rnd::Manager.
Definition environ.h:380
FogMode
How fog attenuates a drawn pixel.
Definition environ.h:28
@ kFogModePixelExp2
Definition environ.h:34
@ kFogModeVertLinear
Definition environ.h:32
@ kFogModePixelExp
Definition environ.h:33
@ kFogModePixelLinear
Definition environ.h:35
@ kFogModeVertExp
Definition environ.h:30
@ kFogModeNone
Definition environ.h:29
@ kFogModeVertExp2
Definition environ.h:31
Manager TheManager
The renderer's object registry.
Object * CreateRegisteredEnviron(const HxStr &name)
Build an environment for the registered "Environ" class.
Linear colour with four float components.
Definition color.h:10