Crystal Space: csLightShaderVarCache Class Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csLightShaderVarCache Class Reference

Helper to cache names of shader variables relevant to lighting. More...

`#include <csgfx/lightsvcache.h>`

List of all members.

## Public Types
| _lightCount
| Number of properties.
| _varCount
| Number of other variables.
enum | DefaultSV { varAmbient = 0, varLightCount, _varCount }
| Other generally useful shader variables that can be obtained. More...
| lightAttenuation
| Attenuation vector.
| lightAttenuationMode
| Attenuation mode (csLightAttenuationMode casted to int).
| lightAttenuationTex
| Attenuation texture.
| lightDiffuse = 0
| Diffuse color.
| lightDirection
| Direction (object space).
| lightDirectionCamera
| Direction (camera space).
| lightDirectionWorld
| Direction (world space).
| lightInnerFalloff
| Spot inner falloff.
| lightOuterFalloff
| Spot outer falloff.
| lightPosition
| Position (object space).
| lightPositionCamera
| Position (camera space).
| lightPositionWorld
| Position (world space).
enum | LightProperty { lightDiffuse = 0, lightSpecular, lightPosition, lightPositionCamera, lightPositionWorld, lightTransformCamera, lightTransformWorld, lightAttenuation, lightAttenuationTex, lightDirection, lightDirectionCamera, lightDirectionWorld, lightInnerFalloff, lightOuterFalloff, lightType, lightAttenuationMode, _lightCount }
| Properties of lights for which shader variables are known. More...
| lightSpecular
| Specular color.
| lightTransformCamera
| Transform (camera space).
| lightTransformWorld
| Transform (world space).
| lightType
| Light type (csLightType casted to int).
| varAmbient = 0
| "light ambient"
| varLightCount
| "light count"
## Public Member Functions
| csLightShaderVarCache ()
| Construct an instance.
csStringID | GetDefaultSVId (DefaultSV var)
| Obtain the name for for a lighting-relevant shader variable whose name does not depend on the number of a light.
csStringID | GetLightSVId (size_t num, LightProperty prop)
| Obtain the name for for a lighting-relevant shader variable whose name also depends on the number of a light.
void | SetStrings (iStringSet *strings)
| Set the string set to query the name identifiers from.

## Detailed Description

Helper to cache names of shader variables relevant to lighting.

Definition at line 36 of file lightsvcache.h.

## Member Enumeration Documentation

enum csLightShaderVarCache::DefaultSV

Other generally useful shader variables that can be obtained.

Enumerator:

  varAmbient | "light ambient"
  varLightCount | "light count"
  _varCount | Number of other variables.

Definition at line 80 of file lightsvcache.h.

enum csLightShaderVarCache::LightProperty

Properties of lights for which shader variables are known.

Enumerator:

  lightDiffuse | Diffuse color.
  lightSpecular | Specular color.
  lightPosition | Position (object space).
  lightPositionCamera | Position (camera space).
  lightPositionWorld | Position (world space).
  lightTransformCamera | Transform (camera space).
  lightTransformWorld | Transform (world space).
  lightAttenuation | Attenuation vector.
  lightAttenuationTex | Attenuation texture.
  lightDirection | Direction (object space).
  lightDirectionCamera | Direction (camera space).
  lightDirectionWorld | Direction (world space).
  lightInnerFalloff | Spot inner falloff.
  lightOuterFalloff | Spot outer falloff.
  lightType | Light type (csLightType casted to int).
  lightAttenuationMode | Attenuation mode (csLightAttenuationMode casted to int).
  _lightCount | Number of properties.

Definition at line 40 of file lightsvcache.h.

## Constructor & Destructor Documentation

csLightShaderVarCache::csLightShaderVarCache | ( |  | ) | `[inline]`

Construct an instance.

Remarks:
  The instance is only useable after a call to SetStrings().

Definition at line 105 of file lightsvcache.h.

## Member Function Documentation

csStringID csLightShaderVarCache::GetDefaultSVId | ( | DefaultSV | var | ) |

Obtain the name for for a lighting-relevant shader variable whose name does not depend on the number of a light.

A caching scheme is used to avoid having to re-request a name from the given string set every time one is needed.

Parameters:

  | var | Variable for which a name is to be retrieved.

Returns:
  Name of the relevant variable, csInvalidStringID in case of an error.

csStringID csLightShaderVarCache::GetLightSVId | ( | size_t | num,
|  | LightProperty | prop |
| ) |  |  |

Obtain the name for for a lighting-relevant shader variable whose name also depends on the number of a light.

A caching scheme is used to avoid having to re-request a name from the given string set every time one is needed.

Parameters:

  | num | Number of the light that appears in the name
  | prop | Light property for which a variable name is to be retrieved.

Returns:
  Name of the relevant variable, csInvalidStringID in case of an error.

Referenced by csLightProperties::csLightProperties().

void csLightShaderVarCache::SetStrings | ( | iStringSet * | strings | ) |

Set the string set to query the name identifiers from.

Remarks:
  Changing the string set will clear the cached names.

The documentation for this class was generated from the following file:

- csgfx/lightsvcache.h