44 void *
operator new(
size_t nSize) {
45 return PoolAlloc(
static_cast<int>(nSize),
sizeof(
PsMat),
"PsMat", 0);
53 void operator delete(
void *pBlock) {
164 return new PsMat(pszName);
void SetupUvXfm(int nPass)
Build the texture coordinate transform of a pass's stage into g_uvXfm and g_stageXfm.
int Select(int nPass)
Select one pass of the material for drawing.
~PsMat() override
Definition psmat.h:35
static void SelectAlphaBlend()
Blend by the source alpha, and make the next Select() of the selected material select its blend again...
void SelectBlendMode(int nPass)
Program the GS blend, dither, alpha test, and alpha correction for a pass.
int TexFunction(int nBlend)
Report the GS texture function a blend draws its texture with.
void BindStageTexture(int nPass)
Bind the texture of a pass's stage and set the colour scale for its texture function.
static RndObject * New(const char *pszName)
Create a material.
Definition psmat.h:163
static void SelectDefault()
Forget the selected material and return the GS to opaque drawing with the default dither.
void SelectStageClamp(const Stage &stage)
Clamp the texture coordinates of a stage, or let them repeat.
static void Init()
Install the material factory for the class Mat of a .rnd file.
PsMat(const char *pszName)
Construct a material.
Definition psmat.h:28
static PsMat * sCurrent
The material Select() last selected, or null.
Definition psmat.h:173
One texture stage.
Definition rndmat.h:61
RndMat(const char *pszName)
Construct an enabled material that blends by source alpha, with a black base colour,...
RndObject(const char *pszName)
Construct an object and register it under a name.
void * PoolAlloc(int nSize, int nBlockSize, const char *pszTag, int nUnused)
Allocate a block from the small-block pool and bill it to a tag.
void PoolFree(int nSize, void *pBlock)
Return a block to the small-block pool.
Transform g_uvXfm
Transform of the texture coordinates of the selected stage.
int g_nSelectedFlat
Flat shading flag of the selected material.
Vector3 g_stageXfm[3]
Basis rows of the stage transform a sphere-mapped stage applies before its sphere map.
Color g_colorScale
Scale from a vertex colour component to the GS range, 128 for a modulated texture and 255 otherwise,...
int g_nSelectedGenMode
Texture coordinate generation mode of the stage PsMat::SetupUvXfm() last processed.
int g_nAlphaBlendEnabled
Non-zero once ALPHA_1 is a blending equation rather than an opaque copy.
int g_nTextured
Non-zero while a stage texture is bound.
int g_nLightingEnabled
Lighting flag of the selected material, cleared when the stage texture is applied as a decal.
int g_nReselectBlend
Non-zero after PsMat::SelectAlphaBlend(), until the next PsMat::Select() of the selected material sel...
Linear colour with four float components.
Definition color.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14