CrystalSpace

Public API Reference

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

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 
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 struct iLightingInfo;
00042 
00050 #define CS_LIGHT_THINGSHADOWS   0x00000001
00051 
00057 #define CS_LIGHT_ACTIVEHALO     0x80000000
00058 
00067 #define CS_LIGHT_DYNAMICTYPE_STATIC     1
00068 
00074 #define CS_LIGHT_DYNAMICTYPE_PSEUDO     2
00075 
00081 #define CS_LIGHT_DYNAMICTYPE_DYNAMIC    3
00082 
00084 
00085 #define CS_DEFAULT_LIGHT_LEVEL 20
00086 
00087 #define CS_NORMAL_LIGHT_LEVEL 128
00088 
00100 
00101 #define CS_ATTN_NONE      0
00102 
00103 #define CS_ATTN_LINEAR    1
00104 
00105 #define CS_ATTN_INVERSE   2
00106 
00107 #define CS_ATTN_REALISTIC 3
00108 
00109 #define CS_ATTN_CLQ 4
00110 
00112 SCF_VERSION (iLightCallback, 0, 2, 0);
00113 
00119 struct iLightCallback : public iBase
00120 {
00125   virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0;
00126 
00131   virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0;
00132 
00137   virtual void OnSectorChange (iLight* light, iSector* newsector) = 0;
00138 
00143   virtual void OnRadiusChange (iLight* light, float newradius) = 0;
00144 
00149   virtual void OnDestroy (iLight* light) = 0;
00150 };
00151 
00152 
00153 SCF_VERSION (iLight, 0, 0, 9);
00154 
00177 struct iLight : public iBase
00178 {
00180   virtual csLight* GetPrivateObject () = 0;
00181 
00183   virtual const char* GetLightID () = 0;
00184 
00186   virtual iObject *QueryObject() = 0;
00187 
00197   virtual int GetDynamicType () const = 0;
00198 
00200   virtual const csVector3& GetCenter () = 0;
00202   virtual void SetCenter (const csVector3& pos) = 0;
00203 
00205   virtual iSector *GetSector () = 0;
00206 
00208   virtual const csColor& GetColor () = 0;
00210   virtual void SetColor (const csColor& col) = 0;
00211   
00215   virtual float GetInfluenceRadius () = 0;
00216 
00220   virtual float GetInfluenceRadiusSq () = 0;
00221   
00225   virtual void SetInfluenceRadius (float radius) = 0;
00226 
00228   virtual int GetAttenuation () = 0;
00240   virtual void SetAttenuation (int a) = 0;
00241 
00247   virtual void SetAttenuationVector (const csVector3& attenv) = 0;
00248 
00253   virtual const csVector3 &GetAttenuationVector() = 0;
00254 
00262   virtual void CalculateAttenuationVector (int atttype, float radius = 1.0f,
00263     float brightness = 1.0f) = 0;
00264 
00273   virtual bool GetDistanceForBrightness (float brightness, float& distance) = 0;
00274 
00276   virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0;
00278   virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes,
00279         float roundness) = 0;
00281   virtual iFlareHalo* CreateFlareHalo () = 0;
00282 
00284   virtual float GetBrightnessAtDistance (float d) = 0;
00285 
00294   virtual csFlags& GetFlags () = 0;
00295 
00300   virtual void SetLightCallback (iLightCallback* cb) = 0;
00301 
00305   virtual void RemoveLightCallback (iLightCallback* cb) = 0;
00306 
00308   virtual int GetLightCallbackCount () const = 0;
00309   
00311   virtual iLightCallback* GetLightCallback (int idx) const = 0;
00312 
00317   virtual uint32 GetLightNumber () const = 0;
00318 
00324   virtual void AddAffectedLightingInfo (iLightingInfo* li) = 0; 
00325 
00329   virtual void RemoveAffectedLightingInfo (iLightingInfo* li) = 0; 
00330 
00335   virtual void Setup () = 0;
00336 };
00337 
00338 SCF_VERSION (iLightList, 0, 0, 2);
00339 
00343 struct iLightList : public iBase
00344 {
00346   virtual int GetCount () const = 0;
00347 
00349   virtual iLight *Get (int n) const = 0;
00350 
00352   virtual int Add (iLight *obj) = 0;
00353 
00355   virtual bool Remove (iLight *obj) = 0;
00356 
00358   virtual bool Remove (int n) = 0;
00359 
00361   virtual void RemoveAll () = 0;
00362 
00364   virtual int Find (iLight *obj) const = 0;
00365 
00367   virtual iLight *FindByName (const char *Name) const = 0;
00368 
00370   virtual iLight *FindByID (const char* id) const = 0;
00371 };
00372 
00373 SCF_VERSION (iLightingProcessData, 0, 0, 1);
00374 
00380 struct iLightingProcessData : public iBase
00381 {
00386   virtual void FinalizeLighting () = 0;
00387 };
00388 
00389 SCF_VERSION (iLightingProcessInfo, 0, 0, 2);
00390 
00397 struct iLightingProcessInfo : public iFrustumViewUserdata
00398 {
00400   virtual iLight* GetLight () const = 0;
00401 
00403   virtual bool IsDynamic () const = 0;
00404 
00406   virtual void SetColor (const csColor& col) = 0;
00407 
00409   virtual const csColor& GetColor () const = 0;
00410 
00416   virtual void AttachUserdata (iLightingProcessData* userdata) = 0;
00417 
00421   virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id,
00422         int version) = 0;
00423 
00429   virtual void FinalizeLighting () = 0;
00430 };
00431 
00432 SCF_VERSION (iLightIterator, 0, 1, 0);
00433 
00440 struct iLightIterator : public iBase
00441 {
00443   virtual bool HasNext () = 0;
00444 
00446   virtual iLight* Next () = 0;
00447 
00449   virtual iSector* GetLastSector () = 0;
00450 
00452   virtual void Reset () = 0;
00453 
00454 };
00455 
00458 #endif // __CS_IENGINE_LIGHT_H__
00459 

Generated for Crystal Space by doxygen 1.2.18