/usr/include/crystalspace-2.0/csgfx/lightsvcache.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /*
Copyright (C) 2005 by Jorrit Tyberghein
(C) 2005 by Frank Richter
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_CSGFX_SHADER_LIGHTSVCACHE_H__
#define __CS_CSGFX_SHADER_LIGHTSVCACHE_H__
#include "csextern.h"
#include "csutil/array.h"
#include "csutil/ref.h"
#include "iutil/strset.h"
#include "ivideo/shader/shader.h"
/**\file
* Helper to cache names of shader variables relevant to lighting.
*/
/**
* Helper to cache names of shader variables relevant to lighting.
*/
class CS_CRYSTALSPACE_EXPORT csLightShaderVarCache
{
public:
/// Properties of lights for which shader variables are known
enum LightProperty
{
/// Diffuse color
lightDiffuse = 0,
/// Specular color
lightSpecular,
/// Position (world space)
lightPositionWorld,
/// Transform (from light to world space)
lightTransformWorld,
/// Inverse transform (from world to light space)
lightTransformWorldInverse,
/// Attenuation vector
lightAttenuation,
/**
* Attenuation texture
* \deprecated Deprecated in 1.3.
*/
lightAttenuationTex,
/// Direction (world space)
lightDirectionWorld,
/// Spot inner falloff
lightInnerFalloff,
/// Spot outer falloff
lightOuterFalloff,
/// Light type (csLightType casted to int)
lightType,
/// Attenuation mode (csLightAttenuationMode casted to int)
lightAttenuationMode,
/// Shadow map projection matrix
lightShadowMapProjection,
/// Shadow map pixel sizes + dimensions
lightShadowMapPixelSize,
/// Number of properties
_lightCount
};
/// Other generally useful shader variables that can be obtained
enum DefaultSV
{
/// "light ambient"
varAmbient = 0,
/// "light count"
varLightCount,
/// Number of other variables
_varCount
};
private:
csRef<iShaderVarStringSet> strings;
CS::ShaderVarStringID defaultVars[_varCount];
CS::ShaderVarStringID lightSVIdCache_unnumbered[_lightCount];
void ClearDefVars ();
public:
/**
* Construct an instance.
* \remarks The instance is only useable after a call to SetStrings().
*/
csLightShaderVarCache () { ClearDefVars (); }
/**
* Set the string set to query the name identifiers from.
* \remarks Changing the string set will clear the cached names.
*/
void SetStrings (iShaderVarStringSet* strings);
/**
* Obtain the name for for a lighting-relevant shader variable.
* A caching scheme is used to avoid having to re-request a name from the
* given string set every time one is needed.
* \param prop Light property for which a variable name is to be retrieved.
* \return Name of the relevant variable, csInvalidStringID in case of an
* error.
*/
CS::ShaderVarStringID GetLightSVId (LightProperty prop);
/**
* 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.
* \param var Variable for which a name is to be retrieved.
* \return Name of the relevant variable, csInvalidStringID in case of an
* error.
*/
CS::ShaderVarStringID GetDefaultSVId (DefaultSV var);
};
#endif // __CS_CSGFX_SHADER_LIGHTSVCACHE_H__
|