196 static void *
operator new(
size_t nSize);
205 static void operator delete(
void *pBlock);
565extern Mat *(*g_pfnNewMat)(
const HxStr &name);
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
void Dump(Dbg &sink) const
Write the stage to the engine text sink.
Stage()
Construct a stage with the default surface.
void SetTex(Tex *pTex)
Replace the stage's texture.
TexGen mGenMode
Definition mat.h:98
Transform mXfm
Definition mat.h:99
void Load(Stream &stream)
Load the stage.
Tex * mTex
Definition mat.h:102
BlendMode mBlend
Definition mat.h:96
int mCoordIndex
Definition mat.h:97
Mat * mMat
Definition mat.h:103
int mUseXfm
Definition mat.h:100
void Save(Stream &stream) const
Serialise the stage.
TexWrap mWrap
Definition mat.h:101
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
virtual void Refresh()
Resynchronise the material after its state or its stage vector has changed.
virtual void SetAlpha(float flAlpha)
Set the diffuse alpha.
void SetMultiPass(int nMultiPass)
Set the multi-pass count.
TexWrap
How a texture coordinate outside the unit square resolves.
Definition mat.h:84
@ kWrapModeMirror
Definition mat.h:84
@ kWrapModeClamp
Definition mat.h:84
@ kWrapModeRepeat
Definition mat.h:84
Color mSpecular
Definition mat.h:485
void GetMeshReferrers(std::vector< Mesh * > &meshes)
Append every referrer of this material whose class is "Mesh" to meshes.
int mVertDiffuse
Non-zero when the vertex colour supplies the diffuse term in place of mDiffuse.
Definition mat.h:505
void RemoveStageTexRefs()
Drop this material's reference on every stage texture.
int mVertEmissive
Vertex emissive flag.
Definition mat.h:516
static HxStr sClassName
Registered class name of Rnd::Mat, the string "Mat".
Definition mat.h:44
Color mEmissive
Colour the surface emits.
Definition mat.h:467
void SetFlat(int nFlat)
Set whether the surface shades flat.
int mMultiPass
Definition mat.h:534
virtual void SetEmissive(const Color &color)
Set the emissive colour.
int mVertAmbient
Non-zero when the vertex colour supplies the ambient term in place of mAmbient.
Definition mat.h:498
BlendMode
Frame buffer blend, as the text dump labels the values.
Definition mat.h:51
@ kBlendModeInvDestAlpha
Definition mat.h:62
@ kBlendModeMultiply
Definition mat.h:55
@ kBlendModeAdd
Definition mat.h:54
@ kBlendModeInvSrcAlpha
Definition mat.h:60
@ kBlendModeSrcAlpha
Definition mat.h:57
@ kBlendModeSrcAlphaOpaque
Definition mat.h:63
@ kBlendModeSrcAdd
Definition mat.h:59
@ kBlendModeSrc
Definition mat.h:53
@ kBlendModeDestAlpha
Definition mat.h:61
@ kBlendModeMultiply2
Definition mat.h:56
@ kBlendModeDest
Definition mat.h:52
@ kBlendModeSrcAlphaAdd
Definition mat.h:58
@ kBlendModeSrcAlphaCutout
Definition mat.h:64
virtual void SetLighting(int nEnable, int nVertAmbient, int nVertDiffuse, int nVertSpecular, int nVertEmissive, int nVertAlpha, int nNormalize)
Set the lighting enable flag, the five per-vertex source flags, and the normalise flag.
int mVertSpecular
Definition mat.h:508
int mVertAlpha
Vertex alpha flag.
Definition mat.h:522
TexGen
How a texture stage produces its texture coordinates.
Definition mat.h:75
@ kGenModeSphere
Definition mat.h:77
@ kGenModeLocalCube
Definition mat.h:80
@ kGenModeOrthoCube
Definition mat.h:79
@ kGenModeFixed
Definition mat.h:76
@ kGenModePlanar
Definition mat.h:78
Cull mCull
Definition mat.h:531
Color mAmbient
Ambient colour.
Definition mat.h:475
int mNormalize
Definition mat.h:525
Mat(const HxStr &name)
Construct a material with the default surface.
Color mDiffuse
Diffuse colour.
Definition mat.h:481
virtual void Save(Stream &stream)
Serialise the material.
virtual void Replace(Object *pFrom, Object *pTo)
Replace one object reference with another.
virtual void SetDiffuse(const Color &color)
Set the diffuse colour, retaining the current alpha.
virtual void Load(Stream &stream)
Load the material.
virtual void SetAmbient(const Color &color)
Set the ambient colour.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy another material over this one.
int mFlat
Definition mat.h:541
virtual void DumpText(Dbg &sink)
Write the material to the engine text sink.
int mEnable
Definition mat.h:488
@ kSerialVersion
Definition mat.h:168
std::vector< Stage > mStages
Definition mat.h:452
virtual const HxStr & ClassName() const
Return the registered class name, "Mat".
Cull
Face winding the rasteriser discards, as the text dump labels the values.
Definition mat.h:68
@ kCullModeNone
Definition mat.h:71
@ kCullModeCw
Definition mat.h:69
@ kCullModeCcw
Definition mat.h:70
BlendMode mBlend
Definition mat.h:458
virtual void SyncMat(int nStage)
Virtual with an empty body in Rnd::Mat.
virtual void SetSpecular(const Color &color, float flAlpha)
Set the specular colour and its alpha.
void AddStage()
Append one stage with the default surface, owned by this material.
void RemoveStage(int nIndex)
Remove one stage, dropping this material's reference on its texture.
Indexed triangle mesh with one material.
Definition mesh.h:46
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Object()
Construct an unnamed object.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
Texture, as a bitmap path plus the load state of its mip levels.
Definition tex.h:43
The rendering engine.
Definition animhelper.h:3
Object * CreateRegisteredMat(const HxStr &name)
Build a material for the registered "Mat" class by calling through g_pfnNewMat.
Mat * NewMat(const HxStr &name)
Allocate and construct a material, the base creator of the "Mat" class.
Mat * NewMatThroughHook(const HxStr &name)
Build a material through the creator hook.
int g_nRndMatLoadVersion
Serial version of the material record currently being read.
int g_nStageTextureBound
Non-zero while the material stage being applied has a texture bound.
Manager TheManager
The renderer's object registry.
Mat *(* g_pfnNewMat)(const HxStr &name)
Creator the registered "Mat" class builds through.
void RegisterMatClass()
Point g_pfnNewMat at NewMat() and register the "Mat" class with Rnd::Manager.
Definition mat.h:611
Linear colour with four float components.
Definition color.h:10