00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #if !defined(__INCLUDE_DefaultTankRendererh_INCLUDE__) 00022 #define __INCLUDE_DefaultTankRendererh_INCLUDE__ 00023 00024 #include <tank/Tank.h> 00025 #include <tank/TankModel.h> 00026 #include <tankgraph/TankMesh.h> 00027 #include <tankgraph/TargetRendererImpl.h> 00028 #include <GLW/GLWTankTip.h> 00029 #include <GLEXT/GLState.h> 00030 00031 class ModelRendererSimulator; 00032 class TargetRendererImplTankAIM 00033 { 00034 public: 00035 static void simulate(float frameTime) { timeLeft_ -= frameTime; } 00036 00037 static ModelRendererSimulator *getAutoAimModel(); 00038 static bool drawAim() { return (timeLeft_ > 0.0f); } 00039 static void setAimPosition(Vector &pos) { aimPosition_ = pos; timeLeft_= 5.0f; } 00040 static Vector &getAimPosition() { return aimPosition_; } 00041 00042 static Vector aimPosition_; 00043 00044 protected: 00045 static float timeLeft_; 00046 }; 00047 00048 class TargetRendererImplTankHUD 00049 { 00050 public: 00051 static void simulate(float frameTime) { timeLeft_ -= frameTime; } 00052 00053 static bool drawText() { return (timeLeft_ > 0.0f); } 00054 static void setText(const char *textA, const char *textB, float percentage = -1.0f) 00055 { textA_ = textA; textB_ = textB; percentage_ = percentage; timeLeft_= 2.0f; } 00056 static const char *getTextA() { return textA_.c_str(); } 00057 static const char *getTextB() { return textB_.c_str(); } 00058 static float getPercentage() { return percentage_; } 00059 00060 protected: 00061 static float timeLeft_; 00062 static float percentage_; 00063 static std::string textA_; 00064 static std::string textB_; 00065 00066 }; 00067 00068 class TargetRendererImplTank : public TargetRendererImpl 00069 { 00070 public: 00071 TargetRendererImplTank(Tank *tank); 00072 virtual ~TargetRendererImplTank(); 00073 00074 // TargetRendererImpl 00075 virtual void simulate(float frameTime); 00076 virtual void drawParticle(float distance); 00077 00078 void render(float distance); 00079 void renderShadow(float distance); 00080 void render2D(float distance); 00081 00082 // TargetRenderer 00083 virtual void fired(); 00084 virtual void shieldHit(); 00085 virtual void targetBurnt() {} 00086 00087 void resetModel() { model_ = 0; mesh_ = 0; } 00088 TankModel *getModel(); 00089 TankMesh *getMesh(); 00090 GLWTankTips *getTips() { return &tankTips_; } 00091 00092 protected: 00093 Tank *tank_; 00094 TankModel *model_; 00095 TankMesh *mesh_; 00096 GLWTankTips tankTips_; 00097 float fireOffSet_; 00098 float shieldHit_; 00099 float smokeTime_, smokeWaitForTime_; 00100 float totalTime_; 00101 float frame_; 00102 00103 void drawInfo(); 00104 void drawLife(); 00105 void drawLifeBar(Vector &bilX, float value, float height, float barheight); 00106 void drawSight(); 00107 void drawArrow(); 00108 }; 00109 00110 00111 #endif
1.5.3