2003-01-22 00:45:36 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-06-21 03:54:08 +08:00
|
|
|
|
|
|
|
#ifndef OSG_GEOMETRY
|
|
|
|
#define OSG_GEOMETRY 1
|
|
|
|
|
|
|
|
#include <osg/Drawable>
|
|
|
|
#include <osg/Vec2>
|
|
|
|
#include <osg/Vec3>
|
|
|
|
#include <osg/Vec4>
|
2002-06-27 18:50:19 +08:00
|
|
|
#include <osg/Array>
|
2002-09-20 22:51:59 +08:00
|
|
|
#include <osg/PrimitiveSet>
|
2002-06-21 03:54:08 +08:00
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2002-06-22 00:45:45 +08:00
|
|
|
|
|
|
|
class SG_EXPORT Geometry : public Drawable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Geometry();
|
|
|
|
|
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
2002-07-26 20:49:19 +08:00
|
|
|
Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new Geometry(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); }
|
2002-06-22 00:45:45 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; }
|
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const { return "Geometry"; }
|
|
|
|
|
2002-09-12 23:34:31 +08:00
|
|
|
virtual Geometry* asGeometry() { return this; }
|
|
|
|
virtual const Geometry* asGeometry() const { return this; }
|
|
|
|
|
2002-06-22 00:45:45 +08:00
|
|
|
enum AttributeBinding
|
|
|
|
{
|
2002-06-24 05:43:46 +08:00
|
|
|
BIND_OFF=0,
|
|
|
|
BIND_OVERALL,
|
2002-10-02 21:12:16 +08:00
|
|
|
BIND_PER_PRIMITIVE_SET,
|
2002-06-24 05:43:46 +08:00
|
|
|
BIND_PER_PRIMITIVE,
|
2002-06-28 16:47:23 +08:00
|
|
|
BIND_PER_VERTEX
|
2002-06-22 00:45:45 +08:00
|
|
|
};
|
|
|
|
|
2002-08-08 19:27:11 +08:00
|
|
|
void setVertexArray(Vec3Array* array) { _vertexArray = array; dirtyDisplayList(); dirtyBound(); }
|
2002-06-22 00:45:45 +08:00
|
|
|
Vec3Array* getVertexArray() { return _vertexArray.get(); }
|
|
|
|
const Vec3Array* getVertexArray() const { return _vertexArray.get(); }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setVertexIndices(IndexArray* array) { _vertexIndices = array; _fastPathComputed=false; dirtyDisplayList(); dirtyBound(); }
|
|
|
|
IndexArray* getVertexIndices() { return _vertexIndices.get(); }
|
|
|
|
const IndexArray* getVertexIndices() const { return _vertexIndices.get(); }
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
|
|
|
|
void setNormalBinding(AttributeBinding ab) { _normalBinding = ab; dirtyDisplayList(); _fastPathComputed=false; }
|
2002-06-22 00:45:45 +08:00
|
|
|
AttributeBinding getNormalBinding() const { return _normalBinding; }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setNormalArray(Vec3Array* array) { _normalArray = array; if (!_normalArray.valid()) _normalBinding=BIND_OFF; _fastPathComputed=false; dirtyDisplayList(); }
|
2002-06-22 00:45:45 +08:00
|
|
|
Vec3Array* getNormalArray() { return _normalArray.get(); }
|
|
|
|
const Vec3Array* getNormalArray() const { return _normalArray.get(); }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setNormalIndices(IndexArray* array) { _normalIndices = array; _fastPathComputed=false; dirtyDisplayList(); }
|
|
|
|
IndexArray* getNormalIndices() { return _normalIndices.get(); }
|
|
|
|
const IndexArray* getNormalIndices() const { return _normalIndices.get(); }
|
|
|
|
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setColorBinding(AttributeBinding ab) { _colorBinding = ab; _fastPathComputed=false;}
|
2002-06-22 00:45:45 +08:00
|
|
|
AttributeBinding getColorBinding() const { return _colorBinding; }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setColorArray(Array* array) { _colorArray = array; if (!_colorArray.valid()) _colorBinding=BIND_OFF; _fastPathComputed=false; dirtyDisplayList(); }
|
2002-06-27 21:15:34 +08:00
|
|
|
Array* getColorArray() { return _colorArray.get(); }
|
|
|
|
const Array* getColorArray() const { return _colorArray.get(); }
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setColorIndices(IndexArray* array) { _colorIndices = array; _fastPathComputed=false; dirtyDisplayList(); }
|
|
|
|
IndexArray* getColorIndices() { return _colorIndices.get(); }
|
|
|
|
const IndexArray* getColorIndices() const { return _colorIndices.get(); }
|
|
|
|
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setSecondaryColorBinding(AttributeBinding ab) { _secondaryColorBinding = ab; _fastPathComputed=false;}
|
2002-08-16 04:27:33 +08:00
|
|
|
AttributeBinding getSecondaryColorBinding() const { return _secondaryColorBinding; }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setSecondaryColorArray(Array* array) { _secondaryColorArray = array; if (!_secondaryColorArray.valid()) _secondaryColorBinding=BIND_OFF; _fastPathComputed=false; dirtyDisplayList(); }
|
2002-08-16 04:27:33 +08:00
|
|
|
Array* getSecondaryColorArray() { return _secondaryColorArray.get(); }
|
|
|
|
const Array* getSecondaryColorArray() const { return _secondaryColorArray.get(); }
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setSecondaryColorIndices(IndexArray* array) { _secondaryColorIndices = array; _fastPathComputed=false; dirtyDisplayList(); }
|
|
|
|
IndexArray* getSecondaryColorIndices() { return _secondaryColorIndices.get(); }
|
|
|
|
const IndexArray* getSecondaryColorIndices() const { return _secondaryColorIndices.get(); }
|
2002-08-16 04:27:33 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
|
|
|
|
void setFogCoordBinding(AttributeBinding ab) { _fogCoordBinding = ab; _fastPathComputed=false;}
|
2002-08-16 04:27:33 +08:00
|
|
|
AttributeBinding getFogCoordBinding() const { return _fogCoordBinding; }
|
|
|
|
|
2003-01-05 04:45:53 +08:00
|
|
|
void setFogCoordArray(Array* array) { _fogCoordArray = array; if (!_fogCoordArray.valid()) _fogCoordBinding=BIND_OFF; dirtyDisplayList(); }
|
|
|
|
Array* getFogCoordArray() { return _fogCoordArray.get(); }
|
|
|
|
const Array* getFogCoordArray() const { return _fogCoordArray.get(); }
|
2002-08-16 04:27:33 +08:00
|
|
|
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setFogCoordIndices(IndexArray* array) { _fogCoordIndices = array; dirtyDisplayList(); }
|
|
|
|
IndexArray* getFogCoordIndices() { return _fogCoordIndices.get(); }
|
|
|
|
const IndexArray* getFogCoordIndices() const { return _fogCoordIndices.get(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::pair< ref_ptr<Array>, ref_ptr<IndexArray> > TexCoordArrayPair;
|
|
|
|
typedef std::vector< TexCoordArrayPair > TexCoordArrayList;
|
2002-06-25 05:37:34 +08:00
|
|
|
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
void setTexCoordArray(unsigned int unit,Array*);
|
|
|
|
Array* getTexCoordArray(unsigned int unit);
|
|
|
|
const Array* getTexCoordArray(unsigned int unit) const;
|
2002-06-25 05:37:34 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setTexCoordIndices(unsigned int unit,IndexArray*);
|
|
|
|
IndexArray* getTexCoordIndices(unsigned int unit);
|
|
|
|
const IndexArray* getTexCoordIndices(unsigned int unit) const;
|
|
|
|
|
2002-06-25 05:37:34 +08:00
|
|
|
unsigned int getNumTexCoordArrays() const { return _texCoordList.size(); }
|
|
|
|
TexCoordArrayList& getTexCoordArrayList() { return _texCoordList; }
|
|
|
|
const TexCoordArrayList& getTexCoordArrayList() const { return _texCoordList; }
|
2002-06-22 00:45:45 +08:00
|
|
|
|
|
|
|
|
2003-05-09 21:07:06 +08:00
|
|
|
#ifdef COMPILE_POSSIBLE_NEW_ARRAY_METHODS
|
|
|
|
|
|
|
|
void setArray(AttributeType type, Array* array);
|
|
|
|
Array* getArray(AttributeType type);
|
|
|
|
const Array* getArray(AttributeType type) const;
|
|
|
|
|
|
|
|
void setIndices(AttributeType type, IndexArray* indices);
|
|
|
|
IndexArray* getIndices(AttributeType type);
|
|
|
|
const IndexArray* getIndices(AttributeType type) const;
|
|
|
|
|
|
|
|
void setNormalize(AttributeType type, GLboolean normalize);
|
|
|
|
GLboolean getNormalize(AttributeType type) const;
|
|
|
|
|
|
|
|
void setBinding(AttributeType type,AttributeBinding binding);
|
|
|
|
AttributeBinding getBinding(AttributeType type) const;
|
|
|
|
|
|
|
|
struct AttributeData
|
|
|
|
{
|
|
|
|
AttributeData():
|
|
|
|
_normalize(GL_FALSE),
|
|
|
|
_binding(BIND_OFF) {}
|
|
|
|
|
|
|
|
ref_ptr<Array> _array;
|
|
|
|
ref_ptr<IndexArray> _indices;
|
|
|
|
GLboolean _normalize;
|
|
|
|
AttributeBinding _binding;
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned int getNumArrays() const { return _attributeList.size(); }
|
|
|
|
|
|
|
|
AttributeData& getAttributeData(unsigned int type) { return _attributeList[type]; }
|
|
|
|
|
|
|
|
const AttributeData& getAttributeData(unsigned int type) const { return _attributeList[type]; }
|
|
|
|
|
|
|
|
typedef std::vector<AttributeData> AttributeList;
|
|
|
|
|
|
|
|
void setAttributeList(AttributeList& al) { _attributeList = al; }
|
|
|
|
|
|
|
|
AttributeList& getAttributeList() { return _attributeList; }
|
|
|
|
|
|
|
|
const AttributeList& getAttributeList() const { return _attributeList; }
|
|
|
|
|
|
|
|
#endif
|
2003-05-07 21:13:13 +08:00
|
|
|
|
|
|
|
typedef std::pair< ref_ptr<Array>, ref_ptr<IndexArray> > VertexAttribArrayPair;
|
|
|
|
typedef std::pair< GLboolean, VertexAttribArrayPair > VertexAttribNormArrayPair;
|
|
|
|
typedef std::vector< VertexAttribNormArrayPair > VertexAttribArrayList;
|
|
|
|
typedef std::vector< AttributeBinding > VertexAttribBindingList;
|
|
|
|
|
|
|
|
void setVertexAttribArray(unsigned int index,bool normalize,Array* array,AttributeBinding ab=BIND_OFF);
|
|
|
|
Array *getVertexAttribArray(unsigned int index);
|
|
|
|
const Array *getVertexAttribArray(unsigned int index) const;
|
|
|
|
|
|
|
|
bool getVertexAttribNormalize(unsigned int index, GLboolean &ret) const;
|
|
|
|
bool getVertexAttribBinding(unsigned int index, AttributeBinding& ab) const;
|
|
|
|
|
|
|
|
void setVertexAttribIndices(unsigned int index,IndexArray* array);
|
|
|
|
IndexArray* getVertexAttribIndices(unsigned int index);
|
|
|
|
const IndexArray* getVertexAttribIndices(unsigned int index) const;
|
|
|
|
|
|
|
|
unsigned int getNumVertexAttribArrays() const { return _vertexAttribList.size(); }
|
|
|
|
VertexAttribArrayList& getVertexAttribArrayList() { return _vertexAttribList; }
|
|
|
|
const VertexAttribArrayList& getVertexAttribArrayList() const { return _vertexAttribList; }
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList;
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
void setPrimitiveSetList(const PrimitiveSetList& primitives) { _primitives = primitives; dirtyDisplayList(); dirtyBound(); }
|
|
|
|
PrimitiveSetList& getPrimitiveSetList() { return _primitives; }
|
|
|
|
const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; }
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
unsigned int getNumPrimitiveSets() const { return _primitives.size(); }
|
|
|
|
PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); }
|
|
|
|
const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); }
|
2002-07-19 22:19:49 +08:00
|
|
|
|
2002-12-08 05:18:12 +08:00
|
|
|
/** Add a primitive set to the geometry.*/
|
2002-11-21 17:07:11 +08:00
|
|
|
bool addPrimitiveSet(PrimitiveSet* primitiveset);
|
|
|
|
|
2002-12-08 05:18:12 +08:00
|
|
|
/** Set a primitive set to the specified position in geometry's primitive set list.*/
|
2002-11-21 17:07:11 +08:00
|
|
|
bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
|
|
|
|
|
2002-12-08 05:18:12 +08:00
|
|
|
/** Insert a primitive set to the specified position in geometry's primitive set list.*/
|
2002-11-21 17:07:11 +08:00
|
|
|
bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
|
|
|
|
|
2002-12-08 05:18:12 +08:00
|
|
|
/** Remove primitive set(s) from the specified position in geometry's primitive set list.*/
|
2002-11-21 17:07:11 +08:00
|
|
|
bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1);
|
|
|
|
|
|
|
|
/** Get the index number of a primitive set, return a value between
|
|
|
|
* 0 and getNumPrimitiveSet()-1 if found, if not found then return getNumPrimitiveSet().
|
|
|
|
* When checking for a valid find value use if ((value=geoemtry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet()) as*/
|
|
|
|
unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2002-10-02 21:16:39 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
/** return true if OpenGL fast paths will be used with drawing this Geometry.
|
|
|
|
* Fast paths use vertex arrays, and glDrawArrays/glDrawElements. Slow paths
|
2002-12-08 05:18:12 +08:00
|
|
|
* use glBegin()/glVertex.../glEnd(). Use of per primitive bindings or per vertex indexed
|
2002-10-02 21:12:16 +08:00
|
|
|
* arrays will drop the rendering path off the fast path.*/
|
|
|
|
bool areFastPathsUsed() const;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2002-07-18 08:53:03 +08:00
|
|
|
|
2002-10-02 21:12:16 +08:00
|
|
|
bool verifyBindings() const;
|
2002-07-18 08:53:03 +08:00
|
|
|
void computeCorrectBindingsAndArraySizes();
|
|
|
|
|
2002-06-21 03:54:08 +08:00
|
|
|
|
|
|
|
/** draw Geometry directly ignoring an OpenGL display list which could be attached.
|
|
|
|
* This is the internal draw method which does the drawing itself,
|
|
|
|
* and is the method to override when deriving from Geometry for user-drawn objects.
|
|
|
|
*/
|
2002-11-06 23:43:11 +08:00
|
|
|
virtual void drawImplementation(State& state) const;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
/** return true, osg::Geometry does support accept(AttributeFunctor&).*/
|
|
|
|
virtual bool supports(AttributeFunctor&) const { return true; }
|
|
|
|
|
2002-07-18 23:36:14 +08:00
|
|
|
/** accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
|
|
|
virtual void accept(AttributeFunctor& af);
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
/** return true, osg::Geometry does support accept(ConstAttributeFunctor&).*/
|
|
|
|
virtual bool supports(ConstAttributeFunctor&) const { return true; }
|
|
|
|
|
|
|
|
/** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
|
|
|
virtual void accept(ConstAttributeFunctor& af) const;
|
|
|
|
|
|
|
|
/** return true, osg::Geometry does support accept(PrimitiveFunctor&) .*/
|
|
|
|
virtual bool supports(PrimitiveFunctor&) const { return true; }
|
|
|
|
|
2002-12-08 05:18:12 +08:00
|
|
|
/** accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has.*/
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(PrimitiveFunctor& pf) const;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
/** Extensions class which encapsulates the querring of extensions and
|
|
|
|
* associated function pointers, and provide convinience wrappers to
|
|
|
|
* check for the extensions or use the associated functions.*/
|
|
|
|
class SG_EXPORT Extensions : public osg::Referenced
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Extensions();
|
|
|
|
|
|
|
|
Extensions(const Extensions& rhs);
|
|
|
|
|
|
|
|
void lowestCommonDenominator(const Extensions& rhs);
|
|
|
|
|
|
|
|
void setupGLExtenions();
|
|
|
|
|
|
|
|
void setVertexProgramSupported(bool flag) { _isVertexProgramSupported=flag; }
|
|
|
|
bool isVertexProgramSupported() const { return _isVertexProgramSupported; }
|
|
|
|
|
|
|
|
void setSecondaryColorSupported(bool flag) { _isSecondaryColorSupported=flag; }
|
|
|
|
bool isSecondaryColorSupported() const { return _isSecondaryColorSupported; }
|
|
|
|
|
|
|
|
void setFogCoordSupported(bool flag) { _isFogCoordSupported=flag; }
|
|
|
|
bool isFogCoordSupported() const { return _isFogCoordSupported; }
|
|
|
|
|
|
|
|
void setMultiTexSupported(bool flag) { _isMultiTexSupported=flag; }
|
|
|
|
bool isMultiTexSupported() const { return _isMultiTexSupported; }
|
|
|
|
|
|
|
|
void glSecondaryColor3ubv(const GLubyte* coord) const;
|
|
|
|
void glSecondaryColor3fv(const GLfloat* coord) const;
|
|
|
|
|
|
|
|
void glFogCoordfv(const GLfloat* coord) const;
|
|
|
|
|
|
|
|
void glMultiTexCoord1f(GLenum target,GLfloat coord) const;
|
|
|
|
void glMultiTexCoord2fv(GLenum target,const GLfloat* coord) const;
|
|
|
|
void glMultiTexCoord3fv(GLenum target,const GLfloat* coord) const;
|
|
|
|
void glMultiTexCoord4fv(GLenum target,const GLfloat* coord) const;
|
|
|
|
|
|
|
|
void glVertexAttrib1s(unsigned int index, GLshort s) const;
|
|
|
|
void glVertexAttrib1f(unsigned int index, GLfloat f) const;
|
|
|
|
void glVertexAttrib2fv(unsigned int index, const GLfloat * v) const;
|
|
|
|
void glVertexAttrib3fv(unsigned int index, const GLfloat * v) const;
|
|
|
|
void glVertexAttrib4fv(unsigned int index, const GLfloat * v) const;
|
|
|
|
void glVertexAttrib4ubv(unsigned int index, const GLubyte * v) const;
|
|
|
|
void glVertexAttrib4Nubv(unsigned int index, const GLubyte * v) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
typedef void (APIENTRY * FogCoordProc) (const GLfloat* coord);
|
|
|
|
|
|
|
|
typedef void (APIENTRY * VertexAttrib1sProc) (unsigned int index, GLshort s);
|
|
|
|
typedef void (APIENTRY * VertexAttrib1fProc) (unsigned int index, GLfloat f);
|
|
|
|
typedef void (APIENTRY * VertexAttribfvProc) (unsigned int index, const GLfloat * v);
|
|
|
|
typedef void (APIENTRY * VertexAttribubvProc) (unsigned int index, const GLubyte * v);
|
|
|
|
|
|
|
|
typedef void (APIENTRY * SecondaryColor3ubvProc) (const GLubyte* coord);
|
|
|
|
typedef void (APIENTRY * SecondaryColor3fvProc) (const GLfloat* coord);
|
|
|
|
|
|
|
|
typedef void (APIENTRY * MultiTexCoord1fProc) (GLenum target,GLfloat coord);
|
|
|
|
typedef void (APIENTRY * MultiTexCoordfvProc) (GLenum target,const GLfloat* coord);
|
|
|
|
|
|
|
|
~Extensions() {}
|
|
|
|
|
|
|
|
bool _isVertexProgramSupported;
|
|
|
|
bool _isSecondaryColorSupported;
|
|
|
|
bool _isFogCoordSupported;
|
|
|
|
bool _isMultiTexSupported;
|
|
|
|
|
|
|
|
FogCoordProc _glFogCoordfv;
|
|
|
|
|
|
|
|
SecondaryColor3ubvProc _glSecondaryColor3ubv;
|
|
|
|
SecondaryColor3fvProc _glSecondaryColor3fv;
|
|
|
|
|
|
|
|
VertexAttrib1sProc _glVertexAttrib1s;
|
|
|
|
VertexAttrib1fProc _glVertexAttrib1f;
|
|
|
|
VertexAttribfvProc _glVertexAttrib2fv;
|
|
|
|
VertexAttribfvProc _glVertexAttrib3fv;
|
|
|
|
VertexAttribfvProc _glVertexAttrib4fv;
|
|
|
|
VertexAttribubvProc _glVertexAttrib4ubv;
|
|
|
|
VertexAttribubvProc _glVertexAttrib4Nubv;
|
|
|
|
|
|
|
|
MultiTexCoord1fProc _glMultiTexCoord1f;
|
|
|
|
MultiTexCoordfvProc _glMultiTexCoord2fv;
|
|
|
|
MultiTexCoordfvProc _glMultiTexCoord3fv;
|
|
|
|
MultiTexCoordfvProc _glMultiTexCoord4fv;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Function to call to get the extension of a specified context.
|
|
|
|
* If the Exentsion object for that context has not yet been created then
|
|
|
|
* and the 'createIfNotInitalized' flag been set to false then returns NULL.
|
|
|
|
* If 'createIfNotInitalized' is true then the Extensions object is
|
|
|
|
* automatically created. However, in this case the extension object
|
|
|
|
* only be created with the graphics context associated with ContextID..*/
|
|
|
|
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
|
|
|
|
|
|
|
|
/** setExtensions allows users to override the extensions across graphics contexts.
|
|
|
|
* typically used when you have different extensions supported across graphics pipes
|
|
|
|
* but need to ensure that they all use the same low common denominator extensions.*/
|
|
|
|
static void setExtensions(unsigned int contextID,Extensions* extensions);
|
|
|
|
|
|
|
|
|
2002-06-21 03:54:08 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
Geometry& operator = (const Geometry&) { return *this;}
|
|
|
|
|
|
|
|
virtual ~Geometry();
|
2002-09-02 20:31:35 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
PrimitiveSetList _primitives;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2003-05-09 21:07:06 +08:00
|
|
|
#ifdef COMPILE_POSSIBLE_NEW_ARRAY_METHODS
|
|
|
|
AttributeList _attributeList;
|
|
|
|
#endif
|
2003-05-07 21:13:13 +08:00
|
|
|
ref_ptr<Vec3Array> _vertexArray;
|
|
|
|
ref_ptr<IndexArray> _vertexIndices;
|
2002-06-22 00:45:45 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
mutable AttributeBinding _normalBinding;
|
|
|
|
ref_ptr<Vec3Array> _normalArray;
|
|
|
|
ref_ptr<IndexArray> _normalIndices;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
mutable AttributeBinding _colorBinding;
|
|
|
|
ref_ptr<Array> _colorArray;
|
|
|
|
ref_ptr<IndexArray> _colorIndices;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
mutable AttributeBinding _secondaryColorBinding;
|
|
|
|
ref_ptr<Array> _secondaryColorArray;
|
|
|
|
ref_ptr<IndexArray> _secondaryColorIndices;
|
2002-08-16 04:27:33 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
mutable AttributeBinding _fogCoordBinding;
|
|
|
|
ref_ptr<Array> _fogCoordArray;
|
|
|
|
ref_ptr<IndexArray> _fogCoordIndices;
|
2002-08-16 04:27:33 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
TexCoordArrayList _texCoordList;
|
2002-10-02 21:12:16 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
VertexAttribArrayList _vertexAttribList;
|
|
|
|
mutable VertexAttribBindingList _vertexAttribBindingList;
|
2002-06-21 03:54:08 +08:00
|
|
|
|
2003-05-07 21:13:13 +08:00
|
|
|
mutable bool _fastPathComputed;
|
|
|
|
mutable bool _fastPath;
|
2002-06-21 03:54:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|