Added VertexArrayState::ArrayDispatch::className() method and implementation for each ArrayDispatch subclass to help with debugging

This commit is contained in:
Robert Osfield 2017-10-06 17:47:19 +01:00
parent 11352bbdbb
commit 9ac2b2eb7b
2 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,8 @@ public:
modifiedCount(0xffffffff),
active(false) {}
virtual const char* className() const = 0; // { return "ArrayDispatch"; }
virtual void enable_and_dispatch(osg::State& /*state*/, const osg::Array* /*new_array*/) {} // = 0;
virtual void enable_and_dispatch(osg::State& /*state*/, const osg::Array* /*new_array*/, const osg::GLBufferObject* /*vbo*/) {} // = 0;

View File

@ -118,6 +118,8 @@ struct VertexArrayDispatch : public VertexArrayState::ArrayDispatch
{
VertexArrayDispatch() {}
virtual const char* className() const { return "VertexArrayDispatch"; }
virtual void enable_and_dispatch(osg::State&, const osg::Array* new_array)
{
VAS_NOTICE<<" VertexArrayDispatch::enable_and_dispatch("<<new_array->getNumElements()<<")"<<std::endl;
@ -171,6 +173,8 @@ struct ColorArrayDispatch : public VertexArrayState::ArrayDispatch
{
ColorArrayDispatch() {}
virtual const char* className() const { return "ColorArrayDispatch"; }
virtual void enable_and_dispatch(osg::State&, const osg::Array* new_array)
{
VAS_NOTICE<<" ColorArrayDispatch::enable_and_dispatch("<<new_array->getNumElements()<<")"<<std::endl;
@ -225,6 +229,8 @@ struct NormalArrayDispatch : public VertexArrayState::ArrayDispatch
{
NormalArrayDispatch() {}
virtual const char* className() const { return "NormalArrayDispatch"; }
virtual void enable_and_dispatch(osg::State&, const osg::Array* new_array)
{
VAS_NOTICE<<" NormalArrayDispatch::enable_and_dispatch("<<new_array->getNumElements()<<")"<<std::endl;
@ -286,6 +292,8 @@ struct SecondaryColorArrayDispatch : public VertexArrayState::ArrayDispatch
{
SecondaryColorArrayDispatch() {}
virtual const char* className() const { return "SecondaryColorArrayDispatch"; }
virtual void enable_and_dispatch(osg::State& state, const osg::Array* new_array)
{
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
@ -331,6 +339,8 @@ struct FogCoordArrayDispatch : public VertexArrayState::ArrayDispatch
{
FogCoordArrayDispatch() {}
virtual const char* className() const { return "FogCoordArrayDispatch"; }
virtual void enable_and_dispatch(osg::State& state, const osg::Array* new_array)
{
glEnableClientState(GL_FOG_COORDINATE_ARRAY);
@ -367,6 +377,8 @@ struct TexCoordArrayDispatch : public VertexArrayState::ArrayDispatch
{
TexCoordArrayDispatch(unsigned int in_unit) : unit(in_unit) {}
virtual const char* className() const { return "TexCoordArrayDispatch"; }
virtual void enable_and_dispatch(osg::State& state, const osg::Array* new_array)
{
VAS_NOTICE<<" TexCoordArrayDispatch::enable_and_dispatch("<<new_array->getNumElements()<<") unit="<<unit<<std::endl;
@ -436,6 +448,8 @@ struct VertexAttribArrayDispatch : public VertexArrayState::ArrayDispatch
{
VertexAttribArrayDispatch(unsigned int in_unit) : unit(in_unit) {}
virtual const char* className() const { return "VertexAttribArrayDispatch"; }
inline void callVertexAttribPointer(GLExtensions* ext, const osg::Array* new_array, const GLvoid * ptr)
{
if (new_array->getPreserveDataType())