resonance 1.0.1
Loading...
Searching...
No Matches
psenviron.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "math/color.h"
6#include "math/vector3.h"
7#include "rnd/environ.h"
8
9class HxStr;
10struct GifQuadword;
11class Sphere;
12namespace Rnd {
13class Light;
14}
15
16namespace Rnd {
17
31
54
76 DirectionalLightRecord *&pDirectionalEnd,
77 PointLightRecord *&pPointBegin,
78 PointLightRecord *&pPointEnd,
79 const float *pXfm,
80 const Sphere *pSphere);
81
104 GifQuadword *pAmbient,
105 GifQuadword *pDiffuse,
106 const float *pXfm,
107 const Sphere *pSphere);
108
121class PsEnviron : public Environ {
122public:
129 static std::vector<DirectionalLightRecord> sDirLights;
130
137 static std::vector<PointLightRecord> sPointLights;
138
148 explicit PsEnviron(const HxStr &name) : Object(name), Environ(name) {
149 }
150
155 virtual ~PsEnviron();
156
168 static Environ *NewEnviron(const HxStr &name);
169
183 static void Init();
184
196 static void Terminate();
197
198protected:
218 virtual int DrawShowing();
219};
220
228
235extern Light *g_pDefaultLight;
236
244extern float g_flFogScale;
245
252extern float g_flFogOffset;
253
254} // namespace Rnd
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Environ(const HxStr &name)
Construct an environment with no lights and no fog.
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
Lighting and fog a subtree is drawn under, PlayStation 2.
Definition psenviron.h:121
static std::vector< DirectionalLightRecord > sDirLights
Directional lights of the current environment, rebuilt by DrawShowing().
Definition psenviron.h:129
static std::vector< PointLightRecord > sPointLights
Point lights of the current environment, rebuilt by DrawShowing().
Definition psenviron.h:137
virtual ~PsEnviron()
static void Terminate()
Undo what Init() installs.
PsEnviron(const HxStr &name)
Construct an environment with no lights and no fog.
Definition psenviron.h:148
virtual int DrawShowing()
Make this environment the current one, program fog, and build the light records.
static void Init()
Install the PlayStation 2 environment factory and build the default scene fixtures.
static Environ * NewEnviron(const HxStr &name)
Build a PlayStation 2 environment the class registry vends.
Bounding sphere.
Definition sphere.h:15
The rendering engine.
Definition animhelper.h:3
int SelectLightForVertex(GifQuadword *pLight, GifQuadword *pAmbient, GifQuadword *pDiffuse, const float *pXfm, const Sphere *pSphere)
Choose the one light the VU1 face program applies to an object and write its parameters.
float g_flFogOffset
Offset added after g_flFogScale has been applied.
PsEnviron * g_pDefaultEnviron
Environment the renderer falls back on when a scene selects none.
float g_flFogScale
Scale a camera space depth is multiplied by to arrive at the byte range of the GS fog register.
int TransformLightRecords(DirectionalLightRecord *&pDirectionalBegin, DirectionalLightRecord *&pDirectionalEnd, PointLightRecord *&pPointBegin, PointLightRecord *&pPointEnd, const float *pXfm, const Sphere *pSphere)
Bring every light record into an object's space and cull the point lights against its bounds.
Light * g_pDefaultLight
Light the default environment applies when a scene supplies none.
Linear colour with four float components.
Definition color.h:10
One quadword of a packet stream.
Definition gfxdevice.h:21
One directional light as the vertex lighting path consumes it.
Definition psenviron.h:24
Color mAmbient
Definition psenviron.h:28
Color mDiffuse
Definition psenviron.h:29
Vector3 mDirection
Definition psenviron.h:25
Vector3 mTransformedDirection
mDirection in the space of the transform TransformLightRecords() last took.
Definition psenviron.h:27
One point light as the vertex lighting path consumes it.
Definition psenviron.h:38
Color mAmbient
Definition psenviron.h:48
int mCulled
1 when TransformLightRecords() found the light out of reach of the bounding sphere.
Definition psenviron.h:51
unsigned mReserved44[3]
Definition psenviron.h:52
Vector3 mPosition
Definition psenviron.h:41
Color mDiffuse
Definition psenviron.h:49
Vector3 mTransformedPosition
mPosition in the space of the transform TransformLightRecords() or SelectLightForVertex() last took.
Definition psenviron.h:47
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12