From c8ba1872746a4f490568613e331069a9166a855f Mon Sep 17 00:00:00 2001 From: vinjn Date: Sat, 19 Sep 2015 16:26:22 +0800 Subject: [PATCH 1/3] Add RGB to Triangle, ITMMesh and the generated OBJ files. Set OpenNIEngine to useInternalCalibration to align color with depth. --- InfiniTAM/Engine/UIEngine.cpp | 4 ++-- .../DeviceAgnostic/ITMRepresentationAccess.h | 19 +++++++++++++++++++ .../CPU/ITMMeshingEngine_CPU.cpp | 4 ++++ InfiniTAM/ITMLib/Engine/ITMMainEngine.cpp | 2 +- InfiniTAM/ITMLib/Objects/ITMMesh.h | 11 ++++++----- InfiniTAM/ITMLib/Utils/ITMLibDefines.h | 2 +- InfiniTAM/InfiniTAM.cpp | 4 +++- 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/InfiniTAM/Engine/UIEngine.cpp b/InfiniTAM/Engine/UIEngine.cpp index 79120f75f..9e99ca8f1 100644 --- a/InfiniTAM/Engine/UIEngine.cpp +++ b/InfiniTAM/Engine/UIEngine.cpp @@ -209,8 +209,8 @@ void UIEngine::glutKeyUpFunction(unsigned char key, int x, int y) else uiEngine->mainEngine->turnOffIntegration(); break; case 'w': - printf("saving mesh to disk ..."); - uiEngine->SaveSceneToMesh("mesh.stl"); + printf("saving colorful mesh to disk ..."); + uiEngine->SaveSceneToMesh("mesh.obj"); printf(" done\n"); break; default: diff --git a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h index 52d9984a5..a503bbdb3 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h +++ b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h @@ -343,6 +343,12 @@ struct VoxelColorReader { _CPU_AND_GPU_CODE_ static Vector4f interpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, const THREADPTR(Vector3f) & point) { return Vector4f(0.0f,0.0f,0.0f,0.0f); } + + _CPU_AND_GPU_CODE_ static Vector4f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, + const THREADPTR(Vector3f) & point) + { + return Vector4f(0.0f, 0.0f, 0.0f, 0.0f); + } }; template @@ -353,4 +359,17 @@ struct VoxelColorReader { typename TIndex::IndexCache cache; return readFromSDF_color4u_interpolated(voxelData, voxelIndex, point, cache); } + + _CPU_AND_GPU_CODE_ static Vector3f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, + const THREADPTR(Vector3i) & point) + { + typename TIndex::IndexCache cache; + bool isFound; + TVoxel resn = readVoxel(voxelData, voxelIndex, point, isFound, cache); + + if (isFound) + return Vector3f(resn.clr.r / 255.0f, resn.clr.g / 255.0f, resn.clr.b / 255.0f); + else + return Vector3f(0.0f, 0.0f, 0.0f); + } }; diff --git a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp index 4aeee4897..83c275725 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp +++ b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp @@ -43,11 +43,15 @@ void ITMMeshingEngine_CPU::MeshScene(ITMMesh *mesh, c if (cubeIndex < 0) continue; + Vector3f clr = VoxelColorReader:: + uninterpolate(localVBA, hashTable, globalPos + Vector3i(x, y, z)); + for (int i = 0; triangleTable[cubeIndex][i] != -1; i += 3) { triangles[noTriangles].p0 = vertList[triangleTable[cubeIndex][i]] * factor; triangles[noTriangles].p1 = vertList[triangleTable[cubeIndex][i + 1]] * factor; triangles[noTriangles].p2 = vertList[triangleTable[cubeIndex][i + 2]] * factor; + triangles[noTriangles].clr = clr; if (noTriangles < noMaxTriangles - 1) noTriangles++; } diff --git a/InfiniTAM/ITMLib/Engine/ITMMainEngine.cpp b/InfiniTAM/ITMLib/Engine/ITMMainEngine.cpp index 3590f37a4..8194d7ebc 100644 --- a/InfiniTAM/ITMLib/Engine/ITMMainEngine.cpp +++ b/InfiniTAM/ITMLib/Engine/ITMMainEngine.cpp @@ -104,7 +104,7 @@ void ITMMainEngine::SaveSceneToMesh(const char *objFileName) { if (mesh == NULL) return; meshingEngine->MeshScene(mesh, scene); - mesh->WriteSTL(objFileName); + mesh->WriteOBJ(objFileName); } void ITMMainEngine::ProcessFrame(ITMUChar4Image *rgbImage, ITMShortImage *rawDepthImage, ITMIMUMeasurement *imuMeasurement) diff --git a/InfiniTAM/ITMLib/Objects/ITMMesh.h b/InfiniTAM/ITMLib/Objects/ITMMesh.h index 7bef51083..cf0f6c835 100644 --- a/InfiniTAM/ITMLib/Objects/ITMMesh.h +++ b/InfiniTAM/ITMLib/Objects/ITMMesh.h @@ -14,7 +14,7 @@ namespace ITMLib class ITMMesh { public: - struct Triangle { Vector3f p0, p1, p2; }; + struct Triangle { Vector3f p0, p1, p2, clr; }; MemoryDeviceType memoryType; @@ -49,10 +49,11 @@ namespace ITMLib { for (uint i = 0; i < noTotalTriangles; i++) { - fprintf(f, "v %f %f %f\n", triangleArray[i].p0.x, triangleArray[i].p0.y, triangleArray[i].p0.z); - fprintf(f, "v %f %f %f\n", triangleArray[i].p1.x, triangleArray[i].p1.y, triangleArray[i].p1.z); - fprintf(f, "v %f %f %f\n", triangleArray[i].p2.x, triangleArray[i].p2.y, triangleArray[i].p2.z); - } + const auto& clr = triangleArray[i].clr; + fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p0.x, triangleArray[i].p0.y, triangleArray[i].p0.z, clr.r, clr.g, clr.b); + fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p1.x, triangleArray[i].p1.y, triangleArray[i].p1.z, clr.r, clr.g, clr.b); + fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p2.x, triangleArray[i].p2.y, triangleArray[i].p2.z, clr.r, clr.g, clr.b); + } for (uint i = 0; i":filename1); - imageSource = new OpenNIEngine(calibFile, filename1); + + // Set useInternalCalibration to true if ITMVoxel::hasColorInformation is true + imageSource = new OpenNIEngine(calibFile, filename1, ITMVoxel::hasColorInformation); if (imageSource->getDepthImageSize().x == 0) { delete imageSource; From abefdb61cac11fa92cb53d0247eac48299c567ba Mon Sep 17 00:00:00 2001 From: vinjn Date: Sat, 19 Sep 2015 16:32:16 +0800 Subject: [PATCH 2/3] Converts space to tab. --- .../DeviceAgnostic/ITMRepresentationAccess.h | 110 +++++++++--------- .../CPU/ITMMeshingEngine_CPU.cpp | 6 +- InfiniTAM/InfiniTAM.cpp | 4 +- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h index a503bbdb3..c9131ab1c 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h +++ b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h @@ -64,8 +64,8 @@ _CPU_AND_GPU_CODE_ inline int findVoxel(const CONSTPTR(ITMLib::Objects::ITMPlain Vector3i point = point_orig - voxelIndex->offset; if ((point.x < 0) || (point.x >= voxelIndex->size.x) || - (point.y < 0) || (point.y >= voxelIndex->size.y) || - (point.z < 0) || (point.z >= voxelIndex->size.z)) { + (point.y < 0) || (point.y >= voxelIndex->size.y) || + (point.z < 0) || (point.z >= voxelIndex->size.z)) { isFound = false; return -1; } @@ -245,91 +245,91 @@ _CPU_AND_GPU_CODE_ inline Vector3f computeSingleNormalFromSDF(const CONSTPTR(TVo float p1, p2, v1; // gradient x p1 = front.x * ncoeff.y * ncoeff.z + - front.z * coeff.y * ncoeff.z + - back.x * ncoeff.y * coeff.z + - back.z * coeff.y * coeff.z; + front.z * coeff.y * ncoeff.z + + back.x * ncoeff.y * coeff.z + + back.z * coeff.y * coeff.z; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(-1, 0, 0), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(-1, 1, 0), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(-1, 0, 1), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(-1, 1, 1), isFound).sdf; p2 = tmp.x * ncoeff.y * ncoeff.z + - tmp.y * coeff.y * ncoeff.z + - tmp.z * ncoeff.y * coeff.z + - tmp.w * coeff.y * coeff.z; + tmp.y * coeff.y * ncoeff.z + + tmp.z * ncoeff.y * coeff.z + + tmp.w * coeff.y * coeff.z; v1 = p1 * coeff.x + p2 * ncoeff.x; p1 = front.y * ncoeff.y * ncoeff.z + - front.w * coeff.y * ncoeff.z + - back.y * ncoeff.y * coeff.z + - back.w * coeff.y * coeff.z; + front.w * coeff.y * ncoeff.z + + back.y * ncoeff.y * coeff.z + + back.w * coeff.y * coeff.z; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(2, 0, 0), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(2, 1, 0), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(2, 0, 1), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(2, 1, 1), isFound).sdf; p2 = tmp.x * ncoeff.y * ncoeff.z + - tmp.y * coeff.y * ncoeff.z + - tmp.z * ncoeff.y * coeff.z + - tmp.w * coeff.y * coeff.z; + tmp.y * coeff.y * ncoeff.z + + tmp.z * ncoeff.y * coeff.z + + tmp.w * coeff.y * coeff.z; ret.x = TVoxel::SDF_valueToFloat(p1 * ncoeff.x + p2 * coeff.x - v1); // gradient y p1 = front.x * ncoeff.x * ncoeff.z + - front.y * coeff.x * ncoeff.z + - back.x * ncoeff.x * coeff.z + - back.y * coeff.x * coeff.z; + front.y * coeff.x * ncoeff.z + + back.x * ncoeff.x * coeff.z + + back.y * coeff.x * coeff.z; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, -1, 0), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, -1, 0), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, -1, 1), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, -1, 1), isFound).sdf; p2 = tmp.x * ncoeff.x * ncoeff.z + - tmp.y * coeff.x * ncoeff.z + - tmp.z * ncoeff.x * coeff.z + - tmp.w * coeff.x * coeff.z; + tmp.y * coeff.x * ncoeff.z + + tmp.z * ncoeff.x * coeff.z + + tmp.w * coeff.x * coeff.z; v1 = p1 * coeff.y + p2 * ncoeff.y; p1 = front.z * ncoeff.x * ncoeff.z + - front.w * coeff.x * ncoeff.z + - back.z * ncoeff.x * coeff.z + - back.w * coeff.x * coeff.z; + front.w * coeff.x * ncoeff.z + + back.z * ncoeff.x * coeff.z + + back.w * coeff.x * coeff.z; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 2, 0), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 2, 0), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 2, 1), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 2, 1), isFound).sdf; p2 = tmp.x * ncoeff.x * ncoeff.z + - tmp.y * coeff.x * ncoeff.z + - tmp.z * ncoeff.x * coeff.z + - tmp.w * coeff.x * coeff.z; + tmp.y * coeff.x * ncoeff.z + + tmp.z * ncoeff.x * coeff.z + + tmp.w * coeff.x * coeff.z; ret.y = TVoxel::SDF_valueToFloat(p1 * ncoeff.y + p2 * coeff.y - v1); // gradient z p1 = front.x * ncoeff.x * ncoeff.y + - front.y * coeff.x * ncoeff.y + - front.z * ncoeff.x * coeff.y + - front.w * coeff.x * coeff.y; + front.y * coeff.x * ncoeff.y + + front.z * ncoeff.x * coeff.y + + front.w * coeff.x * coeff.y; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 0, -1), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 0, -1), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 1, -1), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 1, -1), isFound).sdf; p2 = tmp.x * ncoeff.x * ncoeff.y + - tmp.y * coeff.x * ncoeff.y + - tmp.z * ncoeff.x * coeff.y + - tmp.w * coeff.x * coeff.y; + tmp.y * coeff.x * ncoeff.y + + tmp.z * ncoeff.x * coeff.y + + tmp.w * coeff.x * coeff.y; v1 = p1 * coeff.z + p2 * ncoeff.z; p1 = back.x * ncoeff.x * ncoeff.y + - back.y * coeff.x * ncoeff.y + - back.z * ncoeff.x * coeff.y + - back.w * coeff.x * coeff.y; + back.y * coeff.x * ncoeff.y + + back.z * ncoeff.x * coeff.y + + back.w * coeff.x * coeff.y; tmp.x = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 0, 2), isFound).sdf; tmp.y = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 0, 2), isFound).sdf; tmp.z = readVoxel(voxelData, voxelIndex, pos + Vector3i(0, 1, 2), isFound).sdf; tmp.w = readVoxel(voxelData, voxelIndex, pos + Vector3i(1, 1, 2), isFound).sdf; p2 = tmp.x * ncoeff.x * ncoeff.y + - tmp.y * coeff.x * ncoeff.y + - tmp.z * ncoeff.x * coeff.y + - tmp.w * coeff.x * coeff.y; + tmp.y * coeff.x * ncoeff.y + + tmp.z * ncoeff.x * coeff.y + + tmp.w * coeff.x * coeff.y; ret.z = TVoxel::SDF_valueToFloat(p1 * ncoeff.z + p2 * coeff.z - v1); @@ -344,11 +344,11 @@ struct VoxelColorReader { const THREADPTR(Vector3f) & point) { return Vector4f(0.0f,0.0f,0.0f,0.0f); } - _CPU_AND_GPU_CODE_ static Vector4f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, - const THREADPTR(Vector3f) & point) - { - return Vector4f(0.0f, 0.0f, 0.0f, 0.0f); - } + _CPU_AND_GPU_CODE_ static Vector4f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, + const THREADPTR(Vector3f) & point) + { + return Vector4f(0.0f, 0.0f, 0.0f, 0.0f); + } }; template @@ -360,16 +360,16 @@ struct VoxelColorReader { return readFromSDF_color4u_interpolated(voxelData, voxelIndex, point, cache); } - _CPU_AND_GPU_CODE_ static Vector3f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, - const THREADPTR(Vector3i) & point) - { - typename TIndex::IndexCache cache; - bool isFound; - TVoxel resn = readVoxel(voxelData, voxelIndex, point, isFound, cache); - - if (isFound) - return Vector3f(resn.clr.r / 255.0f, resn.clr.g / 255.0f, resn.clr.b / 255.0f); - else - return Vector3f(0.0f, 0.0f, 0.0f); - } + _CPU_AND_GPU_CODE_ static Vector3f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, + const THREADPTR(Vector3i) & point) + { + typename TIndex::IndexCache cache; + bool isFound; + TVoxel resn = readVoxel(voxelData, voxelIndex, point, isFound, cache); + + if (isFound) + return Vector3f(resn.clr.r / 255.0f, resn.clr.g / 255.0f, resn.clr.b / 255.0f); + else + return Vector3f(0.0f, 0.0f, 0.0f); + } }; diff --git a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp index 83c275725..83b30d20e 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp +++ b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CPU/ITMMeshingEngine_CPU.cpp @@ -43,15 +43,15 @@ void ITMMeshingEngine_CPU::MeshScene(ITMMesh *mesh, c if (cubeIndex < 0) continue; - Vector3f clr = VoxelColorReader:: - uninterpolate(localVBA, hashTable, globalPos + Vector3i(x, y, z)); + Vector3f clr = VoxelColorReader:: + uninterpolate(localVBA, hashTable, globalPos + Vector3i(x, y, z)); for (int i = 0; triangleTable[cubeIndex][i] != -1; i += 3) { triangles[noTriangles].p0 = vertList[triangleTable[cubeIndex][i]] * factor; triangles[noTriangles].p1 = vertList[triangleTable[cubeIndex][i + 1]] * factor; triangles[noTriangles].p2 = vertList[triangleTable[cubeIndex][i + 2]] * factor; - triangles[noTriangles].clr = clr; + triangles[noTriangles].clr = clr; if (noTriangles < noMaxTriangles - 1) noTriangles++; } diff --git a/InfiniTAM/InfiniTAM.cpp b/InfiniTAM/InfiniTAM.cpp index efa7ce0bd..8213f7a8d 100644 --- a/InfiniTAM/InfiniTAM.cpp +++ b/InfiniTAM/InfiniTAM.cpp @@ -45,8 +45,8 @@ static void CreateDefaultImageSource(ImageSourceEngine* & imageSource, IMUSource { printf("trying OpenNI device: %s\n", (filename1==NULL)?"":filename1); - // Set useInternalCalibration to true if ITMVoxel::hasColorInformation is true - imageSource = new OpenNIEngine(calibFile, filename1, ITMVoxel::hasColorInformation); + // Set useInternalCalibration to true if ITMVoxel::hasColorInformation is true + imageSource = new OpenNIEngine(calibFile, filename1, ITMVoxel::hasColorInformation); if (imageSource->getDepthImageSize().x == 0) { delete imageSource; From e2a761ff4c0b538731f3744972a63748d935ee27 Mon Sep 17 00:00:00 2001 From: Conner Brooks Date: Mon, 8 Feb 2016 22:06:56 -0500 Subject: [PATCH 3/3] Add rgb information when meshing with CUDA. --- .../ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h | 2 +- .../Engine/DeviceSpecific/CUDA/ITMMeshingEngine_CUDA.cu | 4 ++++ InfiniTAM/ITMLib/Objects/ITMMesh.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h index c9131ab1c..1dbafb1e5 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h +++ b/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMRepresentationAccess.h @@ -345,7 +345,7 @@ struct VoxelColorReader { { return Vector4f(0.0f,0.0f,0.0f,0.0f); } _CPU_AND_GPU_CODE_ static Vector4f uninterpolate(const CONSTPTR(TVoxel) *voxelData, const CONSTPTR(typename TIndex::IndexData) *voxelIndex, - const THREADPTR(Vector3f) & point) + const THREADPTR(Vector3i) & point) { return Vector4f(0.0f, 0.0f, 0.0f, 0.0f); } diff --git a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CUDA/ITMMeshingEngine_CUDA.cu b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CUDA/ITMMeshingEngine_CUDA.cu index 33166d203..e271cbe46 100644 --- a/InfiniTAM/ITMLib/Engine/DeviceSpecific/CUDA/ITMMeshingEngine_CUDA.cu +++ b/InfiniTAM/ITMLib/Engine/DeviceSpecific/CUDA/ITMMeshingEngine_CUDA.cu @@ -97,6 +97,9 @@ __global__ void meshScene_device(ITMMesh::Triangle *triangles, unsigned int *noT if (cubeIndex < 0) return; + Vector3f clr = VoxelColorReader:: + uninterpolate(localVBA, hashTable, globalPos + Vector3i(threadIdx.x, threadIdx.y, threadIdx.z)); + for (int i = 0; triangleTable[cubeIndex][i] != -1; i += 3) { int triangleId = atomicAdd(noTriangles_device, 1); @@ -106,6 +109,7 @@ __global__ void meshScene_device(ITMMesh::Triangle *triangles, unsigned int *noT triangles[triangleId].p0 = vertList[triangleTable[cubeIndex][i]] * factor; triangles[triangleId].p1 = vertList[triangleTable[cubeIndex][i + 1]] * factor; triangles[triangleId].p2 = vertList[triangleTable[cubeIndex][i + 2]] * factor; + triangles[triangleId].clr = clr; } } } diff --git a/InfiniTAM/ITMLib/Objects/ITMMesh.h b/InfiniTAM/ITMLib/Objects/ITMMesh.h index cf0f6c835..cf3f1e5d7 100644 --- a/InfiniTAM/ITMLib/Objects/ITMMesh.h +++ b/InfiniTAM/ITMLib/Objects/ITMMesh.h @@ -49,7 +49,7 @@ namespace ITMLib { for (uint i = 0; i < noTotalTriangles; i++) { - const auto& clr = triangleArray[i].clr; + const Vector3f clr = triangleArray[i].clr; fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p0.x, triangleArray[i].p0.y, triangleArray[i].p0.z, clr.r, clr.g, clr.b); fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p1.x, triangleArray[i].p1.y, triangleArray[i].p1.z, clr.r, clr.g, clr.b); fprintf(f, "v %f %f %f %f %f %f\n", triangleArray[i].p2.x, triangleArray[i].p2.y, triangleArray[i].p2.z, clr.r, clr.g, clr.b);