Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r471 - in branches/itanium2: Model/Groups Model/Materials Readers/DoubleEagle fox scenes
- Date: Fri, 12 Aug 2005 20:59:02 -0600 (MDT)
Author: abe
Date: Fri Aug 12 20:58:56 2005
New Revision: 471
Added:
branches/itanium2/Model/Groups/KDTree.cc
- copied, changed from r470, branches/itanium2/Model/Groups/kdtree.cc
branches/itanium2/Model/Groups/KDTree.h
- copied, changed from r461, branches/itanium2/Model/Groups/kdtree.h
branches/itanium2/Model/Groups/KDTreeLoader.cc
branches/itanium2/Model/Groups/KDTreeLoader.h
Removed:
branches/itanium2/Model/Groups/kdtree.cc
branches/itanium2/Model/Groups/kdtree.h
Modified:
branches/itanium2/Model/Groups/CMakeLists.txt
branches/itanium2/Model/Groups/TransparentKDTree.cc
branches/itanium2/Model/Groups/TransparentKDTree.h
branches/itanium2/Model/Groups/VolumeGrid.h
branches/itanium2/Model/Materials/CopyColorMaterial.cc
branches/itanium2/Model/Materials/LambertianAlt.cc
branches/itanium2/Readers/DoubleEagle/vn2v3c1.cc
branches/itanium2/fox/dm_demo.cc
branches/itanium2/scenes/boeing777.cc
Log:
M Model/Groups/TransparentKDTree.cc
M Model/Groups/TransparentKDTree.h
A Model/Groups/KDTreeLoader.cc
A Model/Groups/KDTreeLoader.h
A Model/Groups/KDTree.cc
D Model/Groups/kdtree.cc
D Model/Groups/kdtree.h
A Model/Groups/KDTree.h
M Model/Groups/CMakeLists.txt
M Model/Materials/LambertianAlt.cc
M Model/Materials/CopyColorMaterial.cc
M scenes/boeing777.cc
M fox/dm_demo.cc
Moved the kdtree loading code into KDTreeLoader.cc
Modified KDTree so that the full boeing demo uses 8GB less memory.
M Readers/DoubleEagle/vn2v3c1.cc
M Model/Groups/VolumeGrid.h
Commented out line that prevented compiling on gcc
Modified: branches/itanium2/Model/Groups/CMakeLists.txt
==============================================================================
--- branches/itanium2/Model/Groups/CMakeLists.txt (original)
+++ branches/itanium2/Model/Groups/CMakeLists.txt Fri Aug 12 20:58:56
2005
@@ -6,10 +6,12 @@
Groups/RealisticBvh.cc
Groups/Group.h
Groups/Group.cc
- Groups/kdtree.h
- Groups/kdtree.cc
+ Groups/KDTree.h
+ Groups/KDTree.cc
Groups/TransparentKDTree.h
Groups/TransparentKDTree.cc
+ Groups/KDTreeLoader.h
+ Groups/KDTreeLoader.cc
Groups/PsiGammaTable.cc
Groups/PsiGammaTable.h
Groups/VolumeGrid.h
Copied: branches/itanium2/Model/Groups/KDTree.cc (from r470,
branches/itanium2/Model/Groups/kdtree.cc)
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.cc (original)
+++ branches/itanium2/Model/Groups/KDTree.cc Fri Aug 12 20:58:56 2005
@@ -33,7 +33,7 @@
#include <stdio.h>
#include "varray.h"
-#include "kdtree.h"
+#include "KDTree.h"
#include <Model/Intersections/AxisAlignedBox.h>
#include <Interface/Context.h>
@@ -50,594 +50,30 @@
using std::endl;
-// From Tomas Akenine-Mˆller's code, included below in this file.
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// Triangle Intersection routines.
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
int intersect_triangle3(const float orig[3],
const float dir[3],
const float vert0[3], const float vert1[3], const float
vert2[3],
float *t, float *u, float *v );
+// Currently this routine is the fastest.
+// This is a C version of the ray triangle intersection edge form.
int intersect_triangle3_edge( const float orig[3],
const float dir[3],
const float
vert0[3],
float *t, float *u,
float *v,
const float *edge1,
const float *edge2);
+// This is a C++ version of the above routine.
int intersectTriangle3Edge(const Vectorf &direction, const Pointf &origin,
const Vectorf &edge1, Vectorf &edge2, Pointf &p0,
float &t, float &u, float &v );
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-// Worker thread for load V3C1 method (boeing dataset).
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-class V3C1Worker : public Runnable {
-public:
- BBox &bounds; // Thread specific bounding box.
- Barrier &v3c1_barrier;
- int np;
-
- // Target data.
- float *rawData;
- VArray<Triangle> **tris;
- Vectorf **perVertNormals;
-
- // Region of data this thread is responsible for.
- long begin_offset;
- long end_offset;
-
-
/////////////////////////////////////////////////////////////////////////////
- // Constructor.
- V3C1Worker( Barrier &v3c1_barrier_, int np_, float *rawData_,
VArray<Triangle> **tris_, Vectorf **perVertNormals_,
- long begin_offset_, long end_offset_, BBox &bounds_ ) :
- Runnable( true ),
- bounds( bounds_ ),
- v3c1_barrier( v3c1_barrier_ ),
- np( np_ ),
- rawData( rawData_ ), tris( tris_ ), perVertNormals(
perVertNormals_ ),
- begin_offset( begin_offset_ ), end_offset( end_offset_ ) { }
-
-
/////////////////////////////////////////////////////////////////////////////
- // This is the thread method.
- virtual void run() {
-
- // Touch all of the buffers assigned to this thread.
- for (int i=begin_offset;i<end_offset;++i) {
-
- (**tris)[i][0] = Pointf( 0.0, 0.0, 0.0 );
- (*perVertNormals)[3*i] = Vector( 0.0, 0.0, 0.0 );
- }
-
- // Wait for other threads to initialize.
- v3c1_barrier.wait(np+1);
-
- // Wait for the io thread to read in the data.
- v3c1_barrier.wait(np+1);
-
- for (long i=begin_offset; i<end_offset; i++) {
-
- // Offset into the data.
- float *_rawData = rawData + 12 * i;
-
- // Check to see if we are on a big endian system
- // Data was generate on Altix (little endian)
- if (is_big_endian()) {
- for (int j=0; j<3; ++j) {
- (**tris)[i][j] = Pointf( endian_swap(
_rawData[0] ),
-
endian_swap(
_rawData[1] ),
-
endian_swap(
_rawData[2] ));
- _rawData += 3;
- }
- }
-
- // Otherwise don't swap.
- else {
- for (int j=0; j<3; ++j) {
- (**tris)[i][j] = Pointf( _rawData[0],
_rawData[1], _rawData[2] );
- _rawData += 3;
- }
- }
-
- float r, g, b;
-
- // Check for big endian data.
- if (is_big_endian()) {
- r = int(endian_swap(_rawData[0]) * 255 + .5f);
- g = int(endian_swap(_rawData[1]) * 255 + .5f);
- b = int(endian_swap(_rawData[2]) * 255 + .5f);
- _rawData += 3;
- }
- else {
- r = _rawData[0];
- g = _rawData[1];
- b = _rawData[2];
- // r = int(_rawData[0] * 255 + .5f);
- // g = int(_rawData[1] * 255 + .5f);
- // b = int(_rawData[2] * 255 + .5f);
- _rawData += 3;
- }
-
- // Compute edges.
- (**tris)[i].edge1 = (**tris)[i][1] - (**tris)[i][0];
- (**tris)[i].edge2 = (**tris)[i][2] - (**tris)[i][0];
-
- // Specify the payload.
- // (**tris)[i].payload = ((r<<16)+(g<<8)+b);
- (**tris)[i].payload = Color(RGB( r, g, b ));
-
- // Compute the normal.
- (*perVertNormals)[3*i] = Cross((**tris)[i].edge1,
(**tris)[i].edge2).normal();
-
- // Copy normals to each vertex.
- (*perVertNormals)[3*i+1] = (*perVertNormals)[3*i+2] =
(*perVertNormals)[3*i];
-
- // Update the bounding box of the whole scene
- for (long j=0; j<3; j++) {
- Triangle &tri = (**tris)[i];
- bounds.extendByPoint( tri[0] );
- bounds.extendByPoint( tri[1] );
- bounds.extendByPoint( tri[2] );
- }
- }
- }
-
-};
-
-
-int LoadTris(const char *filename,
- VArray<Triangle> **tris,
- Vectorf **perTriNormals,
- Vectorf **perVertNormals,
- BBox &bounds )
-{
- FILE *f;
-
- // perVertNormals = perVertNormals;
-
- // Open the input file.
- if ((f=fopen(filename, "r")) == NULL) {
- fprintf(stderr, "Cannot open file: %s\n", filename);
- return 0;
- }
-
- // Allocate store for the triangles.
- *tris = new VArray<Triangle>;
-
- int line = 0;
- char line_buffer[128];
-
- // Read in the file.
- while (fgets( line_buffer, 127, f ) != NULL) {
-
- // Read in a triangle.
- Triangle tri;
-
- // Parse the triangle description from the file.
- int num_parsed = sscanf( line_buffer,
-
"%f %f %f %f %f %f %f %f %f 0x%X",
- &tri[0][0],
&tri[0][1], &tri[0][2],
- &tri[1][0],
&tri[1][1], &tri[1][2],
- &tri[2][0],
&tri[2][1], &tri[2][2],
- &tri.payload
);
- if (num_parsed != 10) {
- cerr << "Only parsed " << num_parsed << " components
for line "
- << line << " in file "
- << filename << endl;
- break;
- }
-
- ++line;
-
- // Done reading in triangles.
- // time = timer.get_time();
-
- // std::cout << "Input triangles per second: " <<
(double)triangles / (double)time << std::endl;
-
-#if 0
- // Get rid of degenerate polygons
- if ( SAME_TOL_VEC3V(tri[0], tri[1], 1e-5) ||
- SAME_TOL_VEC3V(tri[1], tri[2], 1e-5) ||
- SAME_TOL_VEC3V(tri[2], tri[0], 1e-5) ) {
-
- fprintf(stderr, "Degenerated triangle.\n");
- continue;
- }
-#endif
-
- // Update the bounding box of the whole scene
- bounds.extendByPoint( tri[0] );
- bounds.extendByPoint( tri[1] );
- bounds.extendByPoint( tri[2] );
-
- // Compute the triangle edges.
- tri.edge1 = tri[1] - tri[0];
- tri.edge2 = tri[2] - tri[0];
-
- // Add the triangle to the list.
- (**tris).append(tri);
- }
-
- // Determine the total number of triangles.
- int n = (**tris).getLen();
- fprintf(stderr, "%d triangles loaded\n", n );
-
- // Check to see if per face normals are needed.
- if (perTriNormals) { // if per-triangle normals are required
- *perTriNormals = new Vectorf[n];
- for (int i=0; i<n; i++) {
- Vectorf v01, v02;
- v01 = (**tris)[i][1] - (**tris)[i][0];
- v02 = (**tris)[i][2] - (**tris)[i][0];
-
- (*perTriNormals)[i] = Cross(v01, v02 ).normal();
- }
- }
-
- // Check to see if per vertex normals are needed.
- if (perVertNormals) { // if per-vertex normals are required
- *perVertNormals = new Vectorf[3*n];
- for (int i=0; i<n; i++) {
- Vectorf v01, v02;
- v01 = (**tris)[i][1] - (**tris)[i][0];
- v02 = (**tris)[i][2] - (**tris)[i][0];
-
- int offset = i*3;
-
- // Hansong: these aren't actually per vertex normals??
- (*perVertNormals)[offset] = Cross( v01, v02
).normal();
- (*perVertNormals)[offset+1] =
(*perVertNormals)[offset+2] = (*perVertNormals)[offset];
- }
- }
-
- // Close the file.
- if (fclose(f))
- fprintf(stderr, "Error closing %s\n", filename);
-
- return 1;
-}
-
-struct CacheAlignedBBox {
- BBox box;
- char padding[MAXCACHELINESIZE-sizeof(BBox)];
-};
-
-int LoadBin_V3C1(const char *filename, VArray<Triangle> **tris, /*Vectorf
**perVertNormals,*/ Vectorf **perVertNormals, BBox &bounds, int np ) {
-
- FILE *f;
- if ((f=fopen(filename, "r")) == NULL) {
- fprintf(stderr, "Cannot open file: %s\n", filename);
- return 0;
- }
-
- // Determine the input file size.
- fseek(f, 0, SEEK_END);
- long fileSize = ftell(f);
- fseek(f, 0, SEEK_SET);
-
-
/////////////////////////////////////////////////////////////////////////////
- // Determine the amount of memory needed.
- long nTris = fileSize / (12*sizeof(float));
- int nFloats = fileSize/4;
-
- // Allocate input buffer.
- float *rawData = new float [fileSize / 4];
-
- // Allocate triangles.
- *tris = new VArray<Triangle> (nTris);
- (*tris)->setLen(nTris);
-
- // Allocate normals.
- *perVertNormals = new Vectorf [nTris*3];
-
-
/////////////////////////////////////////////////////////////////////////////
- // Start up the worker threads and touch the memory to distribute it.
-
- std::cerr << "Creating " << np << " workers." << std::endl;
-
- // Create worker threads to preprocess and bound the data.
- Thread **workers = new Thread *[ np ];
- CacheAlignedBBox *worker_box = new CacheAlignedBBox[ np ];
- Barrier v3c1_barrier( "v3c1_barrier" );
-
- int work_per_thread = nTris / np;
-
- long begin = 0;
- long end = work_per_thread;
-
- std::cerr << "Faces per worker: " << work_per_thread << std::endl;
-
- char worker_name[32];
-
- // Assign work to the workers.
- for (int i=0;i<np-1;++i) {
-
- sprintf( worker_name, "V3C1 Worker %d", i );
- workers[i] = new Thread( new V3C1Worker( v3c1_barrier, np,
rawData, tris, perVertNormals, begin, end, worker_box[i].box ), worker_name
);
-
- begin = end;
- end += work_per_thread;
- }
-
- // Assign the rest of the work to the last worker.
- sprintf( worker_name, "V3C1 Worker %d", np-1 );
- workers[np-1] = new Thread( new V3C1Worker( v3c1_barrier, np,
rawData, tris, perVertNormals, begin, nTris, worker_box[np-1].box ), "V3C1
Worker" );
-
- // Wait for all of workers to initialize.
- std::cerr << "Waiting for workers to initalize." << std::endl;
- v3c1_barrier.wait( np+1 );
-
-
/////////////////////////////////////////////////////////////////////////////
- // Read in the data.
- double time_begin = Time::currentSeconds();
-
- long trisRead = fread(rawData, 48, fileSize/48, f);
- if (trisRead != nTris) {
- fprintf(stderr, "Error reading file: %s Tris read: %ld;
expected: %ld\n", filename, trisRead, nTris);
- }
-
- double time_end = Time::currentSeconds();
-
- std::cerr << "Time to input triangles: " << (time_end-time_begin)
<< " seconds. " << std::endl
- << "Total file size: " <<
((double)fileSize/1048576.0) << " MB. " << std::endl
- << "IO Performance: " <<
((double)fileSize/1048576.0)/(time_end-time_begin) << " MB/second." <<
std::endl;
-
- // Allocate a new array for the triangles.
- time_begin = Time::currentSeconds();
-
- // Record the time for alloc/dealloc
- double memory_time = (Time::currentSeconds() - time_begin);
-
-
/////////////////////////////////////////////////////////////////////////////
- // Record the time for the actual preprocess.
- time_begin = Time::currentSeconds();
-
- std::cerr << "Beginning preprocess" << std::endl;
- v3c1_barrier.wait( np+1 );
-
- // Wait for all of the threads to finish.
- for (int i=0;i<np;++i) {
- workers[i]->join();
-
- std::cerr << "Worker " << i << " finished." << std::endl;
-
- // Enlarge the bounding box.
- bounds.extendByBox( worker_box[i].box );
- }
-
- // Delete the array of pointers to workers.
- delete [] workers;
- delete [] worker_box;
-
- time_end = Time::currentSeconds();
-
- std::cerr << "Time to parse triangles: " << (time_end - time_begin)
<< " Seconds." << std::endl;
- std::cerr << "Triangles loaded: " << nTris << std::endl;
-
- time_begin = Time::currentSeconds();
-
- delete [] rawData;
-
- memory_time += (Time::currentSeconds() - time_begin);
-
- std::cerr << "Total time for memory allocation/deallocation: " <<
memory_time << " Seconds." << std::endl;
-
- return 1;
-}
-
-int LoadBin_N1V3(const char *filename, VArray<Triangle> **tris,
- Vectorf
**perVertNormals,
- BBox &bounds,
- long long
maxtris=-1)
-{
- FILE *f;
- int nFloatPerTri = 3+9;
- int triSize = nFloatPerTri*sizeof(float);
-
- if ((f=fopen(filename, "r")) == NULL) {
- fprintf(stderr, "Cannot open file: %s\n", filename);
- return 0;
- }
-
- fseek(f, 0, SEEK_END);
- long long fileSize = ftell(f);
- // One normal followed by 3 vertices
- long long nTris = fileSize / ((3+9)*4);
-
- if (maxtris>0 && nTris > maxtris)
- nTris = maxtris;
-
- long long totalNumFloats = nFloatPerTri * nTris;
- float *rawData = new float [totalNumFloats];
- long i;
-// #pragma omp parallel for private (i)
-
- // Zero out the raw data.
- memset( rawData, 0x0, totalNumFloats*sizeof(float) );
-
- fseek(f, 0, SEEK_SET);
- long long nFloats = fread(rawData, sizeof(float), totalNumFloats, f);
- if (nFloats != totalNumFloats) {
- fprintf(stderr, "Error reading file: %s (size in floats: %lld
read: %lld)\n", filename, totalNumFloats, nFloats);
- }
-
- *tris = new VArray<Triangle> (nTris);
- (*tris)->setLen(nTris);
- *perVertNormals = new Vectorf [nTris*3];
-
- float *_rawData;
-// #pragma omp parallel for private (_rawData, i)
- for (i=0; i<nTris; i++) {
- _rawData = rawData + 12 * i;
-
- (*perVertNormals)[3*i] = (*perVertNormals)[3*i+1] =
- (*perVertNormals)[3*i+2] =
- Vectorf(_rawData[0],
_rawData[1], _rawData[2]);
-
- (**tris)[i][0] = Point(_rawData[3], _rawData[4], _rawData[5]);
- _rawData += 6; // Is this correct?
-
- (**tris)[i][1] = Point(_rawData[0], _rawData[1], _rawData[2]);
- _rawData += 3;
-
- (**tris)[i][2] = Point(_rawData[0], _rawData[1], _rawData[2]);
- _rawData += 3;
-
- (**tris)[i].payload = Color(RGB(1.0,1.0,1.0));
-
- // Compute edges.
- (**tris)[i].edge1 = (**tris)[i][1] - (**tris)[i][0];
- (**tris)[i].edge2 = (**tris)[i][2] - (**tris)[i][0];
-
- //
- // Update the bounding box of the whole scene
- for (int j=0; j<3; j++) {
- Triangle &tri = (**tris)[i];
- bounds.extendByPoint( tri[0] );
- bounds.extendByPoint( tri[1] );
- bounds.extendByPoint( tri[2] );
- }
- }
-
- fprintf(stderr, "Triangles loaded: %d\n", nTris);
- delete [] rawData;
- return 1;
-}
-
-
-// This structure is only used to read from the kd tree file.
-struct AABox3f {
- Pointf min, max;
-};
-
-float endianness_swap( float in ) {
- float out;
- char *ci = (char *)∈
- char *co = (char *)&out;
- co[3] = ci[0];
- co[2] = ci[1];
- co[1] = ci[2];
- co[0] = ci[3];
-
- return out;
-}
-
-int KDTree::load( const char *fn, int np ) {
-
- double time_begin = Time::currentSeconds();
-
- // Call a helper function to load the triangles.
- if (strstr(fn, ".tri")) {
- LoadTris(fn, &tris, NULL, &normals, bbox );
- } else if (strstr(fn, ".v3c1")) {
- LoadBin_V3C1(fn, &tris, &normals, bbox, np );
- } else if (strstr(fn, ".bin") || strstr(fn, "n1v3")) {
- LoadBin_N1V3(fn, &tris, &normals, bbox );
- } else {
- fprintf(stderr, "Unrecognized file type.\n");
- return 0;
- }
-
- double time_end = Time::currentSeconds();
-
- std::cerr << "Total time for loading triangles: " << (time_end -
time_begin) << std::endl << std::endl;
-
-
/////////////////////////////////////////////////////////////////////////////
- // Load the kd tree.
- char filename[512];
- strcpy(filename, fn);
- strcat(filename, ".kd"); // the kd-tree file
- FILE *f = fopen(filename, "rb");
- if (! f) {
- fprintf(stderr, "Error: cannot open %s for loading\n",
filename);
- }
-
- fseek(f, 0, SEEK_END);
- long long fileSize = ftell(f);
-
- void *buffer = (void*)malloc(fileSize);
- fseek(f, 0, SEEK_SET);
-
- time_begin = Time::currentSeconds();
-
- long long nread = fread(buffer, 1, fileSize, f);
- if (nread != fileSize) {
- fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
- filename, fileSize, nread);
- }
- fclose(f);
-
- time_end = Time::currentSeconds();
-
- std::cerr << "Time to read kdtree: " << (time_end-time_begin) << "
seconds." << std::endl;
-
- // Specify the root node loaded from the file.
- rootNode = (KDTreeNode*)buffer;
-
- // Get the bounding box from the file.
- AABox3f bboxf = *(AABox3f*)((char*)buffer + fileSize -
sizeof(AABox3f));
-
- if (is_big_endian()) {
-
- std::cerr << "NOTE: This system is big endian and the boeing
kdtree files are little, swapping bytes." << std::endl;
-
- rootNode->endian_swap();
-
- bboxf.min[0] = endian_swap( bboxf.min[0] );
- bboxf.min[1] = endian_swap( bboxf.min[1] );
- bboxf.min[2] = endian_swap( bboxf.min[2] );
-
- bboxf.max[0] = endian_swap( bboxf.max[0] );
- bboxf.max[1] = endian_swap( bboxf.max[1] );
- bboxf.max[2] = endian_swap( bboxf.max[2] );
-
- }
- bbox = BBox( bboxf.min, bboxf.max );
-
- // Output bounding box size.
- std::cerr << "Model bounds: min: " << bbox[0] << " max: " << bbox[1]
<< std::endl;
-
-
/////////////////////////////////////////////////////////////////////////////
- // Load the index file
- strcpy(filename, fn);
- strcat(filename, ".idx"); // the kd-tree file
- f = fopen(filename, "rb");
- if (! f) {
- fprintf(stderr, "Error: cannot open %s for loading\n",
filename);
- return 0;
- }
-
- fseek(f, 0, SEEK_END);
- fileSize = ftell(f);
- fseek(f, 0, SEEK_SET);
- long long nInt = fileSize/sizeof(int);
- VArray<int> *indices = new VArray<int>(nInt);
- indices->setLen(nInt);
-
- time_begin = Time::currentSeconds();
-
- nread = fread(indices->getArray(), sizeof(int), nInt, f);
- if (nread != nInt) {
- fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
- filename, fileSize, nread);
- return 0;
- }
- fclose(f);
-
- time_end = Time::currentSeconds();
-
- std::cerr << "Total time to read in indices: " <<
(time_end-time_begin) << std::endl;
-
- triIndices = indices;
-
- // Swap the indicies.
- if (is_big_endian()) {
- for (int i=0;i<nInt;++i) {
- (*indices)[i] = endian_swap( (*indices)[i] );
- }
- }
-
- return 1;
-}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@@ -845,11 +281,11 @@
if (intersectTriangles(ray, nearNode->listBegin(),
nearNode->listSize(), travStack[exitPos].t, &isectData, context) &&
(isectData.rayHitTriIndex >= 0)) {
- e.normal =
normals[isectData.rayHitTriIndex*3];
+ e.normal = normals[isectData.rayHitTriIndex];
// Check against the hit record, Note that
tex coord mapper is null.
if (e.hitInfo.hit(isectData.rayHit.t,
material, this, 0 )) {
-
e.hitInfo.scratchpad<ScratchPadInfo>().normal =
normals[isectData.rayHitTriIndex*3];
+
e.hitInfo.scratchpad<ScratchPadInfo>().normal =
normals[isectData.rayHitTriIndex];
e.hitInfo.scratchpad<ScratchPadInfo>().payload =
tris->get(isectData.rayHitTriIndex).payload;
break;
}
Copied: branches/itanium2/Model/Groups/KDTree.h (from r461,
branches/itanium2/Model/Groups/kdtree.h)
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.h (original)
+++ branches/itanium2/Model/Groups/KDTree.h Fri Aug 12 20:58:56 2005
@@ -39,6 +39,7 @@
#include <Model/Primitives/PrimitiveCommon.h>
#include <Interface/Texture.h>
+#include <Model/Groups/KDTreeLoader.h>
#define KDNODE_AXIS_MASK 0x0003
#define KDNODE_INTERNAL_MASK 0x0004
@@ -50,8 +51,11 @@
namespace Manta {
+ // Note: Kdtree is the namespace: KDTree, KDTreeTransparent are
classes
+ // in the namespace.
namespace Kdtree {
+ // Data is stored in 32 bit floats.
typedef VectorT<float,3> Vectorf;
typedef PointT <float,3> Pointf;
@@ -248,6 +252,9 @@
// Transparent KDTree will use data owned by this
kdtree.
friend class TransparentKDTree;
+ // The Kdtree::load(...) function is used to load
data into the kdtree.
+ friend int Manta::Kdtree::load( KDTree *kdtree, const
char *filename, int np );
+
private:
BBox bbox;
@@ -256,7 +263,8 @@
VArray<int> *triIndices;
VArray<Triangle> *tris;
Vectorf *normals;
-
+
+ private:
// This method intersects a list of triangles with
the ray.
int intersectTriangles(const Ray* ray, unsigned int
listBegin, int listSize, float maxDist, void *userData, const RenderContext
&context) const;
Added: branches/itanium2/Model/Groups/KDTreeLoader.cc
==============================================================================
--- (empty file)
+++ branches/itanium2/Model/Groups/KDTreeLoader.cc Fri Aug 12 20:58:56
2005
@@ -0,0 +1,450 @@
+
+
+/*
+ For more information, please see:
http://software.sci.utah.edu
+
+ The MIT License
+
+ Copyright (c) 2005
+ Silicon Graphics Inc. Mountain View California.
+
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+
+#include <iostream>
+
+
+#include <stdio.h>
+#include "varray.h"
+#include "KDTree.h"
+
+#include <Model/Intersections/AxisAlignedBox.h>
+#include <Interface/Context.h>
+
+#include <SCIRun/Core/Thread/Time.h>
+#include <SCIRun/Core/Thread/Thread.h>
+#include <SCIRun/Core/Thread/Runnable.h>
+#include <SCIRun/Core/Thread/Barrier.h>
+
+using namespace Manta;
+using namespace Manta::Kdtree;
+using namespace SCIRun;
+using std::cerr;
+using std::endl;
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// Worker thread for load V3C1 method (boeing dataset).
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+class V3C1Worker : public Runnable {
+public:
+ BBox &bounds; // Thread specific bounding box.
+ Barrier &v3c1_barrier;
+ int np;
+
+ // Target data.
+ float *rawData;
+ VArray<Triangle> **tris;
+ Vectorf **perVertNormals;
+
+ // Region of data this thread is responsible for.
+ long begin_offset;
+ long end_offset;
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Constructor.
+ V3C1Worker( Barrier &v3c1_barrier_, int np_, float *rawData_,
VArray<Triangle> **tris_, Vectorf **perVertNormals_,
+ long begin_offset_, long end_offset_, BBox &bounds_ ) :
+ Runnable( true ),
+ bounds( bounds_ ),
+ v3c1_barrier( v3c1_barrier_ ),
+ np( np_ ),
+ rawData( rawData_ ), tris( tris_ ), perVertNormals(
perVertNormals_ ),
+ begin_offset( begin_offset_ ), end_offset( end_offset_ ) { }
+
+
/////////////////////////////////////////////////////////////////////////////
+ // This is the thread method.
+ virtual void run() {
+
+ // Touch all of the buffers assigned to this thread.
+ for (int i=begin_offset;i<end_offset;++i) {
+
+ (**tris)[i][0][0] = 0.0;
+ (*perVertNormals)[i][0] = 0.0;
+ }
+
+ // Wait for other threads to initialize.
+ v3c1_barrier.wait(np+1);
+
+ // Wait for the io thread to read in the data.
+ v3c1_barrier.wait(np+1);
+
+ for (long i=begin_offset; i<end_offset; i++) {
+
+ // Offset into the data.
+ float *_rawData = rawData + 12 * i;
+
+ // Check to see if we are on a big endian system
+ // Data was generate on Altix (little endian)
+ if (is_big_endian()) {
+ for (int j=0; j<3; ++j) {
+ (**tris)[i][j] = Pointf( endian_swap(
_rawData[0] ),
+
endian_swap(
_rawData[1] ),
+
endian_swap(
_rawData[2] ));
+ _rawData += 3;
+ }
+ }
+
+ // Otherwise don't swap.
+ else {
+ for (int j=0; j<3; ++j) {
+ (**tris)[i][j] = Pointf( _rawData[0],
_rawData[1], _rawData[2] );
+ _rawData += 3;
+ }
+ }
+
+ float r, g, b;
+
+ // Check for big endian data.
+ if (is_big_endian()) {
+ r = int(endian_swap(_rawData[0]) * 255 + .5f);
+ g = int(endian_swap(_rawData[1]) * 255 + .5f);
+ b = int(endian_swap(_rawData[2]) * 255 + .5f);
+ _rawData += 3;
+ }
+ else {
+ r = _rawData[0];
+ g = _rawData[1];
+ b = _rawData[2];
+ // r = int(_rawData[0] * 255 + .5f);
+ // g = int(_rawData[1] * 255 + .5f);
+ // b = int(_rawData[2] * 255 + .5f);
+ _rawData += 3;
+ }
+
+ // Compute edges.
+ (**tris)[i].edge1 = (**tris)[i][1] - (**tris)[i][0];
+ (**tris)[i].edge2 = (**tris)[i][2] - (**tris)[i][0];
+
+ // Specify the payload.
+ // (**tris)[i].payload = ((r<<16)+(g<<8)+b);
+ (**tris)[i].payload = Color(RGB( r, g, b ));
+
+ // Compute the normal.
+ (*perVertNormals)[i] = Cross((**tris)[i].edge1,
(**tris)[i].edge2).normal();
+
+ // Update the bounding box of the whole scene
+ for (long j=0; j<3; j++) {
+ Triangle &tri = (**tris)[i];
+ bounds.extendByPoint( tri[0] );
+ bounds.extendByPoint( tri[1] );
+ bounds.extendByPoint( tri[2] );
+ }
+ }
+ }
+
+};
+
+// Padded bounding box.
+struct CacheAlignedBBox {
+ BBox box;
+ char padding[MAXCACHELINESIZE-sizeof(BBox)];
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// LOAD V3C1 LOAD V3C1 LOAD V3C1 LOAD V3C1 LOAD V3C1 LOAD V3C1 LOAD
V3C1
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+// Load a binary v3c1 file containing the triangles.
+int LoadBin_V3C1(const char *filename, VArray<Triangle> **tris, /*Vectorf
**perVertNormals,*/ Vectorf **perVertNormals, BBox &bounds, int np ) {
+
+ FILE *f;
+ if ((f=fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Cannot open file: %s\n", filename);
+ return 0;
+ }
+
+ // Determine the input file size.
+ fseek(f, 0, SEEK_END);
+ long fileSize = ftell(f);
+ fseek(f, 0, SEEK_SET);
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Determine the amount of memory needed.
+ long nTris = fileSize / (12*sizeof(float));
+ int nFloats = fileSize/4;
+
+ // Allocate input buffer.
+ float *rawData = new float [fileSize / 4];
+
+ // Allocate triangles.
+ *tris = new VArray<Triangle> (nTris);
+ (*tris)->setLen(nTris);
+
+ // Allocate normals.
+ *perVertNormals = new Vectorf [nTris];
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Start up the worker threads and touch the memory to distribute it.
+
+ std::cerr << "Creating " << np << " workers." << std::endl;
+
+ // Create worker threads to preprocess and bound the data.
+ Thread **workers = new Thread *[ np ];
+ CacheAlignedBBox *worker_box = new CacheAlignedBBox[ np ];
+ Barrier v3c1_barrier( "v3c1_barrier" );
+
+ int work_per_thread = nTris / np;
+
+ long begin = 0;
+ long end = work_per_thread;
+
+ std::cerr << "Faces per worker: " << work_per_thread << std::endl;
+
+ char worker_name[32];
+
+ // Assign work to the workers.
+ for (int i=0;i<np-1;++i) {
+
+ sprintf( worker_name, "V3C1 Worker %d", i );
+ workers[i] = new Thread( new V3C1Worker( v3c1_barrier, np,
rawData, tris, perVertNormals, begin, end, worker_box[i].box ), worker_name
);
+
+ begin = end;
+ end += work_per_thread;
+ }
+
+ // Assign the rest of the work to the last worker.
+ sprintf( worker_name, "V3C1 Worker %d", np-1 );
+ workers[np-1] = new Thread( new V3C1Worker( v3c1_barrier, np,
rawData, tris, perVertNormals, begin, nTris, worker_box[np-1].box ), "V3C1
Worker" );
+
+ // Wait for all of workers to initialize.
+ std::cerr << "Waiting for workers to initalize." << std::endl;
+ v3c1_barrier.wait( np+1 );
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Read in the data.
+ double time_begin = Time::currentSeconds();
+
+ long trisRead = fread(rawData, 48, fileSize/48, f);
+ if (trisRead != nTris) {
+ fprintf(stderr, "Error reading file: %s Tris read: %ld;
expected: %ld\n", filename, trisRead, nTris);
+ }
+
+ double time_end = Time::currentSeconds();
+
+ std::cerr << "Time to input triangles: " << (time_end-time_begin)
<< " seconds. " << std::endl
+ << "Total file size: " <<
((double)fileSize/1048576.0) << " MB. " << std::endl
+ << "IO Performance: " <<
((double)fileSize/1048576.0)/(time_end-time_begin) << " MB/second." <<
std::endl;
+
+ // Allocate a new array for the triangles.
+ time_begin = Time::currentSeconds();
+
+ // Record the time for alloc/dealloc
+ double memory_time = (Time::currentSeconds() - time_begin);
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Record the time for the actual preprocess.
+ time_begin = Time::currentSeconds();
+
+ std::cerr << "Beginning preprocess" << std::endl;
+ v3c1_barrier.wait( np+1 );
+
+ // Wait for all of the threads to finish.
+ for (int i=0;i<np;++i) {
+ workers[i]->join();
+
+ std::cerr << "Worker " << i << " finished." << std::endl;
+
+ // Enlarge the bounding box.
+ bounds.extendByBox( worker_box[i].box );
+ }
+
+ // Delete the array of pointers to workers.
+ delete [] workers;
+ delete [] worker_box;
+
+ time_end = Time::currentSeconds();
+
+ std::cerr << "Time to parse triangles: " << (time_end - time_begin)
<< " Seconds." << std::endl;
+ std::cerr << "Triangles loaded: " << nTris << std::endl;
+
+ time_begin = Time::currentSeconds();
+
+ // Delete the intermediate raw data.
+ delete [] rawData;
+
+ memory_time += (Time::currentSeconds() - time_begin);
+
+ std::cerr << "Total time for memory allocation/deallocation: " <<
memory_time << " Seconds." << std::endl;
+
+ return 1;
+}
+
+
+// This structure is only used to read from the kd tree file.
+struct AABox3f {
+ Pointf min, max;
+};
+
+float endianness_swap( float in ) {
+ float out;
+ char *ci = (char *)∈
+ char *co = (char *)&out;
+ co[3] = ci[0];
+ co[2] = ci[1];
+ co[1] = ci[2];
+ co[0] = ci[3];
+
+ return out;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD
LOAD
+////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+// Given a file name, and a number of workers, load the specified file.
+int Manta::Kdtree::load( KDTree *kdtree, const char *fn, int np ) {
+
+ // Time triangle load.
+ double time_begin = Time::currentSeconds();
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Call a helper function to load the triangles.
+ if (strstr(fn, ".v3c1")) {
+ LoadBin_V3C1(fn, &kdtree->tris, &kdtree->normals,
kdtree->bbox, np );
+ } else {
+ fprintf(stderr, "Unrecognized file type.\n");
+ return 0;
+ }
+
+ // Stop timing triangle load.
+ double time_end = Time::currentSeconds();
+ std::cerr << "Total time for loading triangles: " << (time_end -
time_begin) << std::endl << std::endl;
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Load the kd tree.
+ char filename[512];
+ strcpy(filename, fn);
+ strcat(filename, ".kd"); // the kd-tree file
+
+ // Open the kdtree file
+ FILE *f = fopen(filename, "rb");
+ if (! f) {
+ fprintf(stderr, "Error: cannot open %s for loading\n",
filename);
+ }
+
+ fseek(f, 0, SEEK_END);
+ long long fileSize = ftell(f);
+ void *buffer = (void*)malloc(fileSize);
+ fseek(f, 0, SEEK_SET);
+
+ time_begin = Time::currentSeconds();
+
+ // Read in the whole tree.
+ long long nread = fread(buffer, 1, fileSize, f);
+ if (nread != fileSize) {
+ fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
+ filename, fileSize, nread);
+ }
+
+ // Close the file.
+ fclose(f);
+
+ time_end = Time::currentSeconds();
+ std::cerr << "Time to read kdtree: " << (time_end-time_begin) << "
seconds." << std::endl;
+
+ // Specify the root node loaded from the file.
+ kdtree->rootNode = (KDTreeNode*)buffer;
+
+ // Get the bounding box from the file.
+ AABox3f bboxf = *(AABox3f*)((char*)buffer + fileSize -
sizeof(AABox3f));
+
+ // Check to see if we are running on a big endian system, like a
Power970
+ if (is_big_endian()) {
+ std::cerr << "NOTE: This system is big endian and the boeing
kdtree files are little, swapping bytes." << std::endl;
+
+ kdtree->rootNode->endian_swap();
+
+ bboxf.min[0] = endian_swap( bboxf.min[0] );
+ bboxf.min[1] = endian_swap( bboxf.min[1] );
+ bboxf.min[2] = endian_swap( bboxf.min[2] );
+
+ bboxf.max[0] = endian_swap( bboxf.max[0] );
+ bboxf.max[1] = endian_swap( bboxf.max[1] );
+ bboxf.max[2] = endian_swap( bboxf.max[2] );
+
+ }
+ kdtree->bbox = BBox( bboxf.min, bboxf.max );
+
+ // Output bounding box size.
+ std::cerr << "Model bounds: min: " << kdtree->bbox[0] << " max: " <<
kdtree->bbox[1] << std::endl;
+
+
/////////////////////////////////////////////////////////////////////////////
+ // Load the index file
+ strcpy(filename, fn);
+ strcat(filename, ".idx");
+
+ // Open the file.
+ f = fopen(filename, "rb");
+ if (! f) {
+ fprintf(stderr, "Error: cannot open %s for loading\n",
filename);
+ return 0;
+ }
+
+ // Determine file size.
+ fseek(f, 0, SEEK_END);
+ fileSize = ftell(f);
+ fseek(f, 0, SEEK_SET);
+
+ long long nInt = fileSize/sizeof(int);
+ VArray<int> *indices = new VArray<int>(nInt);
+ indices->setLen(nInt);
+
+ // Read in the data.
+ time_begin = Time::currentSeconds();
+ nread = fread(indices->getArray(), sizeof(int), nInt, f);
+ if (nread != nInt) {
+ fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
+ filename, fileSize, nread);
+ return 0;
+ }
+ fclose(f);
+
+ time_end = Time::currentSeconds();
+ std::cerr << "Total time to read in indices: " <<
(time_end-time_begin) << std::endl;
+
+ // Set the kdtree index pointer.
+ kdtree->triIndices = indices;
+
+ // Swap the indicies, if necessary.
+ if (is_big_endian()) {
+ for (int i=0;i<nInt;++i) {
+ (*indices)[i] = endian_swap( (*indices)[i] );
+ }
+ }
+
+ return 1;
+}
Added: branches/itanium2/Model/Groups/KDTreeLoader.h
==============================================================================
--- (empty file)
+++ branches/itanium2/Model/Groups/KDTreeLoader.h Fri Aug 12 20:58:56
2005
@@ -0,0 +1,47 @@
+/*
+ For more information, please see:
http://software.sci.utah.edu
+
+ The MIT License
+
+ Copyright (c) 2005
+ Silicon Graphics Inc. Mountain View California.
+
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __KDTREELOADER_H__
+#define __KDTREELOADER_H__
+
+#include <Model/Groups/KDTree.h>
+
+namespace Manta {
+ namespace Kdtree {
+
+ class KDTree;
+
+ // Load the specified file (and associated kdtree files)
using the given
+ // number of processors. For example if using model.v3c1, the
files
+ // model.v3c1.kd and model.v3c1.idx must be located in the
same directory.
+ int load( KDTree *kdtree, const char *filename, int np );
+
+ };
+};
+
+#endif
\ No newline at end of file
Modified: branches/itanium2/Model/Groups/TransparentKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.cc (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.cc Fri Aug 12 20:58:56
2005
@@ -174,7 +174,7 @@
Color &triangle_color = tris->get( array[i].triIdx
).payload;
- Real scale = Abs(Dot( normals[array[i].triIdx*3],
direction ));
+ Real scale = Abs(Dot( normals[array[i].triIdx],
direction ));
scale *= 0.75;
scale += 0.25;
@@ -360,7 +360,7 @@
// Copy the normal into the scratch
pad.
// Used for shootOneRay type queries.
e.hitInfo.scratchpad<TransparentKDTree::TransparentKDTree::ScratchPadInfo>().normal
=
-
normals[isectData.rayHitTriIndex*3];
+
normals[isectData.rayHitTriIndex];
first_leaf = false;
}
Modified: branches/itanium2/Model/Groups/TransparentKDTree.h
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.h (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.h Fri Aug 12 20:58:56
2005
@@ -46,7 +46,7 @@
#define KDNODE_CHILD_MASK 0x0030
#include <Model/Groups/varray.h>
-#include <Model/Groups/kdtree.h>
+#include <Model/Groups/KDTree.h>
namespace Manta {
Modified: branches/itanium2/Model/Groups/VolumeGrid.h
==============================================================================
--- branches/itanium2/Model/Groups/VolumeGrid.h (original)
+++ branches/itanium2/Model/Groups/VolumeGrid.h Fri Aug 12 20:58:56 2005
@@ -544,8 +544,8 @@
b = (unsigned
char)(accumCO[2] * 255);
a = (unsigned
char)(accumCO[3] * 255);
if (e.hitInfo.hit(T_EPSILON,
_ccm, (Primitive*)1, 0 )) {
-
e.hitInfo.scratchpad<unsigned int>() =
-
(a<<24)+(r<<16)+(g<<8)+b;
+ //
e.hitInfo.scratchpad<unsigned int>() =
+ //
(a<<24)+(r<<16)+(g<<8)+b;
}
}
}
@@ -679,7 +679,7 @@
ray->direction()[1],
ray->direction()[2]
);
- return;
+ return 0;
}
#define DIR_TOL 0.00001f
Modified: branches/itanium2/Model/Materials/CopyColorMaterial.cc
==============================================================================
--- branches/itanium2/Model/Materials/CopyColorMaterial.cc (original)
+++ branches/itanium2/Model/Materials/CopyColorMaterial.cc Fri Aug 12
20:58:56 2005
@@ -10,7 +10,7 @@
#include <Model/Textures/Constant.h>
#include <Interface/Scene.h>
-#include <Model/Groups/kdtree.h>
+#include <Model/Groups/KDTree.h>
using namespace Manta;
Modified: branches/itanium2/Model/Materials/LambertianAlt.cc
==============================================================================
--- branches/itanium2/Model/Materials/LambertianAlt.cc (original)
+++ branches/itanium2/Model/Materials/LambertianAlt.cc Fri Aug 12 20:58:56
2005
@@ -1,6 +1,6 @@
#include <Model/Materials/LambertianAlt.h>
-#include <Model/Groups/kdtree.h>
+#include <Model/Groups/KDTree.h>
#include <Interface/Light.h>
#include <Interface/LightSet.h>
#include <Interface/Primitive.h>
Modified: branches/itanium2/Readers/DoubleEagle/vn2v3c1.cc
==============================================================================
--- branches/itanium2/Readers/DoubleEagle/vn2v3c1.cc (original)
+++ branches/itanium2/Readers/DoubleEagle/vn2v3c1.cc Fri Aug 12 20:58:56
2005
@@ -148,7 +148,7 @@
// Check that both were found.
if ((command == NONE) || (file_list_begin == 0)) {
printf( "Usage: v2v3c1 -vn3 -in <tanker paths...> -out
<outfile.v3c1>\n"
- " v2v3c1 -obj -in
<file1.obj ...> [-out <outfile.v3c1>]\n -- Outfile optional uses group names
otherwise."
+ " v2v3c1 -obj -in
<file1.obj ...> [-out <outfile.v3c1>]\n -- Outfile optional uses group names
otherwise.\n"
" v2v3c1 -info <infile.v3c1 ...> -- Computes
bounds and number of triangles.\n"
" v2v3c1 -clip <px>
<py> <pz> <nx> <ny> <nz> -- Apply a clipping plane to the input files. \n");
return 1;
Modified: branches/itanium2/fox/dm_demo.cc
==============================================================================
--- branches/itanium2/fox/dm_demo.cc (original)
+++ branches/itanium2/fox/dm_demo.cc Fri Aug 12 20:58:56 2005
@@ -55,7 +55,7 @@
using namespace Manta;
using namespace std;
-#include <Model/Groups/kdtree.h>
+#include <Model/Groups/KDTree.h>
#include <Model/Groups/TransparentKDTree.h>
#include <Model/Materials/CopyColorMaterial.h>
using namespace Manta::Kdtree;
Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc (original)
+++ branches/itanium2/scenes/boeing777.cc Fri Aug 12 20:58:56 2005
@@ -43,7 +43,7 @@
#include <Model/AmbientLights/ArcAmbient.h>
#include <Model/Backgrounds/ConstantBackground.h>
#include <Model/Groups/Group.h>
-#include <Model/Groups/kdtree.h>
+#include <Model/Groups/KDTree.h>
#include <Model/Groups/TransparentKDTree.h>
#include <Model/Lights/PointLight.h>
#include <Model/Lights/HeadLight.h>
@@ -147,15 +147,18 @@
// KDTree *kdtree = new KDTree( new LambertianAlt );
+
/////////////////////////////////////////////////////////////////////////////
+ // Load the kdtree.
double start_time = Time::currentSeconds();
- kdtree->load( file_name.c_str(), workers_np );
+ Kdtree::load( kdtree, file_name.c_str(), workers_np );
double end_time = Time::currentSeconds();
std::cerr << "Total load time: " << (end_time-start_time)/60.0 << "
minutes."
<< std::endl << std::endl;
+
/////////////////////////////////////////////////////////////////////////////
// Determine the bounds of the model.
BBox bounds;
kdtree->computeBounds( bounds );
@@ -187,6 +190,8 @@
root_object = kd_primitive;
}
+
/////////////////////////////////////////////////////////////////////////////
+ // Add a head light.
LightSet *lights = new LightSet();
lights->add( new HeadLight( 2.0, Color(RGB(1.0,1.0,1.0)) ));
- [MANTA] r471 - in branches/itanium2: Model/Groups Model/Materials Readers/DoubleEagle fox scenes, abe, 08/12/2005
Archive powered by MHonArc 2.6.16.