00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PROCTEX_H__
00021 #define __PROCTEX_H__
00022
00023 #include <stdarg.h>
00024 #include "csutil/csobject.h"
00025 #include "qint.h"
00026
00027 struct iTextureWrapper;
00028 struct iMaterialWrapper;
00029 struct iEngine;
00030
00031 struct iObjectRegistry;
00032 struct iGraphics2D;
00033 struct iGraphics3D;
00034 struct iTextureManager;
00035 struct iTextureWrapper;
00036
00037 class csProcTexture : public csObject
00038 {
00039 friend struct ProcCallback;
00040
00041 protected:
00042
00043 bool ptReady;
00044
00045
00046 int texFlags;
00047
00048
00049 iTextureWrapper* tex;
00050
00051 int mat_w, mat_h;
00052
00053 iGraphics3D* ptG3D;
00054 iGraphics2D* ptG2D;
00055 iTextureManager* ptTxtMgr;
00056 iObjectRegistry* object_reg;
00057 bool anim_prepared;
00058
00059 bool key_color;
00060 int key_red, key_green, key_blue;
00061
00062
00063
00064
00065 bool use_cb;
00066
00067
00068
00069 csTicks last_cur_time;
00070
00071 private:
00072 static void ProcCallback (iTextureWrapper* txt, void* data);
00073
00074 public:
00075 csProcTexture ();
00076 virtual ~csProcTexture ();
00077
00085 void DisableAutoUpdate () { use_cb = false; }
00086
00101 virtual bool Initialize (iObjectRegistry* object_reg);
00102
00112 iMaterialWrapper* Initialize (iObjectRegistry* object_reg, iEngine* engine,
00113 iTextureManager* txtmgr, const char* name);
00114
00119 virtual bool PrepareAnim ();
00120
00122 void SetKeyColor (int red, int green, int blue)
00123 {
00124 key_color = true;
00125 key_red = red;
00126 key_green = green;
00127 key_blue = blue;
00128 }
00129
00134 virtual void Animate (csTicks current_time) = 0;
00135
00137 iTextureWrapper* GetTextureWrapper () { return tex; }
00138
00140 virtual void GetDimension (int &w, int &h)
00141 { w = mat_w; h = mat_h; }
00142
00143 static int GetRandom (int max)
00144 {
00145 return int ((float(max)*rand()/(RAND_MAX+1.0)));
00146 }
00147 };
00148
00149
00150 #endif // __PROCTEX_H__
00151