Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r397 - in branches/itanium2: Interface Model/Cameras Model/Lights fox scenes
- Date: Mon, 20 Jun 2005 15:24:20 -0600 (MDT)
Author: abe
Date: Mon Jun 20 15:24:13 2005
New Revision: 397
Modified:
branches/itanium2/Interface/Camera.h
branches/itanium2/Model/Cameras/EnvironmentCamera.h
branches/itanium2/Model/Cameras/OrthogonalCamera.h
branches/itanium2/Model/Cameras/PinholeCamera.h
branches/itanium2/Model/Lights/HeadLight.cc
branches/itanium2/Model/Lights/HeadLight.h
branches/itanium2/fox/FMantaNavigator.h
branches/itanium2/fox/FMantaQuakeNav.cc
branches/itanium2/fox/FMantaQuakeNav.h
branches/itanium2/fox/FMantaUniformNav.cc
branches/itanium2/fox/FMantaUniformNav.h
branches/itanium2/fox/fox_manta.cc
branches/itanium2/scenes/boeing777.cc
Log:
M scenes/boeing777.cc
M fox/FMantaUniformNav.cc
M fox/fox_manta.cc
M fox/FMantaUniformNav.h
M fox/FMantaQuakeNav.cc
M fox/FMantaNavigator.h
M fox/FMantaQuakeNav.h
Simple modifications to demo. Still need to be done:
1.) Stable camera navigation that someone from marketing can control.
2.) Cutting plane widget in gui.
3.) File->open to load dataset.
4.) Adding current camera to the bookmark list.
5.) Selecting a new look-at location and rotating around it (Would be cool
but will take some time.)
M Model/Lights/HeadLight.h
M Model/Lights/HeadLight.cc
M Model/Cameras/EnvironmentCamera.h
M Model/Cameras/OrthogonalCamera.h
M Model/Cameras/PinholeCamera.h
M Interface/Camera.h
Modified the camera interface. We probably need to think about this interface
in broader terms then I have.
Modified: branches/itanium2/Interface/Camera.h
==============================================================================
--- branches/itanium2/Interface/Camera.h (original)
+++ branches/itanium2/Interface/Camera.h Mon Jun 20 15:24:13 2005
@@ -19,9 +19,14 @@
virtual void dolly(double) = 0;
// Accessors
- virtual const Point &getPosition() const = 0; // This method
is called to get the "location" by HeadLight etc.
+ virtual Point getPosition() const = 0; // This method is
called to get the eye point by HeadLight etc.
+ virtual Vector getUp() const = 0; // This method
returns the "horizontal center of rotation" about the camera.
+ virtual Point getLookAt() const = 0; // This method
returns the "center of rotation point" about the look at point.
- virtual Point project(const Point &point) = 0; // project the 3D
point on to the camera image plane
+ // Reset the camera.
+ virtual void reset( const Point &eye_, const Vector &up_,
const Point &lookat_ ) = 0;
+
+ virtual Point project(const Point &point) = 0; // project the
3D point on to the camera image plane
enum TransformCenter {
LookAt,
Eye,
Modified: branches/itanium2/Model/Cameras/EnvironmentCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/EnvironmentCamera.h (original)
+++ branches/itanium2/Model/Cameras/EnvironmentCamera.h Mon Jun 20 15:24:13
2005
@@ -27,8 +27,13 @@
virtual Point project(const Point &point); // project a 3D point to the
camera image plane
static Camera* create(const vector<string>& args);
- virtual const Point &getPosition() const { return eye; }
+ virtual Point getPosition() const { return eye; }
+ virtual Point getLookAt() const { return lookat; };
+ virtual Vector getUp() const { return up; };
+ virtual void reset( const Point &eye_, const Vector &up_,
const Point &lookat_ ) {
+ eye = eye_; up = up_; lookat = lookat_; setup(); };
+
private:
void setup();
Point eye;
Modified: branches/itanium2/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/OrthogonalCamera.h (original)
+++ branches/itanium2/Model/Cameras/OrthogonalCamera.h Mon Jun 20 15:24:13
2005
@@ -23,10 +23,15 @@
virtual void dolly(double);
virtual void transform(AffineTransform t, TransformCenter);
virtual void autoview(double fov);
- virtual Point project(const Point &point);
+ virtual Point project(const Point &point);
static Camera* create(const vector<string>& args);
- virtual const Point &getPosition() const { return eye; }
+ virtual Point getPosition() const { return eye; }
+ virtual Point getLookAt() const { return lookat; };
+ virtual Vector getUp() const { return up; };
+
+ virtual void reset( const Point &eye_, const Vector &up_,
const Point &lookat_ ) {
+ eye = eye_; up = up_; lookat = lookat_; setup(); };
private:
void setup();
Modified: branches/itanium2/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.h (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.h Mon Jun 20 15:24:13
2005
@@ -30,7 +30,12 @@
virtual Point project(const Point &point); // project a 3D point
to the camera image plane
static Camera* create(const vector<string>& args);
- virtual const Point &getPosition() const { return eye; }
+ virtual Point getPosition() const { return eye; }
+ virtual Point getLookAt() const { return lookat; };
+ virtual Vector getUp() const { return up; };
+
+ virtual void reset( const Point &eye_, const Vector &up_,
const Point &lookat_ ) {
+ eye = eye_; up = up_; lookat = lookat_; setup(); };
private:
void setup();
Modified: branches/itanium2/Model/Lights/HeadLight.cc
==============================================================================
--- branches/itanium2/Model/Lights/HeadLight.cc (original)
+++ branches/itanium2/Model/Lights/HeadLight.cc Mon Jun 20 15:24:13 2005
@@ -11,9 +11,10 @@
// Determine the camera position.
Point camera = context.camera->getPosition();
+ Vector up = context.camera->getUp();
// Determine light position.
- Point position = camera + offset;
+ Point position = camera + (up * offset);
// Finally compute light direction.
lightDirection = position - e.hitPosition;
Modified: branches/itanium2/Model/Lights/HeadLight.h
==============================================================================
--- branches/itanium2/Model/Lights/HeadLight.h (original)
+++ branches/itanium2/Model/Lights/HeadLight.h Mon Jun 20 15:24:13 2005
@@ -9,15 +9,15 @@
namespace Manta {
class HeadLight : public Light {
public:
- HeadLight(const Vector &offset_, const Color &color_) : offset( offset_
), color( color_ ) { };
+ HeadLight(const Real offset_, const Color &color_) : offset( offset_ ),
color( color_ ) { };
virtual void preprocess(const PreprocessContext&) { /* Does Nothing. */
};
virtual void computeLight( Color &resultColor, Vector
&lightDirection,
const RenderContext &context,
RayPacket::Element &e ) const;
private:
- Vector offset;
- Color color;
+ Real offset;
+ Color color;
};
}
Modified: branches/itanium2/fox/FMantaNavigator.h
==============================================================================
--- branches/itanium2/fox/FMantaNavigator.h (original)
+++ branches/itanium2/fox/FMantaNavigator.h Mon Jun 20 15:24:13 2005
@@ -19,18 +19,18 @@
// Manta interfaces.
RTRTInterface *manta_interface;
- Camera *manta_camera;
+ int manta_channel;
public:
- FMantaNavigator() : manta_interface( 0 ), manta_camera( 0 ) {
};
+ FMantaNavigator() : manta_interface( 0 ), manta_channel( 0 )
{ };
virtual ~FMantaNavigator() { };
// Accessors.
void setMantaInterface( RTRTInterface *manta_interface_ ) {
manta_interface = manta_interface_; };
- void setMantaCamera ( Camera *manta_camera_ )
{ manta_camera = manta_camera_; };
-
+ void setMantaChannel ( int manta_channel_ ) { manta_channel
= manta_channel_; };
+
RTRTInterface *getMantaInterface() { return manta_interface;
};
- Camera *getMantaCamera() { return manta_camera;
};
+ int getMantaChannel() { return manta_channel;
};
// Virtual interface.
virtual long onKeyPress ( FXObject *sender, FXSelector
sel, void *data ) = 0;
Modified: branches/itanium2/fox/FMantaQuakeNav.cc
==============================================================================
--- branches/itanium2/fox/FMantaQuakeNav.cc (original)
+++ branches/itanium2/fox/FMantaQuakeNav.cc Mon Jun 20 15:24:13 2005
@@ -10,6 +10,14 @@
using namespace fox_manta;
using namespace Manta;
+void FMantaQuakeNav::mantaAddTransaction() {
+
+ // Add the transaction to manta.
+ manta_interface->addTransaction("FMantaNavigator",
+
Callback::create(this, &FMantaQuakeNav::mantaThreadCallback ));
+
+};
+
///////////////////////////////////////////////////////////////////////////////
// Basic interaction with the class.
void FMantaQuakeNav::move( Real d ) {
@@ -98,9 +106,20 @@
affine_transform.rotate ( Vector(0.0,1.0,0.0), viewDirAngle );
affine_transform.translate( Vector( posX, height, posY ) );
+ // Get a pointer to the camera.
+ Camera *manta_camera = manta_interface->getCamera( manta_channel );
+
+ // Transform a default eye, up, and lookat.
+ Point eye ( 0.0, 0.0, 0.0 );
+ Point lookat( 0.0, -1.0, 0.0 );
+ Vector up ( 0.0, 0.0, 1.0 );
+
+ eye = affine_transform * eye;
+ lookat = affine_transform * lookat;
+ up = affine_transform * up;
+
// Apply it to the camera.
- // Potential problem: Camera isn't initialized with the Identity
matrix.
- manta_camera->transform( affine_transform, Camera::Origin );
+ manta_camera->reset( eye, up, lookat );
}
Modified: branches/itanium2/fox/FMantaQuakeNav.h
==============================================================================
--- branches/itanium2/fox/FMantaQuakeNav.h (original)
+++ branches/itanium2/fox/FMantaQuakeNav.h Mon Jun 20 15:24:13 2005
@@ -46,13 +46,7 @@
void tilt ( Real d );
- void mantaAddTransaction() {
-
- // Add the transaction to manta.
- manta_interface->addTransaction("FMantaNavigator",
- Callback::create(this,
&FMantaQuakeNav::mantaThreadCallback ));
-
- };
+ void mantaAddTransaction();
public:
// Constructor with default options.
Modified: branches/itanium2/fox/FMantaUniformNav.cc
==============================================================================
--- branches/itanium2/fox/FMantaUniformNav.cc (original)
+++ branches/itanium2/fox/FMantaUniformNav.cc Mon Jun 20 15:24:13 2005
@@ -40,11 +40,14 @@
bool action_occured = false;
Action action;
+ // Get a pointer to this channel's camera.
+ Camera *manta_camera = manta_interface->getCamera( manta_channel );
+
// Check to arrows.
switch (event->code) {
case KEY_Up:
if ((event->state & SHIFTMASK) == SHIFTMASK) {
- action.translation[1] = amount;
+ action.translation[1] = amount * 0.001;
action.type = Action::TRANSLATE;
}
else {
@@ -54,21 +57,29 @@
break;
case KEY_Down:
if ((event->state & SHIFTMASK) == SHIFTMASK) {
- action.translation[1] = -amount;
+ action.translation[1] = -amount * 0.001;
action.type = Action::TRANSLATE;
}
else {
- action.dolly = -amount;
+ action.dolly = -amount * 0.001;
action.type = Action::DOLLY;
}
break;
case KEY_Left:
- action.translation[0] = -amount;
- action.type = Action::TRANSLATE;
+ // action.translation[0] = -amount * 0.001;
+ // action.type = Action::TRANSLATE;
+
+ action.type = Action::ROTATE;
+ action.rotation.initWithRotation( manta_camera->getUp(),
0.01745 );
+
break;
case KEY_Right:
- action.translation[0] = amount;
- action.type = Action::TRANSLATE;
+ // action.translation[0] = amount * 0.001;
+ // action.type = Action::TRANSLATE;
+
+ action.type = Action::ROTATE;
+ action.rotation.initWithRotation( manta_camera->getUp(),
-0.01745 );
+
break;
};
@@ -113,8 +124,6 @@
-((Real)event->win_y-height)/height,
trackball_radius );
- std::cout << "Rotate from: " << rotate_from << std::endl;
-
break;
case SEL_LEFTBUTTONRELEASE:
mouse_down[0] = false;
@@ -166,9 +175,8 @@
action.type = Action::DOLLY;
action.dolly = ((Real) (event->win_x -
event->last_x))/(width+amount);
-
action.dolly *= amount;
-
+
mantaAddTransaction( action );
}
Modified: branches/itanium2/fox/FMantaUniformNav.h
==============================================================================
--- branches/itanium2/fox/FMantaUniformNav.h (original)
+++ branches/itanium2/fox/FMantaUniformNav.h Mon Jun 20 15:24:13 2005
@@ -38,9 +38,6 @@
};
};
- // Which manta channel to use.
- int manta_channel;
-
// Attributes.
Real amount; // Uniform amount to move.
Real trackball_radius; // Radius of trackball, 1.0 is half
width of window.
@@ -64,8 +61,7 @@
public:
FMantaUniformNav() : amount( 1.0 ),
trackball_radius( 1.0 ),
-
rotate_type( ROTATE_EYE ),
-
manta_channel( 0 ) {
+
rotate_type( ROTATE_EYE ) {
mouse_down[0] = mouse_down[1] = mouse_down[2] =
false; };
@@ -77,10 +73,8 @@
void mantaThreadCallback( Action action ) const;
// Accessors.
- void setMantaChannel( int manta_channel_ ) {
manta_channel = manta_channel_; };
- void setAmount( Real amount_ ) { amount =
amount_; };
void setTrackballRadius( Real trackball_radius_ ) {
trackball_radius = trackball_radius_; };
- void setControlSpeed( Real new_speed ) {
setAmount( new_speed ); };
+ void setControlSpeed( Real new_speed ) { amount =
new_speed; };
};
};
Modified: branches/itanium2/fox/fox_manta.cc
==============================================================================
--- branches/itanium2/fox/fox_manta.cc (original)
+++ branches/itanium2/fox/fox_manta.cc Mon Jun 20 15:24:13 2005
@@ -77,11 +77,8 @@
manta_interface->selectRenderer ( "raytracer" );
manta_interface->selectShadowAlgorithm( "hard" );
- Camera *camera = manta_interface->createCamera( "pinhole(-eye 1 1 1
-lookat 0 -1.0 0 -up 0 0 1 -fov 60)" );
- //Camera *camera = new PinholeCamera( Point ( 0.0, 2.0, 1.0 ),
- // Point ( 0.0, 0.0, 0.0 ),
- //
Vector( 0.0, 0.0, 1.0 ),
- //
60
);
+ // Camera *camera = manta_interface->createCamera( "pinhole(-eye 1 1
1 -lookat 0 -1.0 0 -up 0 0 1 -fov 60)" );
+ Camera *camera = new PinholeCamera( Point ( 0.0, 0.0, 0.0 ), Point (
0.0, -1.0, 0.0 ), Vector( 0.0, 0.0, 1.0 ), 60 );
// Create the manta image frame.
FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
@@ -92,12 +89,10 @@
// Create a navigator for the image frame.
FMantaQuakeNav *quake_nav = new FMantaQuakeNav();
- quake_nav->setMantaCamera( camera );
quake_nav->setMantaInterface( manta_interface );
// Create a uniform navigator.
FMantaUniformNav *uniform_nav = new FMantaUniformNav();
- uniform_nav->setMantaCamera( camera );
uniform_nav->setMantaInterface( manta_interface );
uniform_nav->setMantaChannel( 0 );
Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc (original)
+++ branches/itanium2/scenes/boeing777.cc Mon Jun 20 15:24:13 2005
@@ -125,7 +125,7 @@
LightSet *lights = new LightSet();
// lights->add( new PointLight( Point(5000,5000,5000),
Color(RGB(1.0,1.0,1.0)) ));
- lights->add( new HeadLight( Vector( 0.0, 1.0, 0.0 ),
Color(RGB(1.0,1.0,1.0)) ));
+ lights->add( new HeadLight( 2.0, Color(RGB(1.0,1.0,1.0)) ));
//lights->add( new PointLight( bounds.center() + Vector
- [MANTA] r397 - in branches/itanium2: Interface Model/Cameras Model/Lights fox scenes, abe, 06/20/2005
Archive powered by MHonArc 2.6.16.