resonance 1.0.1
Loading...
Searching...
No Matches
psmat.h
Go to the documentation of this file.
1#pragma once
2
3#include "math/vector3.h"
4#include "rnd/mat.h"
5
6struct Color;
7struct Transform;
8
9namespace Rnd {
10
37class PsMat : public Mat {
38public:
51 static Mat *sCurrent;
52
60 PsMat(const HxStr &name);
61
66 virtual ~PsMat();
67
77 static void InstallCreator();
78
83 virtual void SetAmbient(const Color &color);
84
89 virtual void SetDiffuse(const Color &color);
90
95 virtual void SetEmissive(const Color &color);
96
101 virtual void SetAlpha(float flAlpha);
102
107 virtual void SetSpecular(const Color &color, float flAlpha);
108
120 int Select();
121
131 static void SelectDefault();
132
143
144private:
152 void SelectBlendMode();
153
161 void BindStageTexture();
162
169 void SetupUvXfm();
170
180 void SelectStageClamp(const Stage &stage);
181};
182
193Mat *NewPsMat(const HxStr &name);
194
201extern int g_nSelectedGenMode;
202
209extern int g_nSelectedFlat;
210
217extern int g_nAlphaBlendEnabled;
218
225extern int g_nStageBlendDoubles;
226
237
248
255extern int g_nLightingEnabled;
256
257} // namespace Rnd
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
One texture stage of a material.
Definition mat.h:94
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Mat(const HxStr &name)
Construct a material with the default surface.
static void InstallCreator()
Install the PlayStation 2 material creator and build the fixed sphere-map UV transform.
static void SelectDefault()
Drop the cached material state and program the GS for the default opaque surface.
virtual void SetAlpha(float flAlpha)
virtual ~PsMat()
void SelectAlphaBlend()
Force ALPHA_1 to the standard source-alpha equation whatever the material blend is.
static Mat * sCurrent
Material that Rnd::Mat::SelectMaterial() last applied, or null when the applied state is stale.
Definition psmat.h:51
PsMat(const HxStr &name)
Construct a material with the default surface.
virtual void SetSpecular(const Color &color, float flAlpha)
virtual void SetDiffuse(const Color &color)
virtual void SetAmbient(const Color &color)
virtual void SetEmissive(const Color &color)
int Select()
Apply the next pass of this material to the GS.
The rendering engine.
Definition animhelper.h:3
int g_nLightingEnabled
Lighting enable flag of the selected material, cleared when the stage texture function is decal.
int g_nSelectedGenMode
Coordinate generation mode of the stage Rnd::PsMat::SetupUvXfm() last processed.
Mat * NewPsMat(const HxStr &name)
Allocate and construct a PlayStation 2 material.
Transform * g_pSelectedUvXfm
Fixed UV transform the selected stage requires, or null when the stage needs none.
int g_nSelectedFlat
Flat shading flag of the selected material.
int g_nStageBlendDoubles
Non-zero when the bound stage blend is Rnd::Mat::kBlendModeMultiply2.
Transform * g_pSelectedStageXfm
Stage transform of the selected stage when it uses one, otherwise null.
int g_nAlphaBlendEnabled
Non-zero once the GS ALPHA_1 register holds a blending equation rather than an opaque copy.
Linear colour with four float components.
Definition color.h:10
Affine transform stored as three basis rows and a translation row.
Definition transform.h:14