CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 
00029 #include "csutil/scf.h"
00030 #include "iengine/fview.h"
00031 
00032 class csLight;
00033 class csColor;
00034 class csFlags;
00035 struct iLight;
00036 struct iSector;
00037 struct iObject;
00038 struct iCrossHalo;
00039 struct iNovaHalo;
00040 struct iFlareHalo;
00041 
00049 #define CS_LIGHT_THINGSHADOWS   0x00000001
00050 
00056 #define CS_LIGHT_ACTIVEHALO     0x80000000
00057 
00059 
00060 #define CS_DEFAULT_LIGHT_LEVEL 20
00061 
00062 #define CS_NORMAL_LIGHT_LEVEL 128
00063 
00075 
00076 #define CS_ATTN_NONE      0
00077 
00078 #define CS_ATTN_LINEAR    1
00079 
00080 #define CS_ATTN_INVERSE   2
00081 
00082 #define CS_ATTN_REALISTIC 3
00083 
00084 #define CS_ATTN_CLQ 4
00085 
00087 SCF_VERSION (iLightCallback, 0, 2, 0);
00088 
00094 struct iLightCallback : public iBase
00095 {
00100   virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0;
00101 
00106   virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0;
00107 
00112   virtual void OnSectorChange (iLight* light, iSector* newsector) = 0;
00113 
00118   virtual void OnRadiusChange (iLight* light, float newradius) = 0;
00119 
00124   virtual void OnDestroy (iLight* light) = 0;
00125 };
00126 
00127 
00128 SCF_VERSION (iLight, 0, 0, 9);
00129 
00154 struct iLight : public iBase
00155 {
00157   virtual csLight* GetPrivateObject () = 0;
00158 
00160   virtual const char* GetLightID () = 0;
00161 
00163   virtual iObject *QueryObject() = 0;
00164 
00166   virtual const csVector3& GetCenter () = 0;
00168   virtual void SetCenter (const csVector3& pos) = 0;
00169 
00171   virtual iSector *GetSector () = 0;
00173   virtual void SetSector (iSector* sector) = 0;
00174 
00176   virtual const csColor& GetColor () = 0;
00178   virtual void SetColor (const csColor& col) = 0;
00179   
00181   virtual bool IsDynamic () const = 0;
00182 
00186   virtual float GetInfluenceRadius () = 0;
00187 
00191   virtual float GetInfluenceRadiusSq () = 0;
00192   
00196   virtual void SetInfluenceRadius (float radius) = 0;
00197 
00199   virtual int GetAttenuation () = 0;
00211   virtual void SetAttenuation (int a) = 0;
00212 
00218   virtual void SetAttenuationVector (const csVector3& attenv) = 0;
00219 
00224   virtual const csVector3 &GetAttenuationVector() = 0;
00225 
00233   virtual void CalculateAttenuationVector (int atttype, float radius = 1.0f,
00234     float brightness = 1.0f) = 0;
00235 
00244   virtual bool GetDistanceForBrightness (float brightness, float& distance) = 0;
00245 
00247   virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0;
00249   virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes,
00250         float roundness) = 0;
00252   virtual iFlareHalo* CreateFlareHalo () = 0;
00253 
00255   virtual float GetBrightnessAtDistance (float d) = 0;
00256 
00265   virtual csFlags& GetFlags () = 0;
00266 
00271   virtual void SetLightCallback (iLightCallback* cb) = 0;
00272 
00276   virtual void RemoveLightCallback (iLightCallback* cb) = 0;
00277 
00279   virtual int GetLightCallbackCount () const = 0;
00280   
00282   virtual iLightCallback* GetLightCallback (int idx) const = 0;
00283 
00288   virtual uint32 GetLightNumber () const = 0;
00289 };
00290 
00291 SCF_VERSION (iLightList, 0, 0, 2);
00292 
00296 struct iLightList : public iBase
00297 {
00299   virtual int GetCount () const = 0;
00300 
00302   virtual iLight *Get (int n) const = 0;
00303 
00305   virtual int Add (iLight *obj) = 0;
00306 
00308   virtual bool Remove (iLight *obj) = 0;
00309 
00311   virtual bool Remove (int n) = 0;
00312 
00314   virtual void RemoveAll () = 0;
00315 
00317   virtual int Find (iLight *obj) const = 0;
00318 
00320   virtual iLight *FindByName (const char *Name) const = 0;
00321 
00323   virtual iLight *FindByID (const char* id) const = 0;
00324 };
00325 
00326 SCF_VERSION (iLightingProcessData, 0, 0, 1);
00327 
00333 struct iLightingProcessData : public iBase
00334 {
00339   virtual void FinalizeLighting () = 0;
00340 };
00341 
00342 SCF_VERSION (iLightingProcessInfo, 0, 0, 2);
00343 
00350 struct iLightingProcessInfo : public iFrustumViewUserdata
00351 {
00353   virtual iLight* GetLight () const = 0;
00354 
00356   virtual bool IsDynamic () const = 0;
00357 
00359   virtual void SetColor (const csColor& col) = 0;
00360 
00362   virtual const csColor& GetColor () const = 0;
00363 
00369   virtual void AttachUserdata (iLightingProcessData* userdata) = 0;
00370 
00374   virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id,
00375         int version) = 0;
00376 
00382   virtual void FinalizeLighting () = 0;
00383 };
00384 
00385 SCF_VERSION (iLightIterator, 0, 1, 0);
00386 
00393 struct iLightIterator : public iBase
00394 {
00396   virtual bool HasNext () = 0;
00397 
00399   virtual iLight* Next () = 0;
00400 
00402   virtual iSector* GetLastSector () = 0;
00403 
00405   virtual void Reset () = 0;
00406 
00407 };
00408 
00411 #endif // __CS_IENGINE_LIGHT_H__
00412 

Generated for Crystal Space by doxygen 1.2.14