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
00021 class cTree : public cObject {
00022 int seed;
00023 int type;
00024 int age;
00025 GLuint list;
00026 public:
00027 cTree(float* pos, float* rot, int seed, int type, int age);
00028
00029 virtual void drawSolid();
00030
00031 virtual float constrainParticle(float* worldpos, float radius = 0.0f, float* localpos = NULL);
00032 private:
00033 struct rTree {
00034 int seed;
00035 int type;
00036 int age;
00037 GLuint list;
00038 };
00039 static std::list<rTree*> cache;
00040 static GLuint compileTreeDisplaylist(int seed, int type, int age);
00041 static int drawTreePart(int depth, int maxdepth, float length, int seed, GLuint trunk_displaylist, GLuint leaf_displaylist);
00042 static void drawRubberTreeLeaf();
00043 static void drawCaribeanTreeLeaf();
00044 static void drawHalmTreeLeaf();
00045 static void drawButterflyTreeLeaf();
00046 };
00047
00048
00049 #endif
00050