Newer
Older
cg / include / glumodel.h
@glproj03 glproj03 on 9 Feb 2006 1 KB added fractal material
#ifndef _GLUMODEL_H
#define _GLUMODEL_H

#include "vec.h"
#include "thing.h"
#include "poly.h"
#include <string>

class GenericModel : public Thing {
	public:  
		GLUquadricObj* pt;
		Vec* pos;
		Vec* rot;
		Material* mat;
		float scale;
		bool enabled;
		GenericModel();
		GenericModel(Vec _pos, Material _mat);
		void init(Vec _pos, Material _mat);

		void setColor(Color* c);
		void setMaterial(Color _amb);
		void setMaterial(Color _amb, Color _spec);  

		void translate(Vec d);
		void rotate(Vec r);
};

class GluSphere : public GenericModel {
 public:
  float rad;
  GluSphere();
  GluSphere(Vec _pos, Material _mat, float _rad);
  void init(Vec _pos, Material _mat, float _rad);
  void draw();
};

class Fractal : public GenericModel {
 public:
  int iters;
  float len;
  Fractal();
  void init(Vec pos, Material m, int _iters, float _len);  
};

class SierpinskiPyramid : public Fractal {
	private:
		GLuint list;
	public:
		SierpinskiPyramid(Vec p, int iters, float len);
		void construct(int n);
		void draw();
		void drawPyramid();
		void buildList();
		virtual ~SierpinskiPyramid();
};

class KochFractal : public Fractal {
 public:
  float multiplicity;
  float mult_angle;

  KochFractal(Vec pos, int iters, float len);
  //TODO: move draw function to Fractal class, it's common for all 
  //inheriting fractals....
  void draw();
  void iter(float nbit);
};

#endif