| 1 | // Copyright (C) 2006 Erik Dahlberg |
| 2 | // |
| 3 | // This file is part of LSystem3d. |
| 4 | // |
| 5 | // LSystem3D is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License |
| 7 | // as published by the Free Software Foundation; either version 2 |
| 8 | // of the License, or (at your option) any later version. |
| 9 | // |
| 10 | // LSystem3D is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with LSystem3D; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | #ifndef MODEL_H |
| 23 | #define MODEL_H |
| 24 | |
| 25 | #include <GL/gl.h> |
| 26 | |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * The generated l-system model |
| 31 | * TODO: inheritance, i.e. Model<-OpenGLModel/WireModel/...? |
| 32 | */ |
| 33 | class Model |
| 34 | { |
| 35 | public: |
| 36 | /** |
| 37 | * Constructor |
| 38 | */ |
| 39 | Model(); |
| 40 | |
| 41 | /** |
| 42 | * Destructor |
| 43 | */ |
| 44 | ~Model(); |
| 45 | |
| 46 | /** |
| 47 | * Connect two points |
| 48 | * @param diameter diameter of segment |
| 49 | * @param x1 x start point |
| 50 | * @param y1 y start point |
| 51 | * @param z1 z start point |
| 52 | * @param x2 x end point |
| 53 | * @param y2 y end point |
| 54 | * @param z2 z end point |
| 55 | */ |
| 56 | void segment(double diameter, double x1, double y1, double z1, double x2, double y2, double z2); |
| 57 | |
| 58 | /** |
| 59 | * Draw model to screen |
| 60 | */ |
| 61 | void draw(); |
| 62 | |
| 63 | /** |
| 64 | * Clear the model |
| 65 | */ |
| 66 | void clear(); |
| 67 | |
| 68 | /** |
| 69 | * Start recording of drawing operations |
| 70 | */ |
| 71 | void begin(); |
| 72 | |
| 73 | /** |
| 74 | * Stop recording of drawing operations |
| 75 | */ |
| 76 | void end(); |
| 77 | |
| 78 | /** |
| 79 | * Begin creation of a filled surface |
| 80 | */ |
| 81 | void fillBegin(); |
| 82 | |
| 83 | /** |
| 84 | * End creation of a filled surface |
| 85 | */ |
| 86 | void fillEnd(); |
| 87 | |
| 88 | /** |
| 89 | * Create one vertex in the filled surface |
| 90 | * @param x x-coordinate |
| 91 | * @param y y-coordinate |
| 92 | * @param z z-coordinate |
| 93 | */ |
| 94 | void point(double x, double y, double z); |
| 95 | |
| 96 | protected: |
| 97 | |
| 98 | GLuint _displayList; // all drawing operations |
| 99 | }; |
| 100 | |
| 101 | |
| 102 | |
| 103 | #endif |