Text archives Help
- From: aek@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r575 - in trunk: Model/Primitives scenes
- Date: Tue, 27 Sep 2005 15:18:11 -0600 (MDT)
Author: aek
Date: Tue Sep 27 15:18:11 2005
New Revision: 575
Modified:
trunk/Model/Primitives/ParticleBVH.cc
trunk/Model/Primitives/ParticleBVH.h
trunk/scenes/ParticleBVHTest.cc
Log:
* Workaround in partition() for weird compiler bugs(?). Loop exit
condition was failing to trigger when compiled with MIPSPro on Muse and
ICC on Fisher, leading to segfaults. Moved second condition clause to an
if statement with a break. Seems to work now, at least on Fisher.
* Array in ParticleBVHTest for reading data now with large fixed size to
make non-gcc compilers happy.
* Changed return type on intersectParticles() from bool to void, like it
should have been.
Modified: trunk/Model/Primitives/ParticleBVH.cc
==============================================================================
--- trunk/Model/Primitives/ParticleBVH.cc (original)
+++ trunk/Model/Primitives/ParticleBVH.cc Tue Sep 27 15:18:11 2005
@@ -42,12 +42,12 @@
{
--first;
for ( ; ; ) {
- ++first;
- while ( particles[ first ].center[ axis ] <= position && first < last )
- ++first;
- --last;
- while ( particles[ last ].center[ axis ] >= position && first < last )
- --last;
+ for ( ++first; first < last; ++first )
+ if ( particles[ first ].center[ axis ] <= position )
+ break;
+ for ( --last; first < last; --last )
+ if ( particles[ last ].center[ axis ] >= position )
+ break;
if ( first < last )
SWAP( particles[ first ], particles[ last ] );
else
@@ -145,7 +145,7 @@
return false;
}
-inline bool ParticleBVH::intersectParticles(
+inline void ParticleBVH::intersectParticles(
RayPacket &rays,
int const first,
int const last ) const
Modified: trunk/Model/Primitives/ParticleBVH.h
==============================================================================
--- trunk/Model/Primitives/ParticleBVH.h (original)
+++ trunk/Model/Primitives/ParticleBVH.h Tue Sep 27 15:18:11 2005
@@ -42,7 +42,7 @@
int partition( int first, int last, int const axis, double const
position );
int build( int const index, int const first, int const last, int const
size );
bool testBox( RayPacket &rays, BBox const &box ) const;
- bool intersectParticles( RayPacket &rays, int const first, int const
last ) const;
+ void intersectParticles( RayPacket &rays, int const first, int const
last ) const;
public:
class ParticleTexture : public Texture< Color > {
Modified: trunk/scenes/ParticleBVHTest.cc
==============================================================================
--- trunk/scenes/ParticleBVHTest.cc (original)
+++ trunk/scenes/ParticleBVHTest.cc Tue Sep 27 15:18:11 2005
@@ -70,18 +70,19 @@
throw IllegalArgument( "Couldn't load model: " + model_name, 0, args );
int number_of_particles, number_of_variables, radius_index;
in1 >> number_of_particles >> number_of_variables >> radius_index;
- double data[ number_of_variables ];
- double min_value = numeric_limits< double >::max();
- double max_value = -numeric_limits< double >::max();
- if ( min_value == max_value )
- max_value += 1.0;
+ static const int maximum_number_of_variables = 32;
+ double data[ maximum_number_of_variables ];
+ double minimum_value = numeric_limits< double >::max();
+ double maximum_value = -numeric_limits< double >::max();
+ if ( minimum_value == maximum_value )
+ maximum_value += 1.0;
for ( int particle = 0; particle < number_of_particles; ++particle ) {
for ( int variable = 0; variable < number_of_variables; ++variable )
in1 >> data[ variable ];
- if ( data[ map_channel ] < min_value )
- min_value = data[ map_channel ];
- if ( data[ map_channel ] > max_value )
- max_value = data[ map_channel ];
+ if ( data[ map_channel ] < minimum_value )
+ minimum_value = data[ map_channel ];
+ if ( data[ map_channel ] > maximum_value )
+ maximum_value = data[ map_channel ];
}
ifstream in2( model_name.c_str() );
if ( !in2.is_open() )
@@ -94,7 +95,7 @@
for ( int particle = 0; particle < number_of_particles; ++particle ) {
for ( int variable = 0; variable < number_of_variables; ++variable )
in2 >> data[ variable ];
- double map_value = ( data[ map_channel ] - min_value ) / ( max_value -
min_value ) * 11;
+ double map_value = ( data[ map_channel ] - minimum_value ) / (
maximum_value - minimum_value ) * 11;
bvh->setParticle( particle,
Interpolate( color_map[ Floor( map_value ) ],
color_map[ Ceil( map_value ) ],
- [MANTA] r575 - in trunk: Model/Primitives scenes, aek, 09/27/2005
Archive powered by MHonArc 2.6.16.