X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fmodel.h;h=a05d8e3edc3296ea434b04d3ffc44599b75b2def;hb=526db67540bf69a4c09ed0d0f4d62bad0a37ee70;hp=d7ebf26c2b20f63de244e9242824e9de7124e53d;hpb=15c82487a77555b040f3f4e03bc11da8b9bc5905;p=lsystem3d.git diff --git a/src/model.h b/src/model.h index d7ebf26..a05d8e3 100644 --- a/src/model.h +++ b/src/model.h @@ -22,13 +22,18 @@ #ifndef MODEL_H #define MODEL_H +#include + #include +#include "color.h" + +using namespace std; + /** - * The generated l-system model - * TODO: inheritance, i.e. Model<-OpenGLModel/WireModel/...? + * The L-system model */ class Model { @@ -44,8 +49,7 @@ public: ~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 @@ -53,10 +57,26 @@ public: * @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(); @@ -66,36 +86,78 @@ public: 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 _colorTable; // Color table + int _colorIndex; // Current index to color table + double _diameter; // Current diameter of segment + double _diameterFactor; // Diameter factor // TODO: "Diameter factor"? };