|
wavelength 1.0.0
|
Surface description: blending, lighting colours, culling, and a list of texture stages. More...
#include <rndmat.h>


Classes | |
| class | Stage |
| One texture stage. More... | |
Public Types | |
| enum | Blend { kBlendDest = 0 , kBlendSrc = 1 , kBlendAdd = 2 , kBlendMultiply = 3 , kBlendMultiply2 = 4 , kBlendSrcAlpha = 5 , kBlendSrcAlphaAdd = 6 , kBlendSrcAdd = 7 , kBlendInvSrcAlpha = 8 , kBlendDestAlpha = 9 , kBlendInvDestAlpha = 10 , kBlendSrcAlphaOpaque = 11 , kBlendSrcAlphaCutout = 12 , kBlendSubtract = 13 } |
| How a surface or a texture stage combines with what is beneath it. More... | |
| enum | TexGen { kTexGenFixed = 0 , kTexGenSphere = 1 , kTexGenPlanar = 2 , kTexGenOrthoCube = 3 , kTexGenLocalCube = 4 } |
| How a texture stage produces its texture coordinates. More... | |
| enum | TexWrap { kTexWrapClamp = 0 , kTexWrapRepeat = 1 , kTexWrapMirror = 2 } |
| How texture coordinates outside the unit range wrap. More... | |
Public Member Functions | |
| RndMat (const char *pszName) | |
| Construct an enabled material that blends by source alpha, with a black base colour, a white light colour, and a black edge colour. | |
| ~RndMat () override | |
| Drop the references on the stage textures. | |
| void * | operator new (size_t nSize) |
| Allocate a material, billed to the class name. | |
| void | operator delete (void *pBlock) |
| Release a material. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the material. | |
| void | Save (BinStream &stream) override |
| Write the material. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a stage texture with another object. | |
| const char * | ClassName () const override |
| Report the class name. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy another material. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| virtual void | SyncStage (int nStage) |
| Bring the platform state of one stage up to date. | |
| virtual void | SetBaseColor (const Color &color) |
| Set the red, green, and blue of the base colour. | |
| virtual void | SetLightColor (const Color &color) |
| Set the light colour. | |
| virtual void | SetEdgeColor (const Color &color) |
| Set the edge colour. | |
| virtual void | SetAlpha (float fAlpha) |
| Set the alpha of the base colour. | |
| virtual void | SetLighting (int bEnable, int bVertBase, int bVertLight, int bVertEdge, int bNormalize, int bBaseAmbient) |
| Set the lighting switches. | |
| virtual void | Refresh () |
| Take a reference on every stage texture and bring every stage up to date. | |
| void | AddStage () |
| Append a default stage. | |
| int | GetBaseAmbient () const |
| const Color & | GetBaseColor () const |
| int | GetBlend () const |
| void | SetBlend (int nBlend) |
| int | GetCull () const |
| void | SetCull (int nCull) |
| const Color & | GetEdgeColor () const |
| const Color & | GetLightColor () const |
| const std::vector< Stage > & | GetStages () const |
| std::vector< Stage > & | GetStages () |
| int | GetVertBase () const |
| int | GetVertLight () const |
| Public Member Functions inherited from RndObject | |
| RndObject (const char *pszName) | |
| Construct an object and register it under a name. | |
| virtual | ~RndObject () |
| Notify every referrer, then erase the registration. | |
| void | SetName (const char *pszName) |
| Register the object under a different name. | |
| void | AddRef (RndObject *pReferrer) |
| Register an object as a store of a pointer to this one. | |
| void | RemoveRef (RndObject *pReferrer) |
| Drop the first registration AddRef() made for a referrer. | |
| const char * | GetName () const |
| const std::list< RndObject * > & | GetRefs () const |
| int | GetInternal () const |
| void | SetInternal (int nInternal) |
Static Public Member Functions | |
| static RndObject * | New (const char *pszName) |
| Create a material. | |
Static Public Attributes | |
| static const char * | sClassName |
| The class name a .rnd file writes, Mat. | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| static int | sLoadRev |
| The version Load() read last, which Stage::Load() consults. | |
| Static Public Attributes inherited from RndObject | |
| static constexpr int | kCopyChildLists = 0x200 |
| The bit of the Copy() flags that copies the child lists of the mix-ins. | |
Protected Member Functions | |
| void | ReleaseStageTex () |
| Drop the reference on every stage texture. | |
Protected Attributes | |
| std::vector< Stage > | mStages |
| int | mBlend |
| Color | mBaseColor |
| Color | mLightColor |
| Color | mEdgeColor |
| int | mEnable |
| int | mVertBase |
| int | mVertLight |
| int | mVertEdge |
| int | mNormalize |
| int | mBaseAmbient |
| int | mCull |
| int | mFlat |
| int | mMultiPass |
| Protected Attributes inherited from RndObject | |
| std::list< RndObject * > | mRefs |
| String | mName |
Surface description: blending, lighting colours, culling, and a list of texture stages.
The RTTI includes the class name and records RndObject as the one base. PsMat derives from it.
| enum RndMat::Blend |
How a surface or a texture stage combines with what is beneath it.
| Enumerator | |
|---|---|
| kBlendDest | Keep the destination. |
| kBlendSrc | Replace the destination. |
| kBlendAdd | Add the source to the destination. |
| kBlendMultiply | Multiply the destination by the source. |
| kBlendMultiply2 | Multiply the destination by twice the source. |
| kBlendSrcAlpha | Blend by the source alpha. |
| kBlendSrcAlphaAdd | Add the source scaled by its alpha. |
| kBlendSrcAdd | Add the source. |
| kBlendInvSrcAlpha | Blend by the inverse of the source alpha. |
| kBlendDestAlpha | Blend by the destination alpha. |
| kBlendInvDestAlpha | Blend by the inverse of the destination alpha. |
| kBlendSrcAlphaOpaque | Blend by the source alpha and write opaque alpha. |
| kBlendSrcAlphaCutout | Discard the source below an alpha threshold. |
| kBlendSubtract | Subtract the source from the destination. |
| enum RndMat::TexGen |
How a texture stage produces its texture coordinates.
| Enumerator | |
|---|---|
| kTexGenFixed | Use the vertex coordinates. |
| kTexGenSphere | Sphere map. |
| kTexGenPlanar | Planar projection. |
| kTexGenOrthoCube | Cube map in object space. |
| kTexGenLocalCube | Cube map in local space. |
| enum RndMat::TexWrap |
|
explicit |
Construct an enabled material that blends by source alpha, with a black base colour, a white light colour, and a black edge colour.
| pszName | The registry key. |
|
override |
Drop the references on the stage textures.
|
inline |
Allocate a material, billed to the class name.
| nSize | The object size the compiler supplies. |
|
inline |
Release a material.
| pBlock | The block. |
|
overridevirtual |
Write a description of the material.
| stream | The stream to write to. |
Reimplemented from RndObject.
|
overridevirtual |
Write the material.
| stream | The stream to write to. |
Implements RndObject.
Replace a stage texture with another object.
A replacement that is not a texture, or null, clears the stage texture.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Implements RndObject.
|
inlineoverridevirtual |
Report the class name.
Implements RndObject.
|
overridevirtual |
Copy another material.
The flat flag is not copied.
| pSource | The material to copy from. |
| nFlags | The set of fields to copy. The routine ignores it. |
Implements RndObject.
|
overridevirtual |
|
inlinevirtual |
Bring the platform state of one stage up to date.
The base body is empty. The name is inferred.
| nStage | The stage. |
|
inlinevirtual |
Set the red, green, and blue of the base colour.
| color | The colour. Its alpha is ignored. |
|
inlinevirtual |
Set the light colour.
| color | The colour. |
|
inlinevirtual |
Set the edge colour.
| color | The colour. |
|
inlinevirtual |
Set the alpha of the base colour.
| fAlpha | The alpha. |
|
virtual |
Set the lighting switches.
| bEnable | Non-zero to light the surface. |
| bVertBase | Non-zero to take the base colour from the vertices. |
| bVertLight | Non-zero to take the light colour from the vertices. |
| bVertEdge | Non-zero to take the edge colour from the vertices. |
| bNormalize | Non-zero to normalise the normals. |
| bBaseAmbient | Non-zero to light the base colour ambiently. |
|
virtual |
Take a reference on every stage texture and bring every stage up to date.
The name is inferred.
| void RndMat::AddStage | ( | ) |
Append a default stage.
The name is inferred.
|
inlinestatic |
Create a material.
| pszName | The registry key. |
|
inline |
|
inline |
|
inline |
|
inline |
| nBlend | The Blend of the surface. |
|
inline |
|
inline |
| nCull | The CullMode of the surface. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Drop the reference on every stage texture.
The name is inferred.
|
static |
The class name a .rnd file writes, Mat.
|
static |
|
static |
The version Load() read last, which Stage::Load() consults.
|
protected |
The texture stages.
|
protected |
The Blend of the surface.
|
protected |
The base colour.
|
protected |
The light colour.
|
protected |
The edge colour.
|
protected |
Non-zero to light the surface.
|
protected |
Non-zero to take the base colour from the vertices.
|
protected |
Non-zero to take the light colour from the vertices.
|
protected |
Non-zero to take the edge colour from the vertices.
|
protected |
Non-zero to normalise the normals.
|
protected |
Non-zero to light the base colour ambiently.
|
protected |
The CullMode of the surface.
|
protected |
Non-zero for flat shading.
|
protected |
The number of extra passes.