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
00026 struct iTextureWrapper;
00027 struct iMaterialWrapper;
00028 struct iEngine;
00029
00030 struct iObjectRegistry;
00031 struct iGraphics2D;
00032 struct iGraphics3D;
00033 struct iTextureManager;
00034 struct iTextureWrapper;
00035
00036 class csProcTexture : public csObject
00037 {
00038 friend struct ProcCallback;
00039
00040 protected:
00041
00042 bool ptReady;
00043
00044
00045 int texFlags;
00046
00047
00048 iTextureWrapper* tex;
00049
00050 int mat_w, mat_h;
00051
00052 iGraphics3D* ptG3D;
00053 iGraphics2D* ptG2D;
00054 iTextureManager* ptTxtMgr;
00055 iObjectRegistry* object_reg;
00056 bool anim_prepared;
00057
00058 bool key_color;
00059 int key_red, key_green, key_blue;
00060
00061
00062
00063
00064 bool use_cb;
00065
00066
00067
00068 csTicks last_cur_time;
00069
00070 private:
00071 static void ProcCallback (iTextureWrapper* txt, void* data);
00072
00073 public:
00074 csProcTexture ();
00075 virtual ~csProcTexture ();
00076
00084 void DisableAutoUpdate () { use_cb = false; }
00085
00100 virtual bool Initialize (iObjectRegistry* object_reg);
00101
00111 iMaterialWrapper* Initialize (iObjectRegistry* object_reg, iEngine* engine,
00112 iTextureManager* txtmgr, const char* name);
00113
00118 virtual bool PrepareAnim ();
00119
00121 void SetKeyColor (int red, int green, int blue)
00122 {
00123 key_color = true;
00124 key_red = red;
00125 key_green = green;
00126 key_blue = blue;
00127 }
00128
00133 virtual void Animate (csTicks current_time) = 0;
00134
00136 iTextureWrapper* GetTextureWrapper () { return tex; }
00137
00139 virtual void GetDimension (int &w, int &h)
00140 { w = w; h = mat_h; }
00141
00142 static int GetRandom (int max)
00143 {
00144 return (int)(float(max)*rand()/(RAND_MAX+1.0));
00145 }
00146 };
00147
00148
00149 #endif // __PROCTEX_H__
00150