CrystalSpace

Public API Reference

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 #include "ivideo/shader/shader.h"
00029 
00037 class CS_CRYSTALSPACE_EXPORT csLightShaderVarCache
00038 {
00039 public:
00041   enum LightProperty
00042   {
00044     lightDiffuse = 0,
00046     lightSpecular,
00048     lightPositionWorld,
00050     lightTransformWorld,
00052     lightTransformWorldInverse,
00054     lightAttenuation,
00059     lightAttenuationTex,
00061     lightDirectionWorld,
00063     lightInnerFalloff,
00065     lightOuterFalloff,
00067     lightType,
00069     lightAttenuationMode,
00071     lightShadowMapProjection,
00073     lightShadowMapPixelSize,
00074 
00076     _lightCount
00077   };
00078 
00080   enum DefaultSV
00081   {
00083     varAmbient = 0,
00085     varLightCount,
00086     
00088     _varCount
00089   };
00090 private:
00091   csRef<iShaderVarStringSet> strings;
00092   CS::ShaderVarStringID defaultVars[_varCount];
00093   
00094   CS::ShaderVarStringID lightSVIdCache_unnumbered[_lightCount];
00095   
00096   void ClearDefVars ();
00097 public:
00102   csLightShaderVarCache () { ClearDefVars (); }
00103   
00108   void SetStrings (iShaderVarStringSet* strings);
00109   
00118   CS::ShaderVarStringID GetLightSVId (LightProperty prop);
00119     
00129   CS::ShaderVarStringID GetDefaultSVId (DefaultSV var);
00130 };
00131 
00132 #endif // __CS_CSGFX_SHADER_LIGHTSVCACHE_H__

Generated for Crystal Space 2.0 by doxygen 1.7.6.1