Added support for automatic vertex aliasing to new ArrayDispatchers, and updated wrappers
This commit is contained in:
@@ -54,6 +54,9 @@ class OSG_EXPORT ArrayDispatchers : public osg::Referenced
|
||||
void setUseGLBeginEndAdapter(bool flag) { _useGLBeginEndAdapter = flag; }
|
||||
bool getUseGLBeginEndAdapter() const { return _useGLBeginEndAdapter; }
|
||||
|
||||
void setUseVertexAttribAlias(bool flag) { _useVertexAttribAlias = flag; }
|
||||
bool getUseVertexAttribAlias() const { return _useVertexAttribAlias; }
|
||||
|
||||
void activate(unsigned int binding, AttributeDispatch* at)
|
||||
{
|
||||
if (at) _activeDispatchList[binding].push_back(at);
|
||||
@@ -118,7 +121,8 @@ class OSG_EXPORT ArrayDispatchers : public osg::Referenced
|
||||
typedef std::vector<AttributeDispatchList> ActiveDispatchList;
|
||||
ActiveDispatchList _activeDispatchList;
|
||||
|
||||
bool _useGLBeginEndAdapter;
|
||||
bool _useVertexAttribAlias;
|
||||
bool _useGLBeginEndAdapter;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,31 @@ namespace osg {
|
||||
// forward declare GraphicsContext, View and State
|
||||
class GraphicsContext;
|
||||
|
||||
class VertexAttribAlias
|
||||
{
|
||||
public:
|
||||
VertexAttribAlias():
|
||||
_location(0) {}
|
||||
|
||||
VertexAttribAlias(const VertexAttribAlias& rhs):
|
||||
_location(rhs._location),
|
||||
_glName(rhs._glName),
|
||||
_osgName(rhs._osgName),
|
||||
_declaration(rhs._declaration) {}
|
||||
|
||||
VertexAttribAlias(GLuint location, const std::string glName, const std::string osgName, const std::string& declaration):
|
||||
_location(location),
|
||||
_glName(glName),
|
||||
_osgName(osgName),
|
||||
_declaration(declaration) {}
|
||||
|
||||
GLuint _location;
|
||||
std::string _glName;
|
||||
std::string _osgName;
|
||||
std::string _declaration;
|
||||
};
|
||||
|
||||
|
||||
/** Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,
|
||||
* implements lazy state updating and provides accessors for querying the current state.
|
||||
* The venerable Red Book says that "OpenGL is a state machine", and this class
|
||||
@@ -188,9 +213,20 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
|
||||
Polytope getViewFrustum() const;
|
||||
|
||||
|
||||
void setUseVertexAttributeAliasing(bool flag) { _useVertexAttributeAliasing = flag; }
|
||||
bool getUseVertexAttributeAliasing() const { return _useVertexAttributeAliasing ; }
|
||||
|
||||
typedef std::vector<VertexAttribAlias> VertexAttribAliasList;
|
||||
|
||||
const VertexAttribAlias& getVertexAlias() { return _vertexAlias; }
|
||||
const VertexAttribAlias& getNormalAlias() { return _normalAlias; }
|
||||
const VertexAttribAlias& getColorAlias() { return _colorAlias; }
|
||||
const VertexAttribAlias& getSecondaryColorAlias() { return _secondaryColorAlias; }
|
||||
const VertexAttribAlias& getFogCoordAlias() { return _fogCoordAlias; }
|
||||
const VertexAttribAliasList& getTexCoordAliasList() { return _texCoordAliasList; }
|
||||
|
||||
|
||||
const Program::AttribBindingList& getAttributeBindingList() { return _attributeBindingList; }
|
||||
|
||||
bool convertVertexShaderSourceToOsgBuiltIns(std::string& source) const;
|
||||
@@ -1276,24 +1312,6 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
bool* _abortRenderingPtr;
|
||||
CheckForGLErrors _checkGLErrors;
|
||||
|
||||
struct VertexAttribAlias
|
||||
{
|
||||
VertexAttribAlias():
|
||||
_location(0) {}
|
||||
|
||||
VertexAttribAlias(GLuint location, const std::string glName, const std::string osgName, const std::string& declaration):
|
||||
_location(location),
|
||||
_glName(glName),
|
||||
_osgName(osgName),
|
||||
_declaration(declaration) {}
|
||||
|
||||
GLuint _location;
|
||||
std::string _glName;
|
||||
std::string _osgName;
|
||||
std::string _declaration;
|
||||
};
|
||||
|
||||
typedef std::vector<VertexAttribAlias> VertexAttribAliasList;
|
||||
|
||||
bool _useVertexAttributeAliasing;
|
||||
VertexAttribAlias _vertexAlias;
|
||||
|
||||
Reference in New Issue
Block a user