Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r639 - in branches/itanium2: Core/Geometry Core/Math Interface Model/Cameras Model/Materials StandAlone UserInterface fox scenes
- Date: Thu, 20 Oct 2005 15:32:10 -0600 (MDT)
Author: bigler
Date: Thu Oct 20 15:32:09 2005
New Revision: 639
Modified:
branches/itanium2/Core/Geometry/BBox.h
branches/itanium2/Core/Math/ipow.h
branches/itanium2/Interface/Camera.h
branches/itanium2/Model/Cameras/EnvironmentCamera.cc
branches/itanium2/Model/Cameras/EnvironmentCamera.h
branches/itanium2/Model/Cameras/FisheyeCamera.cc
branches/itanium2/Model/Cameras/FisheyeCamera.h
branches/itanium2/Model/Cameras/OrthogonalCamera.cc
branches/itanium2/Model/Cameras/OrthogonalCamera.h
branches/itanium2/Model/Cameras/PinholeCamera.cc
branches/itanium2/Model/Cameras/PinholeCamera.h
branches/itanium2/Model/Cameras/StereoPinholeCamera.cc
branches/itanium2/Model/Cameras/StereoPinholeCamera.h
branches/itanium2/Model/Materials/Phong.cc
branches/itanium2/Model/Materials/Phong.h
branches/itanium2/StandAlone/manta.cc
branches/itanium2/UserInterface/XWindowUI.cc
branches/itanium2/fox/dm_demo.cc
branches/itanium2/scenes/boeing777.cc
branches/itanium2/scenes/objviewer.cc
branches/itanium2/scenes/primtest.cc
Log:
Core/Geometry/BBox.h
Include PointVector.h to get it to compile.
Core/Math/ipow.h
Add float version of ipow.
Interface/Camera.h
Model/Cameras/EnvironmentCamera.cc
Model/Cameras/EnvironmentCamera.h
Model/Cameras/FisheyeCamera.cc
Model/Cameras/FisheyeCamera.h
Model/Cameras/OrthogonalCamera.cc
Model/Cameras/OrthogonalCamera.h
Model/Cameras/PinholeCamera.cc
Model/Cameras/PinholeCamera.h
Model/Cameras/StereoPinholeCamera.cc
Model/Cameras/StereoPinholeCamera.h
Camera::autoview now takes a BBox instead of a field of view. This
function should work as stated for the Pinhole cameras. The
OrthogonalCamera doesn't adjust the scaling to put the geometry in
view, and there seems to be a little weirdness on the FisheyeCamera.
Model/Materials/Phong.cc
Model/Materials/Phong.h
Use ColorComponent instead of Real for as much of the color
computation as possible.
StandAlone/manta.cc
Updates for Phong Real => ColorComponent change.
Added -bbcamera option that calls autoview on the camera before
rendering.
Creating the default channel now happens after creating the default
scene and doing the autoview on the camera.
UserInterface/XWindowUI.cc
Updates for change in API for Camera::autoview. We now computing
the bounding box for the scene and give that to autoview() when "v"
is pressed.
fox/dm_demo.cc
scenes/boeing777.cc
scenes/primtest.cc
Updates for Phong's Real => ColorComponent change.
scenes/objviewer.cc
Got rid of some extra white space.
Modified: branches/itanium2/Core/Geometry/BBox.h
==============================================================================
--- branches/itanium2/Core/Geometry/BBox.h (original)
+++ branches/itanium2/Core/Geometry/BBox.h Thu Oct 20 15:32:09 2005
@@ -2,6 +2,7 @@
#ifndef Manta_Core_BBox_h
#define Manta_Core_BBox_h
+#include <Core/Geometry/PointVector.h>
#include <SCIRun/Core/Math/MiscMath.h>
#include <sgi_stl_warnings_off.h>
Modified: branches/itanium2/Core/Math/ipow.h
==============================================================================
--- branches/itanium2/Core/Math/ipow.h (original)
+++ branches/itanium2/Core/Math/ipow.h Thu Oct 20 15:32:09 2005
@@ -8,9 +8,21 @@
double result=1;
while(p){
if(p&1)
- result*=x;
+ result*=x;
x*=x;
- p>>=1;
+ p>>=1;
+ }
+ 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;
}
Modified: branches/itanium2/Interface/Camera.h
==============================================================================
--- branches/itanium2/Interface/Camera.h (original)
+++ branches/itanium2/Interface/Camera.h Thu Oct 20 15:32:09 2005
@@ -3,7 +3,11 @@
#define Manta_Interface_Camera_h
#include <MantaTypes.h>
+#include <Core/Geometry/BBox.h>
+
+#include <sgi_stl_warnings_off.h>
#include <ostream>
+#include <sgi_stl_warnings_on.h>
namespace Manta {
class RayPacket;
@@ -35,7 +39,7 @@
Origin
};
virtual void transform(AffineTransform t, TransformCenter) = 0;
- virtual void autoview(Real fov) = 0;
+ virtual void autoview(const BBox bbox) = 0;
virtual void output( std::ostream &os ) { /* Default does
nothing. */ }; // Output a text description of the camera's state.
private:
Camera(const Camera&);
Modified: branches/itanium2/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/EnvironmentCamera.cc (original)
+++ branches/itanium2/Model/Cameras/EnvironmentCamera.cc Thu Oct 20
15:32:09 2005
@@ -168,7 +168,7 @@
setup();
}
-void EnvironmentCamera::autoview(Real /*new_fov*/)
+void EnvironmentCamera::autoview(const BBox /*bbox*/)
{
// This functionality doesn't make much sense with the environment camera
}
Modified: branches/itanium2/Model/Cameras/EnvironmentCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/EnvironmentCamera.h (original)
+++ branches/itanium2/Model/Cameras/EnvironmentCamera.h Thu Oct 20 15:32:09
2005
@@ -26,7 +26,7 @@
virtual void translate(Vector);
virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(Real fov);
+ virtual void autoview(const BBox bbox);
virtual Point project(const Point &point) const; // project a 3D point
to the camera image plane
static Camera* create(const vector<string>& args);
Modified: branches/itanium2/Model/Cameras/FisheyeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/FisheyeCamera.cc (original)
+++ branches/itanium2/Model/Cameras/FisheyeCamera.cc Thu Oct 20 15:32:09
2005
@@ -160,20 +160,26 @@
setup();
}
-void FisheyeCamera::autoview(Real new_fov)
+void FisheyeCamera::autoview(const BBox bbox)
{
- BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- hfov = new_fov;
- vfov = new_fov;
+ output(cerr);
Vector diag(bbox.diagonal());
Real w=diag.length();
Vector lookdir(eye-lookat);
lookdir.normalize();
- Real scale = 1/(2*tan(DtoR(hfov/2)));
+ Real scale = 1/(2*tan(DtoR(hfov*45)));
Real length = w*scale;
lookat = bbox.center();
eye = lookat+lookdir*length;
setup();
+}
+
+void FisheyeCamera::output( std::ostream &os ) {
+ os << "fisheye( -eye " << eye
+ << " -lookat " << lookat
+ << " -up " << up
+ << " -fov " << hfov*90 << " )"
+ << std::endl;
}
Point FisheyeCamera::project(const Point& /*point*/) const
Modified: branches/itanium2/Model/Cameras/FisheyeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/FisheyeCamera.h (original)
+++ branches/itanium2/Model/Cameras/FisheyeCamera.h Thu Oct 20 15:32:09
2005
@@ -17,9 +17,14 @@
void setup();
public:
FisheyeCamera(const vector<string>& args);
- FisheyeCamera( const Point &eye_, const Point &lookat_, const Vector
&up_, double hfov_ = 60.0 ) :
- eye( eye_ ), up( up_ ), lookat( lookat_ ), hfov( hfov_ ) { setup();
hfov = hfov / 90; };
-
+ FisheyeCamera( const Point &eye_, const Point &lookat_, const Vector
&up_,
+ Real hfov_ = 60 ) :
+ eye( eye_ ), up( up_ ), lookat( lookat_ ), hfov( hfov_ )
+ {
+ setup();
+ hfov = hfov / 90;
+ };
+
virtual ~FisheyeCamera();
virtual void makeRays(RayPacket&) const;
@@ -28,7 +33,8 @@
virtual void translate(Vector);
virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(Real fov);
+ virtual void autoview(const BBox bbox);
+ virtual void output( std::ostream &os );
virtual Point project(const Point &point) const; // project a 3D point
to the camera image plane
static Camera* create(const vector<string>& args);
Modified: branches/itanium2/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/OrthogonalCamera.cc (original)
+++ branches/itanium2/Model/Cameras/OrthogonalCamera.cc Thu Oct 20 15:32:09
2005
@@ -62,7 +62,7 @@
direction=lookat-eye;
direction.normalize();
v=Cross(direction, up);
- if(v.length2() == 0.0){
+ if(v.length2() == 0){
cerr << "Ambiguous up direction...\n";
}
v.normalize();
@@ -144,11 +144,9 @@
setup();
}
-void OrthogonalCamera::autoview(Real new_fov)
+void OrthogonalCamera::autoview(const BBox bbox)
{
- BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- hscale = new_fov;
- vscale = new_fov;
+ output(cerr);
Vector diag(bbox.diagonal());
Real w=diag.length();
Vector lookdir(eye-lookat);
@@ -156,6 +154,14 @@
lookat = bbox.center();
eye = lookat+lookdir*w;
setup();
+}
+
+void OrthogonalCamera::output( std::ostream &os ) {
+ os << "orthogonal( -eye " << eye
+ << " -lookat " << lookat
+ << " -up " << up
+ << " -scale " << hscale << " )"
+ << std::endl;
}
Point OrthogonalCamera::project(const Point& /*point*/) const
Modified: branches/itanium2/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/OrthogonalCamera.h (original)
+++ branches/itanium2/Model/Cameras/OrthogonalCamera.h Thu Oct 20 15:32:09
2005
@@ -24,7 +24,8 @@
virtual void translate(Vector);
virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(Real fov);
+ virtual void autoview(const BBox bbox);
+ virtual void output( std::ostream &os );
virtual Point project(const Point &point) const;
static Camera* create(const vector<string>& args);
Modified: branches/itanium2/Model/Cameras/PinholeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.cc (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.cc Thu Oct 20 15:32:09
2005
@@ -210,12 +210,8 @@
setup();
}
-void PinholeCamera::autoview(Real new_fov)
+void PinholeCamera::autoview(const BBox bbox)
{
- BBox bbox(Point(-1,-1,(Real)0.2), Point(1,1,(Real)2.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());
Real w=diag.length();
Vector lookdir(eye-lookat);
Modified: branches/itanium2/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.h (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.h Thu Oct 20 15:32:09
2005
@@ -25,7 +25,7 @@
virtual void translate(Vector);
virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(Real fov);
+ virtual void autoview(const BBox bbox);
virtual void output( std::ostream &os );
virtual Point project(const Point &point) const; // project a 3D
point to the camera image plane
static Camera* create(const vector<string>& args);
Modified: branches/itanium2/Model/Cameras/StereoPinholeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/StereoPinholeCamera.cc (original)
+++ branches/itanium2/Model/Cameras/StereoPinholeCamera.cc Thu Oct 20
15:32:09 2005
@@ -247,11 +247,8 @@
setup();
}
-void StereoPinholeCamera::autoview(Real new_fov)
+void StereoPinholeCamera::autoview(const BBox bbox)
{
- BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
- hfov = new_fov;
- vfov = RtoD(2*atan(tan(DtoR(hfov/2))));
Vector diag(bbox.diagonal());
Real w=diag.length();
Vector lookdir(eye-lookat);
Modified: branches/itanium2/Model/Cameras/StereoPinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/StereoPinholeCamera.h (original)
+++ branches/itanium2/Model/Cameras/StereoPinholeCamera.h Thu Oct 20
15:32:09 2005
@@ -43,7 +43,7 @@
virtual void translate(Vector);
virtual void dolly(Real);
virtual void transform(AffineTransform t, TransformCenter);
- virtual void autoview(Real fov);
+ virtual void autoview(const BBox bbox);
virtual void output( std::ostream &os );
virtual Point project(const Point &point) const; // project a 3D
point to the camera image plane
Modified: branches/itanium2/Model/Materials/Phong.cc
==============================================================================
--- branches/itanium2/Model/Materials/Phong.cc (original)
+++ branches/itanium2/Model/Materials/Phong.cc Thu Oct 20 15:32:09 2005
@@ -14,24 +14,25 @@
using namespace Manta;
-Phong::Phong(const Color& diffuse, const Color& specular, int specpow,
- Real refl)
+Phong::Phong(const Color& diffuse, const Color& specular,
+ int specpow, ColorComponent refl)
: specpow(specpow)
{
diffusetex = new Constant<Color>(diffuse);
speculartex = new Constant<Color>(specular);
- refltex = new Constant<Real>(refl);
+ refltex = new Constant<ColorComponent>(refl);
do_refl = (refl != 0);
}
Phong::Phong(const Texture<Color>* diffusetex,
- const Texture<Color>* speculartex,
- int specpow, const Texture<Real>* refltex)
+ const Texture<Color>* speculartex,
+ int specpow, const Texture<ColorComponent>* refltex)
: diffusetex(diffusetex), speculartex(speculartex), refltex(refltex),
specpow(specpow)
{
do_refl=true;
- const Constant<Real>* rtest = dynamic_cast<const Constant<Real>*>(refltex);
+ const Constant<ColorComponent>* rtest =
+ dynamic_cast<const Constant<ColorComponent>*>(refltex);
if(rtest && rtest->getValue() == 0)
do_refl =false;
}
@@ -52,8 +53,6 @@
diffusetex->mapValues(context, rays, diffuse);
Color specular[RayPacket::MaxSize];
speculartex->mapValues(context, rays, specular);
- Real refl[RayPacket::MaxSize];
- refltex->mapValues(context, rays, refl);
// Compute normals
rays.computeNormals(context);
@@ -67,40 +66,44 @@
RayPacket shadowRays(data, 0, rays.getDepth(), 0);
int end = context.shadowAlgorithm->computeShadows(context, activeLights,
rays, start,
shadowRays);
-
+
rays.normalizeDirections();
for(int i=start;i<end;i++){
- RayPacket::Element& e = rays.get(i);
- Color totalDiffuse(e.ambientLight);
- Color totalSpecular = Color::black();
- for(int j=e.shadowBegin;j<e.shadowEnd;j++){
- RayPacket::Element& s = shadowRays.get(j);
- if(!s.hitInfo.wasHit()){
- Real cos_theta = Dot(s.ray.direction(), e.normal);
- totalDiffuse += s.light*cos_theta;
- Vector H = s.ray.direction()-e.ray.direction();
- Real cos_alpha = Dot(H, e.normal);
- if(cos_alpha > 0){
- Real length = H.length();
- totalSpecular += s.light * ipow(cos_alpha/length, specpow);
- }
- }
- }
- rays.setResult(i, diffuse[i]*totalDiffuse+specular[i]*totalSpecular);
+ RayPacket::Element& e = rays.get(i);
+ Color totalDiffuse(e.ambientLight);
+ Color totalSpecular = Color::black();
+ for(int j=e.shadowBegin;j<e.shadowEnd;j++){
+ RayPacket::Element& s = shadowRays.get(j);
+ if(!s.hitInfo.wasHit()){
+ ColorComponent cos_theta = Dot(s.ray.direction(), e.normal);
+ totalDiffuse += s.light*cos_theta;
+ Vector H = s.ray.direction()-e.ray.direction();
+ ColorComponent cos_alpha = Dot(H, e.normal);
+ if(cos_alpha > 0){
+ ColorComponent length = H.length();
+ totalSpecular += s.light * ipow(cos_alpha/length, specpow);
+ }
+ }
}
+ rays.setResult(i, diffuse[i]*totalDiffuse+specular[i]*totalSpecular);
+ }
start = end;
} while(start < rays.getSize());
// Compute reflections
if(do_refl && rays.getDepth() <
context.scene->getRenderParameters().maxDepth){
+ ColorComponent refl[RayPacket::MaxSize];
+ refltex->mapValues(context, rays, refl);
+
rays.computeHitPositions();
RayPacketData rdata;
RayPacket refl_rays(rdata, rays.getSize(), rays.getDepth()+1,
- RayPacket::NormalizedDirections);
+ RayPacket::NormalizedDirections);
refl_rays.useLocalColors();
for(int i=0;i<rays.getSize();i++){
RayPacket::Element& e = rays.get(i);
- Vector refl_dir = e.ray.direction() - e.normal*(2*Dot(e.normal,
e.ray.direction()));
+ Vector refl_dir = (e.ray.direction() -
+ e.normal*(2*Dot(e.normal, e.ray.direction() )));
RayPacket::Element& r = refl_rays.get(i);
r.ray.set(e.hitPosition, refl_dir);
}
Modified: branches/itanium2/Model/Materials/Phong.h
==============================================================================
--- branches/itanium2/Model/Materials/Phong.h (original)
+++ branches/itanium2/Model/Materials/Phong.h Thu Oct 20 15:32:09 2005
@@ -14,15 +14,17 @@
public:
// Note if refl == 0 the phong shader won't cast a reflected
ray.
- Phong(const Color& diffuse, const Color& specular, int specpow, Real
refl = 0);
- Phong(const Texture<Color>* diffuse, const Texture<Color>* specular, int
specpow, const Texture<Real>* refl);
+ Phong(const Color& diffuse, const Color& specular,
+ int specpow, ColorComponent refl = 0);
+ Phong(const Texture<Color>* diffuse, const Texture<Color>* specular,
+ int specpow, const Texture<ColorComponent>* refl);
virtual ~Phong();
virtual void shade(const RenderContext& context, RayPacket& rays) const;
private:
const Texture<Color>* diffusetex;
const Texture<Color>* speculartex;
- const Texture<Real>* refltex;
+ const Texture<ColorComponent>* refltex;
int specpow;
bool do_refl;
};
Modified: branches/itanium2/StandAlone/manta.cc
==============================================================================
--- branches/itanium2/StandAlone/manta.cc (original)
+++ branches/itanium2/StandAlone/manta.cc Thu Oct 20 15:32:09 2005
@@ -4,7 +4,11 @@
#include <Core/Util/Args.h>
#include <Interface/Callback.h>
#include <Interface/Scene.h>
+#include <Interface/Object.h>
+#include <Interface/Camera.h>
#include <Interface/UserInterface.h>
+#include <Interface/Context.h>
+#include <Core/Geometry/BBox.h>
#include <Core/Exceptions/Exception.h>
#include <Core/Exceptions/InternalError.h>
#include <Core/Thread/Time.h>
@@ -62,11 +66,12 @@
printList(cerr, rtrt->listPixelSamplers(), 4);
cerr << " -camera S - User camera model S, valid cameras are:\n";
printList(cerr, rtrt->listCameras(), 4);
-#if NOTFINISHED
+ cerr << " -bbcamera - Positions the lookat in the center of the\n";
+ cerr << " scene, and the eye point far enough away to\n";
+ cerr << " see the entire scene.\n";
cerr << " -renderer S - Use renderer S, valid renderers are:\n";
printList(cerr, rtrt->listRenderers(), 2);
cerr << " -scene S - Render Scene S\n";
-#endif
exit(1);
}
@@ -140,7 +145,8 @@
bool channelCreated=false;
bool stereo = false;
bool haveUI = false;
-
+ bool compute_bb_camera = false;
+
int argc = static_cast<int>(args.size());
for(int i=0;i<argc;i++){
string arg = args[i];
@@ -169,6 +175,8 @@
printList(cerr, rtrt->listCameras());
exit(1);
}
+ } else if(arg == "-bbcamera"){
+ compute_bb_camera = true;
} else if(arg == "-idlemode"){
string s;
if(!getStringArg(i, args, s))
@@ -290,13 +298,19 @@
exit(1);
}
ui->startup();
- }
- if(!channelCreated){
- rtrt->createChannel("opengl", currentCamera, stereo, xres, yres);
}
if(!rtrt->haveScene()){
rtrt->setScene(createDefaultScene());
}
+ if(compute_bb_camera) {
+ BBox bbox;
+ PreprocessContext ppc;
+ rtrt->getScene()->getObject()->computeBounds(ppc, bbox);
+ currentCamera->autoview(bbox);
+ }
+ if(!channelCreated){
+ rtrt->createChannel("opengl", currentCamera, stereo, xres, yres);
+ }
rtrt->beginRendering(true);
delete rtrt;
} catch (SCIRun::Exception *e) {
@@ -326,6 +340,7 @@
#include <Model/Textures/Constant.h>
#include <Model/Textures/CheckerTexture.h>
#include <Model/Materials/Phong.h>
+#include <Model/Materials/Flat.h>
#include <Model/Groups/Group.h>
#include <Model/Primitives/Parallelogram.h>
#include <Model/Primitives/Sphere.h>
@@ -338,7 +353,7 @@
Scene* scene = new Scene();
scene->setBackground(new
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")*0.5));
Material* red=new Phong(Color(RGBColor(.6,0,0)),
- Color(RGBColor(.6,.6,.6)), 32, 0.4);
+ Color(RGBColor(.6,.6,.6)), 32,
(ColorComponent)0.4);
Material* plane_matl = new Phong(new
CheckerTexture<Color>(Color(RGBColor(.6,.6,.6)),
Color(RGBColor(0,0,0)),
@@ -346,10 +361,11 @@
Vector(0,1,0)),
new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
32,
-
new
CheckerTexture<Real>((Real)0.2,
- (Real)0.5,
- Vector(1,0,0),
- Vector(0,1,0)));
+
new
CheckerTexture<ColorComponent>
+ ((ColorComponent)0.2,
+ (ColorComponent)0.5,
+ Vector(1,0,0),
+ Vector(0,1,0)));
Group* world = new Group();
@@ -359,6 +375,7 @@
UniformMapper* uniformmap = new UniformMapper();
floor->setTexCoordMapper(uniformmap);
world->add(floor);
+ // red = new Flat(Color(RGBColor(1,0.1,0.2)));
world->add(new Sphere(red, Point(0,0,1.2), 1.0));
scene->setObject(world);
Modified: branches/itanium2/UserInterface/XWindowUI.cc
==============================================================================
--- branches/itanium2/UserInterface/XWindowUI.cc (original)
+++ branches/itanium2/UserInterface/XWindowUI.cc Thu Oct 20 15:32:09
2005
@@ -5,6 +5,8 @@
#include <Interface/RTRTInterface.h>
#include <Interface/Transaction.h>
#include <Interface/XWindow.h>
+#include <Interface/Scene.h>
+#include <Interface/Object.h>
#include <Core/Exceptions/ErrnoException.h>
#include <Core/Exceptions/InternalError.h>
#include <Core/Geometry/AffineTransform.h>
@@ -12,6 +14,7 @@
#include <Core/Math/Trig.h>
#include <Core/Thread/Runnable.h>
#include <Core/Thread/Thread.h>
+#include <Core/Geometry/BBox.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <errno.h>
@@ -455,9 +458,12 @@
void XWindowUI::autoview(unsigned int, unsigned long, int channel)
{
Camera* camera = rtrt_interface->getCamera(channel);
+ BBox bbox;
+ PreprocessContext ppc;
+ rtrt_interface->getScene()->getObject()->computeBounds(ppc, bbox);
rtrt_interface->addTransaction("autoview",
Callback::create(camera, &Camera::autoview,
- autoview_fov));
+ bbox));
}
void XWindowUI::output_camera(unsigned int, unsigned long, int channel)
Modified: branches/itanium2/fox/dm_demo.cc
==============================================================================
--- branches/itanium2/fox/dm_demo.cc (original)
+++ branches/itanium2/fox/dm_demo.cc Thu Oct 20 15:32:09 2005
@@ -390,7 +390,7 @@
Scene* scene = new Scene();
scene->setBackground(new
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")*0.5));
Material* red=new Phong(Color(RGBColor(.6,0,0)),
- Color(RGBColor(.6,.6,.6)), 32, 0.4);
+ Color(RGBColor(.6,.6,.6)), 32,
(ColorComponent)0.4);
Material* plane_matl = new Phong(new
CheckerTexture<Color>(Color(RGBColor(.6,.6,.6)),
Color(RGBColor(0,0,0)),
@@ -398,10 +398,11 @@
Vector(0,1,0)),
new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
32,
-
new
CheckerTexture<Real>((Real)0.2,
- (Real)0.5,
-
Vector(1,0,0),
-
Vector(0,1,0)));
+
new
CheckerTexture<ColorComponent>
+ ((ColorComponent)0.2,
+ (ColorComponent)0.5,
+ Vector(1,0,0),
+ Vector(0,1,0)));
Group* world = new Group();
Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc (original)
+++ branches/itanium2/scenes/boeing777.cc Thu Oct 20 15:32:09 2005
@@ -93,7 +93,7 @@
Real ambient_dist = 5;
int ambient_rays = 16;
int phong_exp = 512;
- Real phong_reflect = 0;
+ ColorComponent phong_reflect = 0;
bool use_transparency = false;
@@ -121,7 +121,7 @@
}
else if (args[i] == "-phong") {
material_type = MTL_PHONG;
- if (!getIntArg(i, args, phong_exp) || !getArg<Real>(i, args,
phong_reflect)) {
+ if (!getIntArg(i, args, phong_exp) || !getArg<ColorComponent>(i, args,
phong_reflect)) {
throw IllegalArgument("boeing777 -phong <exp> <reflection>", i,
args);
}
}
@@ -176,7 +176,7 @@
kd_material = new Phong( new KDTreeTexture,
new Constant<Color>(Color::white()),
phong_exp,
- new Constant<Real>(phong_reflect) );
+ new Constant<ColorComponent>(phong_reflect) );
break;
};
Modified: branches/itanium2/scenes/objviewer.cc
==============================================================================
--- branches/itanium2/scenes/objviewer.cc (original)
+++ branches/itanium2/scenes/objviewer.cc Thu Oct 20 15:32:09 2005
@@ -83,7 +83,7 @@
bvh = create_single_bvh( model );
else
bvh = create_bvh_meshs( model );
-
+
/////////////////////////////////////////////////////////////////////////////
// Create the scene.
Scene *scene = new Scene();
Modified: branches/itanium2/scenes/primtest.cc
==============================================================================
--- branches/itanium2/scenes/primtest.cc (original)
+++ branches/itanium2/scenes/primtest.cc Thu Oct 20 15:32:09 2005
@@ -99,7 +99,8 @@
int max = SCIRun::Max(numx, numy);
if(material == "redphong")
- matl=new Phong(Color(RGB(.6,0,0)), Color(RGB(.6,.6,.6)), 32, 0.4);
+ matl=new Phong(Color(RGB(.6,0,0)), Color(RGB(.6,.6,.6)),
+ 32, (ColorComponent)0.4);
else if(material == "redlambertian")
matl=new Lambertian(Color(RGB(.6,0,0)));
else if(material == "metal")
@@ -111,7 +112,7 @@
Vector(0,1,0)*texscale),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new Constant<Real>(0));
+ new Constant<ColorComponent>(0));
else if(material == "checker2")
matl = new Phong(new CheckerTexture<Color>(Color(RGB(.6,.6,.6)),
Color(RGB(.6,0,0)),
@@ -119,12 +120,14 @@
Vector(0,1,0)*texscale),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new CheckerTexture<Real>(0.2, 0.5,
- Vector(1,0,0)*texscale,
- Vector(0,1,0)*texscale));
+ new CheckerTexture<ColorComponent>
+ ((ColorComponent)0.2,
+ (ColorComponent)0.5,
+ Vector(1,0,0)*texscale,
+ Vector(0,1,0)*texscale));
else if(material == "checker3")
- matl = new Checker(new Phong(Color(RGB(.6,.6,.6)), Color(RGB(.6,.6,.6)),
32, 0.2),
- new Phong(Color(RGB(.6,0,0)), Color(RGB(.6,.6,.6)),
32, 0.5),
+ matl = new Checker(new Phong(Color(RGB(.6,.6,.6)), Color(RGB(.6,.6,.6)),
32, (ColorComponent)0.2),
+ new Phong(Color(RGB(.6,0,0)), Color(RGB(.6,.6,.6)),
32, (ColorComponent)0.5),
Vector(1,0,0)*texscale, Vector(0,1,0)*texscale);
else if(material == "marble")
{
@@ -134,7 +137,7 @@
10.0, 1.0, 15.0, 6, 2.0, 0.6 ),
new Constant<Color>(Color(RGB(.6,.6,.6))),
32,
- new Constant<Real>(0));
+ new Constant<ColorComponent>(0));
mapr = new UniformMapper();
}
else if(material == "wood")
- [MANTA] r639 - in branches/itanium2: Core/Geometry Core/Math Interface Model/Cameras Model/Materials StandAlone UserInterface fox scenes, bigler, 10/20/2005
Archive powered by MHonArc 2.6.16.