iengine/light.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

- File List
- File Members

iengine/light.h
Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2000-2001 by Jorrit Tyberghein
    00003     Copyright (C) 1999 by Andrew Zabolotny <bit@eltech.ru>
    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_IENGINE_LIGHT_H__
    00021 #define __CS_IENGINE_LIGHT_H__
    00022
    00030 #include "csutil/scf.h"
    00031
    00032 class csColor;
    00033 class csFlags;
    00034 class csVector3;
    00035 class csVector4;
    00036 class csBox3;
    00037
    00038 struct iLight;
    00039 struct iMovable;
    00040 struct iObject;
    00041 struct iSector;
    00042 struct iSceneNode;
    00043 struct iShaderVariableContext;
    00044
    00045 struct iBaseHalo;
    00046 struct iCrossHalo;
    00047 struct iNovaHalo;
    00048 struct iFlareHalo;
    00049
    00052
    00053 #define CS_LIGHT_NOSHADOWS      0x00000001
    00054
    00060 #define CS_LIGHT_ACTIVEHALO     0x80000000
    00061
    00066 enum csLightDynamicType
    00067 {
    00073   CS_LIGHT_DYNAMICTYPE_STATIC = 1,
    00074
    00080   CS_LIGHT_DYNAMICTYPE_PSEUDO = 2,
    00081
    00087   CS_LIGHT_DYNAMICTYPE_DYNAMIC = 3
    00088 };
    00091
    00092 #define CS_DEFAULT_LIGHT_LEVEL 20
    00093
    00094 #define CS_NORMAL_LIGHT_LEVEL 128
    00095
    00109 enum csLightAttenuationMode
    00110 {
    00112   CS_ATTN_NONE = 0,
    00114   CS_ATTN_LINEAR = 1,
    00116   CS_ATTN_INVERSE = 2,
    00118   CS_ATTN_REALISTIC = 3,
    00123   CS_ATTN_CLQ = 4
    00124 };
    00139 enum csLightType
    00140 {
    00142   CS_LIGHT_POINTLIGHT,
    00144   CS_LIGHT_DIRECTIONAL,
    00146   CS_LIGHT_SPOTLIGHT
    00147 };
    00148
    00157 struct iLightCallback : public virtual iBase
    00158 {
    00159   SCF_INTERFACE(iLightCallback,2,0,0);
    00164   virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0;
    00165
    00170   virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0;
    00171
    00176   virtual void OnSectorChange (iLight* light, iSector* newsector) = 0;
    00177
    00182   virtual void OnRadiusChange (iLight* light, float newradius) = 0;
    00183
    00188   virtual void OnDestroy (iLight* light) = 0;
    00189
    00194   virtual void OnAttenuationChange (iLight* light, int newatt) = 0;
    00195 };
    00196
    00197
    00233 struct iLight : public virtual iBase
    00234 {
    00235   SCF_INTERFACE(iLight,3,0,1);
    00237   virtual const char* GetLightID () = 0;
    00238
    00240   virtual iObject *QueryObject() = 0;
    00241
    00249   virtual csLightDynamicType GetDynamicType () const = 0;
    00250
    00256   CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.")
    00257   virtual const csVector3& GetCenter () const = 0;
    00263   CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.")
    00264   virtual const csVector3 GetFullCenter () const = 0;
    00269   CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.")
    00270   virtual void SetCenter (const csVector3& pos) = 0;
    00271
    00276   CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.")
    00277   virtual iSector *GetSector () = 0;
    00278
    00287   virtual iMovable *GetMovable () = 0;
    00288
    00292   virtual iSceneNode* QuerySceneNode () = 0;
    00293
    00295   virtual const csColor& GetColor () const = 0;
    00297   virtual void SetColor (const csColor& col) = 0;
    00298
    00300   virtual const csColor& GetSpecularColor () const = 0;
    00302   virtual void SetSpecularColor (const csColor& col) = 0;
    00303
    00305   virtual csLightType GetType () const = 0;
    00307   virtual void SetType (csLightType type) = 0;
    00308
    00313   virtual csLightAttenuationMode GetAttenuationMode () const = 0;
    00318   virtual void SetAttenuationMode (csLightAttenuationMode a) = 0;
    00319
    00324   virtual void SetAttenuationConstants (const csVector4& constants) = 0;
    00329   virtual const csVector4 &GetAttenuationConstants () const = 0;
    00330
    00337   virtual float GetCutoffDistance () const = 0;
    00338
    00345   virtual void SetCutoffDistance (float distance) = 0;
    00346
    00352   virtual float GetDirectionalCutoffRadius () const = 0;
    00353
    00359   virtual void SetDirectionalCutoffRadius (float radius) = 0;
    00360
    00364   virtual void SetSpotLightFalloff (float inner, float outer) = 0;
    00365
    00369   virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0;
    00370
    00372   virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0;
    00374   virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes,
    00375         float roundness) = 0;
    00377   virtual iFlareHalo* CreateFlareHalo () = 0;
    00378
    00380   virtual iBaseHalo* GetHalo () const = 0;
    00381
    00383   virtual float GetBrightnessAtDistance (float d) const = 0;
    00384
    00390   virtual csFlags& GetFlags () = 0;
    00391
    00396   virtual void SetLightCallback (iLightCallback* cb) = 0;
    00397
    00401   virtual void RemoveLightCallback (iLightCallback* cb) = 0;
    00402
    00404   virtual int GetLightCallbackCount () const = 0;
    00405
    00407   virtual iLightCallback* GetLightCallback (int idx) const = 0;
    00408
    00413   virtual uint32 GetLightNumber () const = 0;
    00414
    00418   virtual iShaderVariableContext* GetSVContext() = 0;
    00419
    00421
    00424   virtual const csBox3& GetLocalBBox () const = 0;
    00425   virtual const csBox3& GetWorldBBox () const = 0;
    00427 };
    00428
    00438 struct iLightList : public virtual iBase
    00439 {
    00440   SCF_INTERFACE(iLightList,2,0,0);
    00442   virtual int GetCount () const = 0;
    00443
    00445   virtual iLight *Get (int n) const = 0;
    00446
    00448   virtual int Add (iLight *obj) = 0;
    00449
    00451   virtual bool Remove (iLight *obj) = 0;
    00452
    00454   virtual bool Remove (int n) = 0;
    00455
    00457   virtual void RemoveAll () = 0;
    00458
    00460   virtual int Find (iLight *obj) const = 0;
    00461
    00463   virtual iLight *FindByName (const char *Name) const = 0;
    00464
    00466   virtual iLight *FindByID (const char* id) const = 0;
    00467 };
    00468
    00481 struct iLightIterator : public virtual iBase
    00482 {
    00483   SCF_INTERFACE (iLightIterator, 0, 1, 0);
    00484
    00486   virtual bool HasNext () = 0;
    00487
    00489   virtual iLight* Next () = 0;
    00490
    00492   virtual iSector* GetLastSector () = 0;
    00493
    00495   virtual void Reset () = 0;
    00496
    00497 };
    00498
    00501 #endif // __CS_IENGINE_LIGHT_H__
    00502