Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r357 - in branches/float: . Core/Geometry Core/Math Core/Util Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/PixelSamplers Engine/Renderers Engine/Shadows Interface Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Instances Model/Materials Model/Primitives Model/TexCoordMappers Model/Textures Readers/BART StandAlone UserInterface scenes
- Date: Sat, 28 May 2005 23:22:34 -0600 (MDT)
Author: sparker
Date: Sat May 28 23:22:01 2005
New Revision: 357
Modified:
branches/float/Core/Geometry/AffineTransform.cc
branches/float/Core/Geometry/BBox.h
branches/float/Core/Geometry/Ray.h
branches/float/Core/Math/Noise.cc
branches/float/Core/Math/Noise.h
branches/float/Core/Math/ipow.h
branches/float/Core/Util/Args.cc
branches/float/Core/Util/Args.h
branches/float/Engine/Control/RTRT.cc
branches/float/Engine/Control/RTRT.h
branches/float/Engine/Display/OpenGLDisplay.cc
branches/float/Engine/Display/OpenGLDisplay.h
branches/float/Engine/Display/XHelper.cc
branches/float/Engine/Display/XHelper.h
branches/float/Engine/IdleModes/ZoomIdleMode.h
branches/float/Engine/ImageTraversers/FramelessImageTraverser.cc
branches/float/Engine/PixelSamplers/HammersleySampler.cc
branches/float/Engine/PixelSamplers/HammersleySampler.h
branches/float/Engine/PixelSamplers/InterLeaveSampler.cc
branches/float/Engine/PixelSamplers/InterLeaveSampler.h
branches/float/Engine/PixelSamplers/JitterSampler.cc
branches/float/Engine/PixelSamplers/JitterSampler.h
branches/float/Engine/PixelSamplers/MultiJitterSampler.cc
branches/float/Engine/PixelSamplers/MultiJitterSampler.h
branches/float/Engine/PixelSamplers/NRooksSampler.cc
branches/float/Engine/PixelSamplers/NRooksSampler.h
branches/float/Engine/PixelSamplers/RampSampler.h
branches/float/Engine/PixelSamplers/Sample.cc
branches/float/Engine/PixelSamplers/SingleSampler.cc
branches/float/Engine/PixelSamplers/SingleSampler.h
branches/float/Engine/Renderers/Moire.cc
branches/float/Engine/Renderers/Moire.h
branches/float/Engine/Shadows/BeamShadows.cc
branches/float/Engine/Shadows/BeamShadows.h
branches/float/Interface/Camera.h
branches/float/Interface/Context.h
branches/float/Interface/FrameState.h
branches/float/Interface/HitInfo.h
branches/float/Interface/Parameters.h
branches/float/Interface/RTRTInterface.h
branches/float/Interface/RayPacket.h
branches/float/MantaTypes.h
branches/float/Model/AmbientLights/ArcAmbient.cc
branches/float/Model/Backgrounds/LinearBackground.cc
branches/float/Model/Cameras/EnvironmentCamera.cc
branches/float/Model/Cameras/EnvironmentCamera.h
branches/float/Model/Cameras/FisheyeCamera.cc
branches/float/Model/Cameras/FisheyeCamera.h
branches/float/Model/Cameras/OrthogonalCamera.cc
branches/float/Model/Cameras/OrthogonalCamera.h
branches/float/Model/Cameras/PinholeCamera.cc
branches/float/Model/Cameras/PinholeCamera.h
branches/float/Model/Groups/BVH.cc
branches/float/Model/Instances/Instance.cc
branches/float/Model/Instances/InstanceRST.cc
branches/float/Model/Instances/InstanceRST.h
branches/float/Model/Instances/InstanceRT.cc
branches/float/Model/Instances/InstanceST.cc
branches/float/Model/Materials/Checker.cc
branches/float/Model/Materials/Dielectric.cc
branches/float/Model/Materials/Dielectric.h
branches/float/Model/Materials/Lambertian.cc
branches/float/Model/Materials/MetalMaterial.cc
branches/float/Model/Materials/Phong.cc
branches/float/Model/Materials/Phong.h
branches/float/Model/Primitives/Cone.cc
branches/float/Model/Primitives/Cone.h
branches/float/Model/Primitives/Cube.cc
branches/float/Model/Primitives/Cube.h
branches/float/Model/Primitives/Cylinder.cc
branches/float/Model/Primitives/Cylinder.h
branches/float/Model/Primitives/Disk.cc
branches/float/Model/Primitives/Disk.h
branches/float/Model/Primitives/HeavyTriangle.cc
branches/float/Model/Primitives/Heightfield.cc
branches/float/Model/Primitives/Heightfield.h
branches/float/Model/Primitives/Hemisphere.cc
branches/float/Model/Primitives/Hemisphere.h
branches/float/Model/Primitives/Parallelogram.cc
branches/float/Model/Primitives/Parallelogram.h
branches/float/Model/Primitives/Ring.cc
branches/float/Model/Primitives/Ring.h
branches/float/Model/Primitives/Sphere.cc
branches/float/Model/Primitives/Sphere.h
branches/float/Model/Primitives/SuperEllipsoid.cc
branches/float/Model/Primitives/SuperEllipsoid.h
branches/float/Model/Primitives/TexTriangle.cc
branches/float/Model/Primitives/Triangle.cc
branches/float/Model/Primitives/Triangle.h
branches/float/Model/TexCoordMappers/SphericalMapper.cc
branches/float/Model/TexCoordMappers/SphericalMapper.h
branches/float/Model/Textures/CheckerTexture.cc
branches/float/Model/Textures/MarbleTexture.cc
branches/float/Model/Textures/MarbleTexture.h
branches/float/Model/Textures/OakTexture.cc
branches/float/Model/Textures/OakTexture.h
branches/float/Model/Textures/WoodTexture.cc
branches/float/Model/Textures/WoodTexture.h
branches/float/Readers/BART/parse.cc
branches/float/StandAlone/manta.cc
branches/float/UserInterface/XWindowUI.cc
branches/float/UserInterface/XWindowUI.h
branches/float/scenes/0.cc
branches/float/scenes/primtest.cc
Log:
Use Reals instead of double, to make float version work
Modified: branches/float/Core/Geometry/AffineTransform.cc
==============================================================================
--- branches/float/Core/Geometry/AffineTransform.cc (original)
+++ branches/float/Core/Geometry/AffineTransform.cc Sat May 28 23:22:01
2005
@@ -235,9 +235,9 @@
mat[2][0] = (d*h-e*g)*inv_denom;
mat[2][1] = (b*g-a*h)*inv_denom;
mat[2][2] = (a*e-b*d)*inv_denom;
- double x = mat[0][3];
- double y = mat[1][3];
- double z = mat[2][3];
+ T x = mat[0][3];
+ T y = mat[1][3];
+ T z = mat[2][3];
mat[0][3] = -(mat[0][0]*x + mat[0][1]*y + mat[0][2]*z);
mat[1][3] = -(mat[1][0]*x + mat[1][1]*y + mat[1][2]*z);
mat[2][3] = -(mat[2][0]*x + mat[2][1]*y + mat[2][2]*z);
Modified: branches/float/Core/Geometry/BBox.h
==============================================================================
--- branches/float/Core/Geometry/BBox.h (original)
+++ branches/float/Core/Geometry/BBox.h Sat May 28 23:22:01 2005
@@ -31,7 +31,7 @@
return max-min;
}
Point center() const {
- return Interpolate(min, max, 0.5);
+ return Interpolate(min, max, 0.5f);
}
void extendByPoint(const Point& p) {
Modified: branches/float/Core/Geometry/Ray.h
==============================================================================
--- branches/float/Core/Geometry/Ray.h (original)
+++ branches/float/Core/Geometry/Ray.h Sat May 28 23:22:01 2005
@@ -42,7 +42,7 @@
const Vector& direction() const {
return dir;
}
- double normalizeDirection() {
+ Real normalizeDirection() {
return dir.normalize();
}
private:
Modified: branches/float/Core/Math/Noise.cc
==============================================================================
--- branches/float/Core/Math/Noise.cc (original)
+++ branches/float/Core/Math/Noise.cc Sat May 28 23:22:01 2005
@@ -83,7 +83,7 @@
* The values in the noise permutation tables can be used to index into
* this table to get the gradients for the noise.
*/
- double Noise1DValueTable[] = {
+ Real Noise1DValueTable[] = {
0.47451, 0.482353, 0.670588, 0.545098, 0.803922, -0.443137, -0.678431,
0.32549, 0.45098, 0.396078, 0.905882, -0.0666667, -0.466667, 0.733333,
0.87451, 0.568627, 0.921569, -0.584314, 0.262745, -0.670588, 0.254902,
@@ -133,7 +133,7 @@
* permutation tables can be used to index into this table to get the
* gradients for the noise.
*/
- double Noise3DValueTable[][ 3 ] = {
+ Real Noise3DValueTable[][ 3 ] = {
{ -0.439336, 0.540416, 0.71759 }, { 0.183348, 0.923971, 0.33565 },
{ -0.15203, -0.392751, -0.906991 }, { 0.707649, 0.112768, 0.697507 },
{ 0.136611, -0.456018, 0.879423 }, { -0.414372, -0.868792, -0.271103 },
@@ -264,63 +264,63 @@
{ 0.238053, -0.36183, -0.901338 }, { 0.5581, -0.681458, -0.473433 }
};
- double ScalarNoise(
+ Real ScalarNoise(
Point const &location )
{
int integer_of_x = Floor( location.x() );
int integer_of_y = Floor( location.y() );
int integer_of_z = Floor( location.z() );
- double offset_of_x = location.x() - integer_of_x;
- double offset_of_y = location.y() - integer_of_y;
- double offset_of_z = location.z() - integer_of_z;
- double fade_x = offset_of_x * offset_of_x * offset_of_x * ( offset_of_x
* ( offset_of_x * 6.0 - 15.0 ) + 10.0 );
- double fade_y = offset_of_y * offset_of_y * offset_of_y * ( offset_of_y
* ( offset_of_y * 6.0 - 15.0 ) + 10.0 );
- double fade_z = offset_of_z * offset_of_z * offset_of_z * ( offset_of_z
* ( offset_of_z * 6.0 - 15.0 ) + 10.0 );
+ Real offset_of_x = location.x() - integer_of_x;
+ Real offset_of_y = location.y() - integer_of_y;
+ Real offset_of_z = location.z() - integer_of_z;
+ Real fade_x = offset_of_x * offset_of_x * offset_of_x * ( offset_of_x *
( offset_of_x * 6.0 - 15.0 ) + 10.0 );
+ Real fade_y = offset_of_y * offset_of_y * offset_of_y * ( offset_of_y *
( offset_of_y * 6.0 - 15.0 ) + 10.0 );
+ Real fade_z = offset_of_z * offset_of_z * offset_of_z * ( offset_of_z *
( offset_of_z * 6.0 - 15.0 ) + 10.0 );
int hash_0 = NoiseXPermutationTable[ integer_of_x & 0xFF ];
int hash_00 = NoiseXPermutationTable[ ( hash_0 + integer_of_y ) & 0xFF ];
int hash_000 = NoiseXPermutationTable[ ( hash_00 + integer_of_z ) & 0xFF
];
int hash_001 = NoiseXPermutationTable[ ( hash_00 + integer_of_z + 1 ) &
0xFF ];
using SCIRun::Interpolate;
- double value_00 = Interpolate( ( Noise3DValueTable[ hash_000 ][ 0 ] *
offset_of_x +
+ Real value_00 = Interpolate( ( Noise3DValueTable[ hash_000 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_000 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_000 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_001 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_001 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
int hash_01 = NoiseXPermutationTable[ ( hash_0 + integer_of_y + 1 ) &
0xFF ];
int hash_010 = NoiseXPermutationTable[ ( hash_01 + integer_of_z ) & 0xFF
];
int hash_011 = NoiseXPermutationTable[ ( hash_01 + integer_of_z + 1 ) &
0xFF ];
- double value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Real value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
+ Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_010 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_011 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
- double value_0 = Interpolate( value_00, value_01, fade_y );
+ Real value_0 = Interpolate( value_00, value_01, fade_y );
int hash_1 = NoiseXPermutationTable[ ( integer_of_x + 1 ) & 0xFF ];
int hash_10 = NoiseXPermutationTable[ ( hash_1 + integer_of_y ) & 0xFF ];
int hash_100 = NoiseXPermutationTable[ ( hash_10 + integer_of_z ) & 0xFF
];
int hash_101 = NoiseXPermutationTable[ ( hash_10 + integer_of_z + 1 ) &
0xFF ];
- double value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ Real value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_100 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_100 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_101 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
int hash_11 = NoiseXPermutationTable[ ( hash_1 + integer_of_y + 1 ) &
0xFF ];
int hash_110 = NoiseXPermutationTable[ ( hash_11 + integer_of_z ) & 0xFF
];
int hash_111 = NoiseXPermutationTable[ ( hash_11 + integer_of_z + 1 ) &
0xFF ];
- double value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Real value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_110 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
- double value_1 = Interpolate( value_10, value_11, fade_y );
+ Real value_1 = Interpolate( value_10, value_11, fade_y );
return Interpolate( value_0, value_1, fade_x );
}
@@ -330,58 +330,58 @@
int integer_of_x = Floor( location.x() );
int integer_of_y = Floor( location.y() );
int integer_of_z = Floor( location.z() );
- double offset_of_x = location.x() - integer_of_x;
- double offset_of_y = location.y() - integer_of_y;
- double offset_of_z = location.z() - integer_of_z;
- double fade_x = offset_of_x * offset_of_x * offset_of_x * ( offset_of_x
* ( offset_of_x * 6.0 - 15.0 ) + 10.0 );
- double fade_y = offset_of_y * offset_of_y * offset_of_y * ( offset_of_y
* ( offset_of_y * 6.0 - 15.0 ) + 10.0 );
- double fade_z = offset_of_z * offset_of_z * offset_of_z * ( offset_of_z
* ( offset_of_z * 6.0 - 15.0 ) + 10.0 );
+ Real offset_of_x = location.x() - integer_of_x;
+ Real offset_of_y = location.y() - integer_of_y;
+ Real offset_of_z = location.z() - integer_of_z;
+ Real fade_x = offset_of_x * offset_of_x * offset_of_x * ( offset_of_x *
( offset_of_x * 6.0 - 15.0 ) + 10.0 );
+ Real fade_y = offset_of_y * offset_of_y * offset_of_y * ( offset_of_y *
( offset_of_y * 6.0 - 15.0 ) + 10.0 );
+ Real fade_z = offset_of_z * offset_of_z * offset_of_z * ( offset_of_z *
( offset_of_z * 6.0 - 15.0 ) + 10.0 );
int hash_0 = NoiseXPermutationTable[ integer_of_x & 0xFF ];
int hash_00 = NoiseXPermutationTable[ ( hash_0 + integer_of_y ) & 0xFF ];
int hash_000 = NoiseXPermutationTable[ ( hash_00 + integer_of_z ) & 0xFF
];
int hash_001 = NoiseXPermutationTable[ ( hash_00 + integer_of_z + 1 ) &
0xFF ];
using SCIRun::Interpolate;
- double value_00 = Interpolate( ( Noise3DValueTable[ hash_000 ][ 0 ] *
offset_of_x +
+ Real value_00 = Interpolate( ( Noise3DValueTable[ hash_000 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_000 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_000 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_001 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_001 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
int hash_01 = NoiseXPermutationTable[ ( hash_0 + integer_of_y + 1 ) &
0xFF ];
int hash_010 = NoiseXPermutationTable[ ( hash_01 + integer_of_z ) & 0xFF
];
int hash_011 = NoiseXPermutationTable[ ( hash_01 + integer_of_z + 1 ) &
0xFF ];
- double value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Real value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
+ Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_010 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_011 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
- double value_0 = Interpolate( value_00, value_01, fade_y );
+ Real value_0 = Interpolate( value_00, value_01, fade_y );
int hash_1 = NoiseXPermutationTable[ ( integer_of_x + 1 ) & 0xFF ];
int hash_10 = NoiseXPermutationTable[ ( hash_1 + integer_of_y ) & 0xFF ];
int hash_100 = NoiseXPermutationTable[ ( hash_10 + integer_of_z ) & 0xFF
];
int hash_101 = NoiseXPermutationTable[ ( hash_10 + integer_of_z + 1 ) &
0xFF ];
- double value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ Real value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_100 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_100 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_101 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
int hash_11 = NoiseXPermutationTable[ ( hash_1 + integer_of_y + 1 ) &
0xFF ];
int hash_110 = NoiseXPermutationTable[ ( hash_11 + integer_of_z ) & 0xFF
];
int hash_111 = NoiseXPermutationTable[ ( hash_11 + integer_of_z + 1 ) &
0xFF ];
- double value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Real value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_110 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
- double value_1 = Interpolate( value_10, value_11, fade_y );
- double x_result = Interpolate( value_0, value_1, fade_x );
+ Real value_1 = Interpolate( value_10, value_11, fade_y );
+ Real x_result = Interpolate( value_0, value_1, fade_x );
hash_0 = NoiseYPermutationTable[ integer_of_x & 0xFF ];
hash_00 = NoiseYPermutationTable[ ( hash_0 + integer_of_y ) & 0xFF ];
hash_000 = NoiseYPermutationTable[ ( hash_00 + integer_of_z ) & 0xFF ];
@@ -391,42 +391,42 @@
Noise3DValueTable[ hash_000 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_001 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_001 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
hash_01 = NoiseYPermutationTable[ ( hash_0 + integer_of_y + 1 ) & 0xFF ];
hash_010 = NoiseYPermutationTable[ ( hash_01 + integer_of_z ) & 0xFF ];
hash_011 = NoiseYPermutationTable[ ( hash_01 + integer_of_z + 1 ) & 0xFF
];
value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_010 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_011 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
value_0 = Interpolate( value_00, value_01, fade_y );
hash_1 = NoiseYPermutationTable[ ( integer_of_x + 1 ) & 0xFF ];
hash_10 = NoiseYPermutationTable[ ( hash_1 + integer_of_y ) & 0xFF ];
hash_100 = NoiseYPermutationTable[ ( hash_10 + integer_of_z ) & 0xFF ];
hash_101 = NoiseYPermutationTable[ ( hash_10 + integer_of_z + 1 ) & 0xFF
];
- value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_100 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_100 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_101 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
hash_11 = NoiseYPermutationTable[ ( hash_1 + integer_of_y + 1 ) & 0xFF ];
hash_110 = NoiseYPermutationTable[ ( hash_11 + integer_of_z ) & 0xFF ];
hash_111 = NoiseYPermutationTable[ ( hash_11 + integer_of_z + 1 ) & 0xFF
];
- value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_110 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
value_1 = Interpolate( value_10, value_11, fade_y );
- double y_result = Interpolate( value_0, value_1, fade_x );
+ Real y_result = Interpolate( value_0, value_1, fade_x );
hash_0 = NoiseZPermutationTable[ integer_of_x & 0xFF ];
hash_00 = NoiseZPermutationTable[ ( hash_0 + integer_of_y ) & 0xFF ];
hash_000 = NoiseZPermutationTable[ ( hash_00 + integer_of_z ) & 0xFF ];
@@ -436,46 +436,46 @@
Noise3DValueTable[ hash_000 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_001 ][ 0 ] *
offset_of_x +
Noise3DValueTable[ hash_001 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_001 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
hash_01 = NoiseZPermutationTable[ ( hash_0 + integer_of_y + 1 ) & 0xFF ];
hash_010 = NoiseZPermutationTable[ ( hash_01 + integer_of_z ) & 0xFF ];
hash_011 = NoiseZPermutationTable[ ( hash_01 + integer_of_z + 1 ) & 0xFF
];
value_01 = Interpolate( ( Noise3DValueTable[ hash_010 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ Noise3DValueTable[ hash_010 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_010 ][ 2 ] *
offset_of_z ),
( Noise3DValueTable[ hash_011 ][ 0 ] *
offset_of_x +
- Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_011 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_011 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
value_0 = Interpolate( value_00, value_01, fade_y );
hash_1 = NoiseZPermutationTable[ ( integer_of_x + 1 ) & 0xFF ];
hash_10 = NoiseZPermutationTable[ ( hash_1 + integer_of_y ) & 0xFF ];
hash_100 = NoiseZPermutationTable[ ( hash_10 + integer_of_z ) & 0xFF ];
hash_101 = NoiseZPermutationTable[ ( hash_10 + integer_of_z + 1 ) & 0xFF
];
- value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ value_10 = Interpolate( ( Noise3DValueTable[ hash_100 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_100 ][ 1 ] *
offset_of_y +
Noise3DValueTable[ hash_100 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0 ) +
+ ( Noise3DValueTable[ hash_101 ][ 0 ] * (
offset_of_x - 1.0f ) +
Noise3DValueTable[ hash_101 ][ 1 ] *
offset_of_y +
- Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ Noise3DValueTable[ hash_101 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
hash_11 = NoiseZPermutationTable[ ( hash_1 + integer_of_y + 1 ) & 0xFF ];
hash_110 = NoiseZPermutationTable[ ( hash_11 + integer_of_z ) & 0xFF ];
hash_111 = NoiseZPermutationTable[ ( hash_11 + integer_of_z + 1 ) & 0xFF
];
- value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0 ) +
+ value_11 = Interpolate( ( Noise3DValueTable[ hash_110 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_110 ][ 1 ] * (
offset_of_y - 1.0f ) +
Noise3DValueTable[ hash_110 ][ 2 ] *
offset_of_z ),
- ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0 ) +
- Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0 ) ),
+ ( Noise3DValueTable[ hash_111 ][ 0 ] * (
offset_of_x - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 1 ] * (
offset_of_y - 1.0f ) +
+ Noise3DValueTable[ hash_111 ][ 2 ] * (
offset_of_z - 1.0f ) ),
fade_z );
value_1 = Interpolate( value_10, value_11, fade_y );
- double z_result = Interpolate( value_0, value_1, fade_x );
+ Real z_result = Interpolate( value_0, value_1, fade_x );
return Vector( x_result, y_result, z_result );
}
- double ScalarCellNoise(
+ Real ScalarCellNoise(
Point const &location )
{
int integer_of_x = Floor( location.x() );
@@ -496,27 +496,27 @@
int hash = NoiseXPermutationTable[ integer_of_x & 0xFF ];
hash = NoiseXPermutationTable[ ( hash + integer_of_y ) & 0xFF ];
hash = NoiseXPermutationTable[ ( hash + integer_of_z ) & 0xFF ];
- double x_result = Noise1DValueTable[ hash ];
+ Real x_result = Noise1DValueTable[ hash ];
hash = NoiseYPermutationTable[ integer_of_x & 0xFF ];
hash = NoiseYPermutationTable[ ( hash + integer_of_y ) & 0xFF ];
hash = NoiseYPermutationTable[ ( hash + integer_of_z ) & 0xFF ];
- double y_result = Noise1DValueTable[ hash ];
+ Real y_result = Noise1DValueTable[ hash ];
hash = NoiseZPermutationTable[ integer_of_x & 0xFF ];
hash = NoiseZPermutationTable[ ( hash + integer_of_y ) & 0xFF ];
hash = NoiseZPermutationTable[ ( hash + integer_of_z ) & 0xFF ];
- double z_result = Noise1DValueTable[ hash ];
+ Real z_result = Noise1DValueTable[ hash ];
return Vector( x_result, y_result, z_result );
}
- double ScalarFBM(
+ Real ScalarFBM(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain )
+ Real const lacunarity,
+ Real const gain )
{
- double sum = 0.0;
- double scale = 1.0;
- double amplitude = 1.0;
+ Real sum = 0.0;
+ Real scale = 1.0;
+ Real amplitude = 1.0;
for( int octave = 0; octave < octaves; ++octave ) {
sum += amplitude * ScalarNoise( location.multipliedBy(scale) );
scale *= lacunarity;
@@ -528,12 +528,12 @@
Vector const VectorFBM(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain )
+ Real const lacunarity,
+ Real const gain )
{
Vector sum( 0.0, 0.0, 0.0 );
- double scale = 1.0;
- double amplitude = 1.0;
+ Real scale = 1.0;
+ Real amplitude = 1.0;
for( int octave = 0; octave < octaves; ++octave ) {
sum += amplitude * VectorNoise( location.multipliedBy(scale) );
scale *= lacunarity;
@@ -542,15 +542,15 @@
return sum;
}
- double Turbulence(
+ Real Turbulence(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain )
+ Real const lacunarity,
+ Real const gain )
{
- double sum = 0.0;
- double scale = 1.0;
- double amplitude = 1.0;
+ Real sum = 0.0;
+ Real scale = 1.0;
+ Real amplitude = 1.0;
for( int octave = 0; octave < octaves; ++octave ) {
sum += amplitude * fabs( ScalarNoise( location.multipliedBy(scale) ) );
scale *= lacunarity;
Modified: branches/float/Core/Math/Noise.h
==============================================================================
--- branches/float/Core/Math/Noise.h (original)
+++ branches/float/Core/Math/Noise.h Sat May 28 23:22:01 2005
@@ -3,10 +3,6 @@
#include <Core/Geometry/PointVector.h>
-namespace SCIRun {
- class Point;
-}
-
namespace Manta {
/**
@@ -19,7 +15,7 @@
* @param location the point to evaluate the noise at
* @return a signed scalar noise value
*/
- double ScalarNoise(
+ Real ScalarNoise(
Point const &location );
/**
@@ -42,7 +38,7 @@
* @param location the point to evaluate the noise at
* @return a scalar value between -1 and 1
*/
- double ScalarCellNoise(
+ Real ScalarCellNoise(
Point const &location );
/**
@@ -72,11 +68,11 @@
* @param gain how the range is scaled at each octave.
* @return the scalar-value at that point
*/
- double ScalarFBM(
+ Real ScalarFBM(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain );
+ Real const lacunarity,
+ Real const gain );
/**
* Vector-valued fractional brownian motion noise, a.k.a. fBm noise.
@@ -96,8 +92,8 @@
Vector const VectorFBM(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain );
+ Real const lacunarity,
+ Real const gain );
/**
* Perlin's turbulence function. This is very similiar to the fractional
@@ -111,11 +107,11 @@
* @param gain how the range is scaled at each octave.
* @return the scalar-value at that point
*/
- double Turbulence(
+ Real Turbulence(
Point const &location,
int const octaves,
- double const lacunarity,
- double const gain );
+ Real const lacunarity,
+ Real const gain );
}
Modified: branches/float/Core/Math/ipow.h
==============================================================================
--- branches/float/Core/Math/ipow.h (original)
+++ branches/float/Core/Math/ipow.h Sat May 28 23:22:01 2005
@@ -14,6 +14,18 @@
}
return result;
}
+
+ inline float ipow(float x, int p)
+ {
+ float result=1;
+ while(p){
+ if(p&1)
+ result*=x;
+ x*=x;
+ p>>=1;
+ }
+ return result;
+ }
}
#endif
Modified: branches/float/Core/Util/Args.cc
==============================================================================
--- branches/float/Core/Util/Args.cc (original)
+++ branches/float/Core/Util/Args.cc Sat May 28 23:22:01 2005
@@ -70,6 +70,40 @@
}
}
+ bool getFloatArg(int& i, const vector<string>& args, float& result)
+ {
+ if(++i >= static_cast<int>(args.size())){
+ i--;
+ return false;
+ } else {
+ char* ptr = const_cast<char*>(args[i].c_str());
+ double tmpresult = strtod(ptr, &ptr);
+ if(ptr == args[i].c_str() || *ptr != 0){
+ i--;
+ return false;
+ }
+ result = tmpresult;
+ return true;
+ }
+ }
+
+ bool getRealArg(int& i, const vector<string>& args, Real& result)
+ {
+ if(++i >= static_cast<int>(args.size())){
+ i--;
+ return false;
+ } else {
+ char* ptr = const_cast<char*>(args[i].c_str());
+ double tmpresult = strtod(ptr, &ptr);
+ if(ptr == args[i].c_str() || *ptr != 0){
+ i--;
+ return false;
+ }
+ result = tmpresult;
+ return true;
+ }
+ }
+
// Parse an argument of the form NxM, where N and M are integers
bool getResolutionArg(int& i, const vector<string>& args, int& xres, int&
yres)
{
Modified: branches/float/Core/Util/Args.h
==============================================================================
--- branches/float/Core/Util/Args.h (original)
+++ branches/float/Core/Util/Args.h Sat May 28 23:22:01 2005
@@ -12,6 +12,8 @@
using namespace std;
bool getStringArg(int& i, const vector<string>&, string& result);
bool getDoubleArg(int& i, const vector<string>&, double& result);
+ bool getFloatArg(int& i, const vector<string>&, float& result);
+ bool getRealArg(int& i, const vector<string>&, Real& result);
bool getIntArg(int& i, const vector<string>&, int& result);
bool getLongArg(int& i, const vector<string>&, long& result);
bool getResolutionArg(int& i, const vector<string>&, int& xres, int& yres);
Modified: branches/float/Engine/Control/RTRT.cc
==============================================================================
--- branches/float/Engine/Control/RTRT.cc (original)
+++ branches/float/Engine/Control/RTRT.cc Sat May 28 23:22:01 2005
@@ -152,7 +152,7 @@
callbackLock.writeUnlock();
}
-void RTRT::setTimeMode(TimeMode /*tm*/, double /*rate*/)
+void RTRT::setTimeMode(TimeMode /*tm*/, Real /*rate*/)
{
NOT_FINISHED("RTRT::setTimeMode");
}
@@ -233,7 +233,7 @@
animFrameState.frameTime = Time::currentSeconds() * timeScale;
break;
case FixedRate:
- animFrameState.frameTime =
static_cast<double>(animFrameState.frameNumber) / frameRate;
+ animFrameState.frameTime =
static_cast<Real>(animFrameState.frameNumber) / frameRate;
break;
case Static:
break;
Modified: branches/float/Engine/Control/RTRT.h
==============================================================================
--- branches/float/Engine/Control/RTRT.h (original)
+++ branches/float/Engine/Control/RTRT.h Sat May 28 23:22:01 2005
@@ -101,7 +101,7 @@
virtual void registerParallelAnimationCallback(CallbackBase_3Data<int,
int, bool&>*);
// Control of time/animation
- virtual void setTimeMode(TimeMode tm, double rate);
+ virtual void setTimeMode(TimeMode tm, Real rate);
// Parallel processing
virtual void changeNumWorkers(int workers);
@@ -224,8 +224,8 @@
// Time control
TimeMode timeMode;
- double timeScale;
- double frameRate;
+ Real timeScale;
+ Real frameRate;
char pad0[MAXCACHELINESIZE];
FrameState animFrameState;
Modified: branches/float/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- branches/float/Engine/Display/OpenGLDisplay.cc (original)
+++ branches/float/Engine/Display/OpenGLDisplay.cc Sat May 28 23:22:01
2005
@@ -302,7 +302,7 @@
}
}
-void OpenGLDisplay::display_frame_rate(double framerate) {
+void OpenGLDisplay::display_frame_rate(Real framerate) {
// Display textual information on the screen:
char buf[200];
if (framerate > 1)
Modified: branches/float/Engine/Display/OpenGLDisplay.h
==============================================================================
--- branches/float/Engine/Display/OpenGLDisplay.h (original)
+++ branches/float/Engine/Display/OpenGLDisplay.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_OpenGLDisplay_h
#define Manta_Engine_OpenGLDisplay_h
+#include <MantaTypes.h>
#include <Interface/ImageDisplay.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
@@ -41,10 +42,10 @@
// This is when the last frame started displaying. Use it to
// compute the framerate.
- double last_frame_time;
+ Real last_frame_time;
// Used to display the frame rate on the screen
- void display_frame_rate(double framerate);
+ void display_frame_rate(Real framerate);
};
}
Modified: branches/float/Engine/Display/XHelper.cc
==============================================================================
--- branches/float/Engine/Display/XHelper.cc (original)
+++ branches/float/Engine/Display/XHelper.cc Sat May 28 23:22:01 2005
@@ -1,3 +1,4 @@
+
#include <Engine/Display/XHelper.h>
#include <Core/Color/RGBColor.h>
@@ -35,7 +36,7 @@
// Print the string using the current OpenGL context.
-void XHelper::printString(GLuint fontbase, double x, double y,
+void XHelper::printString(GLuint fontbase, Real x, Real y,
const char *s, const RGBColor& c) {
// Set the font color
glColor3f(c.r(), c.g(), c.b());
Modified: branches/float/Engine/Display/XHelper.h
==============================================================================
--- branches/float/Engine/Display/XHelper.h (original)
+++ branches/float/Engine/Display/XHelper.h Sat May 28 23:22:01 2005
@@ -9,12 +9,13 @@
*
*************************************/
-#include <GL/gl.h>
-#include <X11/Xlib.h>
-
#ifndef Manta_Engine_XHelper_h
#define Manta_Engine_XHelper_h
+#include <MantaTypes.h>
+#include <GL/gl.h>
+#include <X11/Xlib.h>
+
#ifdef __sgi
#define __FONTSTRING__
"-adobe-helvetica-bold-r-normal--12-120-*-*-p-*-iso8859-1"
#else
@@ -35,7 +36,7 @@
static GLuint getGLFont(XFontStruct* fontInfo);
// Print the string using the current OpenGL context.
- static void printString(GLuint fontbase, double x, double y,
+ static void printString(GLuint fontbase, Real x, Real y,
const char *s, const RGBColor& c);
// Calculates how many pixels wide a string will be using the
Modified: branches/float/Engine/IdleModes/ZoomIdleMode.h
==============================================================================
--- branches/float/Engine/IdleModes/ZoomIdleMode.h (original)
+++ branches/float/Engine/IdleModes/ZoomIdleMode.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_ZoomIdleMode_h
#define Manta_Engine_ZoomIdleMode_h
+#include <MantaTypes.h>
#include <Interface/IdleMode.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -29,7 +30,7 @@
};
vector<ChannelData> channeldata;
- double factor;
+ Real factor;
};
}
Modified: branches/float/Engine/ImageTraversers/FramelessImageTraverser.cc
==============================================================================
--- branches/float/Engine/ImageTraversers/FramelessImageTraverser.cc
(original)
+++ branches/float/Engine/ImageTraversers/FramelessImageTraverser.cc Sat
May 28 23:22:01 2005
@@ -183,16 +183,16 @@
for(int i=0;i<size;i++) {
Fragment::Element& fe = fragment.get(f+i);
// normalized
- double px, py;
+ Real px, py;
if(xres>yres) // let the smaller dimension be mapped to [-1,1]
{
- px = (double)(-1.0 + 2.0*(double)(fe.x+0.5)/(double)yres);
- py = (double)(-1.0 + 2.0*(double)(fe.y+0.5)/(double)yres);
+ px = (Real)(-1.0 + 2.0*(Real)(fe.x+0.5)/(Real)yres);
+ py = (Real)(-1.0 + 2.0*(Real)(fe.y+0.5)/(Real)yres);
}
else
{
- px = (double)(-1.0 + 2.0*(double)(fe.x+0.5)/(double)xres);
- py = (double)(-1.0 + 2.0*(double)(fe.y+0.5)/(double)xres);
+ px = (Real)(-1.0 + 2.0*(Real)(fe.x+0.5)/(Real)xres);
+ py = (Real)(-1.0 + 2.0*(Real)(fe.y+0.5)/(Real)xres);
}
//printf("%f, %f\n", (float)px, (float)py);
rays.setPixel(i, 0, px, py, &fe.color);
Modified: branches/float/Engine/PixelSamplers/HammersleySampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/HammersleySampler.cc (original)
+++ branches/float/Engine/PixelSamplers/HammersleySampler.cc Sat May 28
23:22:01 2005
@@ -113,7 +113,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
@@ -144,7 +144,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Fragment::Element& fe0 = fragment.get(f+i);
Modified: branches/float/Engine/PixelSamplers/HammersleySampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/HammersleySampler.h (original)
+++ branches/float/Engine/PixelSamplers/HammersleySampler.h Sat May 28
23:22:01 2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_HammersleySampler_h
#define Manta_Engine_HammersleySampler_h
+#include <MantaTypes.h>
#include <Interface/PixelSampler.h>
#include <Core/Math/MT_RNG.h>
#include <Core/Math/vector2d.h>
@@ -29,10 +30,10 @@
HammersleySampler& operator=(const HammersleySampler&);
int num_samples;
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector2d *samples;
Modified: branches/float/Engine/PixelSamplers/InterLeaveSampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/InterLeaveSampler.cc (original)
+++ branches/float/Engine/PixelSamplers/InterLeaveSampler.cc Sat May 28
23:22:01 2005
@@ -124,7 +124,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
for(int x = 0; x < num_samples; x++)
{
@@ -149,7 +149,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Fragment::Element& fe0 = fragment.get(f+i);
for(int x = 0; x < num_samples; x++)
Modified: branches/float/Engine/PixelSamplers/InterLeaveSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/InterLeaveSampler.h (original)
+++ branches/float/Engine/PixelSamplers/InterLeaveSampler.h Sat May 28
23:22:01 2005
@@ -32,10 +32,10 @@
int num_grid;
int num_samples;
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector2d ** interLeavedSamples;
MT_RNG *random;
Modified: branches/float/Engine/PixelSamplers/JitterSampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/JitterSampler.cc (original)
+++ branches/float/Engine/PixelSamplers/JitterSampler.cc Sat May 28
23:22:01 2005
@@ -107,7 +107,7 @@
Fragment::Element& fe0 = fragment.get(f);
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Sample::jitter(samples, num_samples, random[thd_num]);
@@ -132,7 +132,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Fragment::Element& fe0 = fragment.get(f+i);
Modified: branches/float/Engine/PixelSamplers/JitterSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/JitterSampler.h (original)
+++ branches/float/Engine/PixelSamplers/JitterSampler.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_JitterSampler_h
#define Manta_Engine_JitterSampler_h
+#include <MantaTypes.h>
#include <Interface/PixelSampler.h>
#include <Core/Math/MT_RNG.h>
#include <Core/Math/vector2d.h>
@@ -30,10 +31,10 @@
JitterSampler& operator=(const JitterSampler&);
int num_samples;
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector2d *samples;
Modified: branches/float/Engine/PixelSamplers/MultiJitterSampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/MultiJitterSampler.cc (original)
+++ branches/float/Engine/PixelSamplers/MultiJitterSampler.cc Sat May 28
23:22:01 2005
@@ -113,7 +113,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Sample::multiJitter(samples, num_samples, random[thd_num]);
@@ -141,7 +141,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Fragment::Element& fe0 = fragment.get(f+i);
Modified: branches/float/Engine/PixelSamplers/MultiJitterSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/MultiJitterSampler.h (original)
+++ branches/float/Engine/PixelSamplers/MultiJitterSampler.h Sat May 28
23:22:01 2005
@@ -29,10 +29,10 @@
MultiJitterSampler& operator=(const MultiJitterSampler&);
int num_samples;
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector2d *samples;
Modified: branches/float/Engine/PixelSamplers/NRooksSampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/NRooksSampler.cc (original)
+++ branches/float/Engine/PixelSamplers/NRooksSampler.cc Sat May 28
23:22:01 2005
@@ -113,7 +113,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
@@ -144,7 +144,7 @@
int i = 0;
int count = 0;
- double px, py;
+ Real px, py;
while(i < size){
Fragment::Element& fe0 = fragment.get(f+i);
Modified: branches/float/Engine/PixelSamplers/NRooksSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/NRooksSampler.h (original)
+++ branches/float/Engine/PixelSamplers/NRooksSampler.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_NRooksSampler_h
#define Manta_Engine_NRooksSampler_h
+#include <MantaTypes.h>
#include <Interface/PixelSampler.h>
#include <Core/Math/MT_RNG.h>
#include <Core/Math/vector2d.h>
@@ -29,10 +30,10 @@
NRooksSampler& operator=(const NRooksSampler&);
int num_samples;
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector2d *samples;
Modified: branches/float/Engine/PixelSamplers/RampSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/RampSampler.h (original)
+++ branches/float/Engine/PixelSamplers/RampSampler.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_RampSampler_h
#define Manta_Engine_RampSampler_h
+#include <MantaTypes.h>
#include <Interface/PixelSampler.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -25,10 +26,10 @@
RampSampler& operator=(const RampSampler&);
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector<ChannelInfo> channelInfo;
};
Modified: branches/float/Engine/PixelSamplers/Sample.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/Sample.cc (original)
+++ branches/float/Engine/PixelSamplers/Sample.cc Sat May 28 23:22:01
2005
@@ -1,11 +1,12 @@
#include <Engine/PixelSamplers/Sample.h>
+#include <MantaTypes.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
-
+using namespace Manta;
void Sample::random(vector2d *samples, int num_samples, MT_RNG seed)
{
@@ -23,8 +24,8 @@
for(int i = 0; i < sqrt_samples; i++)
for(int j = 0; j < sqrt_samples; j++)
{
- float x = ((double)i + seed.gendrand()) / (double)sqrt_samples;
- float y = ((double)j + seed.gendrand()) / (double)sqrt_samples;
+ Real x = ((Real)i + seed.gendrand()) / (Real)sqrt_samples;
+ Real y = ((Real)j + seed.gendrand()) / (Real)sqrt_samples;
(samples[i*sqrt_samples +j]).setX(x);
(samples[i*sqrt_samples +j]).setY(y);
}
@@ -35,13 +36,13 @@
{
for (int i = 0; i < num_samples; i++)
{
- samples[i].setX(((double)i + seed.gendrand()) / (double)num_samples);
- samples[i].setY(((double)i + seed.gendrand()) / (double)num_samples);
+ samples[i].setX(((Real)i + seed.gendrand()) / (Real)num_samples);
+ samples[i].setY(((Real)i + seed.gendrand()) / (Real)num_samples);
}
// shuffle the x coords
for (int i = num_samples - 2; i >= 0; i--)
{
- int target = int(seed.gendrand() * (double)i);
+ int target = int(seed.gendrand() * (Real)i);
float temp = samples[i+1].x();
samples[i+1].setX(samples[target].x());
samples[target].setX(temp);
@@ -88,10 +89,10 @@
void Sample::hammersley(vector2d *samples, int num_samples, MT_RNG seed)
{
- double p, u, v;
+ Real p, u, v;
int k, kk;
- double offu = (seed.gendrand() +.75f) / 2.0f;
- double offv = (seed.gendrand() +.75f) / 2.0f;
+ Real offu = (seed.gendrand() +.75f) / 2.0f;
+ Real offv = (seed.gendrand() +.75f) / 2.0f;
for (k=0 ; k<num_samples ; k++)
{
@@ -100,7 +101,7 @@
for (kk=k ; kk ; p*=0.5f, kk>>=1)
if (kk & 1) u += p; // kk mod 2 == 1
- v = ((double)k + 0.5f) / (double)num_samples;
+ v = ((Real)k + 0.5f) / (Real)num_samples;
u += offu;
v += offv;
u -= int(u);
@@ -114,7 +115,7 @@
{
for (int i = num_samples - 2; i >= 0; i--)
{
- int target = int(seed.gendrand() * (double)i);
+ int target = int(seed.gendrand() * (Real)i);
vector2d temp = samples[i+1];
samples[i+1] = samples[target];
samples[target] = temp;
@@ -140,10 +141,10 @@
{
float x = samples[i].x();
float y = samples[i].y();
- if (x < 0.5f) samples[i].setX((float)sqrt(2.0*(double)x) - 1.0f);
- else samples[i].setX(1.0f - (float)sqrt(2.0 - 2.0 * (double)x));
- if (y < 0.5f) samples[i].setY((float)sqrt(2.0*(double)y) - 1.0f);
- else samples[i].setY(1.0f - (float)sqrt(2.0 - 2.0 * (double)y));
+ if (x < 0.5f) samples[i].setX((float)sqrt(2.0*(Real)x) - 1.0f);
+ else samples[i].setX(1.0f - (float)sqrt(2.0 - 2.0 * (Real)x));
+ if (y < 0.5f) samples[i].setY((float)sqrt(2.0*(Real)y) - 1.0f);
+ else samples[i].setY(1.0f - (float)sqrt(2.0 - 2.0 * (Real)y));
}
}
@@ -166,14 +167,14 @@
{
for(int i = 0; i < num_samples; i++)
{
- samples[i] = (double)drand48();
+ samples[i] = (Real)drand48();
}
}
void Sample::jitter(float *samples, int num_samples)
{
for(int i = 0; i < num_samples; i++)
- samples[i] = ((double)i+(double)drand48())/(double)num_samples;
+ samples[i] = ((Real)i+(Real)drand48())/(Real)num_samples;
}
@@ -181,8 +182,8 @@
{
for(int i = num_samples - 2; i >= 0; i--)
{
- int target = int ((double)drand48() * (double)i);
- double temp = samples[i+1];
+ int target = int ((Real)drand48() * (Real)i);
+ Real temp = samples[i+1];
samples[i+1] = samples[target];
samples[target] = temp;
}
Modified: branches/float/Engine/PixelSamplers/SingleSampler.cc
==============================================================================
--- branches/float/Engine/PixelSamplers/SingleSampler.cc (original)
+++ branches/float/Engine/PixelSamplers/SingleSampler.cc Sat May 28
23:22:01 2005
@@ -64,8 +64,8 @@
if(fragment.getFlags() & Fragment::ConsecutiveX){
Fragment::Element& fe0 = fragment.get(f);
- double px = fe0.x*ci.xscale+ci.xoffset;
- double py = fe0.y*ci.yscale+ci.yoffset;
+ Real px = fe0.x*ci.xscale+ci.xoffset;
+ Real py = fe0.y*ci.yscale+ci.yoffset;
for(int i=0;i<size;i++){
Fragment::Element& fe = fragment.get(f+i);
rays.setPixel(i, 0, px, py, &fe.color);
@@ -74,8 +74,8 @@
} else {
for(int i=0;i<size;i++){
Fragment::Element& fe = fragment.get(f+i);
- double px = fe.x*ci.xscale+ci.xoffset;
- double py = fe.y*ci.yscale+ci.yoffset;
+ Real px = fe.x*ci.xscale+ci.xoffset;
+ Real py = fe.y*ci.yscale+ci.yoffset;
rays.setPixel(i, 1, px, py, &fe.color);
}
}
Modified: branches/float/Engine/PixelSamplers/SingleSampler.h
==============================================================================
--- branches/float/Engine/PixelSamplers/SingleSampler.h (original)
+++ branches/float/Engine/PixelSamplers/SingleSampler.h Sat May 28 23:22:01
2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_SingleSampler_h
#define Manta_Engine_SingleSampler_h
+#include <MantaTypes.h>
#include <Interface/PixelSampler.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -26,10 +27,10 @@
SingleSampler& operator=(const SingleSampler&);
struct ChannelInfo {
- double xscale;
- double xoffset;
- double yscale;
- double yoffset;
+ Real xscale;
+ Real xoffset;
+ Real yscale;
+ Real yoffset;
};
vector<ChannelInfo> channelInfo;
};
Modified: branches/float/Engine/Renderers/Moire.cc
==============================================================================
--- branches/float/Engine/Renderers/Moire.cc (original)
+++ branches/float/Engine/Renderers/Moire.cc Sat May 28 23:22:01 2005
@@ -23,10 +23,10 @@
for(int i=0;i<argc;i++){
string arg = args[i];
if(arg == "-rate"){
- if(!getDoubleArg(i, args, rate))
+ if(!getRealArg(i, args, rate))
throw IllegalArgument("Moire rate", i, args);
} else if(arg == "-cycles"){
- if(!getDoubleArg(i, args, cycles))
+ if(!getRealArg(i, args, cycles))
throw IllegalArgument("Moire cycles", i, args);
} else {
throw IllegalArgument("Moire", i, args);
@@ -53,12 +53,12 @@
void Moire::traceEyeRays(const RenderContext& context, RayPacket& rays)
{
ASSERT(rays.getFlags() & RayPacket::HaveImageCoordinates);
- double phase = context.frameState->frameTime * M_PI;
- double cycles = 100;
+ Real phase = context.frameState->frameTime * M_PI;
+ Real cycles = 100;
for(int i=0;i<rays.getSize();i++){
const RayPacket::Element& p = rays.get(i);
- double dist2 = p.imageX*p.imageX + p.imageY*p.imageY;
- double val = cos(dist2*2*M_PI*cycles+phase)/2+0.5;
+ Real dist2 = p.imageX*p.imageX + p.imageY*p.imageY;
+ Real val = cos(dist2*2*M_PI*cycles+phase)/2+0.5;
*p.color = Color(GrayColor(val));
}
}
Modified: branches/float/Engine/Renderers/Moire.h
==============================================================================
--- branches/float/Engine/Renderers/Moire.h (original)
+++ branches/float/Engine/Renderers/Moire.h Sat May 28 23:22:01 2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_Moire_h
#define Manta_Engine_Moire_h
+#include <MantaTypes.h>
#include <Interface/Renderer.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -26,8 +27,8 @@
Moire(const Moire&);
Moire& operator=(const Moire&);
- double rate;
- double cycles;
+ Real rate;
+ Real cycles;
};
}
Modified: branches/float/Engine/Shadows/BeamShadows.cc
==============================================================================
--- branches/float/Engine/Shadows/BeamShadows.cc (original)
+++ branches/float/Engine/Shadows/BeamShadows.cc Sat May 28 23:22:01
2005
@@ -12,7 +12,7 @@
using namespace Manta;
-static const double sqrt_two = 1.414213562373095;
+static const Real sqrt_two = 1.414213562373095;
ShadowAlgorithm* BeamShadows::create(const vector<string>& args)
{
@@ -28,18 +28,18 @@
for(int i=0; i< argc; i++){
string arg = args[i];
if(arg == "-radius"){
- if(!getDoubleArg(i, args, radius))
+ if(!getRealArg(i, args, radius))
throw IllegalArgument("BeamShadows -radius", i, args);
gotRadius = true;
} else if(arg == "-style") {
if(!getIntArg(i, args, style))
throw IllegalArgument("BeamShadows -style", i, args);
} else if(arg == "-noisefreq") {
- if(!getDoubleArg(i, args, noisefreq))
+ if(!getRealArg(i, args, noisefreq))
throw IllegalArgument("BeamShadows -noisefreq", i, args);
gotNoiseFreq = true;
} else if(arg == "-noiseamp") {
- if(!getDoubleArg(i, args, noiseamp))
+ if(!getRealArg(i, args, noiseamp))
throw IllegalArgument("BeamShadows -noiseamp", i, args);
gotNoiseAmp = true;
} else {
@@ -74,7 +74,7 @@
Vector dir( lights->centers[l]+Vector(0,0,radius)-e.hitPosition );
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -82,7 +82,7 @@
dir =
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,-6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -90,7 +90,7 @@
dir =
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -98,7 +98,7 @@
dir =
lights->centers[l]+Vector(4.0/3.0/sqrt_two*radius,0,-1.0/3.0*radius)-e.hitPosition;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -125,39 +125,39 @@
axis_z );
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
}
dir = ( lights->centers[l] - e.hitPosition +
- (-6.0/sqrt_two) * axis_y +
- (-2.0/3.0/sqrt_two) * axis_x +
- (-1.0/3.0) * axis_z );
+ (-6.0f/sqrt_two) * axis_y +
+ (-2.0f/3.0f/sqrt_two) * axis_x +
+ (-1.0f/3.0f) * axis_z );
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
}
dir = ( lights->centers[l] - e.hitPosition +
- (6.0/sqrt_two) * axis_y +
- (-2.0/3.0/sqrt_two) * axis_x +
- (-1.0/3.0) * axis_z );
+ (6.0f/sqrt_two) * axis_y +
+ (-2.0f/3.0f/sqrt_two) * axis_x +
+ (-1.0f/3.0f) * axis_z );
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
}
dir = ( lights->centers[l] - e.hitPosition +
- (-4.0/3.0/sqrt_two) * axis_x +
- (-1.0/3.0) * axis_z );
+ (-4.0f/3.0f/sqrt_two) * axis_x +
+ (-1.0f/3.0f) * axis_z );
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -175,7 +175,7 @@
dir+=VectorNoise(Point(dir*noisefreq))*noiseamp;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -184,7 +184,7 @@
dir+=VectorNoise(Point((dir+Vector(0,0,31.4159))*noisefreq))*noiseamp;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -193,7 +193,7 @@
dir+=VectorNoise(Point((dir+Vector(0,31.4159,0))*noisefreq))*noiseamp;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
@@ -202,7 +202,7 @@
dir+=VectorNoise(Point((dir+Vector(31.4159,0,0))*noisefreq))*noiseamp;
if(Dot(dir, e.normal) > 0){
RayPacket::Element& s = shadowRays.get(sidx++);
- double length = dir.normalize();
+ Real length = dir.normalize();
s.ray.set(e.hitPosition, dir);
s.light = lights->colors[l] * 0.25;
s.hitInfo.reset(length);
Modified: branches/float/Engine/Shadows/BeamShadows.h
==============================================================================
--- branches/float/Engine/Shadows/BeamShadows.h (original)
+++ branches/float/Engine/Shadows/BeamShadows.h Sat May 28 23:22:01 2005
@@ -2,6 +2,7 @@
#ifndef Manta_Engine_BeamShadows_h
#define Manta_Engine_BeamShadows_h
+#include <MantaTypes.h>
#include <Interface/ShadowAlgorithm.h>
#include <sgi_stl_warnings_off.h>
#include <vector>
@@ -27,10 +28,10 @@
BeamShadows(const BeamShadows&);
BeamShadows& operator=(const BeamShadows&);
- double radius;
+ Real radius;
int style;
- double noisefreq;
- double noiseamp;
+ Real noisefreq;
+ Real noiseamp;
};
}
Modified: branches/float/Interface/Camera.h
==============================================================================
--- branches/float/Interface/Camera.h (original)
+++ branches/float/Interface/Camera.h Sat May 28 23:22:01 2005
@@ -14,17 +14,17 @@
virtual void makeRays(RayPacket&) const = 0;
// Camera manipulation
- virtual void scaleFOV(double) = 0;
+ virtual void scaleFOV(Real) = 0;
virtual void translate(Vector v) = 0;
- virtual void dolly(double) = 0;
- virtual Point project(const Point &point) = 0; // project the 3D
point on to the camera image plane
+ virtual void dolly(Real) = 0;
+ virtual Point project(const Point &point) = 0; // project the 3D point
on to the camera image plane
enum TransformCenter {
LookAt,
Eye,
Origin
};
virtual void transform(AffineTransform t, TransformCenter) = 0;
- virtual void autoview(double fov) = 0;
+ virtual void autoview(Real fov) = 0;
private:
Camera(const Camera&);
Camera& operator=(const Camera&);
Modified: branches/float/Interface/Context.h
==============================================================================
--- branches/float/Interface/Context.h (original)
+++ branches/float/Interface/Context.h Sat May 28 23:22:01 2005
@@ -2,6 +2,8 @@
#ifndef Manta_Interface_Context_h
#define Manta_Interface_Context_h
+#include <MantaTypes.h>
+
namespace Manta {
class Camera;
class FrameState;
@@ -66,7 +68,7 @@
int numChannels;
int proc;
int numProcs;
- double currentTime;
+ Real currentTime;
LoadBalancer* loadBalancer;
PixelSampler* pixelSampler;
Renderer* renderer;
Modified: branches/float/Interface/FrameState.h
==============================================================================
--- branches/float/Interface/FrameState.h (original)
+++ branches/float/Interface/FrameState.h Sat May 28 23:22:01 2005
@@ -5,7 +5,7 @@
namespace Manta {
struct FrameState {
long frameNumber;
- double frameTime;
+ Real frameTime;
};
}
Modified: branches/float/Interface/HitInfo.h
==============================================================================
--- branches/float/Interface/HitInfo.h (original)
+++ branches/float/Interface/HitInfo.h Sat May 28 23:22:01 2005
@@ -35,10 +35,10 @@
const Material* material;
const Primitive* primitive;
const TexCoordMapper* tex;
- double scale;
- double inv_scale;
+ Real scale;
+ Real inv_scale;
MPTscale(const Material* material, const Primitive* primitive,
- const TexCoordMapper* tex, double scale, double inv_scale)
+ const TexCoordMapper* tex, Real scale, Real inv_scale)
: material(material), primitive(primitive), tex(tex),
scale(scale), inv_scale(inv_scale)
{
@@ -59,7 +59,7 @@
hitMatl = 0;
min_t = MAXT;
}
- inline void reset(double min) {
+ inline void reset(Real min) {
hitMatl = 0;
min_t = min;
}
@@ -75,18 +75,18 @@
const TexCoordMapper* hitTexCoordMapper() const {
return hitTex;
}
- double minT() const {
+ Real minT() const {
return min_t;
}
- void scaleT(double scale) {
+ void scaleT(Real scale) {
if(hitMatl != 0)
min_t *= scale;
}
- void overrideT(double new_mint) {
+ void overrideT(Real new_mint) {
min_t = new_mint;
}
- bool hit(double t, const Material* matl, const Primitive* prim,
+ bool hit(Real t, const Material* matl, const Primitive* prim,
const TexCoordMapper* tex) {
if(t<T_EPSILON)
return false;
@@ -126,7 +126,7 @@
const Primitive* hitPrim;
const Material* hitMatl;
const TexCoordMapper* hitTex;
- double min_t;
+ Real min_t;
char scratchpad_data[MaxScratchpadSize];
};
}
Modified: branches/float/Interface/Parameters.h
==============================================================================
--- branches/float/Interface/Parameters.h (original)
+++ branches/float/Interface/Parameters.h Sat May 28 23:22:01 2005
@@ -3,6 +3,7 @@
#define Manta_Interface_Parameters_h
#define MAXCACHELINESIZE 128
-#define T_EPSILON 1.e-8
+//#define T_EPSILON 1.e-8f
+#define T_EPSILON 1.e-5f
#endif
Modified: branches/float/Interface/RTRTInterface.h
==============================================================================
--- branches/float/Interface/RTRTInterface.h (original)
+++ branches/float/Interface/RTRTInterface.h Sat May 28 23:22:01 2005
@@ -2,6 +2,7 @@
#ifndef Manta_Interface_RTRTInterface_H
#define Manta_Interface_RTRTInterface_H
+#include <MantaTypes.h>
#include <Interface/Callback.h>
#include <Interface/Transaction.h>
#include <sgi_stl_warnings_off.h>
@@ -122,7 +123,7 @@
enum TimeMode {
RealTime, FixedRate, Static, FixedSamplingRate
};
- virtual void setTimeMode(TimeMode tm, double rate) = 0;
+ virtual void setTimeMode(TimeMode tm, Real rate) = 0;
// Parallel processing
virtual void changeNumWorkers(int) = 0;
Modified: branches/float/Interface/RayPacket.h
==============================================================================
--- branches/float/Interface/RayPacket.h (original)
+++ branches/float/Interface/RayPacket.h Sat May 28 23:22:01 2005
@@ -66,8 +66,8 @@
struct Element {
Color localColor;
Color* color;
- double imageX;
- double imageY;
+ Real imageX;
+ Real imageY;
int whichEye;
Ray ray;
HitInfo hitInfo;
@@ -87,7 +87,7 @@
Element& get(int which) {
return data[which];
}
- void setPixel(int which, int whichEye, double imageX, double imageY,
+ void setPixel(int which, int whichEye, Real imageX, Real imageY,
Color* color) {
data[which].color = color;
data[which].imageX = imageX;
@@ -113,7 +113,7 @@
return;
if(flags & HaveHitRecords){
for(int i=0;i<size;i++){
- double length = data[i].ray.normalizeDirection();
+ Real length = data[i].ray.normalizeDirection();
data[i].hitInfo.scaleT(length);
}
} else {
Modified: branches/float/MantaTypes.h
==============================================================================
--- branches/float/MantaTypes.h (original)
+++ branches/float/MantaTypes.h Sat May 28 23:22:01 2005
@@ -4,7 +4,7 @@
namespace Manta {
// Scalars
- typedef double Real;
+ typedef float Real;
// Colors - forward declarations only
typedef float ColorComponent;
Modified: branches/float/Model/AmbientLights/ArcAmbient.cc
==============================================================================
--- branches/float/Model/AmbientLights/ArcAmbient.cc (original)
+++ branches/float/Model/AmbientLights/ArcAmbient.cc Sat May 28 23:22:01
2005
@@ -23,9 +23,9 @@
rays.computeNormals(context);
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double cosine = Dot(e.normal, up);
- double sine = sqrt(1-cosine*cosine);
- double w0, w1;
+ Real cosine = Dot(e.normal, up);
+ Real sine = sqrt(1-cosine*cosine);
+ Real w0, w1;
if(cosine > 0){
w0= sine/2.;
w1= (1. - w0);
Modified: branches/float/Model/Backgrounds/LinearBackground.cc
==============================================================================
--- branches/float/Model/Backgrounds/LinearBackground.cc (original)
+++ branches/float/Model/Backgrounds/LinearBackground.cc Sat May 28
23:22:01 2005
@@ -24,7 +24,7 @@
rays.normalizeDirections();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double t = 0.5 * (1 + Dot(e.ray.direction(), up));
+ Real t = 0.5 * (1 + Dot(e.ray.direction(), up));
rays.setResult(i, cup*t+cdown*(1-t));
}
}
Modified: branches/float/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- branches/float/Model/Cameras/EnvironmentCamera.cc (original)
+++ branches/float/Model/Cameras/EnvironmentCamera.cc Sat May 28 23:22:01
2005
@@ -82,8 +82,8 @@
if (normalizeRays) {
for (int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e=rays.get(i);
- double theta=0.5*(M_PI - M_PI*e.imageY);
- double phi=M_PI*e.imageX + M_PI;
+ Real theta=0.5*(M_PI - M_PI*e.imageY);
+ Real phi=M_PI*e.imageX + M_PI;
Vector xyz(sin(theta)*cos(phi), sin(theta)*sin(phi),
cos(theta));
Vector raydir(Dot(xyz, v),
@@ -96,8 +96,8 @@
} else {
for (int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e=rays.get(i);
- double theta=0.5*(M_PI - M_PI*e.imageY);
- double phi=M_PI*e.imageX + M_PI;
+ Real theta=0.5*(M_PI - M_PI*e.imageY);
+ Real phi=M_PI*e.imageX + M_PI;
Vector xyz(sin(theta)*cos(phi), sin(theta)*sin(phi),
cos(theta));
Vector raydir(Dot(xyz, v),
@@ -108,7 +108,7 @@
}
}
-void EnvironmentCamera::scaleFOV(double scale)
+void EnvironmentCamera::scaleFOV(Real scale)
{
// This functionality doesn't make much sense with the environment camera
}
@@ -122,7 +122,7 @@
setup();
}
-void EnvironmentCamera::dolly(double scale)
+void EnvironmentCamera::dolly(Real scale)
{
Vector dir=lookat - eye;
eye += dir*scale;
@@ -145,7 +145,7 @@
}
Vector lookdir(eye - lookat);
- double length=lookdir.length();
+ Real length=lookdir.length();
AffineTransform frame;
frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -160,7 +160,7 @@
setup();
}
-void EnvironmentCamera::autoview(double new_fov)
+void EnvironmentCamera::autoview(Real new_fov)
{
// This functionality doesn't make much sense with the environment camera
}
Modified: branches/float/Model/Cameras/EnvironmentCamera.h
==============================================================================
--- branches/float/Model/Cameras/EnvironmentCamera.h (original)
+++ branches/float/Model/Cameras/EnvironmentCamera.h Sat May 28 23:22:01
2005
@@ -19,11 +19,11 @@
virtual void makeRays(RayPacket&) const;
// Camera manipulation
- virtual void scaleFOV(double);
+ virtual void scaleFOV(Real);
virtual void translate(Vector);
- virtual void dolly(double);
+ virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(double fov);
+ virtual void autoview(Real fov);
virtual Point project(const Point &point); // project a 3D point to the
camera image plane
static Camera* create(const vector<string>& args);
private:
Modified: branches/float/Model/Cameras/FisheyeCamera.cc
==============================================================================
--- branches/float/Model/Cameras/FisheyeCamera.cc (original)
+++ branches/float/Model/Cameras/FisheyeCamera.cc Sat May 28 23:22:01
2005
@@ -15,7 +15,7 @@
using namespace std;
using SCIRun::Clamp;
-static const double sqrt_two = 1.4142135623730951;
+static const Real sqrt_two = 1.4142135623730951;
FisheyeCamera::FisheyeCamera(const vector<string>& args)
{
@@ -39,7 +39,7 @@
throw IllegalArgument("FisheyeCamera -up", i, args);
gotUp = true;
} else if(arg == "-fov"){
- if(!getDoubleArg(i, args, hfov))
+ if(!getRealArg(i, args, hfov))
throw IllegalArgument("FisheyeCamera -fov", i, args);
gotFov = true;
} else {
@@ -96,20 +96,20 @@
rays.setFlag(RayPacket::ConstantOrigin|RayPacket::NormalizedDirections);
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double z = sqrt( 2.0 - e.imageX * e.imageX - e.imageY * e.imageY );
- double theta = atan2( e.imageY, e.imageX );
- double phi = acos( z / sqrt_two ) * hfov;
- double x = cos( theta ) * sin( phi );
- double y = sin( theta ) * sin( phi );
+ Real z = sqrt( 2.0 - e.imageX * e.imageX - e.imageY * e.imageY );
+ Real theta = atan2( e.imageY, e.imageX );
+ Real phi = acos( z / sqrt_two ) * hfov;
+ Real x = cos( theta ) * sin( phi );
+ Real y = sin( theta ) * sin( phi );
z = cos( phi );
e.ray.set(eye, v*x+u*y+n*z);
}
}
-void FisheyeCamera::scaleFOV(double scale)
+void FisheyeCamera::scaleFOV(Real scale)
{
- double fov_min = 0;
- double fov_max = 4.0;
+ Real fov_min = 0;
+ Real fov_max = 4.0;
hfov = scale*hfov;
hfov = Clamp(hfov, fov_min, fov_max);
vfov = scale*vfov;
@@ -125,7 +125,7 @@
setup();
}
-void FisheyeCamera::dolly(double scale)
+void FisheyeCamera::dolly(Real scale)
{
Vector dir = lookat - eye;
eye += dir*scale;
@@ -148,7 +148,7 @@
}
Vector lookdir(eye-lookat);
- double length = lookdir.length();
+ Real length = lookdir.length();
AffineTransform frame;
frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -163,18 +163,18 @@
setup();
}
-void FisheyeCamera::autoview(double new_fov)
+void FisheyeCamera::autoview(Real new_fov)
{
BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- // double ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
+ // Real ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
hfov = new_fov;
vfov = new_fov;
Vector diag(bbox.diagonal());
- double w=diag.length();
+ Real w=diag.length();
Vector lookdir(eye-lookat);
lookdir.normalize();
- double scale = 1.0/(2*tan(DtoR(hfov/2.0)));
- double length = w*scale;
+ Real scale = 1.0/(2*tan(DtoR(hfov/2.0)));
+ Real length = w*scale;
lookat = bbox.center();
eye = lookat+lookdir*length;
setup();
Modified: branches/float/Model/Cameras/FisheyeCamera.h
==============================================================================
--- branches/float/Model/Cameras/FisheyeCamera.h (original)
+++ branches/float/Model/Cameras/FisheyeCamera.h Sat May 28 23:22:01
2005
@@ -19,11 +19,11 @@
virtual void makeRays(RayPacket&) const;
// Camera manipulation
- virtual void scaleFOV(double);
+ virtual void scaleFOV(Real);
virtual void translate(Vector);
- virtual void dolly(double);
+ virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(double fov);
+ virtual void autoview(Real fov);
virtual Point project(const Point &point); // project a 3D point
to the camera image plane
static Camera* create(const vector<string>& args);
private:
@@ -31,7 +31,7 @@
Point eye;
Point lookat;
Vector up;
- double hfov, vfov, width, height, nearZ; // x and y field of view,
+ Real hfov, vfov, width, height, nearZ; // x and y field of view,
// width and height of image
plane
// distance from eye to image
plane
@@ -39,7 +39,7 @@
Vector u,v,n;
// for projection we maintain a uvn rotation matrix
- double uvn[3][3];
+ Real uvn[3][3];
};
}
Modified: branches/float/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- branches/float/Model/Cameras/OrthogonalCamera.cc (original)
+++ branches/float/Model/Cameras/OrthogonalCamera.cc Sat May 28 23:22:01
2005
@@ -35,7 +35,7 @@
throw IllegalArgument("OrthogonalCamera -up", i, args);
gotUp = true;
} else if(arg == "-scale"){
- if(!getDoubleArg(i, args, hscale))
+ if(!getRealArg(i, args, hscale))
throw IllegalArgument("OrthogonalCamera -scale", i, args);
gotScale = true;
} else {
@@ -89,7 +89,7 @@
// FOV doesn't quite make sense here - orthogonal cameras don't have FOV's.
// But in the context of the camera interface, adjusting the scale makes
// the most sense, so we'll do that.
-void OrthogonalCamera::scaleFOV(double scale)
+void OrthogonalCamera::scaleFOV(Real scale)
{
hscale *= scale;
vscale *= scale;
@@ -105,7 +105,7 @@
setup();
}
-void OrthogonalCamera::dolly(double scale)
+void OrthogonalCamera::dolly(Real scale)
{
Vector dir = lookat - eye;
eye += dir*scale;
@@ -128,7 +128,7 @@
}
Vector lookdir(eye-lookat);
- double length = lookdir.length();
+ Real length = lookdir.length();
AffineTransform frame;
frame.initWithBasis(v.normal()*length, u.normal()*length, lookdir, cen);
@@ -143,14 +143,14 @@
setup();
}
-void OrthogonalCamera::autoview(double new_fov)
+void OrthogonalCamera::autoview(Real new_fov)
{
BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- // double ratio = tan(DtoR(vscale/2))/tan(DtoR(hscale/2));
+ // Real ratio = tan(DtoR(vscale/2))/tan(DtoR(hscale/2));
hscale = new_fov;
vscale = new_fov;
Vector diag(bbox.diagonal());
- double w=diag.length();
+ Real w=diag.length();
Vector lookdir(eye-lookat);
lookdir.normalize();
lookat = bbox.center();
Modified: branches/float/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- branches/float/Model/Cameras/OrthogonalCamera.h (original)
+++ branches/float/Model/Cameras/OrthogonalCamera.h Sat May 28 23:22:01
2005
@@ -18,11 +18,11 @@
virtual void makeRays(RayPacket&) const;
// Camera manipulation
- virtual void scaleFOV(double);
+ virtual void scaleFOV(Real);
virtual void translate(Vector);
- virtual void dolly(double);
+ virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(double fov);
+ virtual void autoview(Real fov);
virtual Point project(const Point &point);
static Camera* create(const vector<string>& args);
private:
@@ -30,7 +30,7 @@
Point eye;
Point lookat;
Vector up;
- double hscale, vscale;
+ Real hscale, vscale;
Vector direction;
Vector u,v;
Modified: branches/float/Model/Cameras/PinholeCamera.cc
==============================================================================
--- branches/float/Model/Cameras/PinholeCamera.cc (original)
+++ branches/float/Model/Cameras/PinholeCamera.cc Sat May 28 23:22:01
2005
@@ -38,7 +38,7 @@
throw IllegalArgument("PinholeCamera -up", i, args);
gotUp = true;
} else if(arg == "-fov"){
- if(!getDoubleArg(i, args, hfov))
+ if(!getRealArg(i, args, hfov))
throw IllegalArgument("PinholeCamera -fov", i, args);
gotFov = true;
} else if(arg == "-normalizeRays"){
@@ -116,10 +116,10 @@
}
}
-void PinholeCamera::scaleFOV(double scale)
+void PinholeCamera::scaleFOV(Real scale)
{
- double fov_min = 0;
- double fov_max = 180;
+ Real fov_min = 0;
+ Real fov_max = 180;
hfov = RtoD(2*atan(scale*tan(DtoR(hfov/2.))));
hfov = Clamp(hfov, fov_min, fov_max);
vfov = RtoD(2*atan(scale*tan(DtoR(vfov/2.))));
@@ -136,7 +136,7 @@
setup();
}
-void PinholeCamera::dolly(double scale)
+void PinholeCamera::dolly(Real scale)
{
Vector dir = lookat - eye;
eye += dir*scale;
@@ -159,7 +159,7 @@
}
Vector lookdir(eye-lookat);
- double length = lookdir.length();
+ Real length = lookdir.length();
AffineTransform frame;
frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -174,18 +174,18 @@
setup();
}
-void PinholeCamera::autoview(double new_fov)
+void PinholeCamera::autoview(Real new_fov)
{
BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- // double ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
+ // Real ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
hfov = new_fov;
vfov = RtoD(2*atan(tan(DtoR(hfov/2))));
Vector diag(bbox.diagonal());
- double w=diag.length();
+ Real w=diag.length();
Vector lookdir(eye-lookat);
lookdir.normalize();
- double scale = 1.0/(2*tan(DtoR(hfov/2.0)));
- double length = w*scale;
+ Real scale = 1.0/(2*tan(DtoR(hfov/2.0)));
+ Real length = w*scale;
lookat = bbox.center();
eye = lookat+lookdir*length;
setup();
Modified: branches/float/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/float/Model/Cameras/PinholeCamera.h (original)
+++ branches/float/Model/Cameras/PinholeCamera.h Sat May 28 23:22:01
2005
@@ -19,11 +19,11 @@
virtual void makeRays(RayPacket&) const;
// Camera manipulation
- virtual void scaleFOV(double);
+ virtual void scaleFOV(Real);
virtual void translate(Vector);
- virtual void dolly(double);
+ virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(double fov);
+ virtual void autoview(Real fov);
virtual Point project(const Point &point); // project a 3D point
to the camera image plane
static Camera* create(const vector<string>& args);
private:
@@ -31,7 +31,7 @@
Point eye;
Point lookat;
Vector up;
- double hfov, vfov, width, height, nearZ; // x and y field of view,
+ Real hfov, vfov, width, height, nearZ; // x and y field of view,
// width and height of image
plane
// distance from eye to image
plane
bool normalizeRays;
@@ -40,7 +40,7 @@
Vector u,v;
// for projection we maintain a uvn rotation matrix
- double uvn[3][3];
+ Real uvn[3][3];
};
}
Modified: branches/float/Model/Groups/BVH.cc
==============================================================================
--- branches/float/Model/Groups/BVH.cc (original)
+++ branches/float/Model/Groups/BVH.cc Sat May 28 23:22:01 2005
@@ -316,8 +316,8 @@
Vector t2 = (node->max - e.ray.origin()) * e.inverseDirection;
Vector tn = Min(t1, t2);
Vector tf = Max(t1, t2);
- double tnear = tn.maxComponent();
- double tfar = tf.minComponent();
+ Real tnear = tn.maxComponent();
+ Real tfar = tf.minComponent();
if(tnear <= tfar){
if(node->left <= 0)
// Hit prim
@@ -345,8 +345,8 @@
Vector t2 = (node->max - e.ray.origin()) * e.inverseDirection;
Vector tn = Min(t1, t2);
Vector tf = Max(t1, t2);
- double tnear = tn.maxComponent();
- double tfar = tf.minComponent();
+ Real tnear = tn.maxComponent();
+ Real tfar = tf.minComponent();
bool hit = (tnear <= tfar);
cur.bv_hit[i] = hit;
total += (int)hit;
Modified: branches/float/Model/Instances/Instance.cc
==============================================================================
--- branches/float/Model/Instances/Instance.cc (original)
+++ branches/float/Model/Instances/Instance.cc Sat May 28 23:22:01 2005
@@ -44,8 +44,8 @@
RayPacketData raydata;
RayPacket instance_rays(raydata, rays.getSize(), rays.getDepth(),
rays.getFlags());
- double scales[RayPacket::MaxSize];
- double inv_scales[RayPacket::MaxSize];
+ Real scales[RayPacket::MaxSize];
+ Real inv_scales[RayPacket::MaxSize];
if(rays.getFlags() & RayPacket::ConstantOrigin){
RayPacket::Element& e0 = rays.get(0);
@@ -58,9 +58,9 @@
Vector dir = transform_inv * e.ray.direction();
- double length = dir.length();
+ Real length = dir.length();
inv_scales[i] = length;
- double ilength = 1./length;
+ Real ilength = 1./length;
scales[i] = ilength;
te.ray.set(o, dir*ilength);
te.hitInfo.reset(e.hitInfo.minT()*length);
@@ -73,9 +73,9 @@
Point o = transform_inv * e.ray.origin();
Vector dir = transform_inv * e.ray.direction();
- double length = dir.length();
+ Real length = dir.length();
inv_scales[i] = length;
- double ilength = 1./length;
+ Real ilength = 1./length;
scales[i] = ilength;
te.ray.set(o, dir*ilength);
te.hitInfo.reset(e.hitInfo.minT()*length);
@@ -87,10 +87,10 @@
RayPacket::Element& te = instance_rays.get(i);
if(te.hitInfo.wasHit()){
// Instance was hit
- double s = scales[i];
+ Real s = scales[i];
if(e.hitInfo.hit(te.hitInfo.minT()*s, material, this, tex)){
// Instance is now the closest
- double is = inv_scales[i];
+ Real is = inv_scales[i];
e.hitInfo.scratchpad<MPTscale>() =
MPTscale(te.hitInfo.hitMaterial(),
te.hitInfo.hitPrimitive(),
te.hitInfo.hitTexCoordMapper(),
@@ -102,7 +102,7 @@
void Instance::computeNormal(const RenderContext& context, RayPacket& rays)
const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
@@ -112,10 +112,10 @@
Point o = transform_inv * e.ray.origin();
Vector dir = transform_inv * e.ray.direction();
- double scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(o, dir*scale);
old_minT[i] = e.hitInfo.minT();
- double inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(inv_scale);
}
rays.resetFlag(RayPacket::HaveHitPositions);
@@ -165,7 +165,7 @@
void Instance::computeTexCoords2(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
@@ -176,10 +176,10 @@
Point o = transform_inv * e.ray.origin();
Vector dir = transform_inv * e.ray.direction();
- double scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(o, dir*scale);
old_minT[i] = e.hitInfo.minT();
- double inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(inv_scale);
}
rays.resetFlag(RayPacket::HaveHitPositions);
@@ -207,7 +207,7 @@
void Instance::computeTexCoords3(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
@@ -218,10 +218,10 @@
Point o = transform_inv * e.ray.origin();
Vector dir = transform_inv * e.ray.direction();
- double scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real scale = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(o, dir*scale);
old_minT[i] = e.hitInfo.minT();
- double inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real inv_scale = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(inv_scale);
}
rays.resetFlag(RayPacket::HaveHitPositions);
Modified: branches/float/Model/Instances/InstanceRST.cc
==============================================================================
--- branches/float/Model/Instances/InstanceRST.cc (original)
+++ branches/float/Model/Instances/InstanceRST.cc Sat May 28 23:22:01
2005
@@ -20,11 +20,11 @@
// but this seems easier: pass in the three axes and make sure that the
// transformed lengths are all the same
Vector v1 = transform * Vector(1,0,0);
- double l1 = v1.normalize();
+ Real l1 = v1.normalize();
Vector v2 = transform * Vector(0,1,0);
- double l2 = v2.normalize();
+ Real l2 = v2.normalize();
Vector v3 = transform * Vector(0,0,1);
- double l3 = v3.normalize();
+ Real l3 = v3.normalize();
scale = l1;
inv_scale = 1./l1;
@@ -105,7 +105,7 @@
void InstanceRST::computeNormal(const RenderContext& context, RayPacket&
rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
@@ -169,7 +169,7 @@
void InstanceRST::computeTexCoords2(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
@@ -209,7 +209,7 @@
void InstanceRST::computeTexCoords3(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
// Save the original rays
Modified: branches/float/Model/Instances/InstanceRST.h
==============================================================================
--- branches/float/Model/Instances/InstanceRST.h (original)
+++ branches/float/Model/Instances/InstanceRST.h Sat May 28 23:22:01
2005
@@ -35,17 +35,17 @@
private:
- // Instanced Object & Properties.
+ // Instanced Object & Properties.
Object* instance;
Material* material;
const TexCoordMapper* tex;
- // Transform and its inverse.
- AffineTransform transform;
- AffineTransform transform_inv;
-
- double scale;
- double inv_scale;
+ // Transform and its inverse.
+ AffineTransform transform;
+ AffineTransform transform_inv;
+
+ Real scale;
+ Real inv_scale;
};
}
Modified: branches/float/Model/Instances/InstanceRT.cc
==============================================================================
--- branches/float/Model/Instances/InstanceRT.cc (original)
+++ branches/float/Model/Instances/InstanceRT.cc Sat May 28 23:22:01
2005
@@ -20,11 +20,11 @@
// but this seems easier: pass in the three axes and make sure that the
// transformed lengths are all the same
Vector v1 = transform * Vector(1,0,0);
- double l1 = v1.normalize();
+ Real l1 = v1.normalize();
Vector v2 = transform * Vector(0,1,0);
- double l2 = v2.normalize();
+ Real l2 = v2.normalize();
Vector v3 = transform * Vector(0,0,1);
- double l3 = v3.normalize();
+ Real l3 = v3.normalize();
if(SCIRun::Abs(l1-1) > 1.e-10 || SCIRun::Abs(l2-1) > 1.e-10 ||
SCIRun::Abs(l3-1) > 1.e-10){
ostringstream msg;
Modified: branches/float/Model/Instances/InstanceST.cc
==============================================================================
--- branches/float/Model/Instances/InstanceST.cc (original)
+++ branches/float/Model/Instances/InstanceST.cc Sat May 28 23:22:01
2005
@@ -41,10 +41,10 @@
RayPacketData raydata;
RayPacket instance_rays(raydata, rays.getSize(), rays.getDepth(),
rays.getFlags());
- double scales[RayPacket::MaxSize];
- double inv_scales[RayPacket::MaxSize];
+ Real scales[RayPacket::MaxSize];
+ Real inv_scales[RayPacket::MaxSize];
if(uniform_scale){
- double iscale = inv_scale.x();
+ Real iscale = inv_scale.x();
if(rays.getFlags() & RayPacket::ConstantOrigin){
RayPacket::Element& e = rays.get(0);
Point o( Vector(e.ray.origin()-translation)*iscale );
@@ -70,9 +70,9 @@
RayPacket::Element& e = rays.get(i);
RayPacket::Element& te = instance_rays.get(i);
Vector dir(e.ray.direction()*inv_scale);
- double length = dir.length();
+ Real length = dir.length();
inv_scales[i] = length;
- double ilength = 1./length;
+ Real ilength = 1./length;
scales[i] = ilength;
te.ray.set(o, dir*ilength);
te.hitInfo.reset(e.hitInfo.minT()*length);
@@ -82,9 +82,9 @@
RayPacket::Element& e = rays.get(i);
RayPacket::Element& te = instance_rays.get(i);
Vector dir(e.ray.direction()*inv_scale);
- double length = dir.length();
+ Real length = dir.length();
scales[i] = length;
- double ilength = 1./length;
+ Real ilength = 1./length;
inv_scales[i] = ilength;
te.ray.set(Point((Vector(e.ray.origin())-translation)*inv_scale),
dir*ilength);
@@ -94,7 +94,7 @@
}
instance->intersect(context, instance_rays);
if(uniform_scale){
- double s = scale.x();
+ Real s = scale.x();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
RayPacket::Element& te = instance_rays.get(i);
@@ -114,10 +114,10 @@
RayPacket::Element& te = instance_rays.get(i);
if(te.hitInfo.wasHit()){
// Instance was hit
- double s = scales[i];
+ Real s = scales[i];
if(e.hitInfo.hit(te.hitInfo.minT()*s, material, this, tex)){
// Instance is now the closest
- double is = inv_scales[i];
+ Real is = inv_scales[i];
e.hitInfo.scratchpad<MPTscale>() =
MPTscale(te.hitInfo.hitMaterial(),
te.hitInfo.hitPrimitive(),
te.hitInfo.hitTexCoordMapper(),
@@ -130,12 +130,12 @@
void InstanceST::computeNormal(const RenderContext& context, RayPacket&
rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Point old_origins[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
if(uniform_scale){
// Save the original origins and minT
- double is = inv_scale.x();
+ Real is = inv_scale.x();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
old_origins[i] = e.ray.origin();
@@ -149,11 +149,11 @@
RayPacket::Element& e = rays.get(i);
old_rays[i] = e.ray;
Vector dir(e.ray.direction()*inv_scale);
- double ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(Point((Vector(e.ray.origin())-translation)*inv_scale),
dir*ilength);
old_minT[i] = e.hitInfo.minT();
- double length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(length);
}
}
@@ -211,12 +211,12 @@
void InstanceST::computeTexCoords2(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Point old_origins[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
if(uniform_scale){
// Save the original origins and minT
- double is = inv_scale.x();
+ Real is = inv_scale.x();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
old_origins[i] = e.ray.origin();
@@ -230,11 +230,11 @@
RayPacket::Element& e = rays.get(i);
old_rays[i] = e.ray;
Vector dir(e.ray.direction()*inv_scale);
- double ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(Point((Vector(e.ray.origin())-translation)*inv_scale),
dir*ilength);
old_minT[i] = e.hitInfo.minT();
- double length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(length);
}
}
@@ -270,12 +270,12 @@
void InstanceST::computeTexCoords3(const RenderContext& context,
RayPacket& rays) const
{
- double old_minT[RayPacket::MaxSize];
+ Real old_minT[RayPacket::MaxSize];
Point old_origins[RayPacket::MaxSize];
Ray old_rays[RayPacket::MaxSize];
if(uniform_scale){
// Save the original origins and minT
- double is = inv_scale.x();
+ Real is = inv_scale.x();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
old_origins[i] = e.ray.origin();
@@ -289,11 +289,11 @@
RayPacket::Element& e = rays.get(i);
old_rays[i] = e.ray;
Vector dir(e.ray.direction()*inv_scale);
- double ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
+ Real ilength = rays.get(i).hitInfo.scratchpad<MPTscale>().scale;
e.ray.set(Point((Vector(e.ray.origin())-translation)*inv_scale),
dir*ilength);
old_minT[i] = e.hitInfo.minT();
- double length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
+ Real length = rays.get(i).hitInfo.scratchpad<MPTscale>().inv_scale;
e.hitInfo.scaleT(length);
}
}
Modified: branches/float/Model/Materials/Checker.cc
==============================================================================
--- branches/float/Model/Materials/Checker.cc (original)
+++ branches/float/Model/Materials/Checker.cc Sat May 28 23:22:01 2005
@@ -31,8 +31,8 @@
else
rays.computeTextureCoordinates2(context);
RayPacket::Element& e0 = rays.get(0);
- double vv1 = Dot(e0.texCoords, v1);
- double vv2 = Dot(e0.texCoords, v2);
+ Real vv1 = Dot(e0.texCoords, v1);
+ Real vv2 = Dot(e0.texCoords, v2);
if(vv1<0)
vv1=-vv1+1;
if(vv2<0)
@@ -49,8 +49,8 @@
int which = which0;
while(stop < rays.getSize()){
RayPacket::Element& e = rays.get(stop);
- double vv1 = Dot(e.texCoords, v1);
- double vv2 = Dot(e.texCoords, v2);
+ Real vv1 = Dot(e.texCoords, v1);
+ Real vv2 = Dot(e.texCoords, v2);
if(vv1<0)
vv1=-vv1+1;
if(vv2<0)
Modified: branches/float/Model/Materials/Dielectric.cc
==============================================================================
--- branches/float/Model/Materials/Dielectric.cc (original)
+++ branches/float/Model/Materials/Dielectric.cc Sat May 28 23:22:01
2005
@@ -15,7 +15,7 @@
using namespace Manta;
Dielectric::Dielectric(const Color& diffuse, const Color& specular,
- int specpow, double n, double nt)
+ int specpow, Real n, Real nt)
: diffuse(diffuse), specular(specular), specpow(specpow),
n(n), nt(nt)
{
@@ -53,11 +53,11 @@
for(int j=e.shadowBegin;j<e.shadowEnd;j++){
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalDiffuse += s.light*cos_theta;
Vector H = s.ray.direction()-e.ray.direction();
H.normalize();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0)
totalSpecular += s.light * ipow(cos_alpha, specpow);
}
@@ -73,11 +73,11 @@
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
s.ray.normalizeDirection();
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalDiffuse += s.light*cos_theta;
Vector H = s.ray.direction()-e.ray.direction();
H.normalize();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0)
totalSpecular += s.light * ipow(cos_alpha, specpow);
}
@@ -92,8 +92,8 @@
int maxdepth = 5;
if(rays.getDepth() < maxdepth) {
// Compute refractions
- double *c = new double[rays.getSize()];
- double *tst = new double[rays.getSize()];
+ Real *c = new Real[rays.getSize()];
+ Real *tst = new Real[rays.getSize()];
Color *col = new Color[rays.getSize()];
RayPacketData rfdata;
RayPacket refr_rays(rfdata, rays.getSize(), rays.getDepth()+1,
@@ -108,9 +108,9 @@
tst[i] = 1-((n*n*(1-Dot(d,e.normal)*Dot(d,e.normal)))/(nt*nt));
Vector refr_dir = ((n*(d-norm*Dot(d,norm)))/nt)-(norm*tst[i]);
RayPacket::Element& r = refr_rays.get(i);
- double x = refr_dir.x()*0.00001-e.hitPosition.x();
- double y = refr_dir.y()*0.00001-e.hitPosition.y();
- double z = refr_dir.z()*0.00001-e.hitPosition.z();
+ Real x = refr_dir.x()*0.00001-e.hitPosition.x();
+ Real y = refr_dir.y()*0.00001-e.hitPosition.y();
+ Real z = refr_dir.z()*0.00001-e.hitPosition.z();
r.ray.set(Point(x,y,z), refr_dir);
if(Dot(d,norm) < 0) {
@@ -119,7 +119,7 @@
}
else {
c[i] = Dot(refr_dir, e.normal);
- double tmpt = e.hitInfo.minT();
+ Real tmpt = e.hitInfo.minT();
col[i] = e.color->attenuate(-tmpt);
}
}
@@ -129,16 +129,16 @@
RayPacket refl_rays(rdata, rays.getSize(), rays.getDepth()+1,
RayPacket::NormalizedDirections);
refl_rays.useLocalColors();
- double *refl = new double[rays.getSize()];
+ Real *refl = new Real[rays.getSize()];
for(int i=0;i<rays.getSize();i++) {
- double R0 = ((n-1)*(n-1))/((n+1)*(n+1));
+ Real R0 = ((n-1)*(n-1))/((n+1)*(n+1));
refl[i] = R0 + ((1-R0)*(1-c[i])*(1-c[i])*(1-c[i])*(1-c[i])*(1-c[i]));
RayPacket::Element& e = rays.get(i);
Vector refl_dir = e.ray.direction() - e.normal*(2*Dot(e.normal,
e.ray.direction()));
RayPacket::Element& r = refl_rays.get(i);
- double x = refl_dir.x()*0.00001+e.hitPosition.x();
- double y = refl_dir.y()*0.00001+e.hitPosition.y();
- double z = refl_dir.z()*0.00001+e.hitPosition.z();
+ Real x = refl_dir.x()*0.00001+e.hitPosition.x();
+ Real y = refl_dir.y()*0.00001+e.hitPosition.y();
+ Real z = refl_dir.z()*0.00001+e.hitPosition.z();
r.ray.set(Point(x,y,z), refl_dir);
}
Modified: branches/float/Model/Materials/Dielectric.h
==============================================================================
--- branches/float/Model/Materials/Dielectric.h (original)
+++ branches/float/Model/Materials/Dielectric.h Sat May 28 23:22:01 2005
@@ -11,7 +11,7 @@
class Dielectric : public LitMaterial {
public:
Dielectric(const Color& diffuse, const Color& specular, int specpow,
- double n, double nt);
+ Real n, Real nt);
virtual ~Dielectric();
virtual void shade(const RenderContext& context, RayPacket& rays) const;
@@ -19,7 +19,7 @@
Color diffuse;
Color specular;
int specpow;
- double n, nt;
+ Real n, nt;
};
}
Modified: branches/float/Model/Materials/Lambertian.cc
==============================================================================
--- branches/float/Model/Materials/Lambertian.cc (original)
+++ branches/float/Model/Materials/Lambertian.cc Sat May 28 23:22:01
2005
@@ -53,7 +53,7 @@
for(int j=e.shadowBegin;j<e.shadowEnd;j++){
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalLight += s.light*cos_theta;
}
}
@@ -67,7 +67,7 @@
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
s.ray.normalizeDirection();
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalLight += s.light*cos_theta;
}
}
Modified: branches/float/Model/Materials/MetalMaterial.cc
==============================================================================
--- branches/float/Model/Materials/MetalMaterial.cc (original)
+++ branches/float/Model/Materials/MetalMaterial.cc Sat May 28 23:22:01
2005
@@ -61,7 +61,7 @@
if(!s.hitInfo.wasHit()){
Vector H = s.ray.direction()-e.ray.direction();
H.normalize();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0)
totalSpecular += s.light*ipow(cos_alpha, phong_exponent);
}
@@ -78,7 +78,7 @@
s.ray.normalizeDirection();
Vector H = s.ray.direction()-e.ray.direction();
H.normalize();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0)
totalSpecular += s.light*ipow(cos_alpha, phong_exponent);
}
@@ -108,7 +108,7 @@
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
RayPacket::Element& r = refl_rays.get(i);
- double cosine = -Dot(e.normal, e.ray.direction());
+ Real cosine = -Dot(e.normal, e.ray.direction());
if(cosine < 0)
cosine =-cosine;
Modified: branches/float/Model/Materials/Phong.cc
==============================================================================
--- branches/float/Model/Materials/Phong.cc (original)
+++ branches/float/Model/Materials/Phong.cc Sat May 28 23:22:01 2005
@@ -15,23 +15,23 @@
using namespace Manta;
Phong::Phong(const Color& diffuse, const Color& specular, int specpow,
- double refl)
+ Real refl)
: specpow(specpow)
{
diffusetex = new Constant<Color>(diffuse);
speculartex = new Constant<Color>(specular);
- refltex = new Constant<double>(refl);
+ refltex = new Constant<Real>(refl);
do_refl = (refl != 0);
}
Phong::Phong(const Texture<Color>* diffusetex,
const Texture<Color>* speculartex,
- int specpow, const Texture<double>* refltex)
+ int specpow, const Texture<Real>* refltex)
: diffusetex(diffusetex), speculartex(speculartex), refltex(refltex),
specpow(specpow)
{
do_refl=true;
- const Constant<double>* rtest = dynamic_cast<const
Constant<double>*>(refltex);
+ const Constant<Real>* rtest = dynamic_cast<const Constant<Real>*>(refltex);
if(rtest && rtest->getValue() == 0)
do_refl =false;
}
@@ -52,7 +52,7 @@
diffusetex->mapValues(context, rays, diffuse);
Color specular[RayPacket::MaxSize];
speculartex->mapValues(context, rays, specular);
- double refl[RayPacket::MaxSize];
+ Real refl[RayPacket::MaxSize];
refltex->mapValues(context, rays, refl);
// Compute normals
@@ -76,12 +76,12 @@
for(int j=e.shadowBegin;j<e.shadowEnd;j++){
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalDiffuse += s.light*cos_theta;
Vector H = s.ray.direction()-e.ray.direction();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0){
- double length = H.length();
+ Real length = H.length();
totalSpecular += s.light * ipow(cos_alpha/length, specpow);
}
}
@@ -97,12 +97,12 @@
RayPacket::Element& s = shadowRays.get(j);
if(!s.hitInfo.wasHit()){
s.ray.normalizeDirection();
- double cos_theta = Dot(s.ray.direction(), e.normal);
+ Real cos_theta = Dot(s.ray.direction(), e.normal);
totalDiffuse += s.light*cos_theta;
Vector H = s.ray.direction()-e.ray.direction();
- double cos_alpha = Dot(H, e.normal);
+ Real cos_alpha = Dot(H, e.normal);
if(cos_alpha > 0){
- double length = H.length();
+ Real length = H.length();
totalSpecular += s.light * ipow(cos_alpha/length, specpow);
}
}
Modified: branches/float/Model/Materials/Phong.h
==============================================================================
--- branches/float/Model/Materials/Phong.h (original)
+++ branches/float/Model/Materials/Phong.h Sat May 28 23:22:01 2005
@@ -12,16 +12,16 @@
class Phong : public LitMaterial {
public:
Phong(const Color& diffuse, const Color& specular, int specpow,
- double refl);
+ Real refl);
Phong(const Texture<Color>* diffuse, const Texture<Color>* specular,
- int specpow, const Texture<double>* refl);
+ int specpow, const Texture<Real>* refl);
virtual ~Phong();
virtual void shade(const RenderContext& context, RayPacket& rays) const;
private:
const Texture<Color>* diffusetex;
const Texture<Color>* speculartex;
- const Texture<double>* refltex;
+ const Texture<Real>* refltex;
int specpow;
bool do_refl;
};
Modified: branches/float/Model/Primitives/Cone.cc
==============================================================================
--- branches/float/Model/Primitives/Cone.cc (original)
+++ branches/float/Model/Primitives/Cone.cc Sat May 28 23:22:01 2005
@@ -8,7 +8,7 @@
using namespace Manta;
using namespace std;
-Cone::Cone(Material* mat, const Point& bottom, const Point& top, double Rb,
double Rt)
+Cone::Cone(Material* mat, const Point& bottom, const Point& top, Real Rb,
Real Rt)
: PrimitiveCommon(mat, this), bottom(bottom), top(top), Rb(Rb), Rt(Rt)
{
}
@@ -30,48 +30,48 @@
if(rays.getFlags() & RayPacket::ConstantOrigin) {
RayPacket::Element& e0 = rays.get(0);
Point Pa = bottom + Rb * (top - bottom) / (Rb-Rt);
- double btx = (top.x()-bottom.x())*(top.x()-bottom.x());
- double bty = (top.y()-bottom.y())*(top.y()-bottom.y());
- double btz = (top.z()-bottom.z())*(top.z()-bottom.z());
- double lbt = sqrt(btx+bty+btz);
- double RbRt = Rb-Rt;
- double hyp = sqrt(lbt*lbt + RbRt*RbRt);
+ Real btx = (top.x()-bottom.x())*(top.x()-bottom.x());
+ Real bty = (top.y()-bottom.y())*(top.y()-bottom.y());
+ Real btz = (top.z()-bottom.z())*(top.z()-bottom.z());
+ Real lbt = sqrt(btx+bty+btz);
+ Real RbRt = Rb-Rt;
+ Real hyp = sqrt(lbt*lbt + RbRt*RbRt);
Vector Va = (top-bottom) / lbt;
- // double tgAlpha = (Rb-Rt) / lbt;
- double cosA = RbRt/hyp;
- double sinA = lbt/hyp;
- double cosA2 = cosA*cosA;
- double sinA2 = sinA*sinA;
+ // Real tgAlpha = (Rb-Rt) / lbt;
+ Real cosA = RbRt/hyp;
+ Real sinA = lbt/hyp;
+ Real cosA2 = cosA*cosA;
+ Real sinA2 = sinA*sinA;
Point P(xform * e0.ray.origin());
Vector dP(P - Pa);
for(int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e = rays.get(i);
Vector V(xform * e.ray.direction());
Vector tv = V;
- double dist_scale = tv.normalize();
- double a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
+ Real dist_scale = tv.normalize();
+ Real a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
(sinA2*Dot(V,Va)*Dot(V,Va));
- double b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
+ Real b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
2*sinA2*Dot(V,Va)*Dot(dP,Va);
- double c = cosA2*Dot(dP-Dot(dP,Va)*Va,
+ Real c = cosA2*Dot(dP-Dot(dP,Va)*Va,
dP-Dot(dP,Va)*Va)-
sinA2*Dot(dP,Va)*Dot(dP,Va);
- double d = sqrt(b*b-4*a*c);
+ Real d = sqrt(b*b-4*a*c);
if(d > 0.0) {
- double t1 = (-b+d)/(2*a);
- double t2 = (-b-d)/(2*a);
+ Real t1 = (-b+d)/(2*a);
+ Real t2 = (-b-d)/(2*a);
if(t1 < t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
- double z1 = P.z()+t1*V.z();
- double z2 = P.z()+t2*V.z();
+ Real z1 = P.z()+t1*V.z();
+ Real z2 = P.z()+t2*V.z();
if(t1>0 && z1 > 0.0 && z1 < 1.0) {
e.hitInfo.hit(t1/dist_scale, material, this, tex);
}
@@ -83,47 +83,47 @@
}
else {
Point Pa = bottom + Rb * (top - bottom) / (Rb-Rt);
- double btx = (top.x()-bottom.x())*(top.x()-bottom.x());
- double bty = (top.y()-bottom.y())*(top.y()-bottom.y());
- double btz = (top.z()-bottom.z())*(top.z()-bottom.z());
- double lbt = sqrt(btx+bty+btz);
- double RbRt = Rb-Rt;
- double hyp = sqrt(lbt*lbt + RbRt*RbRt);
+ Real btx = (top.x()-bottom.x())*(top.x()-bottom.x());
+ Real bty = (top.y()-bottom.y())*(top.y()-bottom.y());
+ Real btz = (top.z()-bottom.z())*(top.z()-bottom.z());
+ Real lbt = sqrt(btx+bty+btz);
+ Real RbRt = Rb-Rt;
+ Real hyp = sqrt(lbt*lbt + RbRt*RbRt);
Vector Va = (top-bottom) / lbt;
- // double tgAlpha = (Rb-Rt) / lbt;
- double cosA = RbRt/hyp;
- double sinA = lbt/hyp;
- double cosA2 = cosA*cosA;
- double sinA2 = sinA*sinA;
+ // Real tgAlpha = (Rb-Rt) / lbt;
+ Real cosA = RbRt/hyp;
+ Real sinA = lbt/hyp;
+ Real cosA2 = cosA*cosA;
+ Real sinA2 = sinA*sinA;
for(int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e = rays.get(i);
Point P(xform * e.ray.origin());
Vector dP(P - Pa);
Vector V(xform * e.ray.direction());
Vector tv = V;
- double dist_scale = tv.normalize();
- double a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
+ Real dist_scale = tv.normalize();
+ Real a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
(sinA2*Dot(V,Va)*Dot(V,Va));
- double b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
+ Real b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
2*sinA2*Dot(V,Va)*Dot(dP,Va);
- double c = cosA2*Dot(dP-Dot(dP,Va)*Va, dP-Dot(dP,Va)*Va)-
+ Real c = cosA2*Dot(dP-Dot(dP,Va)*Va, dP-Dot(dP,Va)*Va)-
sinA2*Dot(dP,Va)*Dot(dP,Va);
- double d = sqrt(b*b-4*a*c);
+ Real d = sqrt(b*b-4*a*c);
if(d > 0.0) {
- double t1 = (-b+d)/(2*a);
- double t2 = (-b-d)/(2*a);
+ Real t1 = (-b+d)/(2*a);
+ Real t2 = (-b-d)/(2*a);
if(t1 < t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
- double z1 = P.z()+t1*V.z();
- double z2 = P.z()+t2*V.z();
+ Real z1 = P.z()+t1*V.z();
+ Real z2 = P.z()+t2*V.z();
if(t1>0 && z1 > 0.0 && z1 < 1.0) {
e.hitInfo.hit(t1/dist_scale, material, this, tex);
}
Modified: branches/float/Model/Primitives/Cone.h
==============================================================================
--- branches/float/Model/Primitives/Cone.h (original)
+++ branches/float/Model/Primitives/Cone.h Sat May 28 23:22:01 2005
@@ -12,7 +12,7 @@
class Cone : public PrimitiveCommon, public TexCoordMapper {
public:
- Cone(Material* mat, const Point& bottom, const Point& top, double Rb,
double Rt);
+ Cone(Material* mat, const Point& bottom, const Point& top, Real Rb, Real
Rt);
virtual ~Cone();
virtual void computeBounds(const PreprocessContext& context,
@@ -26,7 +26,7 @@
private:
Point bottom, top;
- double Rb, Rt;
+ Real Rb, Rt;
AffineTransform xform, ixform;
};
}
Modified: branches/float/Model/Primitives/Cube.cc
==============================================================================
--- branches/float/Model/Primitives/Cube.cc (original)
+++ branches/float/Model/Primitives/Cube.cc Sat May 28 23:22:01 2005
@@ -8,7 +8,7 @@
using namespace std;
using SCIRun::Abs;
-Cube::Cube(Material* mat, const Point& anch, double w, double h, double d)
+Cube::Cube(Material* mat, const Point& anch, Real w, Real h, Real d)
: PrimitiveCommon(mat), anchor(anch), w(w), h(h), d(d)
{
xmin = anchor.x(); xmax = xmin + w;
@@ -33,16 +33,16 @@
rays.computeInverseDirections();
if(rays.getFlags() & RayPacket::ConstantOrigin && rays.getSize()>1) {
RayPacket::Element& e0 = rays.get(0);
- double xo = e0.ray.origin().x();
- double yo = e0.ray.origin().y();
- double zo = e0.ray.origin().z();
+ Real xo = e0.ray.origin().x();
+ Real yo = e0.ray.origin().y();
+ Real zo = e0.ray.origin().z();
for(int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e = rays.get(i);
- double tnear, tfar, t1, t2;
+ Real tnear, tfar, t1, t2;
t1 = (xmin - xo) * e.inverseDirection.x();
t2 = (xmax - xo) * e.inverseDirection.x();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -52,7 +52,7 @@
t1 = (ymin - yo) * e.inverseDirection.y();
t2 = (ymax - yo) * e.inverseDirection.y();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -62,7 +62,7 @@
t1 = (zmin - zo) * e.inverseDirection.z();
t2 = (zmax - zo) * e.inverseDirection.z();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -76,14 +76,14 @@
else {
for(int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e = rays.get(i);
- double xo = e.ray.origin().x();
- double yo = e.ray.origin().y();
- double zo = e.ray.origin().z();
- double tnear, tfar, t1, t2;
+ Real xo = e.ray.origin().x();
+ Real yo = e.ray.origin().y();
+ Real zo = e.ray.origin().z();
+ Real tnear, tfar, t1, t2;
t1 = (xmin - xo) * e.inverseDirection.x();
t2 = (xmax - xo) * e.inverseDirection.x();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -93,7 +93,7 @@
t1 = (ymin - yo) * e.inverseDirection.y();
t2 = (ymax - yo) * e.inverseDirection.y();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -103,7 +103,7 @@
t1 = (zmin - zo) * e.inverseDirection.z();
t2 = (zmax - zo) * e.inverseDirection.z();
if(t1>t2) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
Modified: branches/float/Model/Primitives/Cube.h
==============================================================================
--- branches/float/Model/Primitives/Cube.h (original)
+++ branches/float/Model/Primitives/Cube.h Sat May 28 23:22:01 2005
@@ -10,7 +10,7 @@
class Cube : public PrimitiveCommon {
public:
- Cube(Material* mat, const Point& anch, double w, double h, double d);
+ Cube(Material* mat, const Point& anch, Real w, Real h, Real d);
~Cube();
virtual void computeBounds(const PreprocessContext& context,
@@ -20,10 +20,10 @@
private:
Point anchor;
- double w,h,d;
- double xmin, xmax;
- double ymin, ymax;
- double zmin, zmax;
+ Real w,h,d;
+ Real xmin, xmax;
+ Real ymin, ymax;
+ Real zmin, zmax;
};
}
Modified: branches/float/Model/Primitives/Cylinder.cc
==============================================================================
--- branches/float/Model/Primitives/Cylinder.cc (original)
+++ branches/float/Model/Primitives/Cylinder.cc Sat May 28 23:22:01 2005
@@ -6,7 +6,7 @@
using namespace std;
Cylinder::Cylinder(Material* mat, const Point& bottom, const Point& top,
- double radius)
+ Real radius)
: PrimitiveCommon(mat, this), bottom(bottom), top(top), radius(radius)
{
}
@@ -28,33 +28,33 @@
for(int i=0; i<rays.getSize(); i++) {
RayPacket::Element& e = rays.get(i);
Vector v(xform.project(e.ray.direction()));
- double dist_scale=v.normalize();
+ Real dist_scale=v.normalize();
Ray xray(xform.project(e.ray.origin()), v);
- double dx=xray.direction().x();
- double dy=xray.direction().y();
- double a=dx*dx+dy*dy;
+ Real dx=xray.direction().x();
+ Real dy=xray.direction().y();
+ Real a=dx*dx+dy*dy;
if(a >= 1.e-6) {
// Check sides...
- double ox=xray.origin().x();
- double oy=xray.origin().y();
- double oz=xray.origin().z();
- double dz=xray.direction().z();
+ Real ox=xray.origin().x();
+ Real oy=xray.origin().y();
+ Real oz=xray.origin().z();
+ Real dz=xray.direction().z();
- double b=2*(ox*dx+oy*dy);
- double c=ox*ox+oy*oy-1;
- double d=b*b-4*a*c;
+ Real b=2*(ox*dx+oy*dy);
+ Real c=ox*ox+oy*oy-1;
+ Real d=b*b-4*a*c;
if(d>0.0) {
- double sd=sqrt(d);
- double t1=(-b+sd)/(2*a);
- double t2=(-b-sd)/(2*a);
+ Real sd=sqrt(d);
+ Real t1=(-b+sd)/(2*a);
+ Real t2=(-b-sd)/(2*a);
if(t1>t2){
- double tmp=t1;
+ Real tmp=t1;
t1=t2;
t2=tmp;
}
- double z1=oz+t1*dz;
- double z2=oz+t2*dz;
+ Real z1=oz+t1*dz;
+ Real z2=oz+t2*dz;
if(t1 > 1.e-6 && z1 > 0.0 && z1 < 1.0){
e.hitInfo.hit(t1/dist_scale, material, this, tex);
} else if(t2 > 1.e-6 && z2 > 0.0 && z2 < 1.0){
Modified: branches/float/Model/Primitives/Cylinder.h
==============================================================================
--- branches/float/Model/Primitives/Cylinder.h (original)
+++ branches/float/Model/Primitives/Cylinder.h Sat May 28 23:22:01 2005
@@ -13,7 +13,7 @@
class Cylinder : public PrimitiveCommon, public TexCoordMapper {
public:
Cylinder(Material* mat, const Point& bottom, const Point& top,
- double radius);
+ Real radius);
virtual ~Cylinder();
virtual void computeBounds(const PreprocessContext& context,
@@ -23,7 +23,7 @@
private:
Point bottom, top;
- double radius;
+ Real radius;
AffineTransform xform;
AffineTransform ixform;
};
Modified: branches/float/Model/Primitives/Disk.cc
==============================================================================
--- branches/float/Model/Primitives/Disk.cc (original)
+++ branches/float/Model/Primitives/Disk.cc Sat May 28 23:22:01 2005
@@ -5,13 +5,13 @@
using namespace Manta;
using namespace std;
-Disk::Disk(Material* mat, const Point& center, const Vector& n, double
radius, const Vector& axis) : PrimitiveCommon(mat, this), _c(center), _n(n),
_r(radius), _partial(false), _minTheta(0.0), _maxTheta(2.0 * M_PI) {
+Disk::Disk(Material* mat, const Point& center, const Vector& n, Real radius,
const Vector& axis) : PrimitiveCommon(mat, this), _c(center), _n(n),
_r(radius), _partial(false), _minTheta(0.0), _maxTheta(2.0 * M_PI) {
_n.normalize();
_d = -Dot(_n, _c);
setupAxes(axis);
}
-Disk::Disk(Material* mat, const Point& center, const Vector& n, double
radius, const Vector& axis, double minTheta, double maxTheta) :
PrimitiveCommon(mat, this), _c(center), _n(n), _r(radius), _partial(true),
_minTheta(minTheta), _maxTheta(maxTheta) {
+Disk::Disk(Material* mat, const Point& center, const Vector& n, Real radius,
const Vector& axis, Real minTheta, Real maxTheta) : PrimitiveCommon(mat,
this), _c(center), _n(n), _r(radius), _partial(true), _minTheta(minTheta),
_maxTheta(maxTheta) {
_n.normalize();
_d = -Dot(_n, _c);
setupAxes(axis);
@@ -26,14 +26,14 @@
void Disk::intersect(const RenderContext& context, RayPacket& rays) const {
int i, numRays(rays.getSize());
- const static double EPSILON(1.0e-6);
+ const static Real EPSILON(1.0e-6);
Point rayO;
Vector rayD;
- double denom, t;
+ Real denom, t;
if (rays.getFlags() & RayPacket::ConstantOrigin) {
rayO = rays.get(0).ray.origin();
- double nDotO(Dot(_n, rayO));
+ Real nDotO(Dot(_n, rayO));
for (i = 0; i < numRays; i++) {
RayPacket::Element& e(rays.get(i));
@@ -124,13 +124,13 @@
**/
bool Disk::checkBounds(const Point& p) const {
Vector dir(p - _c);
- double dist(dir.normalize());
+ Real dist(dir.normalize());
if (dist > _r)
return false;
if (_partial) {
- double theta(atan2(Dot(_v, dir), Dot(_u, dir)));
+ Real theta(atan2(Dot(_v, dir), Dot(_u, dir)));
if (theta < 0.0)
theta = 2.0 * M_PI + theta;
@@ -151,7 +151,7 @@
* given vector.
**/
void Disk::setupAxes(const Vector& axis) {
- const static double EPSILON(1.0e-6);
+ const static Real EPSILON(1.0e-6);
_u = axis;
_u.normalize();
@@ -176,7 +176,7 @@
**/
void Disk::getTexCoords(Point& p) const {
Vector dir(p - _c);
- double dist(dir.normalize()), theta;
+ Real dist(dir.normalize()), theta;
theta = atan2(Dot(_v, dir), Dot(_u, dir));
if (theta < 0.0)
Modified: branches/float/Model/Primitives/Disk.h
==============================================================================
--- branches/float/Model/Primitives/Disk.h (original)
+++ branches/float/Model/Primitives/Disk.h Sat May 28 23:22:01 2005
@@ -9,8 +9,8 @@
namespace Manta {
class Disk : public PrimitiveCommon, public TexCoordMapper {
public:
- Disk(Material* mat, const Point& center, const Vector& n, double radius,
const Vector& axis);
- Disk(Material* mat, const Point& center, const Vector& n, double radius,
const Vector& axis, double minTheta, double maxTheta);
+ Disk(Material* mat, const Point& center, const Vector& n, Real radius,
const Vector& axis);
+ Disk(Material* mat, const Point& center, const Vector& n, Real radius,
const Vector& axis, Real minTheta, Real maxTheta);
virtual ~Disk();
virtual void computeBounds(const PreprocessContext& context, BBox& bbox)
const;
@@ -24,7 +24,7 @@
bool _partial;
Point _c;
Vector _n, _u, _v;
- double _d, _r, _minTheta, _maxTheta;
+ Real _d, _r, _minTheta, _maxTheta;
bool checkBounds(const Point& p) const;
void setupAxes(const Vector& axis);
Modified: branches/float/Model/Primitives/HeavyTriangle.cc
==============================================================================
--- branches/float/Model/Primitives/HeavyTriangle.cc (original)
+++ branches/float/Model/Primitives/HeavyTriangle.cc Sat May 28 23:22:01
2005
@@ -30,16 +30,16 @@
const Vector& dir(e.ray.direction());
Vector o(p1 - e.ray.origin());
- double det=Dot(n,dir);
+ Real det=Dot(n,dir);
if(det>1.e-9 || det < -1.e-9) {
- double idet = 1./det;
+ Real idet = 1./det;
Vector DX(Cross(dir, o));
- double A=-Dot(DX, e2)*idet;
+ Real A=-Dot(DX, e2)*idet;
if(A>0.0 && A<1.0) {
- double B=Dot(DX, e1)*idet;
+ Real B=Dot(DX, e1)*idet;
if(B>0.0 && A+B<1.0) {
- double t=Dot(n, o)*idet;
+ Real t=Dot(n, o)*idet;
if (e.hitInfo.hit(t, material, this, tex)){
TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
th.a = A;
Modified: branches/float/Model/Primitives/Heightfield.cc
==============================================================================
--- branches/float/Model/Primitives/Heightfield.cc (original)
+++ branches/float/Model/Primitives/Heightfield.cc Sat May 28 23:22:01
2005
@@ -41,7 +41,7 @@
//
--------------------------------------------------------------------------------------
// --- Constructor
//
--------------------------------------------------------------------------------------
-Heightfield::Heightfield(Material * material, char * fileName, const Point &
minBound, const Point & maxBound, double scale)
+Heightfield::Heightfield(Material * material, char * fileName, const Point &
minBound, const Point & maxBound, Real scale)
: PrimitiveCommon(material), m_Box(minBound, maxBound)
{
readHeightfieldFile(fileName, &m_Nx, &m_Ny, &m_Data);
@@ -76,8 +76,8 @@
Vector diagonal;
Point hitPoint;
int hitLattice[2], stop[2], di[2], ind;
- double tnext[2], dtd[2], far[2], zm[2], datam[2], cellSize[2];
- double tnear, tfar, zenter, texit, zexit;
+ Real tnext[2], dtd[2], far[2], zm[2], datam[2], cellSize[2];
+ Real tnear, tfar, zenter, texit, zexit;
bool validtcells[2];
if (!(rays.getFlags() & RayPacket::NormalizedDirections))
@@ -111,8 +111,8 @@
tnear = 0.0;
diagonal = m_Box.diagonal();
- cellSize[0] = diagonal.x() / (double)m_Nx;
- cellSize[1] = diagonal.y() / (double)m_Ny;
+ cellSize[0] = diagonal.x() / (Real)m_Nx;
+ cellSize[1] = diagonal.y() / (Real)m_Ny;
hitPoint = ray.origin() + (ray.direction() * tnear);
hitLattice[0] = (int)((hitPoint.x() - m_Box.getMin().x()) / cellSize[0]);
@@ -131,10 +131,10 @@
dtd[0] = fabs(cellSize[0] / ray.direction().x());
dtd[1] = fabs(cellSize[1] / ray.direction().y());
- if (di[0] == 1) far[0] = m_Box.getMin().x() + cellSize[0] *
(double)(hitLattice[0] + 1);
- else far[0] = m_Box.getMin().x() + cellSize[0] *
(double)(hitLattice[0] );
- if (di[1] == 1) far[1] = m_Box.getMin().y() + cellSize[1] *
(double)(hitLattice[1] + 1);
- else far[1] = m_Box.getMin().y() + cellSize[1] *
(double)(hitLattice[1] );
+ if (di[0] == 1) far[0] = m_Box.getMin().x() + cellSize[0] *
(Real)(hitLattice[0] + 1);
+ else far[0] = m_Box.getMin().x() + cellSize[0] *
(Real)(hitLattice[0] );
+ if (di[1] == 1) far[1] = m_Box.getMin().y() + cellSize[1] *
(Real)(hitLattice[1] + 1);
+ else far[1] = m_Box.getMin().y() + cellSize[1] *
(Real)(hitLattice[1] );
tnext[0] = (far[0] - ray.origin().x()) / ray.direction().x();
tnext[1] = (far[1] - ray.origin().y()) / ray.direction().y();
@@ -154,14 +154,14 @@
if (!(zm[0] > datam[1] || zm[1] < datam[0]))
{
- double a, b, c;
- double sx, dx, sy, dy;
+ Real a, b, c;
+ Real sx, dx, sy, dy;
Point pe;
- double ce[2], z[4];
+ Real ce[2], z[4];
pe = ray.origin() + ray.direction() * tnear;
- ce[0] = pe.x() - (m_Box.getMin().x() + cellSize[0] *
(double)(hitLattice[0]));
- ce[1] = pe.y() - (m_Box.getMin().y() + cellSize[1] *
(double)(hitLattice[1]));
+ ce[0] = pe.x() - (m_Box.getMin().x() + cellSize[0] *
(Real)(hitLattice[0]));
+ ce[1] = pe.y() - (m_Box.getMin().y() + cellSize[1] *
(Real)(hitLattice[1]));
sx = ce[0] / cellSize[0];
sy = ce[1] / cellSize[1];
@@ -179,7 +179,7 @@
if (a == 0.0)
{
- double tcell, u, v;
+ Real tcell, u, v;
tcell = -c / b;
u = sx + tcell * dx;
@@ -194,10 +194,10 @@
}
else
{
- double delta = b*b - 4.0*a*c;
+ Real delta = b*b - 4.0*a*c;
if (delta >= 0.0)
{
- double tcells[2], a2, u, v, tcell;
+ Real tcells[2], a2, u, v, tcell;
delta = sqrt(delta);
a2 = 2.0 * a;
@@ -263,13 +263,13 @@
// --- Rescale the height of the data to fit the Box
// --- according to the given percentage of the size of the box to which the
data should be rescaled
//
--------------------------------------------------------------------------------------
-void Heightfield::rescaleDataHeight(double scale)
+void Heightfield::rescaleDataHeight(Real scale)
{
using SCIRun::Min;
using SCIRun::Max;
unsigned int i, j;
- double min, max, factor, margin;
+ Real min, max, factor, margin;
min = m_Data[0][0];
max = min;
@@ -293,9 +293,9 @@
//
--------------------------------------------------------------------------------------
// --- Read the given file and returns nx, ny and the data
//
--------------------------------------------------------------------------------------
-void Heightfield::readHeightfieldFile(char * fileName, unsigned int * pnx,
unsigned int * pny, double *** pdata)
+void Heightfield::readHeightfieldFile(char * fileName, unsigned int * pnx,
unsigned int * pny, Real *** pdata)
{
- double minz, maxz;
+ Real minz, maxz;
int nx, ny, i, j;
float ** data;
@@ -324,10 +324,10 @@
*pnx = nx;
*pny = ny;
- ALLOCATE2DARRAY(*pdata, nx+1, ny+1, double);
+ ALLOCATE2DARRAY(*pdata, nx+1, ny+1, Real);
for(i=0; i<=nx; i++)
for(j=0; j<=ny; j++)
- (*pdata)[i][j] = (double)data[i][j];
+ (*pdata)[i][j] = (Real)data[i][j];
// DELETE2DARRAY(data, nx+1);
}
Modified: branches/float/Model/Primitives/Heightfield.h
==============================================================================
--- branches/float/Model/Primitives/Heightfield.h (original)
+++ branches/float/Model/Primitives/Heightfield.h Sat May 28 23:22:01
2005
@@ -14,21 +14,21 @@
public:
- Heightfield(Material * material, char * fileName, const
Point & minBound, const Point & maxBound, double scale = 0.95);
+ Heightfield(Material * material, char * fileName, const Point &
minBound, const Point & maxBound, float scale = 0.95);
virtual ~Heightfield();
virtual void computeBounds(const PreprocessContext & context, BBox &
bbox) const;
virtual void intersect(const RenderContext & context, RayPacket &
rays) const;
virtual void computeNormal(const RenderContext & context, RayPacket &
rays) const;
- virtual void rescaleDataHeight(double scale);
- virtual void readHeightfieldFile(char * fileName, unsigned int * pnx,
unsigned int * pny, double *** pdata);
+ virtual void rescaleDataHeight(float scale);
+ virtual void readHeightfieldFile(char * fileName, unsigned int * pnx,
unsigned int * pny, float *** pdata);
private:
BBox m_Box;
unsigned int m_Nx;
unsigned int m_Ny;
- double ** m_Data;
+ float ** m_Data;
};
}
Modified: branches/float/Model/Primitives/Hemisphere.cc
==============================================================================
--- branches/float/Model/Primitives/Hemisphere.cc (original)
+++ branches/float/Model/Primitives/Hemisphere.cc Sat May 28 23:22:01
2005
@@ -9,7 +9,7 @@
using namespace Manta;
using namespace std;
-Hemisphere::Hemisphere(Material* material, const Point& center, double
radius, const Vector& normal)
+Hemisphere::Hemisphere(Material* material, const Point& center, Real radius,
const Vector& normal)
: PrimitiveCommon(material, this), _c(center), _r(radius), _n(normal) {
setupAxes();
}
@@ -24,7 +24,7 @@
void Hemisphere::intersect(const RenderContext&, RayPacket& rays) const {
int i, numRays(rays.getSize()),
rpFlags(rays.getFlags() & (RayPacket::ConstantOrigin |
RayPacket::NormalizedDirections));
- double a, b, c, disc, r, t;
+ Real a, b, c, disc, r, t;
Point rayO;
Vector rayD, tRayO;
@@ -157,7 +157,7 @@
void Hemisphere::computeTexCoords2(const RenderContext& context, RayPacket&
rays) const {
int i, numRays(rays.getSize());
Vector n;
- double theta, phi;
+ Real theta, phi;
if (!(rays.getFlags() & RayPacket::HaveUnitNormals))
computeNormal(context, rays);
@@ -199,7 +199,7 @@
}
void Hemisphere::setupAxes() {
- const static double EPSILON(1.0e-6);
+ const static Real EPSILON(1.0e-6);
_u = Vector(1.0, 0.0, 0.0);
_v = Cross(_n, _u);
Modified: branches/float/Model/Primitives/Hemisphere.h
==============================================================================
--- branches/float/Model/Primitives/Hemisphere.h (original)
+++ branches/float/Model/Primitives/Hemisphere.h Sat May 28 23:22:01
2005
@@ -8,7 +8,7 @@
namespace Manta {
class Hemisphere : public PrimitiveCommon, public TexCoordMapper {
public:
- Hemisphere(Material* material, const Point& center, double radius, const
Vector& normal);
+ Hemisphere(Material* material, const Point& center, Real radius, const
Vector& normal);
virtual ~Hemisphere();
virtual void computeBounds(const PreprocessContext& context, BBox& bbox)
const;
@@ -20,7 +20,7 @@
private:
Point _c;
- double _r;
+ Real _r;
Vector _n, _u, _v;
bool checkBounds(const Point& p) const;
Modified: branches/float/Model/Primitives/Parallelogram.cc
==============================================================================
--- branches/float/Model/Primitives/Parallelogram.cc (original)
+++ branches/float/Model/Primitives/Parallelogram.cc Sat May 28 23:22:01
2005
@@ -44,23 +44,23 @@
{
if(rays.getFlags() & RayPacket::ConstantOrigin && rays.getSize()>1){
RayPacket::Element& e0 = rays.get(0);
- double num = d-Dot(normal, e0.ray.origin());
+ Real num = d-Dot(normal, e0.ray.origin());
Point a(e0.ray.origin()-anchor);
- double o1 = Dot(a, v1);
- double o2 = Dot(a, v2);
+ Real o1 = Dot(a, v1);
+ Real o2 = Dot(a, v2);
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double dt=Dot(e.ray.direction(), normal);
+ Real dt=Dot(e.ray.direction(), normal);
if(Abs(dt) < 1.e-6)
continue;
- double t=num/dt;
+ Real t=num/dt;
if(t>e.hitInfo.minT())
continue;
Vector vi(e.ray.direction()*t);
- double a1 = Dot(v1, vi)+o1;
+ Real a1 = Dot(v1, vi)+o1;
if (a1 < 0.0 || a1 > 1.0)
continue;
- double a2 = Dot(v2, vi)+o2;
+ Real a2 = Dot(v2, vi)+o2;
if (a2 < 0.0 || a2 > 1.0)
continue;
@@ -70,18 +70,18 @@
} else {
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double dt=Dot(e.ray.direction(), normal);
+ Real dt=Dot(e.ray.direction(), normal);
if(Abs(dt) < 1.e-6)
continue;
- double t=(d-Dot(normal, e.ray.origin()))/dt;
+ Real t=(d-Dot(normal, e.ray.origin()))/dt;
if(t>e.hitInfo.minT())
continue;
Point p(e.ray.origin()+e.ray.direction()*t);
Vector vi(p-anchor);
- double a1 = Dot(v1, vi);
+ Real a1 = Dot(v1, vi);
if (a1 < 0.0 || a1 > 1.0)
continue;
- double a2 = Dot(v2, vi);
+ Real a2 = Dot(v2, vi);
if (a2 < 0.0 || a2 > 1.0)
continue;
Modified: branches/float/Model/Primitives/Parallelogram.h
==============================================================================
--- branches/float/Model/Primitives/Parallelogram.h (original)
+++ branches/float/Model/Primitives/Parallelogram.h Sat May 28 23:22:01
2005
@@ -25,7 +25,7 @@
Point anchor;
Vector v1, v2;
Vector normal;
- double d;
+ Real d;
};
}
Modified: branches/float/Model/Primitives/Ring.cc
==============================================================================
--- branches/float/Model/Primitives/Ring.cc (original)
+++ branches/float/Model/Primitives/Ring.cc Sat May 28 23:22:01 2005
@@ -5,8 +5,8 @@
using namespace Manta;
using namespace std;
-Ring::Ring(Material* mat, const Point& cen, const Vector& n, double radius,
- double thickness)
+Ring::Ring(Material* mat, const Point& cen, const Vector& n, Real radius,
+ Real thickness)
: PrimitiveCommon(mat, this), cen(cen), n(n), radius(radius),
thickness(thickness)
{
this->n.normalize();
@@ -30,15 +30,15 @@
RayPacket::Element& e = rays.get(i);
Vector dir(e.ray.direction());
Point orig(e.ray.origin());
- double dt=Dot(dir, n);
+ Real dt=Dot(dir, n);
if(dt < 1.e-6 && dt > -1.e-6)
return;
- double t=(d-Dot(n, orig))/dt;
+ Real t=(d-Dot(n, orig))/dt;
if(e.hitInfo.wasHit() && t>e.hitInfo.minT())
return;
Point p(orig+dir*t);
- double l=(p-cen).length2();
- double outer_radius=radius+thickness;
+ Real l=(p-cen).length2();
+ Real outer_radius=radius+thickness;
if(l > radius*radius && l < outer_radius*outer_radius)
e.hitInfo.hit(t, material, this, tex);
}
Modified: branches/float/Model/Primitives/Ring.h
==============================================================================
--- branches/float/Model/Primitives/Ring.h (original)
+++ branches/float/Model/Primitives/Ring.h Sat May 28 23:22:01 2005
@@ -12,8 +12,8 @@
class Ring : public PrimitiveCommon, public TexCoordMapper {
public:
- Ring(Material* mat, const Point& cen, const Vector& n, double radius,
- double thicknes);
+ Ring(Material* mat, const Point& cen, const Vector& n, Real radius,
+ Real thicknes);
virtual ~Ring();
virtual void computeBounds(const PreprocessContext& context,
@@ -24,7 +24,7 @@
private:
Point cen;
Vector n;
- double d, radius, thickness;
+ Real d, radius, thickness;
};
}
Modified: branches/float/Model/Primitives/Sphere.cc
==============================================================================
--- branches/float/Model/Primitives/Sphere.cc (original)
+++ branches/float/Model/Primitives/Sphere.cc Sat May 28 23:22:01 2005
@@ -8,7 +8,7 @@
using namespace std;
using SCIRun::Clamp;
-Sphere::Sphere(Material* material, const Point& center, double radius)
+Sphere::Sphere(Material* material, const Point& center, Real radius)
: PrimitiveCommon(material, this), center(center), radius(radius)
{
inv_radius = 1./radius;
@@ -30,24 +30,24 @@
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
Vector OC=center-e.ray.origin();
- double tca=Dot(OC, e.ray.direction());
- double l2oc=OC.length2();
- double rad2=radius*radius;
+ Real tca=Dot(OC, e.ray.direction());
+ Real l2oc=OC.length2();
+ Real rad2=radius*radius;
if(l2oc <= rad2){
// Inside the sphere
- double t2hc=rad2-l2oc+tca*tca;
- double thc=sqrt(t2hc);
- double t=tca+thc;
+ Real t2hc=rad2-l2oc+tca*tca;
+ Real thc=sqrt(t2hc);
+ Real t=tca+thc;
e.hitInfo.hit(material, this, t);
} else {
if(tca < 0.0){
// Behind ray, no intersections...
} else {
- double t2hc=rad2-l2oc+tca*tca;
+ Real t2hc=rad2-l2oc+tca*tca;
if(t2hc <= 0.0){
// Ray misses, no intersections
} else {
- double thc=sqrt(t2hc);
+ Real thc=sqrt(t2hc);
e.hitInfo.hit(material, this, tca-thc);
e.hitInfo.hit(material, this, tca+thc);
}
@@ -61,19 +61,19 @@
// Rays of constant origin and normalized directions
RayPacket::Element& e0 = rays.get(0);
Vector O(e0.ray.origin()-center);
- double C = Dot(O, O) - radius*radius;
+ Real C = Dot(O, O) - radius*radius;
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
const Vector& D(e.ray.direction());
- double B = Dot(O, D);
- double disc = B*B-C;
+ Real B = Dot(O, D);
+ Real disc = B*B-C;
if(disc >= 0){
- double r = sqrt(disc);
- double t0 = -(r+B);
+ Real r = sqrt(disc);
+ Real t0 = -(r+B);
if(t0 > 0){
e.hitInfo.hit(t0, material, this, tex);
} else {
- double t1 = r-B;
+ Real t1 = r-B;
e.hitInfo.hit(t1, material, this, tex);
}
}
@@ -85,20 +85,20 @@
// Rays of constant origin for not normalized directions
RayPacket::Element& e0 = rays.get(0);
Vector O(e0.ray.origin()-center);
- double C = Dot(O, O) - radius*radius;
+ Real C = Dot(O, O) - radius*radius;
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
const Vector& D(e.ray.direction());
- double A = Dot(D, D);
- double B = Dot(O, D);
- double disc = B*B-A*C;
+ Real A = Dot(D, D);
+ Real B = Dot(O, D);
+ Real disc = B*B-A*C;
if(disc >= 0){
- double r = sqrt(disc);
- double t0 = -(r+B)/A;
+ Real r = sqrt(disc);
+ Real t0 = -(r+B)/A;
if(t0 > 0){
e.hitInfo.hit(t0, material, this, tex);
} else {
- double t1 = (r-B)/A;
+ Real t1 = (r-B)/A;
e.hitInfo.hit(t1, material, this, tex);
}
}
@@ -112,16 +112,16 @@
RayPacket::Element& e = rays.get(i);
Vector O(e.ray.origin()-center);
const Vector& D(e.ray.direction());
- double B = Dot(O, D);
- double C = Dot(O, O) - radius*radius;
- double disc = B*B-C;
+ Real B = Dot(O, D);
+ Real C = Dot(O, O) - radius*radius;
+ Real disc = B*B-C;
if(disc >= 0){
- double r = sqrt(disc);
- double t0 = -(r+B);
+ Real r = sqrt(disc);
+ Real t0 = -(r+B);
if(t0 > 0){
e.hitInfo.hit(t0, material, this, tex);
} else {
- double t1 = r-B;
+ Real t1 = r-B;
e.hitInfo.hit(t1, material, this, tex);
}
}
@@ -135,17 +135,17 @@
RayPacket::Element& e = rays.get(i);
Vector O(e.ray.origin()-center);
const Vector& D(e.ray.direction());
- double A = Dot(D, D);
- double B = Dot(O, D);
- double C = Dot(O, O) - radius*radius;
- double disc = B*B-A*C;
+ Real A = Dot(D, D);
+ Real B = Dot(O, D);
+ Real C = Dot(O, O) - radius*radius;
+ Real disc = B*B-A*C;
if(disc >= 0){
- double r = sqrt(disc);
- double t0 = -(r+B)/A;
+ Real r = sqrt(disc);
+ Real t0 = -(r+B)/A;
if(t0 > 0){
e.hitInfo.hit(t0, material, this, tex);
} else {
- double t1 = (r-B)/A;
+ Real t1 = (r-B)/A;
e.hitInfo.hit(t1, material, this, tex);
}
}
@@ -172,9 +172,9 @@
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
Vector n = (e.hitPosition-center)*inv_radius;
- double angle = Clamp(n.z(), -1.0, 1.0);
- double theta = acos(angle);
- double phi = atan2(n.x(), n.y());
+ Real angle = Clamp(n.z(), -1.0, 1.0);
+ Real theta = acos(angle);
+ Real phi = atan2(n.x(), n.y());
e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), 0);
}
rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
@@ -187,9 +187,9 @@
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
Vector n = (e.hitPosition-center)*inv_radius;
- double angle = Clamp(n.z(), -1.0, 1.0);
- double theta = acos(angle);
- double phi = atan2(n.x(), n.y());
+ Real angle = Clamp(n.z(), -1.0, 1.0);
+ Real theta = acos(angle);
+ Real phi = atan2(n.x(), n.y());
e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), 0);
}
rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
Modified: branches/float/Model/Primitives/Sphere.h
==============================================================================
--- branches/float/Model/Primitives/Sphere.h (original)
+++ branches/float/Model/Primitives/Sphere.h Sat May 28 23:22:01 2005
@@ -9,7 +9,7 @@
namespace Manta {
class Sphere : public PrimitiveCommon, public TexCoordMapper {
public:
- Sphere(Material* material, const Point& center, double radius);
+ Sphere(Material* material, const Point& center, Real radius);
virtual ~Sphere();
virtual void computeBounds(const PreprocessContext& context,
@@ -22,8 +22,8 @@
RayPacket& rays) const;
private:
Point center;
- double radius;
- double inv_radius;
+ Real radius;
+ Real inv_radius;
};
}
Modified: branches/float/Model/Primitives/SuperEllipsoid.cc
==============================================================================
--- branches/float/Model/Primitives/SuperEllipsoid.cc (original)
+++ branches/float/Model/Primitives/SuperEllipsoid.cc Sat May 28 23:22:01
2005
@@ -7,6 +7,8 @@
using namespace Manta;
using namespace std;
using SCIRun::Clamp;
+using SCIRun::Abs;
+using SCIRun::Pow;
#define GOLDENMEAN 0.61803398874989484820
#define BRACKETWIDTH 1.e-6
@@ -15,9 +17,9 @@
SuperEllipsoid::SuperEllipsoid(
Material *material,
Point const ¢er,
- double radius,
- double alpha,
- double beta )
+ Real radius,
+ Real alpha,
+ Real beta )
: PrimitiveCommon( material, this ),
center( center ),
radius( radius )
@@ -32,23 +34,23 @@
{
}
-inline double SuperEllipsoid::functionValue(
+inline Real SuperEllipsoid::functionValue(
Vector const &location ) const
{
- double x_power = pow( fabs( location.x() ), two_over_alpha );
- double y_power = pow( fabs( location.y() ), two_over_alpha );
- double z_power = pow( fabs( location.z() ), two_over_beta );
- return pow( x_power + y_power, alpha_over_beta ) + z_power - 1.;
+ Real x_power = Pow( Abs( location.x() ), two_over_alpha );
+ Real y_power = Pow( Abs( location.y() ), two_over_alpha );
+ Real z_power = Pow( Abs( location.z() ), two_over_beta );
+ return Pow( x_power + y_power, alpha_over_beta ) + z_power - 1.;
}
inline Vector const SuperEllipsoid::functionGradient(
Vector const &location,
- double &value ) const
+ Real &value ) const
{
- double x_power = pow( fabs(location.x() ), two_over_alpha );
- double y_power = pow( fabs(location.y() ), two_over_alpha );
- double z_power = pow( fabs(location.z() ), two_over_beta );
- double x_and_y_power = pow( x_power + y_power, alpha_over_beta - 1. );
+ Real x_power = pow( fabs(location.x() ), two_over_alpha );
+ Real y_power = pow( fabs(location.y() ), two_over_alpha );
+ Real z_power = pow( fabs(location.z() ), two_over_beta );
+ Real x_and_y_power = pow( x_power + y_power, alpha_over_beta - 1. );
value = x_and_y_power * ( x_power + y_power ) + z_power - 1.;
return Vector( two_over_beta * x_and_y_power * x_power / location.x(),
two_over_beta * x_and_y_power * y_power / location.y(),
@@ -57,12 +59,12 @@
inline Vector const SuperEllipsoid::logarithmFunctionGradient(
Vector const &location,
- double &value ) const
+ Real &value ) const
{
- double x_power = pow( fabs(location.x() ), two_over_alpha );
- double y_power = pow( fabs(location.y() ), two_over_alpha );
- double z_power = pow( fabs(location.z() ), two_over_beta );
- double x_and_y_power = pow( x_power + y_power, 1. - alpha_over_beta ) *
z_power + x_power + y_power;
+ Real x_power = pow( fabs(location.x() ), two_over_alpha );
+ Real y_power = pow( fabs(location.y() ), two_over_alpha );
+ Real z_power = pow( fabs(location.z() ), two_over_beta );
+ Real x_and_y_power = pow( x_power + y_power, 1. - alpha_over_beta ) *
z_power + x_power + y_power;
value = log( pow( x_power + y_power, alpha_over_beta ) + z_power );
return Vector( two_over_beta * x_power / ( location.x() * x_and_y_power ),
two_over_beta * y_power / ( location.y() * x_and_y_power ),
@@ -89,11 +91,11 @@
// First check if the ray hits the bounding box and whether it could
// remotely produce a hit of interest.
// TODO: Maybe factor this out into a common routine?
- double tnear, tfar, t1, t2;
+ Real tnear, tfar, t1, t2;
t1 = ( -radius - offset_center.x() ) * e.inverseDirection.x();
t2 = ( radius - offset_center.x() ) * e.inverseDirection.x();
if( t1 > t2 ) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -102,7 +104,7 @@
t1 = ( -radius - offset_center.y() ) * e.inverseDirection.y();
t2 = ( radius - offset_center.y() ) * e.inverseDirection.y();
if( t1 > t2 ) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -113,7 +115,7 @@
t1 = ( -radius - offset_center.z() ) * e.inverseDirection.z();
t2 = ( radius - offset_center.z() ) * e.inverseDirection.z();
if( t1 > t2 ) {
- double temp = t1;
+ Real temp = t1;
t1 = t2;
t2 = temp;
}
@@ -124,12 +126,12 @@
continue;
// A few preliminary early exit tests...
- double near_value, far_value;
- double near_deriv = Dot( functionGradient(
+ Real near_value, far_value;
+ Real near_deriv = Dot( functionGradient(
( offset_center + tnear * e.ray.direction()
) * inv_radius,
near_value ),
e.ray.direction() );
- double far_deriv = Dot( functionGradient(
+ Real far_deriv = Dot( functionGradient(
( offset_center + tfar * e.ray.direction() )
* inv_radius,
far_value ),
e.ray.direction() );
@@ -140,13 +142,13 @@
// Try to find the minimum of the super ellipsoid function using the
// Golden Section Search. We'll use this to bracket the root.
if ( near_deriv * far_deriv <= 0 ) {
- double a_bracket = tnear;
- double b_bracket = tfar;
- double left = GOLDENMEAN * a_bracket + ( 1. - GOLDENMEAN ) * b_bracket;
- double left_value = functionValue(
+ Real a_bracket = tnear;
+ Real b_bracket = tfar;
+ Real left = GOLDENMEAN * a_bracket + ( 1. - GOLDENMEAN ) * b_bracket;
+ Real left_value = functionValue(
( offset_center + left * e.ray.direction() ) * inv_radius );
- double right = ( 1. - GOLDENMEAN ) * a_bracket + GOLDENMEAN *
b_bracket;
- double right_value = functionValue(
+ Real right = ( 1. - GOLDENMEAN ) * a_bracket + GOLDENMEAN * b_bracket;
+ Real right_value = functionValue(
( offset_center + right * e.ray.direction() ) * inv_radius );
while( fabs( b_bracket - a_bracket ) > BRACKETWIDTH ) {
if ( left_value < right_value ) {
@@ -188,9 +190,9 @@
// bisection step.
if ( near_value * far_value >= 0. )
continue;
- double troot = ( tnear + tfar ) * 0.5;
- double root_value;
- double root_deriv = Dot( logarithmFunctionGradient(
+ Real troot = ( tnear + tfar ) * 0.5;
+ Real root_value;
+ Real root_deriv = Dot( logarithmFunctionGradient(
( offset_center + troot * e.ray.direction()
) * inv_radius,
root_value ),
e.ray.direction() );
@@ -227,7 +229,7 @@
{
// FIXME: Calculate proper normal once intersection code works - sphere
// normal close enough for now...
- double ignored;
+ Real ignored;
rays.computeHitPositions();
for( int i = 0; i < rays.getSize(); i++ ) {
RayPacket::Element &e( rays.get( i ) );
@@ -243,9 +245,9 @@
for( int i = 0; i < rays.getSize(); i++ ) {
RayPacket::Element &e( rays.get( i ) );
Vector n = ( e.hitPosition - center ) * inv_radius;
- double angle = Clamp( n.z(), -1.0, 1.0 );
- double theta = acos( angle );
- double phi = atan2( n.x(), n.y() );
+ Real angle = Clamp( n.z(), -1.0, 1.0 );
+ Real theta = acos( angle );
+ Real phi = atan2( n.x(), n.y() );
e.texCoords = Point( ( phi + M_PI ) * ( 1. / ( 2 * M_PI ) ),
theta * ( 1. / M_PI ),
0 );
@@ -261,9 +263,9 @@
for( int i = 0; i < rays.getSize(); i++ ) {
RayPacket::Element &e = rays.get( i );
Vector n = ( e.hitPosition - center ) * inv_radius;
- double angle = Clamp( n.z(), -1.0, 1.0 );
- double theta = acos( angle );
- double phi = atan2( n.x(), n.y() );
+ Real angle = Clamp( n.z(), -1.0, 1.0 );
+ Real theta = acos( angle );
+ Real phi = atan2( n.x(), n.y() );
e.texCoords = Point( ( phi + M_PI ) * ( 1. / ( 2 * M_PI ) ),
theta * ( 1. / M_PI ),
0 );
Modified: branches/float/Model/Primitives/SuperEllipsoid.h
==============================================================================
--- branches/float/Model/Primitives/SuperEllipsoid.h (original)
+++ branches/float/Model/Primitives/SuperEllipsoid.h Sat May 28 23:22:01
2005
@@ -9,7 +9,7 @@
namespace Manta {
class SuperEllipsoid : public PrimitiveCommon, public TexCoordMapper {
public:
- SuperEllipsoid(Material* material, const Point& center, double radius,
double alpha, double beta);
+ SuperEllipsoid(Material* material, const Point& center, Real radius,
Real alpha, Real beta);
virtual ~SuperEllipsoid();
virtual void computeBounds(const PreprocessContext& context,
@@ -21,15 +21,15 @@
virtual void computeTexCoords3(const RenderContext& context,
RayPacket& rays) const;
private:
- double functionValue(const Vector& location) const;
- Vector const functionGradient(const Vector& location, double& value )
const;
- Vector const logarithmFunctionGradient(const Vector& location, double&
value ) const;
+ Real functionValue(const Vector& location) const;
+ Vector const functionGradient(const Vector& location, Real& value )
const;
+ Vector const logarithmFunctionGradient(const Vector& location, Real&
value ) const;
Point center;
- double radius;
- double inv_radius;
- double two_over_alpha;
- double two_over_beta;
- double alpha_over_beta;
+ Real radius;
+ Real inv_radius;
+ Real two_over_alpha;
+ Real two_over_beta;
+ Real alpha_over_beta;
};
}
Modified: branches/float/Model/Primitives/TexTriangle.cc
==============================================================================
--- branches/float/Model/Primitives/TexTriangle.cc (original)
+++ branches/float/Model/Primitives/TexTriangle.cc Sat May 28 23:22:01
2005
@@ -35,8 +35,8 @@
for(int i=0; i<nrays; i++) {
RayPacket::Element& e = rays.get(i);
TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
- double A = th.a;
- double B = th.b;
+ Real A = th.a;
+ Real B = th.b;
e.normal = (n1 * A) + (n2 * B) + (n3 * (1.0 - A - B));
e.normal.normalize();
}
@@ -50,8 +50,8 @@
for(int i=0; i<nrays; i++) {
RayPacket::Element& e = rays.get(i);
TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
- double A = th.a;
- double B = th.b;
+ Real A = th.a;
+ Real B = th.b;
e.texCoords = tc1.multipliedBy(A);
e.texCoords.addTo(tc2.multipliedBy(B));
e.texCoords.addTo(tc3.multipliedBy(1.0 - A - B));
@@ -66,8 +66,8 @@
for(int i=0; i<nrays; i++) {
RayPacket::Element& e = rays.get(i);
TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
- double A = th.a;
- double B = th.b;
+ Real A = th.a;
+ Real B = th.b;
e.texCoords = tc1.multipliedBy(A);
e.texCoords.addTo(tc2.multipliedBy(B));
e.texCoords.addTo(tc3.multipliedBy(1.0 - A - B));
Modified: branches/float/Model/Primitives/Triangle.cc
==============================================================================
--- branches/float/Model/Primitives/Triangle.cc (original)
+++ branches/float/Model/Primitives/Triangle.cc Sat May 28 23:22:01 2005
@@ -40,16 +40,16 @@
const Vector& dir(e.ray.direction());
Vector o(p1 - e.ray.origin());
- double det=Dot(_n,dir);
+ Real det=Dot(_n,dir);
if(det>1.e-9 || det < -1.e-9) {
- double idet = 1./det;
+ Real idet = 1./det;
Vector DX(Cross(dir, o));
- double A =-Dot(DX, _e2)*idet;
+ Real A =-Dot(DX, _e2)*idet;
if(A>0.0 && A<1.0) {
- double B = Dot(DX, _e1)*idet;
+ Real B = Dot(DX, _e1)*idet;
if(B>0.0 && A+B<1.0) {
- double t=Dot(_n, o)*idet;
+ Real t=Dot(_n, o)*idet;
if (e.hitInfo.hit(t, material, this, tex)){
TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
th.a = A;
Modified: branches/float/Model/Primitives/Triangle.h
==============================================================================
--- branches/float/Model/Primitives/Triangle.h (original)
+++ branches/float/Model/Primitives/Triangle.h Sat May 28 23:22:01 2005
@@ -11,7 +11,7 @@
class Triangle : public PrimitiveCommon {
public:
struct TriangleHit{
- double a,b;
+ Real a,b;
};
Triangle(Material* mat, const Point& _p1, const Point& _p2, const Point&
_p3);
Modified: branches/float/Model/TexCoordMappers/SphericalMapper.cc
==============================================================================
--- branches/float/Model/TexCoordMappers/SphericalMapper.cc (original)
+++ branches/float/Model/TexCoordMappers/SphericalMapper.cc Sat May 28
23:22:01 2005
@@ -6,7 +6,7 @@
using namespace Manta;
using SCIRun::Clamp;
-SphericalMapper::SphericalMapper(const Point& center, double radius)
+SphericalMapper::SphericalMapper(const Point& center, Real radius)
: center(center), radius(radius)
{
inv_radius = 1./radius;
@@ -23,10 +23,10 @@
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
Vector n = e.hitPosition-center;
- double w = n.normalize() * inv_radius;
- double angle = Clamp(n.z(), -1.0, 1.0);
- double theta = acos(angle);
- double phi = atan2(n.x(), n.y());
+ Real w = n.normalize() * inv_radius;
+ Real angle = Clamp(n.z(), -1.0, 1.0);
+ Real theta = acos(angle);
+ Real phi = atan2(n.x(), n.y());
e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), w);
}
rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
@@ -39,10 +39,10 @@
for(int i = 0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
Vector n = e.hitPosition-center;
- double w = n.normalize() * inv_radius;
- double angle = Clamp(n.z(), -1.0, 1.0);
- double theta = acos(angle);
- double phi = atan2(n.x(), n.y());
+ Real w = n.normalize() * inv_radius;
+ Real angle = Clamp(n.z(), -1.0, 1.0);
+ Real theta = acos(angle);
+ Real phi = atan2(n.x(), n.y());
e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), w);
}
rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
Modified: branches/float/Model/TexCoordMappers/SphericalMapper.h
==============================================================================
--- branches/float/Model/TexCoordMappers/SphericalMapper.h (original)
+++ branches/float/Model/TexCoordMappers/SphericalMapper.h Sat May 28
23:22:01 2005
@@ -9,7 +9,7 @@
class SphericalMapper : public TexCoordMapper {
public:
- SphericalMapper(const Point& center, double radius);
+ SphericalMapper(const Point& center, Real radius);
virtual ~SphericalMapper();
virtual void computeTexCoords2(const RenderContext& context,
@@ -21,8 +21,8 @@
SphericalMapper& operator=(const SphericalMapper&);
Point center;
- double radius;
- double inv_radius;
+ Real radius;
+ Real inv_radius;
};
}
Modified: branches/float/Model/Textures/CheckerTexture.cc
==============================================================================
--- branches/float/Model/Textures/CheckerTexture.cc (original)
+++ branches/float/Model/Textures/CheckerTexture.cc Sat May 28 23:22:01
2005
@@ -34,8 +34,8 @@
rays.computeTextureCoordinates2(context);
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- double vv1 = Dot(e.texCoords, v1);
- double vv2 = Dot(e.texCoords, v2);
+ Real vv1 = Dot(e.texCoords, v1);
+ Real vv2 = Dot(e.texCoords, v2);
if(vv1<0)
vv1=-vv1+1;
if(vv2<0)
Modified: branches/float/Model/Textures/MarbleTexture.cc
==============================================================================
--- branches/float/Model/Textures/MarbleTexture.cc (original)
+++ branches/float/Model/Textures/MarbleTexture.cc Sat May 28 23:22:01
2005
@@ -11,12 +11,12 @@
MarbleTexture< ValueType >::MarbleTexture(
ValueType const &value1,
ValueType const &value2,
- double const scale,
- double const fscale,
- double const tscale,
+ Real const scale,
+ Real const fscale,
+ Real const tscale,
int const octaves,
- double const lacunarity,
- double const gain )
+ Real const lacunarity,
+ Real const gain )
: value1( value1 ),
value2( value2 ),
scale ( scale ),
@@ -43,7 +43,7 @@
for( int i = 0; i < rays.getSize(); i++ ) {
RayPacket::Element &e = rays.get( i );
Point T = e.texCoords.multipliedBy(scale * fscale);
- double value = 0.5 * cos( e.texCoords.x() * scale + tscale *
Turbulence( T, octaves, lacunarity, gain ) ) * 0.5;
+ Real value = 0.5 * cos( e.texCoords.x() * scale + tscale * Turbulence(
T, octaves, lacunarity, gain ) ) * 0.5;
results[ i ] = SCIRun::Interpolate( value1, value2, value );
}
}
Modified: branches/float/Model/Textures/MarbleTexture.h
==============================================================================
--- branches/float/Model/Textures/MarbleTexture.h (original)
+++ branches/float/Model/Textures/MarbleTexture.h Sat May 28 23:22:01
2005
@@ -13,12 +13,12 @@
MarbleTexture(
ValueType const &value1,
ValueType const &value2,
- double const scale,
- double const fscale,
- double const tscale,
+ Real const scale,
+ Real const fscale,
+ Real const tscale,
int const octaves,
- double const lacunarity,
- double const gain );
+ Real const lacunarity,
+ Real const gain );
virtual ~MarbleTexture();
virtual void mapValues(
RenderContext const &context,
@@ -32,12 +32,12 @@
ValueType value1;
ValueType value2;
- double scale;
- double fscale;
- double tscale;
+ Real scale;
+ Real fscale;
+ Real tscale;
int octaves;
- double lacunarity;
- double gain;
+ Real lacunarity;
+ Real gain;
};
}
Modified: branches/float/Model/Textures/OakTexture.cc
==============================================================================
--- branches/float/Model/Textures/OakTexture.cc (original)
+++ branches/float/Model/Textures/OakTexture.cc Sat May 28 23:22:01 2005
@@ -11,17 +11,17 @@
OakTexture< ValueType >::OakTexture(
ValueType const &value1,
ValueType const &value2,
- double const ringfreq,
- double const ringunevenness,
- double const grainfreq,
- double const ringnoise,
- double const ringnoisefreq,
- double const trunkwobble,
- double const trunkwobblefreq,
- double const angularwobble,
- double const angularwobblefreq,
- double const ringy,
- double const grainy )
+ Real const ringfreq,
+ Real const ringunevenness,
+ Real const grainfreq,
+ Real const ringnoise,
+ Real const ringnoisefreq,
+ Real const trunkwobble,
+ Real const trunkwobblefreq,
+ Real const angularwobble,
+ Real const angularwobblefreq,
+ Real const ringy,
+ Real const grainy )
: value1( value1 ),
value2( value2 ),
ringfreq( ringfreq ),
@@ -60,19 +60,19 @@
Point Pring = e.texCoords + ringnoise * offset;
Vector vsnoise = VectorNoise( Point( 0.5, 0.5, e.texCoords.z() *
trunkwobblefreq ) );
Pring += Vector( trunkwobble * vsnoise.x(), trunkwobble * vsnoise.y(),
0.0 );
- double r = sqrt( Pring.x() * Pring.x() + Pring.y() * Pring.y() ) *
ringfreq;
+ Real r = sqrt( Pring.x() * Pring.x() + Pring.y() * Pring.y() ) *
ringfreq;
r += angularwobble * SmoothStep( r, 0, 5 ) * ScalarNoise( Point(
angularwobble * Pring.x(),
angularwobble * Pring.y(),
angularwobble * Pring.z() * 0.1 ) );
r += 0.5 * ScalarNoise( Point( 0.5, 0.5, r ) );
- double rfrac = r - floor( r );
- double inring = SmoothStep( rfrac, 0.1, 0.55 ) - SmoothStep( rfrac,
0.7, 0.95 );
+ Real rfrac = r - floor( r );
+ Real inring = SmoothStep( rfrac, 0.1, 0.55 ) - SmoothStep( rfrac, 0.7,
0.95 );
Point Pgrain( e.texCoords.multipliedBy(Vector(grainfreq, grainfreq,
grainfreq*0.05)));
- double grain = 0.0;
- double amp = 1.0;
+ Real grain = 0.0;
+ Real amp = 1.0;
for ( int it = 0; it < 2; ++it )
{
- double g = 0.8 * ScalarNoise( Pgrain );
+ Real g = 0.8 * ScalarNoise( Pgrain );
g *= ( 0.3 + 0.7 * inring );
g = Clamp( 0.8 - g, 0.0, 1.0 );
g = grainy * SmoothStep( g * g, 0.5, 1.0 );
@@ -82,7 +82,7 @@
Pgrain.multiplyBy(2.0);
amp *= 0.5;
}
- double value = Interpolate( 1.0, grain, inring * ringy );
+ Real value = Interpolate( 1.0f, grain, inring * ringy );
results[ i ] = Interpolate( value2, value1, value );
}
}
Modified: branches/float/Model/Textures/OakTexture.h
==============================================================================
--- branches/float/Model/Textures/OakTexture.h (original)
+++ branches/float/Model/Textures/OakTexture.h Sat May 28 23:22:01 2005
@@ -13,17 +13,17 @@
OakTexture(
ValueType const &value1,
ValueType const &value2,
- double const ringfreq,
- double const ringunevenness,
- double const grainfreq,
- double const ringnoise,
- double const ringnoisefreq,
- double const trunkwobble,
- double const trunkwobblefreq,
- double const angularwobble,
- double const angularwobblefreq,
- double const ringy,
- double const grainy );
+ Real const ringfreq,
+ Real const ringunevenness,
+ Real const grainfreq,
+ Real const ringnoise,
+ Real const ringnoisefreq,
+ Real const trunkwobble,
+ Real const trunkwobblefreq,
+ Real const angularwobble,
+ Real const angularwobblefreq,
+ Real const ringy,
+ Real const grainy );
virtual ~OakTexture();
virtual void mapValues(
RenderContext const &context,
@@ -37,17 +37,17 @@
ValueType value1;
ValueType value2;
- double const ringfreq;
- double const ringunevenness;
- double const grainfreq;
- double const ringnoise;
- double const ringnoisefreq;
- double const trunkwobble;
- double const trunkwobblefreq;
- double const angularwobble;
- double const angularwobblefreq;
- double const ringy;
- double const grainy;
+ Real const ringfreq;
+ Real const ringunevenness;
+ Real const grainfreq;
+ Real const ringnoise;
+ Real const ringnoisefreq;
+ Real const trunkwobble;
+ Real const trunkwobblefreq;
+ Real const angularwobble;
+ Real const angularwobblefreq;
+ Real const ringy;
+ Real const grainy;
};
}
Modified: branches/float/Model/Textures/WoodTexture.cc
==============================================================================
--- branches/float/Model/Textures/WoodTexture.cc (original)
+++ branches/float/Model/Textures/WoodTexture.cc Sat May 28 23:22:01
2005
@@ -11,13 +11,13 @@
WoodTexture< ValueType >::WoodTexture(
ValueType const &value1,
ValueType const &value2,
- double const scale,
- double const rscale,
- double const tscale,
- double const sharpness,
+ Real const scale,
+ Real const rscale,
+ Real const tscale,
+ Real const sharpness,
int const octaves,
- double const lacunarity,
- double const gain )
+ Real const lacunarity,
+ Real const gain )
: value1( value1 ),
value2( value2 ),
scale ( scale ),
@@ -45,9 +45,9 @@
for( int i = 0; i < rays.getSize(); i++ ) {
RayPacket::Element &e = rays.get( i );
Point T = e.texCoords.multipliedBy(scale);
- double distance = sqrt( T.x() * T.x() + T.y() * T.y() ) * rscale;
- double fbm = tscale * ScalarFBM( T, octaves, lacunarity, gain );
- double value = 0.5 * cos( distance + fbm ) + 0.5;
+ Real distance = sqrt( T.x() * T.x() + T.y() * T.y() ) * rscale;
+ Real fbm = tscale * ScalarFBM( T, octaves, lacunarity, gain );
+ Real value = 0.5 * cos( distance + fbm ) + 0.5;
results[ i ] = SCIRun::Interpolate( value2, value1, pow( value,
sharpness ) );
}
}
Modified: branches/float/Model/Textures/WoodTexture.h
==============================================================================
--- branches/float/Model/Textures/WoodTexture.h (original)
+++ branches/float/Model/Textures/WoodTexture.h Sat May 28 23:22:01 2005
@@ -13,13 +13,13 @@
WoodTexture(
ValueType const &value1,
ValueType const &value2,
- double const scale,
- double const rscale,
- double const tscale,
- double const sharpness,
+ Real const scale,
+ Real const rscale,
+ Real const tscale,
+ Real const sharpness,
int const octaves,
- double const lacunarity,
- double const gain );
+ Real const lacunarity,
+ Real const gain );
virtual ~WoodTexture();
virtual void mapValues(
RenderContext const &context,
@@ -33,13 +33,13 @@
ValueType value1;
ValueType value2;
- double scale;
- double rscale;
- double tscale;
- double sharpness;
+ Real scale;
+ Real rscale;
+ Real tscale;
+ Real sharpness;
int octaves;
- double lacunarity;
- double gain;
+ Real lacunarity;
+ Real gain;
};
}
Modified: branches/float/Readers/BART/parse.cc
==============================================================================
--- branches/float/Readers/BART/parse.cc (original)
+++ branches/float/Readers/BART/parse.cc Sat May 28 23:22:01 2005
@@ -405,8 +405,8 @@
Cone *nextObj = new Cone(currentMaterial,
Point(base_pt[X],base_pt[Y],base_pt[Z]),
Point(apex_pt[X],apex_pt[Y],apex_pt[Z]),
- (double)r0,
- (double)r1);
+ (Real)r0,
+ (Real)r1);
myGroup->add(nextObj);
}
@@ -436,7 +436,7 @@
Sphere *nextObj = new Sphere(currentMaterial,
Point(center[X],center[Y],center[Z]),
- (double)radius);
+ (Real)radius);
myGroup->add(nextObj);
}
@@ -1356,9 +1356,9 @@
}
/* indices appear in this order: [texture] [normals] vertices.
[]=optional */
- Point p1((double)verts[v[0]][0], (double)verts[v[0]][1],
(double)verts[v[0]][2]);
- Point p2((double)verts[v[1]][0], (double)verts[v[1]][1],
(double)verts[v[1]][2]);
- Point p3((double)verts[v[2]][0], (double)verts[v[2]][1],
(double)verts[v[2]][2]);
+ Point p1((Real)verts[v[0]][0], (Real)verts[v[0]][1],
(Real)verts[v[0]][2]);
+ Point p2((Real)verts[v[1]][0], (Real)verts[v[1]][1],
(Real)verts[v[1]][2]);
+ Point p3((Real)verts[v[2]][0], (Real)verts[v[2]][1],
(Real)verts[v[2]][2]);
myGroup->add(new Triangle(currentMaterial, p1, p2, p3));
Modified: branches/float/StandAlone/manta.cc
==============================================================================
--- branches/float/StandAlone/manta.cc (original)
+++ branches/float/StandAlone/manta.cc Sat May 28 23:22:01 2005
@@ -329,6 +329,7 @@
// please do not change it. Please create a new scene instead
Scene* scene = new Scene();
scene->setBackground(new
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")*0.5));
+ cerr << Point(1,1,1) << " " << Vector(2,3,4) << '\n';
Material* red=new Phong(Color(RGBColor(.6,0,0)),
Color(RGBColor(.6,.6,.6)), 32, 0.4);
@@ -338,9 +339,9 @@
Vector(0,1,0)),
new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
32,
- new CheckerTexture<double>(0.2, 0.5,
- Vector(1,0,0),
- Vector(0,1,0)));
+ new CheckerTexture<Real>(0.2, 0.5,
+ Vector(1,0,0),
+ Vector(0,1,0)));
Group* world = new Group();
Modified: branches/float/UserInterface/XWindowUI.cc
==============================================================================
--- branches/float/UserInterface/XWindowUI.cc (original)
+++ branches/float/UserInterface/XWindowUI.cc Sat May 28 23:22:01 2005
@@ -466,9 +466,9 @@
} else {
// Zoom in/out.
XWindow* window = windows[channel];
- double xmotion= double(ias.last_x - mouse_x)/window->xres;
- double ymotion= double(ias.last_y - mouse_y)/window->yres;
- double scale;
+ Real xmotion= Real(ias.last_x - mouse_x)/window->xres;
+ Real ymotion= Real(ias.last_y - mouse_y)/window->yres;
+ Real scale;
if (Abs(xmotion) > Abs(ymotion))
scale = xmotion;
else
@@ -495,8 +495,8 @@
{
InteractionState& ias = interactions[channel];
XWindow* window = windows[channel];
- double xpos = 2.0*mouse_x/window->xres - 1.0;
- double ypos = 1.0 - 2.0*mouse_y/window->yres;
+ Real xpos = 2.0*mouse_x/window->xres - 1.0;
+ Real ypos = 1.0 - 2.0*mouse_y/window->yres;
if(event == ButtonPress){
ias.rotate_from = projectToSphere(xpos, ypos, trackball_radius);
} else {
@@ -525,8 +525,8 @@
ias.last_y = mouse_y;
} else {
XWindow* window = windows[channel];
- double xmotion = double(ias.last_x-mouse_x)/window->xres;
- double ymotion = -double(ias.last_y-mouse_y)/window->yres;
+ Real xmotion = Real(ias.last_x-mouse_x)/window->xres;
+ Real ymotion = -Real(ias.last_y-mouse_y)/window->yres;
Vector translation(xmotion*translate_speed, ymotion*translate_speed, 0);
Camera* camera = rtrt_interface->getCamera(channel);
@@ -547,10 +547,10 @@
ias.last_y = mouse_y;
} else {
XWindow* window = windows[channel];
- double xmotion = -double(ias.last_x-mouse_x)/window->xres;
- double ymotion = double(ias.last_y-mouse_y)/window->yres;
+ Real xmotion = -Real(ias.last_x-mouse_x)/window->xres;
+ Real ymotion = Real(ias.last_y-mouse_y)/window->yres;
- double scale;
+ Real scale;
if (Abs(xmotion)>Abs(ymotion))
scale=xmotion;
else
@@ -720,18 +720,18 @@
}
}
-Vector XWindowUI::projectToSphere(double x, double y, double radius) const
+Vector XWindowUI::projectToSphere(Real x, Real y, Real radius) const
{
x /= radius;
y /= radius;
- double rad2 = x*x+y*y;
+ Real rad2 = x*x+y*y;
if(rad2 > 1){
- double rad = sqrt(rad2);
+ Real rad = sqrt(rad2);
x /= rad;
y /= rad;
return Vector(x,y,0);
} else {
- double z = sqrt(1-rad2);
+ Real z = sqrt(1-rad2);
return Vector(x,y,z);
}
}
Modified: branches/float/UserInterface/XWindowUI.h
==============================================================================
--- branches/float/UserInterface/XWindowUI.h (original)
+++ branches/float/UserInterface/XWindowUI.h Sat May 28 23:22:01 2005
@@ -78,7 +78,7 @@
void animation_callback(int, int, bool&);
// Utility functions
- Vector projectToSphere(double x, double y, double radius) const;
+ Vector projectToSphere(float x, float y, float radius) const;
// This is a pointer to the interface we will use to interact with manta.
RTRTInterface *rtrt_interface;
@@ -124,12 +124,12 @@
vector<InteractionState> interactions;
// Interaction parameters
- double fov_speed;
- double translate_speed;
- double dolly_speed;
- double rotate_speed;
- double autoview_fov;
- double trackball_radius;
+ float fov_speed;
+ float translate_speed;
+ float dolly_speed;
+ float rotate_speed;
+ float autoview_fov;
+ float trackball_radius;
XWindowUI(const XWindowUI&);
XWindowUI& operator=(const XWindowUI&);
Modified: branches/float/scenes/0.cc
==============================================================================
--- branches/float/scenes/0.cc (original)
+++ branches/float/scenes/0.cc Sat May 28 23:22:01 2005
@@ -28,12 +28,12 @@
using namespace Manta;
using namespace std;
-static const double SCALE = 1./3.;
-static const double BV_RADIUS = 1.0;
+static const Real SCALE = 1./3.;
+static const Real BV_RADIUS = 1.0;
static void create_dirs(Vector* objset)
{
- double dist=1./sqrt(2.0);
+ Real dist=1./sqrt(2.0);
Vector dir[3];
dir[0]=Vector(dist, dist, 0);
dir[1]=Vector(dist, 0, -dist);
@@ -42,7 +42,7 @@
Vector axis(1, -1, 0);
axis.normalize();
- double rot=asin(2.0/sqrt(6.0));
+ Real rot=asin(2.0/sqrt(6.0));
AffineTransform t;
t.initWithRotation(axis, rot);
@@ -60,7 +60,7 @@
}
static void create_objs(Group* group, const Point& center,
- double radius, const Vector& dir, int depth,
+ Real radius, const Vector& dir, int depth,
Vector* objset, Material* matl)
{
group->add(new Sphere(matl, center, radius));
@@ -74,12 +74,12 @@
mx.initWithIdentity();
mx.rotate(Vector(0,0,1), dir);
- double scale = radius * (1+SCALE);
+ Real scale = radius * (1+SCALE);
for(int n=0;n<9;n++){
Vector child_vec(mx * objset[n]);
Point child_pt(center+child_vec*scale);
- double child_rad=radius*SCALE; Vector child_dir = child_pt-center;
+ Real child_rad=radius*SCALE; Vector child_dir = child_pt-center;
child_dir *= 1./scale;
create_objs(group, child_pt, child_rad, child_dir, depth, objset,
matl);
}
@@ -117,8 +117,8 @@
Material* matl3=new MetalMaterial( Color(RGBColor(.7,.7,.7)));
world->add(new Sphere(matl3,
corner+diag1*1.25+diag2*.6+z*2+Vector(0,0,.6), .6));
- double planesize=15;
- double scale = 2*planesize;
+ Real planesize=15;
+ Real scale = 2*planesize;
Material* matl2 = new Lambertian(new
CheckerTexture<Color>(Color(RGBColor(.95,.95,.95)),
Color(RGBColor(.7,.3,.3)),
Vector(1,1.1,0)*scale,
@@ -133,7 +133,7 @@
Scene* make_scene(const ReadContext& context, const vector<string>& args)
{
int scenesize=2;
- double light_radius=0.8;
+ Real light_radius=0.8;
int argc = static_cast<int>(args.size());
Group* world = 0;
for(int i=0;i<argc;i++){
@@ -142,7 +142,7 @@
if(!getIntArg(i, args, scenesize))
throw IllegalArgument("scene 0 -size", i, args);
} else if(arg == "-light"){
- if(!getDoubleArg(i, args, light_radius))
+ if(!getRealArg(i, args, light_radius))
throw IllegalArgument("scene 0 -light", i, args);
} else if(arg == "-bv"){
string s;
@@ -166,7 +166,7 @@
Camera cam(Point(1.8,-5.53,1.25), Point(0.0,-.13,1.22),
Vector(0,0,1), 28.2);
- double ambient_scale=1.0;
+ Real ambient_scale=1.0;
Color bgcolor(RGB(0.1, 0.2, 0.45));
Color cdown(RGB(0.82, 0.62, 0.62));
Color cup(RGB(0.1, 0.3, 0.8));
Modified: branches/float/scenes/primtest.cc
==============================================================================
--- branches/float/scenes/primtest.cc (original)
+++ branches/float/scenes/primtest.cc Sat May 28 23:22:01 2005
@@ -49,8 +49,8 @@
{
std::cout << "Make_scene args: " << args.size() << std::endl;
- double scale = 1;
- double texscale = 20;
+ Real scale = 1;
+ Real texscale = 20;
int numx = 8;
int numy = 8;
string primtype = "sphere";
@@ -63,10 +63,10 @@
for(int i=0;i<argc;i++){
string arg = args[i];
if(arg == "-scale"){
- if(!getDoubleArg(i, args, scale))
+ if(!getRealArg(i, args, scale))
throw IllegalArgument("scene primtest -scale", i, args);
} else if(arg == "-texscale"){
- if(!getDoubleArg(i, args, texscale))
+ if(!getRealArg(i, args, texscale))
throw IllegalArgument("scene primtest -texscale", i, args);
} else if(arg == "-num"){
if(!getResolutionArg(i, args, numx, numy))
@@ -111,7 +111,7 @@
Vector(0,1,0)*texscale),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new Constant<double>(0));
+ new Constant<Real>(0));
else if(material == "checker2")
matl = new Phong(new CheckerTexture<Color>(Color(RGB(.6,.6,.6)),
Color(RGB(.6,0,0)),
@@ -119,7 +119,7 @@
Vector(0,1,0)*texscale),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new CheckerTexture<double>(0.2, 0.5,
+ new CheckerTexture<Real>(0.2, 0.5,
Vector(1,0,0)*texscale,
Vector(0,1,0)*texscale));
else if(material == "checker3")
@@ -134,7 +134,7 @@
10.0, 1.0, 15.0, 6, 2.0, 0.6 ),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new Constant<double>(0));
+ new Constant<Real>(0));
mapr = new UniformMapper();
}
else if(material == "wood")
@@ -161,9 +161,9 @@
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
int idx = j*numx+i;
- double radius = (idx+1)/static_cast<double>(numx*numy)*scale/max;
- Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Real radius = (idx+1)/static_cast<Real>(numx*numy)*scale/max;
+ Point p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
Primitive* prim = new Sphere( matl, p, radius );
if ( mapr )
@@ -175,11 +175,11 @@
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
int idx = j*numx+i;
- double radius = (idx+1)/static_cast<double>(numx*numy)*scale/max;
- double alpha = (i+1)/static_cast<double>(numx)*2.;
- double beta = (j+1)/static_cast<double>(numy)*2.;
- Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Real radius = (idx+1)/static_cast<Real>(numx*numy)*scale/max;
+ Real alpha = (i+1)/static_cast<Real>(numx)*2.;
+ Real beta = (j+1)/static_cast<Real>(numy)*2.;
+ Point p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
Primitive* prim = new SuperEllipsoid( matl, p, radius, alpha, beta );
if ( mapr )
@@ -191,8 +191,8 @@
Vector p2(scale/max, scale/max, scale/max);
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Point p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
Primitive* prim = new Cube( matl, p-p2, p2.x()*1.156, p2.y()*1.156,
p2.z()*1.156 );
if ( mapr )
@@ -223,7 +223,7 @@
Point p2(scale/max/1.414, scale/max/1.414, scale/max/1.414);
Primitive* o1 = new Cube(matl, Point(-p2.x(), -p2.y(), -p2.z()),
p2.x()*2, p2.y()*2, p2.z()*2);
Primitive* o2 = new Sphere(matl, Point(0,0,0), scale/max);
- double s = scale/max/1.414*2*(1+1.e-10);
+ Real s = scale/max/1.414*2*(1+1.e-10);
LinearMapper* map = new LinearMapper(Point(0,0,0),
Vector(s,0,0),
Vector(0,s,0),
@@ -261,11 +261,11 @@
if(arraytype == "spin"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
- double a1 = i/static_cast<double>(numx-1)*M_PI*2;
- double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+ Real a1 = i/static_cast<Real>(numx-1)*M_PI*2;
+ Real a2 = j/static_cast<Real>(numy-1)*M_PI*2;
AffineTransform t;
t.initWithIdentity();
t.rotate(Vector(0,1,0), a1);
@@ -277,8 +277,8 @@
} else if(arraytype == "shift"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
group->add(new InstanceT(spinprim, p));
}
@@ -286,35 +286,35 @@
} else if(arraytype == "scale"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
int idx = j*numx+i;
- double scale = (idx+1)/static_cast<double>(numx*numy);
+ Real scale = (idx+1)/static_cast<Real>(numx*numy);
group->add(new InstanceST(spinprim, Vector(scale, scale, scale),
p));
}
}
} else if(arraytype == "nuscale"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
- double xscale = (i+1)/static_cast<double>(numx);
- double yscale = (j+1)/static_cast<double>(numy);
+ Real xscale = (i+1)/static_cast<Real>(numx);
+ Real yscale = (j+1)/static_cast<Real>(numy);
group->add(new InstanceST(spinprim, Vector(xscale, yscale, 1), p));
}
}
} else if(arraytype == "spinscale"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
- double a1 = i/static_cast<double>(numx-1)*M_PI*2;
- double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+ Real a1 = i/static_cast<Real>(numx-1)*M_PI*2;
+ Real a2 = j/static_cast<Real>(numy-1)*M_PI*2;
int idx = j*numx+i;
- double scale = (idx+1)/static_cast<double>(numx*numy);
+ Real scale = (idx+1)/static_cast<Real>(numx*numy);
AffineTransform t;
t.initWithIdentity();
t.scale(Vector(scale, scale, scale));
@@ -327,13 +327,13 @@
} else if(arraytype == "spinscale2"){
for(int i=0;i<numx;i++){
for(int j=0;j<numy;j++){
- Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
- (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+ Vector p((i/static_cast<Real>(numx-1) - 0.5)*scale*2,
+ (j/static_cast<Real>(numy-1) - 0.5)*scale*2,
0);
- double a1 = i/static_cast<double>(numx-1)*M_PI*2;
- double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+ Real a1 = i/static_cast<Real>(numx-1)*M_PI*2;
+ Real a2 = j/static_cast<Real>(numy-1)*M_PI*2;
int idx = j*numx+i;
- double scale = (idx+1)/static_cast<double>(numx*numy);
+ Real scale = (idx+1)/static_cast<Real>(numx*numy);
AffineTransform t;
t.initWithIdentity();
t.scale(Vector(scale, scale, scale));
- [MANTA] r357 - in branches/float: . Core/Geometry Core/Math Core/Util Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/PixelSamplers Engine/Renderers Engine/Shadows Interface Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Instances Model/Materials Model/Primitives Model/TexCoordMappers Model/Textures Readers/BART StandAlone UserInterface scenes, sparker, 05/28/2005
Archive powered by MHonArc 2.6.16.