C# Class idTech4.Renderer.idMaterial

Material.
Any errors during parsing just set MF_DEFAULTED and return, rather than throwing a hard error. This will cause the material to fall back to default material, but otherwise let things continue.

Each material may have a set of calculations that must be evaluated before drawing with it.

Every expression that a material uses can be evaluated at one time, which will allow for perfect common subexpression removal when I get around to writing it.

Without this, scrolling an entire surface could result in evaluating the same texture matrix calculations a half dozen times.

Open question: should I allow arbitrary per-vertex color, texCoord, and vertex calculations to be specified in the material code?

Every stage will definately have a valid image pointer.

We might want the ability to change the sort value based on conditionals, but it could be a hassle to implement,

Inheritance: idTech4.Text.idDecl
Afficher le fichier Open project: iainmckay/idtech4.net Class Usage Examples

Méthodes publiques

Méthode Description
AddReference ( ) : void
EvaluateRegisters ( float &registers, float shaderParms, View view ) : void
EvaluateRegisters ( float &registers, float shaderParms, View view, idSoundEmitter soundEmitter ) : void
GetStage ( int index ) : MaterialStage
Parse ( string text ) : bool

Parses the current material definition and finds all necessary images.

TestMaterialFlag ( MaterialFlags flag ) : bool

Test for existance of specific material flag(s).

idMaterial ( ) : System

Méthodes protégées

Méthode Description
ClearData ( ) : void
GenerateDefaultText ( ) : bool

Private Methods

Méthode Description
AddImplicitStages ( TextureRepeat textureRepeatDefault = TextureRepeat.Repeat ) : void

Adds implicit stages to the material.

If a material has diffuse or specular stages without any bump stage, add an implicit _flat bumpmap stage.

It is valid to have either a diffuse or specular without the other.

It is valid to have a reflection map and a bump map for bumpy reflection.

AppendToken ( StringBuilder b, idToken token ) : void
CheckForConstantRegisters ( ) : void

As of 5/2/03, about half of the unique materials loaded on typical maps are constant, but 2/3 of the surface references are. This is probably an optimization of dubious value.

CheckSurfaceParameter ( idToken token ) : bool

See if the current token matches one of the surface parameter bit flags.

Clear ( ) : void
EmitOp ( int a, int b, ExpressionOperationType opType ) : int
GetDestinationBlendMode ( string name ) : MaterialStates
GetExpressionConstant ( float f ) : int
GetExpressionOperation ( ) : ExpressionOperation
GetExpressionTemporary ( ) : int
GetSourceBlendMode ( string name ) : MaterialStates
MatchAndAppendToken ( StringBuilder b, idLexer lexer, string match ) : void
MatchToken ( idLexer lexer, string match ) : bool

Sets defaultShader and returns false if the next token doesn't match.

MultiplyTextureMatrix ( TextureStage &textureStage, int registers ) : void
ParseBlend ( idLexer lexer, MaterialStage &stage ) : void
ParseDecalInfo ( idLexer lexer ) : void
ParseDeform ( idLexer lexer ) : void
ParseEmitOp ( idLexer lexer, int a, ExpressionOperationType opType, int priority ) : int
ParseExpression ( idLexer lexer ) : int

ParseExpressionPriority ( idLexer lexer, int priority ) : int
ParseFragmentMap ( idLexer lexer, NewMaterialStage &newStage ) : void
ParseMaterial ( idLexer lexer ) : void

Parses the material, if there are any errors during parsing the defaultShader will be set.

ParsePastImageProgram ( idLexer lexer ) : string
ParseSort ( idLexer lexer ) : void
ParseStage ( idLexer lexer, TextureRepeat textureRepeatDefault ) : void
ParseTerm ( idLexer lexer ) : int

ParseVertexParameter ( idLexer lexer, NewMaterialStage &newStage ) : void

Parses a vertex parameter.

If there is a single value, it will be repeated across all elements. If there are two values, 3 = 0.0, 4 = 1.0. if there are three values, 4 = 1.0.

SortInteractionStages ( ) : void

Sorts the shader stages.

The renderer expects bump, then diffuse, then specular There can be multiple bump maps, followed by additional diffuse and specular stages, which allows cross-faded bump mapping. Ambient stages can be interspersed anywhere, but they are ignored during interactions, and all the interaction stages are ignored during ambient drawing.

Method Details

AddReference() public méthode

public AddReference ( ) : void
Résultat void

ClearData() protected méthode

protected ClearData ( ) : void
Résultat void

EvaluateRegisters() public méthode

public EvaluateRegisters ( float &registers, float shaderParms, View view ) : void
registers float
shaderParms float
view View
Résultat void

EvaluateRegisters() public méthode

public EvaluateRegisters ( float &registers, float shaderParms, View view, idSoundEmitter soundEmitter ) : void
registers float
shaderParms float
view View
soundEmitter idSoundEmitter
Résultat void

GenerateDefaultText() protected méthode

protected GenerateDefaultText ( ) : bool
Résultat bool

GetStage() public méthode

public GetStage ( int index ) : MaterialStage
index int
Résultat MaterialStage

Parse() public méthode

Parses the current material definition and finds all necessary images.
public Parse ( string text ) : bool
text string
Résultat bool

TestMaterialFlag() public méthode

Test for existance of specific material flag(s).
public TestMaterialFlag ( MaterialFlags flag ) : bool
flag MaterialFlags
Résultat bool

idMaterial() public méthode

public idMaterial ( ) : System
Résultat System