Text archives Help
- From: "James Bigler" <bigler@cs.utah.edu>
- To: manta@sci.utah.edu
- Subject: [Manta] r2093 - trunk/scenes
- Date: Tue, 19 Feb 2008 21:28:24 -0700 (MST)
Author: bigler
Date: Tue Feb 19 21:28:23 2008
New Revision: 2093
Modified:
trunk/scenes/complexitytest.cc
trunk/scenes/vorpal.cc
Log:
scenes/complexitytest.cc
scenes/vorpal.cc
Replace drand48 with MT_RNG.
Modified: trunk/scenes/complexitytest.cc
==============================================================================
--- trunk/scenes/complexitytest.cc (original)
+++ trunk/scenes/complexitytest.cc Tue Feb 19 21:28:23 2008
@@ -32,6 +32,7 @@
#include <Core/Exceptions/IllegalArgument.h>
#include <Core/Exceptions/UnknownColor.h>
#include <Core/Math/MinMax.h>
+#include <Core/Math/MT_RNG.h>
#include <Core/Util/Args.h>
#include <Core/Util/Preprocessor.h>
#include <Image/TGAFile.h>
@@ -237,19 +238,20 @@
cerr << "Generating " << num_objects << " instances...\n";
Material* no_instance_matl = new NullMaterial();
+ MT_RNG rng;
for(unsigned int i = 0; i < num_objects; ++i) {
if(no_instances) {
- Vector origin = Vector(drand48(), drand48(), drand48())*cube_scale;
- Color color = Color(RGB(drand48(), drand48(), drand48()));
+ Vector origin = Vector(rng.nextReal(), rng.nextReal(),
rng.nextReal())*cube_scale;
+ Color color = Color(RGB(rng.nextReal(), rng.nextReal(),
rng.nextReal()));
group->add(new Sphere(no_instance_matl, origin, object_scale));
} else {
- Vector origin = Vector(drand48(), drand48(), drand48())*cube_scale;
- Vector rotation_axis = Vector(drand48(), drand48(),
drand48()).normal();
- Real rotation_amount = drand48()*M_PI*2.0;
+ Vector origin = Vector(rng.nextReal(), rng.nextReal(),
rng.nextReal())*cube_scale;
+ Vector rotation_axis = Vector(rng.nextReal(), rng.nextReal(),
rng.nextReal()).normal();
+ Real rotation_amount = rng.nextReal()*M_PI*2.0;
- Color color = Color(RGB(drand48(), drand48(), drand48()));
+ Color color = Color(RGB(rng.nextReal(), rng.nextReal(),
rng.nextReal()));
AffineTransform t;
t.initWithIdentity();
Modified: trunk/scenes/vorpal.cc
==============================================================================
--- trunk/scenes/vorpal.cc (original)
+++ trunk/scenes/vorpal.cc Tue Feb 19 21:28:23 2008
@@ -1,5 +1,6 @@
#include <Core/Exceptions/IllegalArgument.h>
#include <Core/Math/MinMax.h>
+#include <Core/Math/MT_RNG.h>
#include <Core/Util/Args.h>
#include <Core/Util/Preprocessor.h>
#include <Interface/Context.h>
@@ -61,10 +62,11 @@
// 64, (ColorComponent) 0.4);
//Note, we add some randomness just to test the dynnamic scenes and
interpolation...
+ MT_RNG rng;
for (int i = 0; i < nparticles; ++i) {
- Vector center( (data[i*3 + 0]-min_x)/max_dim*(drand48()*.2+.9),
- (data[i*3 + 1]-min_y)/max_dim*(drand48()*.2+.9),
- data[i*3 + 2]*2*(drand48()*.2+.9));
+ Vector center( (data[i*3 + 0]-min_x)/max_dim*(rng.nextDouble()*.2+.9),
+ (data[i*3 + 1]-min_y)/max_dim*(rng.nextDouble()*.2+.9),
+ data[i*3 + 2]*2*(rng.nextDouble()*.2+.9));
particles->add(new Sphere(particle_matl, center, .03));
}
- [Manta] r2093 - trunk/scenes, James Bigler, 02/19/2008
Archive powered by MHonArc 2.6.16.