Changeset 337
- Timestamp:
- 10/21/06 13:42:59 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Dirk_RenderTraversalWork/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeoBuilder.cpp
r106 r337 86 86 }; 87 87 88 GeoBuilder::GeoBuilder(void) 89 : _geo(), 90 _actLen(0), 91 _actType(-1) 92 { 88 GeoBuilder::GeoBuilder(void) : 89 _geo() 90 { 91 reset(); 92 } 93 94 GeoBuilder::~GeoBuilder() 95 { 96 if(_geo != NullFC) 97 subRef(_geo); 98 } 99 100 void GeoBuilder::reset(void) 101 { 102 if(_geo != NullFC) 103 subRef(_geo); 104 93 105 _geo = Geometry::create(); 106 addRef(_geo); 94 107 95 108 MaterialPtr mat = getDefaultMaterial(); 96 109 97 110 _geo->setMaterial(mat); 111 112 _actLen = 0; 113 _actType = -1; 98 114 } 99 115 100 116 // Property Helper 101 102 117 GeoVectorPropertyPtr GeoBuilder::getProperty(UInt32 index) 103 118 { … … 145 160 } 146 161 147 // Are we in a begin/end loop? Then add current vertex TOindex162 // Are we in a begin/end loop? Then add current vertex to index 148 163 if(_actType != -1) 149 164 addIndex(possize - 1); … … 203 218 _actLen = 0; 204 219 _actType = -1; 220 } 221 222 void GeoBuilder::tri(UInt32 start) 223 { 224 addType(GL_QUADS); 225 addLength(3); 226 227 addIndex(start ); 228 addIndex(start + 1); 229 addIndex(start + 2); 230 } 231 232 void GeoBuilder::tri(UInt32 i1, UInt32 i2, UInt32 i3) 233 { 234 addType(GL_TRIANGLES); 235 addLength(3); 236 237 addIndex(i1); 238 addIndex(i2); 239 addIndex(i3); 205 240 } 206 241 branches/Dirk_RenderTraversalWork/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeoBuilder.h
r106 r337 61 61 GeoBuilder(void); 62 62 63 ~GeoBuilder(); 64 65 void reset(void); 66 63 67 /*! \} */ 64 68 /*---------------------------------------------------------------------*/ … … 86 90 } 87 91 92 template <class Type> 93 void texcoord(UInt16 unit, Type data) 94 { 95 getProperty(Geometry::TexCoordsIndex + unit)->addValue(data); 96 } 97 98 template <class Type> 99 UInt32 prop(UInt16 index, Type data) 100 { 101 getProperty(index)->addValue(data); 102 103 if(index == 0) 104 return finishVertex(); 105 else 106 return 0; 107 } 108 88 109 template <class VType, class NType> 89 110 UInt32 fullVertex(VType vert, NType norm) … … 101 122 } 102 123 124 template <class VType, class NType, class CType, class TType> 125 UInt32 fullVertex(VType vert, NType norm, CType col, TType tc) 126 { 127 color(col); 128 normal(norm); 129 texcoord(0, tc); 130 return vertex(vert); 131 } 132 103 133 /*! \} */ 104 134 /*---------------------------------------------------------------------*/ … … 109 139 110 140 void end(void); 141 142 void tri(UInt32 start); 143 144 void tri(UInt32 i1, UInt32 i2, UInt32 i3); 111 145 112 146 void quad(UInt32 start);
