| ## Public API Reference

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

- File List
- File Members

# csgfx/lightsvcache.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005 by Jorrit Tyberghein
    00003               (C) 2005 by Frank Richter
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public
    00016     License along with this library; if not, write to the Free
    00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00018 */
    00019
    00020 #ifndef __CS_CSGFX_SHADER_LIGHTSVCACHE_H__
    00021 #define __CS_CSGFX_SHADER_LIGHTSVCACHE_H__
    00022
    00023 #include "csextern.h"
    00024
    00025 #include "csutil/array.h"
    00026 #include "csutil/ref.h"
    00027 #include "iutil/strset.h"
    00028
    00036 class CS_CRYSTALSPACE_EXPORT csLightShaderVarCache
    00037 {
    00038 public:
    00040   enum LightProperty
    00041   {
    00043     lightDiffuse = 0,
    00045     lightSpecular,
    00047     lightPosition,
    00049     lightPositionCamera,
    00051     lightPositionWorld,
    00053     lightTransformCamera,
    00055     lightTransformWorld,
    00057     lightAttenuation,
    00059     lightAttenuationTex,
    00061     lightDirection,
    00063     lightDirectionCamera,
    00065     lightDirectionWorld,
    00067     lightInnerFalloff,
    00069     lightOuterFalloff,
    00071     lightType,
    00073     lightAttenuationMode,
    00074
    00076     _lightCount
    00077   };
    00078
    00080   enum DefaultSV
    00081   {
    00083     varAmbient = 0,
    00085     varLightCount,
    00086
    00088     _varCount
    00089   };
    00090 private:
    00091   struct LightSvIdCacheEntry
    00092   {
    00093     csStringID ids[_lightCount];
    00094   };
    00095   csArray<LightSvIdCacheEntry> lightSVIdCache;
    00096   csRef<iStringSet> strings;
    00097   csStringID defaultVars[_varCount];
    00098
    00099   void ClearDefVars ();
    00100 public:
    00105   csLightShaderVarCache () { ClearDefVars(); }
    00106
    00111   void SetStrings (iStringSet* strings);
    00112
    00123   csStringID GetLightSVId (size_t num, LightProperty prop);
    00124
    00134   csStringID GetDefaultSVId (DefaultSV var);
    00135 };
    00136
    00137 #endif // __CS_CSGFX_SHADER_LIGHTSVCACHE_H__