X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fmodel.h;h=2e05697051530a8952811c64ad8a7a1b61fabc27;hb=1a372e99786b50b48ed0158b4adcb276cf945a9e;hp=d7ebf26c2b20f63de244e9242824e9de7124e53d;hpb=dd73b028a74ef8b57569c3e76751481d2124e491;p=lsystem3d.git diff --git a/src/model.h b/src/model.h index d7ebf26..2e05697 100644 --- a/src/model.h +++ b/src/model.h @@ -1,6 +1,6 @@ // Copyright (C) 2006 Erik Dahlberg // -// This file is part of LSystem3d. +// This file is part of LSystem3D. // // LSystem3D is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -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"? };