00001
00009 #ifndef _CTREE_H
00010 #define _CTREE_H
00011
00012 class cTree;
00013
00014 #include "cObject.h"
00015 #include <GL/gl.h>
00016 #include <list>
00017
00018 class cPlanetmap;
00019
00023 class cTree : public cObject {
00024 friend class cPlanetmap;
00025 struct rTree {
00026 unsigned int seed;
00027 unsigned char type;
00028 unsigned char age;
00029 GLuint list;
00030 };
00031 rTree tree;
00032 public:
00033 cTree(float* pos, float* rot, int seed, int type, int age);
00034
00035 virtual void drawSolid();
00036
00037 virtual float constrainParticle(float* worldpos, float radius = 0.0f, float* localpos = NULL, cObject* enactor = NULL);
00038 private:
00039
00040 static std::map<OID,rTree*> cache;
00041 static GLuint compileTreeDisplaylist(int seed, int type, int age);
00042 static int drawTreePart(int depth, int maxdepth, float length, int seed, GLuint trunk_displaylist, GLuint leaf_displaylist);
00043 static void drawRubberTreeLeaf();
00044 static void drawCaribeanTreeLeaf();
00045 static void drawHalmTreeLeaf();
00046 static void drawButterflyTreeLeaf();
00047 };
00048
00049
00050 #endif
00051