267 | | |
268 | | #if defined(OSG_USE_DEPRECATED_GEOMETRY_METHODS) |
269 | | /** no longer supported.*/ |
270 | | inline void setVertexIndices(IndexArray* array); |
271 | | inline const IndexArray* getVertexIndices() const; |
272 | | |
273 | | /** no longer supported.*/ |
274 | | inline void setNormalIndices(IndexArray* array); |
275 | | inline const IndexArray* getNormalIndices() const; |
276 | | |
277 | | /** no longer supported.*/ |
278 | | inline void setColorIndices(IndexArray* array); |
279 | | inline const IndexArray* getColorIndices() const; |
280 | | |
281 | | /** no longer supported.*/ |
282 | | inline void setSecondaryColorIndices(IndexArray* array); |
283 | | inline const IndexArray* getSecondaryColorIndices() const; |
284 | | |
285 | | /** no longer supported.*/ |
286 | | inline void setFogCoordIndices(IndexArray* array); |
287 | | inline const IndexArray* getFogCoordIndices() const; |
288 | | |
289 | | /** no longer supported.*/ |
290 | | inline void setTexCoordIndices(unsigned int unit,IndexArray*); |
291 | | inline const IndexArray* getTexCoordIndices(unsigned int unit) const; |
292 | | |
293 | | /** no longer supported.*/ |
294 | | inline void setVertexAttribIndices(unsigned int index,IndexArray* array); |
295 | | inline const IndexArray* getVertexAttribIndices(unsigned int index) const; |
296 | | #endif |
322 | | if (_vertexArray.valid()) { _vertexArray->setUserData(array); if (array) _containsDeprecatedData = true; } |
323 | | else { OSG_WARN<<"Geometry::setVertexIndicies(..) function failed as there is no vertex array to associate inidices with."<<std::endl; } |
324 | | } |
325 | | |
326 | | inline const IndexArray* Geometry::getVertexIndices() const |
327 | | { |
328 | | if (_vertexArray.valid()) return dynamic_cast<IndexArray*>(_vertexArray->getUserData()); |
329 | | else return 0; |
330 | | } |
331 | | |
332 | | inline void Geometry::setNormalIndices(IndexArray* array) |
333 | | { |
334 | | if (_normalArray.valid()) { _normalArray->setUserData(array); if (array) _containsDeprecatedData = true; } |
335 | | else { OSG_WARN<<"Geometry::setNormalIndicies(..) function failed as there is no normal array to associate inidices with."<<std::endl; } |
336 | | } |
337 | | inline const IndexArray* Geometry::getNormalIndices() const |
338 | | { |
339 | | if (_normalArray.valid()) return dynamic_cast<IndexArray*>(_normalArray->getUserData()); |
340 | | else return 0; |
341 | | } |
342 | | |
343 | | inline void Geometry::setColorIndices(IndexArray* array) |
344 | | { |
345 | | if (_colorArray.valid()) { _colorArray->setUserData(array); if (array) _containsDeprecatedData = true; } |
346 | | else { OSG_WARN<<"Geometry::setColorIndicies(..) function failed as there is no color array to associate inidices with."<<std::endl; } |
347 | | } |
348 | | inline const IndexArray* Geometry::getColorIndices() const |
349 | | { |
350 | | if (_colorArray.valid()) return dynamic_cast<IndexArray*>(_colorArray->getUserData()); |
351 | | else return 0; |
352 | | } |
353 | | |
354 | | inline void Geometry::setSecondaryColorIndices(IndexArray* array) |
355 | | { |
356 | | if (_secondaryColorArray.valid()) { _secondaryColorArray->setUserData(array); if (array) _containsDeprecatedData = true; } |
357 | | else { OSG_WARN<<"Geometry::setSecondaryColorArray(..) function failed as there is no secondary color array to associate inidices with."<<std::endl; } |
358 | | } |
359 | | inline const IndexArray* Geometry::getSecondaryColorIndices() const |
360 | | { |
361 | | if (_secondaryColorArray.valid()) return dynamic_cast<IndexArray*>(_secondaryColorArray->getUserData()); |
362 | | else return 0; |
363 | | } |
364 | | |
365 | | inline void Geometry::setFogCoordIndices(IndexArray* array) |
366 | | { |
367 | | if (_fogCoordArray.valid()) { _fogCoordArray->setUserData(array); if (array) _containsDeprecatedData = true; } |
368 | | else { OSG_WARN<<"Geometry::setFogCoordIndicies(..) function failed as there is no fog coord array to associate inidices with."<<std::endl; } |
369 | | } |
370 | | inline const IndexArray* Geometry::getFogCoordIndices() const |
371 | | { |
372 | | if (_fogCoordArray.valid()) return dynamic_cast<IndexArray*>(_fogCoordArray->getUserData()); |
373 | | else return 0; |
374 | | } |
375 | | |
376 | | inline void Geometry::setTexCoordIndices(unsigned int unit,IndexArray* array) |
377 | | { |
378 | | if (unit<_texCoordList.size() && _texCoordList[unit].valid()) { _texCoordList[unit]->setUserData(array); if (array) _containsDeprecatedData = true; } |
379 | | else { OSG_WARN<<"Geometry::setTexCoordIndices(..) function failed as there is no texcoord array to associate inidices with."<<std::endl; } |
380 | | } |
381 | | inline const IndexArray* Geometry::getTexCoordIndices(unsigned int unit) const |
382 | | { |
383 | | if (unit<_texCoordList.size() && _texCoordList[unit].valid()) return dynamic_cast<IndexArray*>(_texCoordList[unit]->getUserData()); |
384 | | else return 0; |
385 | | } |
386 | | |
387 | | inline void Geometry::setVertexAttribIndices(unsigned int index,IndexArray* array) |
388 | | { |
389 | | if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) { _vertexAttribList[index]->setUserData(array); if (array) _containsDeprecatedData = true; } |
390 | | else { OSG_WARN<<"Geometry::setVertexAttribIndices(..) function failed as there is no vertex attrib array to associate inidices with."<<std::endl; } |
391 | | } |
392 | | inline const IndexArray* Geometry::getVertexAttribIndices(unsigned int index) const |
393 | | { |
394 | | if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) return dynamic_cast<IndexArray*>(_vertexAttribList[index]->getUserData()); |
395 | | else return 0; |
396 | | } |
397 | | |
398 | | } // namespace osg |
| 292 | public: |
| 293 | Geometry() : osg::Geometry() {} |
| 294 | Geometry(const Geometry& geometry,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : osg::Geometry(geometry, copyop) {} |
| 295 | |
| 296 | /** Same values as Array::Binding.*/ |
| 297 | enum AttributeBinding |
| 298 | { |
| 299 | BIND_OFF=0, |
| 300 | BIND_OVERALL=1, |
| 301 | BIND_PER_PRIMITIVE_SET=2, |
| 302 | BIND_PER_PRIMITIVE=3, |
| 303 | BIND_PER_VERTEX=4 |
| 304 | }; |
| 305 | |
| 306 | void setNormalBinding(AttributeBinding ab); |
| 307 | AttributeBinding getNormalBinding() const; |
| 308 | |
| 309 | void setColorBinding(AttributeBinding ab); |
| 310 | AttributeBinding getColorBinding() const; |
| 311 | |
| 312 | void setSecondaryColorBinding(AttributeBinding ab); |
| 313 | AttributeBinding getSecondaryColorBinding() const; |
| 314 | |
| 315 | void setFogCoordBinding(AttributeBinding ab); |
| 316 | AttributeBinding getFogCoordBinding() const; |
| 317 | |
| 318 | void setVertexAttribBinding(unsigned int index,AttributeBinding ab); |
| 319 | AttributeBinding getVertexAttribBinding(unsigned int index) const; |
| 320 | |
| 321 | void setVertexAttribNormalize(unsigned int index,GLboolean norm); |
| 322 | GLboolean getVertexAttribNormalize(unsigned int index) const; |
| 323 | |
| 324 | void setVertexIndices(osg::IndexArray* array); |
| 325 | const osg::IndexArray* getVertexIndices() const; |
| 326 | |
| 327 | void setNormalIndices(osg::IndexArray* array); |
| 328 | const osg::IndexArray* getNormalIndices() const; |
| 329 | |
| 330 | void setColorIndices(osg::IndexArray* array); |
| 331 | const osg::IndexArray* getColorIndices() const; |
| 332 | |
| 333 | void setSecondaryColorIndices(osg::IndexArray* array); |
| 334 | const osg::IndexArray* getSecondaryColorIndices() const; |
| 335 | |
| 336 | void setFogCoordIndices(osg::IndexArray* array); |
| 337 | const osg::IndexArray* getFogCoordIndices() const; |
| 338 | |
| 339 | void setTexCoordIndices(unsigned int unit,osg::IndexArray* array); |
| 340 | const osg::IndexArray* getTexCoordIndices(unsigned int unit) const; |
| 341 | |
| 342 | void setVertexAttribIndices(unsigned int index,osg::IndexArray* array); |
| 343 | const osg::IndexArray* getVertexAttribIndices(unsigned int index) const; |
| 344 | |
| 345 | }; |
| 346 | |
| 347 | } // namespace deprecated_osg |