| 1 | /*************************************************************************** |
| 2 | model.h - description |
| 3 | ------------------- |
| 4 | begin : may 22th, 2004 |
| 5 | copyright : (C) 2003-2005 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: model.h 450 2010-11-21 19:11:43Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #ifndef _OPENCITY_MODEL_H_ |
| 21 | #define _OPENCITY_MODEL_H_ 1 |
| 22 | |
| 23 | #include "main.h" |
| 24 | #include "texture.h" |
| 25 | |
| 26 | // The constants used to select the display list |
| 27 | #define OC_OPAQUE_ONESIDE_LIST 0x01 |
| 28 | #define OC_OPAQUE_TWOSIDE_LIST 0x02 |
| 29 | #define OC_ALPHA_LIST 0x04 |
| 30 | |
| 31 | |
| 32 | //======================================================================== |
| 33 | /** This is an internal 3d model representation used by OpenCity. |
| 34 | */ |
| 35 | class Model { |
| 36 | public: |
| 37 | Model( |
| 38 | GLuint dlOpaqueOneSide, |
| 39 | GLuint dlOpaqueTwoSide, |
| 40 | GLuint dlAlpha |
| 41 | ); |
| 42 | |
| 43 | Model( |
| 44 | GLuint dlOpaqueOneSide, |
| 45 | GLuint dlOpaqueTwoSide, |
| 46 | GLuint dlAlpha, |
| 47 | const string& rcsTextureFile |
| 48 | ); |
| 49 | |
| 50 | ~Model(); |
| 51 | |
| 52 | |
| 53 | //======================================================================== |
| 54 | /** Simply call the internal OpenGL display list |
| 55 | */ |
| 56 | void |
| 57 | DisplayList() const; |
| 58 | |
| 59 | |
| 60 | //======================================================================== |
| 61 | /** Call the internal OpenGL display list after modifying the MODELVIEW |
| 62 | matrix according to the given parameters |
| 63 | \param rcfW = GL x |
| 64 | \param rcfL = GL z |
| 65 | \param tabY = GL y |
| 66 | */ |
| 67 | void |
| 68 | DisplayList( |
| 69 | const OC_FLOAT & rcfW, |
| 70 | const OC_FLOAT & rcfL, |
| 71 | const signed char tabY [] |
| 72 | ) const; |
| 73 | |
| 74 | void |
| 75 | DisplayList( |
| 76 | const OC_FLOAT & rcfW, |
| 77 | const OC_FLOAT & rcfL, |
| 78 | const signed char tabY [], |
| 79 | const uint dlMask |
| 80 | ) const; |
| 81 | |
| 82 | |
| 83 | private: |
| 84 | // Display lists used with AC3D model |
| 85 | GLuint _uiOpaqueOneSide; ///< One side opaque polygon display list |
| 86 | GLuint _uiOpaqueTwoSide; ///< Two side opaque polygon display list |
| 87 | GLuint _uiAlpha; ///< Alpha bleding polygon display list |
| 88 | |
| 89 | /// This model texture object is used to keep the right texture reference count |
| 90 | Texture moTexture; |
| 91 | }; |
| 92 | |
| 93 | |
| 94 | #endif |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 |