[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20662] branches/bb_dev/source/gameengine/ Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp: Fix for: Normals are not being updated in VBO.
Dalai Felinto
dfelinto at gmail.com
Fri Jun 5 22:56:20 CEST 2009
Revision: 20662
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20662
Author: dfelinto
Date: 2009-06-05 22:56:20 +0200 (Fri, 05 Jun 2009)
Log Message:
-----------
Fix for: Normals are not being updated in VBO.
Do we need to update Tangent as well?
Does anyone have a test file with a material with tangent space + skinned mesh (ie with armature) ?
Modified Paths:
--------------
branches/bb_dev/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
Modified: branches/bb_dev/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
===================================================================
--- branches/bb_dev/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp 2009-06-05 19:43:33 UTC (rev 20661)
+++ branches/bb_dev/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp 2009-06-05 20:56:20 UTC (rev 20662)
@@ -222,6 +222,8 @@
unsigned int num = 0;
RAS_VboSlot *slot = 0;
int usage = 0;
+ float *normals = 0;
+
for(ms->begin(it); !ms->end(it); ms->next(it)) {
if(it.totindex == 0)
continue;
@@ -231,16 +233,23 @@
{
if(!slot->m_verts)
slot->m_verts = new float[it.array->m_vertex.size()*3];
+
+ normals = new float[it.array->m_vertex.size()*3];
for(vertnum = 0, num = 0; vertnum < it.array->m_vertex.size(); vertnum++)
{
- memcpy(&slot->m_verts[num],
- it.array->m_vertex[vertnum].getXYZ(), sizeof(float)*3);
+ memcpy(&slot->m_verts[num], it.array->m_vertex[vertnum].getXYZ(), sizeof(float)*3);
+ memcpy(&normals[num], it.array->m_vertex[vertnum].getNormal(), sizeof(float)*3);
num+=3;
}
glBindBufferARB(GL_ARRAY_BUFFER_ARB, slot->m_vertVbo);
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0,
sizeof(float)*it.array->m_vertex.size()*3, slot->m_verts);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, slot->m_normalVbo);
+ glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0,
+ sizeof(float)*it.array->m_vertex.size()*3, normals);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+
}
if(zsort)
{
@@ -264,6 +273,7 @@
}
}
}
+ delete[] normals;
}
void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
More information about the Bf-blender-cvs
mailing list