Added Vector serialization and support in lua plugin top enable script users to set/get vector properties such as osg::Array, osg::PrimitiveSet and children lists.

This commit is contained in:
Robert Osfield
2014-02-24 10:19:48 +00:00
parent 6d68718fba
commit 4ef5d9eb5f
15 changed files with 1566 additions and 103 deletions

View File

@@ -189,6 +189,22 @@ const Array* Geometry::getTexCoordArray(unsigned int index) const
else return 0;
}
void Geometry::setTexCoordArrayList(const ArrayList& arrayList)
{
_texCoordList = arrayList;
dirtyDisplayList();
if (_useVertexBufferObjects)
{
for(ArrayList::iterator itr = _texCoordList.begin();
itr != _texCoordList.end();
++itr)
{
addVertexBufferObjectIfRequired(itr->get());
}
}
}
void Geometry::setVertexAttribArray(unsigned int index, Array* array, osg::Array::Binding binding)
{
@@ -216,6 +232,23 @@ const Array *Geometry::getVertexAttribArray(unsigned int index) const
else return 0;
}
void Geometry::setVertexAttribArrayList(const ArrayList& arrayList)
{
_vertexAttribList = arrayList;
dirtyDisplayList();
if (_useVertexBufferObjects)
{
for(ArrayList::iterator itr = _vertexAttribList.begin();
itr != _vertexAttribList.end();
++itr)
{
addVertexBufferObjectIfRequired(itr->get());
}
}
}
bool Geometry::addPrimitiveSet(PrimitiveSet* primitiveset)
{
@@ -712,7 +745,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
// draw the primitives themselves.
//
drawPrimitivesImplementation(renderInfo);
// unbind the VBO's if any are used.
state.unbindVertexBufferObject();
state.unbindElementBufferObject();