QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::Shader Struct Reference
[Shading & Lighting]

Mesh surface description. More...

#include <Q/q.h>

Inheritance diagram for Q::Shader:

Q::Object Q::ObjectBase List of all members.

Public Member Functions

 Shader ()
 Shader (const char *name)
Utils::Result setDiffuseColor (const Maths::Vec4f &v)
Utils::Result setAmbientColor (const Maths::Vec4f &v)
Utils::Result setSpecularColor (const Maths::Vec4f &v)
Utils::Result setEmissiveColor (const Maths::Vec4f &v)
Utils::Result setShininess (float s)
Utils::Result setDiffuseMap (const TextureEffect &t)
Utils::Result setSpecularMap (const TextureEffect &t)
Utils::Result setUseMaterialAmbient (bool b)
Utils::Result setUseMaterialDiffuse (bool b)
Utils::Result setAdditiveBlend (bool b)
Utils::Result setDepthWriteDisable (bool b)
Utils::Result setAlphaMask (bool b)
Utils::Result setClampedTextureAddressing (bool b)
Utils::Result optimize ()
Maths::Vec4f diffuseColor () const
Maths::Vec4f ambientColor () const
Maths::Vec4f specularColor () const
Maths::Vec4f emissiveColor () const
float shininess () const
TextureEffect diffuseMap () const
TextureEffect specularMap () const
bool useMaterialAmbient () const
bool useMaterialDiffuse () const
bool additiveBlend () const
bool depthWriteDisable () const
bool alphaMask () const
bool clampedTextureAddressing () const

Static Public Member Functions

Shader create (const char *name, const TextureEffect &diffuseMap, const Database &db=Database())
Shader find (const char *name)
Shader defaultShader ()
ClassType classType ()
Shader cast (const ObjectBase &)

Detailed Description

Mesh surface description.

The Shader object is used to define the surface appearance of objects in the scene. This includes defining the textures used, material colors and other properties used for rendering the objects.


Constructor & Destructor Documentation

Q::Shader::Shader  )  [inline]
 

Create a null shader reference.

Q::Shader::Shader const char *  name  ) 
 

Search the currently attached databases for a shader with the given name.


Member Function Documentation

bool Q::Shader::additiveBlend  )  const
 

Return true if additive blending should be used for the shader.

bool Q::Shader::alphaMask  )  const
 

Return true if the alpha channel contains only one bit of information.

Maths::Vec4f Q::Shader::ambientColor  )  const
 

Return the ambient color of the shader.

Shader Q::Shader::cast const ObjectBase  )  [static]
 

If the object referenced by obj is a shader, then return a suitable Shader reference to the object.

Note:
Casting this object will cause it to be loaded from the database if it is not currently resident.

bool Q::Shader::clampedTextureAddressing  )  const
 

Return true if the texture addressing mode is set to clamp instead of the normal mode of wrap.

ClassType Q::Shader::classType  )  [static]
 

Return the type for this class.

Shader Q::Shader::create const char *  name,
const TextureEffect diffuseMap,
const Database db = Database()
[static]
 

Create a new shader named name in the given database, db, (or the most recently attached read-write database if db is null). The diffuse texture for the new shader is set to diffuseMap.

Shader Q::Shader::defaultShader  )  [static]
 

Return a default shader.

bool Q::Shader::depthWriteDisable  )  const
 

Return true if objects rendered using this shader should not update the depth buffer.

Maths::Vec4f Q::Shader::diffuseColor  )  const
 

Return the diffuse color of the shader.

TextureEffect Q::Shader::diffuseMap  )  const
 

Return the diffuse texture for the shader.

Maths::Vec4f Q::Shader::emissiveColor  )  const
 

Return the emissive color of the shader.

Shader Q::Shader::find const char *  name  )  [static]
 

Search the currently attached databases for a shader with the given name and return that object, if it exists.

Utils::Result Q::Shader::optimize  ) 
 

Given the existing state of the shader, this method calculates the optimum means of rendering objects using the shader. This should be called once after initialising all values of the shader.

Utils::Result Q::Shader::setAdditiveBlend bool  b  ) 
 

When b is true, the images generated when rendering objects using the shader are blended with the other objects in the scene by adding the colors together.

Utils::Result Q::Shader::setAlphaMask bool  b  ) 
 

When b is true, this hints that the alpha channel of the texture contains only one bit of information (i.e. a texel is either fully opaque or fully transparent). This can allow more efficient rendering of the object.

Utils::Result Q::Shader::setAmbientColor const Maths::Vec4f v  ) 
 

Set the ambient color of the shader.

Utils::Result Q::Shader::setClampedTextureAddressing bool  b  ) 
 

When b is true, the texture addressing mode is set to be clamped rather than wrapped. This means that textures will not tile but will instead copy the last texel from the edge of the texture.

Utils::Result Q::Shader::setDepthWriteDisable bool  b  ) 
 

When b is true, objects rendered using this shader do not update the depth buffer.

Utils::Result Q::Shader::setDiffuseColor const Maths::Vec4f v  ) 
 

Set the diffuse color of the shader.

Utils::Result Q::Shader::setDiffuseMap const TextureEffect t  ) 
 

Set the diffuse texture for the shader.

Utils::Result Q::Shader::setEmissiveColor const Maths::Vec4f v  ) 
 

Set the emissive color of the shader.

Utils::Result Q::Shader::setShininess float  s  ) 
 

Set the shininess value for the shader.

Utils::Result Q::Shader::setSpecularColor const Maths::Vec4f v  ) 
 

Set the specular color of the shader.

Utils::Result Q::Shader::setSpecularMap const TextureEffect t  ) 
 

Set the specular texture for the shader.

Utils::Result Q::Shader::setUseMaterialAmbient bool  b  ) 
 

If b is true, then the shader's ambient color will be used to modulate the ambient light value during lighting. If b is false, then the vertex color is used instead.

Utils::Result Q::Shader::setUseMaterialDiffuse bool  b  ) 
 

If b is true, then the shader's diffuse color will be used to modulate the diffuse light value during lighting. If b is false, then the vertex color is used instead.

float Q::Shader::shininess  )  const
 

Return the shininess value for the shader.

Maths::Vec4f Q::Shader::specularColor  )  const
 

Return the specular color of the shader.

TextureEffect Q::Shader::specularMap  )  const
 

Return the specular texture for the shader.

bool Q::Shader::useMaterialAmbient  )  const
 

Return true if the material's ambient color should be used in ambient lighting calculations or false if the vertex color should be used.

bool Q::Shader::useMaterialDiffuse  )  const
 

Return true if the material's diffuse color should be used in diffuse lighting calculations or false if the vertex color should be used.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004