#ifndef MODEL_H
#define MODEL_H
+#include <vector>
+
#include <GL/gl.h>
+#include "color.h"
+
+using namespace std;
+
/**
- * The generated l-system model
- * TODO: inheritance, i.e. Model<-OpenGLModel/WireModel/...?
+ * The L-system model
*/
class Model
{
~Model();
/**
- * Connect two points
- * @param diameter diameter of segment
+ * Create a segment
* @param x1 x start point
* @param y1 y start point
* @param z1 z start point
* @param y2 y end point
* @param z2 z end point
*/
- void segment(double diameter, double x1, double y1, double z1, double x2, double y2, double z2);
+ void segment(double x1, double y1, double z1, double x2, double y2, double z2);
+
+ /**
+ * Specify a vertex
+ * @param x x-coordinate
+ * @param y y-coordinate
+ * @param z z-coordinate
+ */
+ void vertex(double x, double y, double z);
+
+ /**
+ * Specify a normal
+ * @param x x-coordinate
+ * @param y y-coordinate
+ * @param z z-coordinate
+ */
+ void normal(double x, double y, double z);
/**
- * Draw model to screen
+ * Render to screen
*/
void draw();
void clear();
/**
- * Start recording of drawing operations
+ * Begin a modelling session
*/
void begin();
/**
- * Stop recording of drawing operations
+ * End a modelling session
*/
void end();
/**
- * Begin creation of a filled surface
+ * Begin creation of a filled polygon
*/
void fillBegin();
/**
- * End creation of a filled surface
+ * End creation of a filled polygon
*/
void fillEnd();
/**
- * Create one vertex in the filled surface
- * @param x x-coordinate
- * @param y y-coordinate
- * @param z z-coordinate
+ * Increment current index to color table
+ */
+ void nextColor();
+
+ /**
+ * Decrement current index to color table
+ */
+ void prevColor();
+
+ /**
+ * Decrement diameter of segment
+ */
+ void decrementDiameter();
+
+ /**
+ * Set current color index
+ * @param index the color index
+ */
+ void setColorIndex(int index);
+
+ /**
+ * Set current diameter of segment
+ * @param diameter the diameter
*/
- void point(double x, double y, double z);
+ void setDiameter(double diameter);
+
+ /**
+ * Set diameter factor
+ * @param diameter the diameter factor
+ */
+ void setDiameterFactor(double diameterFactor);
+
+ /**
+ * Get current color index
+ * @return color index
+ */
+ int getColorIndex();
+
+ /**
+ * Get current diameter of segment
+ * @return diameter of segment
+ */
+ double getDiameter();
protected:
- GLuint _displayList; // all drawing operations
+ GLuint _displayList; // All drawing operations
+
+ vector<Color> _colorTable; // Color table
+ int _colorIndex; // Current index to color table
+ double _diameter; // Current diameter of segment
+ double _diameterFactor; // Diameter factor // TODO: "Diameter factor"?
};