Skip to content

Instantly share code, notes, and snippets.

@marchelbling
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marchelbling/0c5908e13a1bd78a3f7c to your computer and use it in GitHub Desktop.
Save marchelbling/0c5908e13a1bd78a3f7c to your computer and use it in GitHub Desktop.
osg gdb scripts
set $id=0
set $numVertices = geom.getVertexArray()->getNumElements()
while $id < geom.getNumPrimitiveSets()
set $primitive = geom.getPrimitiveSet($id)
set $primitive_size = $primitive->getNumIndices()
printf "processing primitive n.%d (mode: %d, type: %d, size: %d)", $id, $primitive->getMode(), $primitive->getType(), $primitive_size
set $ii = 0
while $ii < $primitive_size
if $primitive->index($ii) >= $numVertices
printf "primitive %d has wrong index (%d >= %d) at index %d", $id, $primitive->index($ii), $numVertices, $ii
end
set $ii = $ii + 1
printf "."
end
set $id = $id + 1
printf " ok!\n"
end
if true
set $numVertices=geom.getVertexArray()->getNumElements()
set $normals=geom.getNormalArray()
if $normals != 0
if $normals->getNumElements() != $numVertices
printf ">>>wrong number of normals: %d when expecting %d\n", $normals->getNumElements(), $numVertices
end
else
printf "no normals...\n"
end
#####
set $colors=geom.getColorArray()
if $colors != 0
if $colors->getNumElements() != $numVertices
printf ">>>wrong number of colors: %d when expecting %d\n", $colors->getNumElements(), $numVertices
end
else
printf "no colors...\n"
end
#####
set $colors=geom.getSecondaryColorArray()
if $colors != 0
if $colors->getNumElements() != $numVertices
printf ">>>wrong number of colors: %d when expecting %d\n", $colors->getNumElements(), $numVertices
end
else
printf "no 2ndary colors...\n"
end
######
set $nbUvChannels=geom.getNumTexCoordArrays()
set $uv=0
while $uv < $nbUvChannels
set $channel=geom.getTexCoordArray($uv)
if $channel != 0
if $channel->getNumElements() != $numVertices
printf ">>> wrong number of uvs on channel n.%d: %d when expecting %d\n", $uv, $channel->getNumElements(), $numVertices
end
else
printf "no uv channel %d\n", $uv
end
set $uv = $uv + 1
end
######
set $nbAttributes=geom.getNumVertexAttribArrays()
set $va=0
while $va < $nbAttributes
set $attr=geom.getVertexAttribArray($va)
if $attr != 0
if $attr->getNumElements() != $numVertices
printf "wrong number of attributes on channel n.%d: %d when expecting %d\n", $va, $attr->getNumElements(), $numVertices
end
else
printf "no attribute channel %d\n", $va
end
set $va = $va + 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment