Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1585 - trunk/Model/Groups
- Date: Mon, 30 Jul 2007 18:10:41 -0600 (MDT)
Author: abe
Date: Mon Jul 30 18:10:40 2007
New Revision: 1585
Modified:
trunk/Model/Groups/KDTreeLoader.cc
Log:
Attempting to get he 777 demo working on a smaller system.
M Groups/KDTreeLoader.cc
Modified: trunk/Model/Groups/KDTreeLoader.cc
==============================================================================
--- trunk/Model/Groups/KDTreeLoader.cc (original)
+++ trunk/Model/Groups/KDTreeLoader.cc Mon Jul 30 18:10:40 2007
@@ -142,8 +142,12 @@
for (long i=begin_offset;i<end_offset;++i) {
(**tris)[i].v[0] = 0.0;
+
(*perVertNormals)[i][0][0] = 0.0;
+
+#ifdef USE_TEXTURE_COORDS
(*perVertTexCoords)[i][0][0] = 0.0;
+#endif
}
// Wait for other threads to initialize.
@@ -195,8 +199,10 @@
}
if (rawTexData) {
+#ifdef USE_TEXTURE_COORDS
(*perVertTexCoords)[i][j] = VectorT<float,2>( _rawTexData[0],
_rawTexData[1] );
+#endif
_rawTexData += 2;
}
}
@@ -305,6 +311,7 @@
FILE *normal_file;
float *rawNormData = 0;
+
size_t normal_file_size;
if ((normal_file=fopen(normal_file_name, "r")) == NULL) {
fprintf(stderr, "Cannot open file: %s\n", normal_file_name);
@@ -331,15 +338,18 @@
}
}
+
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Load texture coordinates.
+ float *rawTexData = 0;
+
+#ifdef USE_TEXTURE_COORDS
char tex_file_name[512];
strcpy(tex_file_name, filename);
strcat(tex_file_name, ".tex2");
FILE *tex_file;
- float *rawTexData = 0;
size_t tex_file_size;
if ((tex_file=fopen(tex_file_name, "r")) == NULL) {
fprintf(stderr, "Cannot open file: %s\n", tex_file_name);
@@ -366,6 +376,7 @@
std::cerr << "Could not allocate " << (tex_file_size) << " bytes." <<
std::endl;
}
}
+#endif
/////////////////////////////////////////////////////////////////////////////
@@ -373,8 +384,15 @@
// Allocate normals.
*perVertNormals = new TriangleNormal[nTris];
+
// Allocate texture coords.
+#if USE_TEXTURE_COORDS
*perVertTexCoords = new TextureCoord[nTris*3];
+#else
+ *perVertTexCoords = 0;
+#endif
+
+
/////////////////////////////////////////////////////////////////////////////
// Start up the worker threads and touch the memory to distribute it.
@@ -446,7 +464,8 @@
if (trisRead != nTris) {
fprintf(stderr, "Error reading file: %s Tris read: %ld;
expected: %ld\n", filename, trisRead, nTris);
}
-
+
+
if(rawNormData) {
trisRead = fread_64(rawNormData, 36, normal_file_size/36,
normal_file );
if (trisRead != nTris) {
@@ -454,12 +473,15 @@
}
}
+
+#ifdef USE_TEXTURE_COORDS
if (rawTexData) {
trisRead = fread_64(rawTexData, 24, tex_file_size/24,
tex_file );
if (trisRead != nTris) {
fprintf(stderr, "Error reading file: %s Tris read:
%ld; expected: %ld\n", tex_file_name, trisRead, nTris);
}
}
+#endif
double time_end = Time::currentSeconds();
@@ -504,7 +526,9 @@
// Delete the intermediate raw data.
delete [] rawVertColData;
delete [] rawNormData;
+#if USE_TEXTURE_COORDS
delete [] rawTexData;
+#endif
memory_time += (Time::currentSeconds() - time_begin);
- [MANTA] r1585 - trunk/Model/Groups, abe, 07/30/2007
Archive powered by MHonArc 2.6.16.