CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 "iutil/strset.h"
00026 
00034 class CS_CRYSTALSPACE_EXPORT csLightShaderVarCache
00035 {
00036 public:
00038   enum LightProperty
00039   {
00041     lightDiffuse = 0,
00043     lightSpecular,
00045     lightPosition,
00047     lightPositionCamera,
00049     lightPositionWorld,
00051     lightAttenuation,
00053     lightAttenuationTex,
00055     lightDirection,
00057     lightDirectionCamera,
00059     lightDirectionWorld,
00061     lightInnerFalloff,
00063     lightOuterFalloff,
00065     lightType,
00067     lightAttenuationMode,
00068 
00070     _lightCount
00071   };
00072 
00074   enum DefaultSV
00075   {
00077     varAmbient = 0,
00079     varLightCount,
00080     
00082     _varCount
00083   };
00084 private:
00085   struct LightSvIdCacheEntry
00086   {
00087     csStringID ids[_lightCount];
00088   };
00089   csArray<LightSvIdCacheEntry> lightSVIdCache;
00090   csRef<iStringSet> strings;
00091   csStringID defaultVars[_varCount];
00092   
00093   void ClearDefVars ();
00094 public:
00099   csLightShaderVarCache () { ClearDefVars(); }
00100   
00105   void SetStrings (iStringSet* strings);
00106   
00117   csStringID GetLightSVId (size_t num, LightProperty prop);
00118     
00128   csStringID GetDefaultSVId (DefaultSV var);
00129 };
00130 
00131 #endif // __CS_CSGFX_SHADER_LIGHTSVCACHE_H__

Generated for Crystal Space by doxygen 1.4.4