2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit b863e31c authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

* Fixed MeshGeometry OpenGL buffer upload for colors and normals

* Implemented GeometryDataFactory::createCube() normal generation
parent ec6332b6
......@@ -68,7 +68,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(urb.x, llf.y, llf.z));
texCoords.push_back(tgt::vec3(tLlf.x, tLlf.y, tLlf.z));
vertices.push_back(tgt::vec3(llf.x, llf.y, llf.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(0.f, 0.f, -1.f))));
vertices.clear();
texCoords.clear();
......@@ -81,7 +81,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(urb.x, llf.y, urb.z));
texCoords.push_back(tgt::vec3(tUrb.x, tLlf.y, tLlf.z));
vertices.push_back(tgt::vec3(urb.x, llf.y, llf.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(1.f, 0.f, 0.f))));
vertices.clear();
texCoords.clear();
......@@ -94,7 +94,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(urb.x, urb.y, llf.z));
texCoords.push_back(tgt::vec3(tLlf.x, tUrb.y, tLlf.z));
vertices.push_back(tgt::vec3(llf.x, urb.y, llf.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(0.f, 1.f, 0.f))));
vertices.clear();
texCoords.clear();
......@@ -107,7 +107,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(llf.x, llf.y, llf.z));
texCoords.push_back(tgt::vec3(tLlf.x, tLlf.y, tUrb.z));
vertices.push_back(tgt::vec3(llf.x, llf.y, urb.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(-1.f, 0.f, 0.f))));
vertices.clear();
texCoords.clear();
......@@ -120,7 +120,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(urb.x, llf.y, urb.z));
texCoords.push_back(tgt::vec3(tLlf.x, tLlf.y, tUrb.z));
vertices.push_back(tgt::vec3(llf.x, llf.y, urb.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(0.f, -1.f, 0.f))));
vertices.clear();
texCoords.clear();
......@@ -133,7 +133,7 @@ namespace campvis {
vertices.push_back(tgt::vec3(llf.x, llf.y, urb.z));
texCoords.push_back(tgt::vec3(tUrb.x, tLlf.y, tUrb.z));
vertices.push_back(tgt::vec3(urb.x, llf.y, urb.z));
faces.push_back(FaceGeometry(vertices, texCoords));
faces.push_back(FaceGeometry(vertices, texCoords, std::vector<tgt::vec4>(), std::vector<tgt::vec3>(4, tgt::vec3(0.f, 0.f, 1.f))));
vertices.clear();
texCoords.clear();
......
......@@ -164,9 +164,9 @@ namespace campvis {
if (createTexCoordsBuffer)
_texCoordsBuffer->subdata(startIndex * sizeof(tgt::vec3), &(it->getTextureCoordinates().front()), numVertices * sizeof(tgt::vec3));
if (createColorsBuffer)
_colorsBuffer->subdata(startIndex * sizeof(tgt::vec3), &(it->getColors().front()), numVertices * sizeof(tgt::vec3));
_colorsBuffer->subdata(startIndex * sizeof(tgt::vec4), &(it->getColors().front()), numVertices * sizeof(tgt::vec4));
if (createNormalsBuffer)
_normalsBuffer->subdata(startIndex * sizeof(tgt::vec4), &(it->getNormals().front()), numVertices * sizeof(tgt::vec4));
_normalsBuffer->subdata(startIndex * sizeof(tgt::vec3), &(it->getNormals().front()), numVertices * sizeof(tgt::vec3));
startIndex += numVertices;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment