|
halo.h00001 /* 00002 Copyright (C) 1998-2001 by Jorrit Tyberghein 00003 Copyright (C) 2001 by W.C.A. Wijngaards 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_HALO_H__ 00021 #define __CS_HALO_H__ 00022 00023 #include "csgeom/math3d.h" 00024 #include "csengine/light.h" 00025 #include "ivideo/halo.h" 00026 #include "iengine/halo.h" 00027 00028 class csEngine; 00029 struct iMaterialWrapper; 00030 00035 class csHalo : public iBaseHalo 00036 { 00038 float Intensity; 00039 00040 public: 00042 csHaloType Type; 00043 00045 csHalo (csHaloType iType); 00047 virtual ~csHalo (); 00048 00050 virtual unsigned char *Generate (int Size) = 0; 00051 00053 virtual float GetIntensity () { return Intensity; } 00055 virtual void SetIntensity (float iInt) { Intensity = iInt; } 00056 00057 SCF_DECLARE_IBASE; 00058 }; 00059 00063 class csCrossHalo : public csHalo 00064 { 00065 public: 00067 float IntensityFactor; 00069 float CrossFactor; 00070 00072 csCrossHalo (float intensity_factor, float cross_factor); 00073 00075 virtual unsigned char *Generate (int Size); 00076 00077 //------------------------ iCrossHalo ------------------------------------ 00078 SCF_DECLARE_IBASE_EXT (csHalo); 00079 struct CrossHalo : public iCrossHalo 00080 { 00081 SCF_DECLARE_EMBEDDED_IBASE (csCrossHalo); 00082 virtual void SetIntensityFactor (float i) 00083 { scfParent->IntensityFactor = i; } 00084 virtual float GetIntensityFactor () 00085 { return scfParent->IntensityFactor; } 00086 virtual void SetCrossFactor (float i) 00087 { scfParent->CrossFactor = i; } 00088 virtual float GetCrossFactor () 00089 { return scfParent->CrossFactor; } 00090 } scfiCrossHalo; 00091 friend struct CrossHalo; 00092 }; 00093 00095 class csNovaHalo : public csHalo 00096 { 00097 public: 00099 int Seed; 00101 int NumSpokes; 00103 float Roundness; 00104 00106 csNovaHalo (int seed, int num_spokes, float roundness); 00107 00109 virtual unsigned char *Generate (int Size); 00110 00111 //------------------------ iNovaHalo ------------------------------------ 00112 SCF_DECLARE_IBASE_EXT (csHalo); 00113 struct NovaHalo : public iNovaHalo 00114 { 00115 SCF_DECLARE_EMBEDDED_IBASE (csNovaHalo); 00116 virtual void SetRandomSeed (int s) 00117 { scfParent->Seed = s; } 00118 virtual int GetRandomSeed () 00119 { return scfParent->Seed; } 00120 virtual void SetSpokeCount (int s) 00121 { scfParent->NumSpokes = s; } 00122 virtual int GetSpokeCount () 00123 { return scfParent->NumSpokes; } 00124 virtual void SetRoundnessFactor (float r) 00125 { scfParent->Roundness = r; } 00126 virtual float GetRoundnessFactor () 00127 { return scfParent->Roundness; } 00128 } scfiNovaHalo; 00129 friend struct NovaHalo; 00130 }; 00131 00132 00134 struct csFlareComponent { 00136 float position; 00138 float width, height; 00140 iMaterialWrapper *image; 00142 uint mixmode; 00144 csFlareComponent *next; 00145 }; 00146 00150 class csFlareHalo : public csHalo 00151 { 00152 private: 00154 csFlareComponent *components; 00156 csFlareComponent *last; 00157 public: 00159 csFlareHalo(); 00161 ~csFlareHalo(); 00167 void AddComponent(float pos, float w, float h, uint mode, 00168 iMaterialWrapper *image); 00170 csFlareComponent *GetComponents() const {return components;} 00176 virtual unsigned char *Generate (int Size); 00177 00178 //------------------------ iFlareHalo ------------------------------------ 00179 SCF_DECLARE_IBASE_EXT (csHalo); 00180 struct FlareHalo : public iFlareHalo 00181 { 00182 SCF_DECLARE_EMBEDDED_IBASE (csFlareHalo); 00183 virtual void AddComponent (float pos, float w, float h, uint mode, 00184 iMaterialWrapper *image) 00185 { 00186 scfParent->AddComponent (pos, w, h, mode, image); 00187 } 00188 } scfiFlareHalo; 00189 friend struct FlareHalo; 00190 }; 00191 00202 class csLightHalo 00203 { 00204 public: 00206 csLight *Light; 00207 00209 iHalo *Handle; 00210 00212 csTicks LastTime; 00213 00215 csLightHalo (csLight *iLight, iHalo *iHandle); 00216 00218 virtual ~csLightHalo (); 00219 00226 virtual bool Process (csTicks ElapsedTime, csEngine const&); 00227 00232 bool IsVisible(csEngine const& engine, csVector3& v); 00233 00241 bool ComputeNewIntensity(csTicks ElapsedTime, float& hintensity, 00242 bool halo_vis); 00243 }; 00244 00249 class csLightFlareHalo : public csLightHalo 00250 { 00252 int halosize; 00254 csFlareHalo *flare; 00255 public: 00260 csLightFlareHalo(csLight *light, csFlareHalo *halo, int iHaloSize); 00262 virtual ~csLightFlareHalo(); 00263 00265 virtual bool Process (csTicks elapsed_time, csEngine const& engine); 00267 void ProcessFlareComponent(csEngine const& engine, csFlareComponent *comp, 00268 csVector2 const& start, csVector2 const& deltapos); 00269 }; 00270 00271 #endif // __CS_HALO_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |