CrystalSpace

Public API Reference

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

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 
00074 
00075 #define CS_ATTN_NONE      0
00076 
00077 #define CS_ATTN_LINEAR    1
00078 
00079 #define CS_ATTN_INVERSE   2
00080 
00081 #define CS_ATTN_REALISTIC 3
00082 
00084 SCF_VERSION (iLightCallback, 0, 2, 0);
00085 
00091 struct iLightCallback : public iBase
00092 {
00097   virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0;
00098 
00103   virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0;
00104 
00109   virtual void OnSectorChange (iLight* light, iSector* newsector) = 0;
00110 
00115   virtual void OnRadiusChange (iLight* light, float newradius) = 0;
00116 
00121   virtual void OnDestroy (iLight* light) = 0;
00122 };
00123 
00124 
00125 SCF_VERSION (iLight, 0, 0, 9);
00126 
00151 struct iLight : public iBase
00152 {
00154   virtual csLight* GetPrivateObject () = 0;
00155 
00157   virtual const char* GetLightID () = 0;
00158 
00160   virtual iObject *QueryObject() = 0;
00161 
00163   virtual const csVector3& GetCenter () = 0;
00165   virtual void SetCenter (const csVector3& pos) = 0;
00166 
00168   virtual iSector *GetSector () = 0;
00170   virtual void SetSector (iSector* sector) = 0;
00171 
00172 #ifndef CS_USE_NEW_RENDERER
00173 
00174   virtual float GetRadius () = 0;
00176   virtual float GetSquaredRadius () = 0;
00178   virtual float GetInverseRadius () = 0;
00180   virtual void SetRadius (float r) = 0;
00181 #endif
00182 
00184   virtual const csColor& GetColor () = 0;
00186   virtual void SetColor (const csColor& col) = 0;
00187   
00189   virtual bool IsDynamic () const = 0;
00190 
00191 #ifndef CS_USE_NEW_RENDERER
00192 
00193   virtual int GetAttenuation () = 0;
00204   virtual void SetAttenuation (int a) = 0;
00205 
00206 #else
00207 
00212   virtual void SetAttenuationVector(csVector3 attenv) = 0;
00213 
00218   virtual const csVector3 &GetAttenuationVector() = 0;
00219 
00223   virtual float GetInfluenceRadius () = 0;
00224 
00228   virtual float GetInfluenceRadiusSq () = 0;
00229   
00233   virtual void SetInfluenceRadius (float radius) = 0;
00234 
00242   virtual void CalculateAttenuationVector (int atttype, float radius = 1.0f,
00243     float brightness = 1.0f) = 0;
00244 
00253   virtual bool GetDistanceForBrightness (float brightness, float& distance) = 0;
00254 #endif
00255 
00256   virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0;
00258   virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes,
00259         float roundness) = 0;
00261   virtual iFlareHalo* CreateFlareHalo () = 0;
00262 
00264   virtual float GetBrightnessAtDistance (float d) = 0;
00265 
00274   virtual csFlags& GetFlags () = 0;
00275 
00280   virtual void SetLightCallback (iLightCallback* cb) = 0;
00281 
00285   virtual void RemoveLightCallback (iLightCallback* cb) = 0;
00286 
00288   virtual int GetLightCallbackCount () const = 0;
00289   
00291   virtual iLightCallback* GetLightCallback (int idx) const = 0;
00292 
00297   virtual uint32 GetLightNumber () const = 0;
00298 };
00299 
00300 SCF_VERSION (iLightList, 0, 0, 2);
00301 
00305 struct iLightList : public iBase
00306 {
00308   virtual int GetCount () const = 0;
00309 
00311   virtual iLight *Get (int n) const = 0;
00312 
00314   virtual int Add (iLight *obj) = 0;
00315 
00317   virtual bool Remove (iLight *obj) = 0;
00318 
00320   virtual bool Remove (int n) = 0;
00321 
00323   virtual void RemoveAll () = 0;
00324 
00326   virtual int Find (iLight *obj) const = 0;
00327 
00329   virtual iLight *FindByName (const char *Name) const = 0;
00330 
00332   virtual iLight *FindByID (const char* id) const = 0;
00333 };
00334 
00335 SCF_VERSION (iLightingProcessData, 0, 0, 1);
00336 
00342 struct iLightingProcessData : public iBase
00343 {
00348   virtual void FinalizeLighting () = 0;
00349 };
00350 
00351 SCF_VERSION (iLightingProcessInfo, 0, 0, 2);
00352 
00359 struct iLightingProcessInfo : public iFrustumViewUserdata
00360 {
00362   virtual iLight* GetLight () const = 0;
00363 
00365   virtual bool IsDynamic () const = 0;
00366 
00368   virtual void SetColor (const csColor& col) = 0;
00369 
00371   virtual const csColor& GetColor () const = 0;
00372 
00378   virtual void AttachUserdata (iLightingProcessData* userdata) = 0;
00379 
00383   virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id,
00384         int version) = 0;
00385 
00391   virtual void FinalizeLighting () = 0;
00392 };
00393 
00394 SCF_VERSION (iLightIterator, 0, 0, 1);
00395 
00402 struct iLightIterator : public iBase
00403 {
00405   virtual void Restart () = 0;
00406 
00408   virtual iLight* Fetch () = 0;
00409 
00411   virtual iSector* GetLastSector () = 0;
00412 };
00413 
00416 #endif // __CS_IENGINE_LIGHT_H__
00417 

Generated for Crystal Space by doxygen 1.2.14