History

Normal map support almost there.

Andrzej Kapolka committed 13 years ago

Commit 06e050f1 parent 2931e2e13 files · +308 −54Browse files

Showing the changes to interface/src/renderer/GeometryCache.cpp (1 of 13 files). Show all

Unified · Split

interface/src/renderer/GeometryCache.cpp+11−5
@@ -396,7 +396,8 @@ void NetworkGeometry::maybeReadModelWithMapping() { · 395 unmodified lines
396 // if we don't need to do any blending or springing, then the positions/normals can be static396 // if we don't need to do any blending or springing, then the positions/normals can be static
397 if (mesh.blendshapes.isEmpty() && mesh.springiness == 0.0f) {397 if (mesh.blendshapes.isEmpty() && mesh.springiness == 0.0f) {
398 int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3);398 int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3);
399 int colorsOffset = normalsOffset + mesh.normals.size() * sizeof(glm::vec3);399 int tangentsOffset = normalsOffset + mesh.normals.size() * sizeof(glm::vec3);
400 int colorsOffset = tangentsOffset + mesh.tangents.size() * sizeof(glm::vec3);
400 int texCoordsOffset = colorsOffset + mesh.colors.size() * sizeof(glm::vec3);401 int texCoordsOffset = colorsOffset + mesh.colors.size() * sizeof(glm::vec3);
401 int clusterIndicesOffset = texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2);402 int clusterIndicesOffset = texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2);
402 int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4);403 int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4);
@@ -404,6 +405,7 @@ void NetworkGeometry::maybeReadModelWithMapping() { · 1 unmodified line
404 NULL, GL_STATIC_DRAW);405 NULL, GL_STATIC_DRAW);
405 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.vertices.size() * sizeof(glm::vec3), mesh.vertices.constData());406 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.vertices.size() * sizeof(glm::vec3), mesh.vertices.constData());
406 glBufferSubData(GL_ARRAY_BUFFER, normalsOffset, mesh.normals.size() * sizeof(glm::vec3), mesh.normals.constData());407 glBufferSubData(GL_ARRAY_BUFFER, normalsOffset, mesh.normals.size() * sizeof(glm::vec3), mesh.normals.constData());
408 glBufferSubData(GL_ARRAY_BUFFER, tangentsOffset, mesh.tangents.size() * sizeof(glm::vec3), mesh.tangents.constData());
407 glBufferSubData(GL_ARRAY_BUFFER, colorsOffset, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData());409 glBufferSubData(GL_ARRAY_BUFFER, colorsOffset, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData());
408 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2),410 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2),
409 mesh.texCoords.constData());411 mesh.texCoords.constData());
@@ -414,12 +416,14 @@ void NetworkGeometry::maybeReadModelWithMapping() { · 4 unmodified lines
414 416
415 // if there's no springiness, then the cluster indices/weights can be static417 // if there's no springiness, then the cluster indices/weights can be static
416 } else if (mesh.springiness == 0.0f) {418 } else if (mesh.springiness == 0.0f) {
417 int texCoordsOffset = mesh.colors.size() * sizeof(glm::vec3);419 int colorsOffset = mesh.tangents.size() * sizeof(glm::vec3);
420 int texCoordsOffset = colorsOffset + mesh.colors.size() * sizeof(glm::vec3);
418 int clusterIndicesOffset = texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2);421 int clusterIndicesOffset = texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2);
419 int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4);422 int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4);
420 glBufferData(GL_ARRAY_BUFFER, clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4),423 glBufferData(GL_ARRAY_BUFFER, clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4),
421 NULL, GL_STATIC_DRAW);424 NULL, GL_STATIC_DRAW);
422 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData()); 425 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.tangents.size() * sizeof(glm::vec3), mesh.tangents.constData());
426 glBufferSubData(GL_ARRAY_BUFFER, colorsOffset, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData());
423 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2), mesh.texCoords.constData());427 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2), mesh.texCoords.constData());
424 glBufferSubData(GL_ARRAY_BUFFER, clusterIndicesOffset, mesh.clusterIndices.size() * sizeof(glm::vec4),428 glBufferSubData(GL_ARRAY_BUFFER, clusterIndicesOffset, mesh.clusterIndices.size() * sizeof(glm::vec4),
425 mesh.clusterIndices.constData());429 mesh.clusterIndices.constData());
@@ -427,9 +431,11 @@ void NetworkGeometry::maybeReadModelWithMapping() { · 1 unmodified line
427 mesh.clusterWeights.constData());431 mesh.clusterWeights.constData());
428 432
429 } else {433 } else {
430 int texCoordsOffset = mesh.colors.size() * sizeof(glm::vec3);434 int colorsOffset = mesh.tangents.size() * sizeof(glm::vec3);
435 int texCoordsOffset = colorsOffset + mesh.colors.size() * sizeof(glm::vec3);
431 glBufferData(GL_ARRAY_BUFFER, texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2), NULL, GL_STATIC_DRAW);436 glBufferData(GL_ARRAY_BUFFER, texCoordsOffset + mesh.texCoords.size() * sizeof(glm::vec2), NULL, GL_STATIC_DRAW);
432 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData());437 glBufferSubData(GL_ARRAY_BUFFER, 0, mesh.tangents.size() * sizeof(glm::vec3), mesh.tangents.constData());
438 glBufferSubData(GL_ARRAY_BUFFER, colorsOffset, mesh.colors.size() * sizeof(glm::vec3), mesh.colors.constData());
433 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2),439 glBufferSubData(GL_ARRAY_BUFFER, texCoordsOffset, mesh.texCoords.size() * sizeof(glm::vec2),
434 mesh.texCoords.constData());440 mesh.texCoords.constData());
435 }441 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t