Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <technique.h>
Classes | |
struct | ShaderParam |
struct | TextureUnit |
Public Types | |
enum | Tristate { False =0, True =1, Auto =2 } |
enum | Type { FixedPass, ShaderPass } |
enum | BlendMode { Default, Add, Multiply, AlphaBlend, Decal, PremultAlphaBlend, MultiAlphaBlend } |
enum | DepthFunction { Less, LEqual, Greater, GEqual, Equal, Always, Never } |
enum | Face { None, Front, Back, FrontAndBack, DefaultFace } |
enum | PolyMode { Point, Line, Fill } |
Public Member Functions | |
Pass () | |
~Pass () | |
void | setProgram (const std::string &vertex, const std::string &fragment) |
int | getCompiledProgram () const |
void | addTextureUnit (const std::string &source, int target, const std::string &deflt, const std::string ¶mName, Technique::Pass::TextureUnit::Kind texKind) |
void | addShaderParam (const std::string &name, float value[4], bool optional) |
void | addShaderParam (const std::string &name, ShaderParam::Semantic semantic, bool optional) |
size_t | getNumTextureUnits () const |
const TextureUnit & | getTextureUnit (int index) const |
TextureUnit & | getTextureUnit (int index) |
size_t | getNumShaderParams () const |
const ShaderParam & | getShaderParam (int index) const |
ShaderParam & | getShaderParam (int index) |
void | compile () |
bool | isCompiled () const |
bool | isCompiled (int programVersion) const |
Public Attributes | |
Type | type |
bool | sRGBAware |
bool | colorWrite |
Tristate | zWrite |
unsigned int | perLightIteration |
unsigned int | maxIterations |
BlendMode | blendMode |
DepthFunction | depthFunction |
Face | cullMode |
PolyMode | polyMode |
float | offsetFactor |
float | offsetUnits |
float | lineWidth |
int | sequence |
Definition at line 22 of file technique.h.
Definition at line 62 of file technique.h.
Enumerator | |
---|---|
None | |
Front | |
Back | |
FrontAndBack | |
DefaultFace |
Definition at line 97 of file technique.h.
Enumerator | |
---|---|
Point | |
Line | |
Fill |
Definition at line 106 of file technique.h.
Enumerator | |
---|---|
False | |
True | |
Auto |
Definition at line 37 of file technique.h.
Definition at line 44 of file technique.h.
Technique::Pass::Pass | ( | ) |
Definition at line 261 of file technique.cpp.
Technique::Pass::~Pass | ( | ) |
Definition at line 278 of file technique.cpp.
Add a constant shader param
name | A string defining the shader's parameter name. |
value | An array of 4 floats with the parameter's value. |
optional | Optional parameters are allowed to be left unresolved. |
void Technique::Pass::addShaderParam | ( | const std::string & | name, |
ShaderParam::Semantic | semantic, | ||
bool | optional | ||
) |
Add an automatic shader param
name | A string defining the shader's parameter name. |
semantic | The kind of value that will be automatically put in the variable. |
optional | Optional parameters are allowed to be left unresolved. |
void Technique::Pass::addTextureUnit | ( | const std::string & | source, |
int | target, | ||
const std::string & | deflt, | ||
const std::string & | paramName, | ||
Technique::Pass::TextureUnit::Kind | texKind | ||
) |
Add a texture unit
source | A string of the form [type]:[path or index] that specifies the texture unit's data source. |
target | The target texturing unit |
deflt | A string of the form [type]:[path or index] that specifies the texture unit's default data source if the mesh lacks the specified decal in 'source' |
paramName | The shader parameter name (for a shader pass) that is to be bound to this texture unit. |
Definition at line 290 of file technique.cpp.
References Technique::Pass::TextureUnit::defaultIndex, Technique::Pass::TextureUnit::defaultPath, Technique::Pass::TextureUnit::defaultType, Technique::Pass::TextureUnit::origTargetIndex, __impl::parseSourceType(), Technique::Pass::TextureUnit::sourceIndex, Technique::Pass::TextureUnit::sourcePath, Technique::Pass::TextureUnit::sourceType, Technique::Pass::TextureUnit::targetIndex, Technique::Pass::TextureUnit::targetParamId, Technique::Pass::TextureUnit::targetParamName, and Technique::Pass::TextureUnit::texKind.
void Technique::Pass::compile | ( | ) |
Compile the pass (shaders, fetch shader params, etc...)
Definition at line 365 of file technique.cpp.
References gl_options_t::ext_srgb_framebuffer, GFXCreateProgram(), GFXDestroyProgram(), GFXGetProgramVersion(), GFXNamedShaderConstant(), gl_options, max(), gl_options_t::nv_fp2, BaseUtil::Texture(), and VSFileSystem::vs_dprintf().
|
inline |
Get the vertex and fragment programs, compiled. 0 for fixed-function
Definition at line 301 of file technique.h.
|
inline |
Get the number of shader params in this pass
Definition at line 358 of file technique.h.
Referenced by GameUnit< UnitType >::applyTechniqueOverrides().
|
inline |
Get the number of texture units in this pass
Definition at line 340 of file technique.h.
Referenced by OrigMeshContainer::operator<().
|
inline |
Get the specified shader param
Definition at line 364 of file technique.h.
References index.
Referenced by GameUnit< UnitType >::applyTechniqueOverrides().
|
inline |
|
inline |
Get the specified texture unit
Definition at line 346 of file technique.h.
References index.
Referenced by OrigMeshContainer::operator<().
|
inline |
bool Technique::Pass::isCompiled | ( | ) | const |
Return whether the pass has been compiled or not
Definition at line 450 of file technique.cpp.
Return whether the pass has been compiled with a matching program version
Return whether the pass has been compiled or not with a matching program version
Definition at line 456 of file technique.cpp.
void Technique::Pass::setProgram | ( | const std::string & | vertex, |
const std::string & | fragment | ||
) |
Set the vertex and fragment programs - throw on error
Definition at line 283 of file technique.cpp.
BlendMode Technique::Pass::blendMode |
Blending mode - either default or an override
Definition at line 270 of file technique.h.
Referenced by setupGLState().
bool Technique::Pass::colorWrite |
Whether to write the color buffer or not
Definition at line 258 of file technique.h.
Referenced by setupGLState().
Face Technique::Pass::cullMode |
Polygon backface culling mode. Front will CULL Front faces, so standard is Back
Definition at line 276 of file technique.h.
Referenced by setupGLState().
DepthFunction Technique::Pass::depthFunction |
Z-test function - far queue always overrides with Always
Definition at line 273 of file technique.h.
Referenced by setupGLState().
float Technique::Pass::lineWidth |
Line width - for line-mode polygons
Definition at line 288 of file technique.h.
Referenced by setupGLState().
unsigned int Technique::Pass::maxIterations |
The maximum number of iterations, 0 means infinite - nonzero helps keep performance acceptable
Definition at line 267 of file technique.h.
float Technique::Pass::offsetFactor |
Polygon offset slope factor
Definition at line 282 of file technique.h.
Referenced by setupGLState().
float Technique::Pass::offsetUnits |
unsigned int Technique::Pass::perLightIteration |
The number of lights this pass can handle, 0 means infinite
Definition at line 264 of file technique.h.
PolyMode Technique::Pass::polyMode |
Polygon rasterization mode
Definition at line 279 of file technique.h.
Referenced by setupGLState().
int Technique::Pass::sequence |
Sequence number, the order in which passes are rendered
Definition at line 291 of file technique.h.
bool Technique::Pass::sRGBAware |
Shaders are aware of SRGB frambuffers, so everything should be set up for sRGB blending if sRGB framebuffers are available. Shaders will be compiled with SRGB_FRAMEBUFFER set to 0 (not supported) or 1 (supported).
Definition at line 255 of file technique.h.
Referenced by setupGLState().
Type Technique::Pass::type |
Type of pass - shader or fixed pipeline
Definition at line 249 of file technique.h.
Referenced by Mesh::ProcessDrawQueue().
Tristate Technique::Pass::zWrite |
Whether to write the z-buffer or not - default or an override
Definition at line 261 of file technique.h.