Bläddra i källkod

*** empty log message ***

David Rose 24 år sedan
förälder
incheckning
fc07879f44

+ 4 - 3
pandaapp/src/stitch/Sources.pp

@@ -4,7 +4,8 @@
     stitchbase
   #define OTHER_LIBS \
     progbase \
-    linmath:c putil:c express:c panda:m pandaexpress:m pystub dtoolconfig dtool
+    pnmimage:c mathutil:c linmath:c putil:c panda:m \
+    express:c pandaexpress:m pystub dtoolconfig dtool
 
   #define SOURCES \
     stitchCommandProgram.cxx stitchCommandProgram.h
@@ -19,8 +20,8 @@
     stitchbase
   #define OTHER_LIBS \
     progbase \
-    pnmimagetypes:c pnmimage:c linmath:c putil:c express:c panda:m \
-    pandaexpress:m pystub dtoolconfig dtool
+    pnmimagetypes:c pnmimage:c linmath:c putil:c panda:m \
+    express:c pandaexpress:m pystub dtoolconfig dtool
 
   #define SOURCES \
     stitchImageProgram.cxx stitchImageProgram.h

+ 2 - 2
pandaapp/src/stitchbase/stitchCommand.cxx

@@ -599,8 +599,8 @@ create_image() {
   }
 
   StitchImage *image = 
-    new StitchImage(get_name(), filename, lens, size_pixels, film_offset_mm,
-		    resolution);
+    new StitchImage(get_name(), filename, lens, size_pixels, resolution,
+		    film_offset_mm);
   image->setup_grid(50, 50);
 
   // Also look for points and other stuff.

+ 5 - 5
pandaapp/src/stitchbase/stitchImage.cxx

@@ -38,9 +38,9 @@ StitchImage(const string &name, const string &filename,
   // _size_pixels[1] - 1) at the lower-right.
 
   // Millimeters are used when interfacing with the lens.  They start
-  // at -film_offset_mm at the center, and range from
-  // -film_offset_mm-size_mm at the lower-left, to
-  // -film_offset_mm+size_mm at the upper-right.
+  // at film_offset_mm at the center, and range from
+  // film_offset_mm-size_mm at the lower-left, to
+  // film_offset_mm+size_mm at the upper-right.
 
   LVector2d pixels_per_uv(_size_pixels[0] - 1.0, _size_pixels[1] - 1.0);
 
@@ -68,10 +68,10 @@ StitchImage(const string &name, const string &filename,
   _uv_to_mm = 
     LMatrix3d::translate_mat(LVector2d(-0.5, -0.5)) *
     LMatrix3d::scale_mat(mm_per_uv) *
-    LMatrix3d::translate_mat(-_film_offset_mm);
+    LMatrix3d::translate_mat(_film_offset_mm);
 
   _mm_to_uv =
-    LMatrix3d::translate_mat(_film_offset_mm) *
+    LMatrix3d::translate_mat(-_film_offset_mm) *
     LMatrix3d::scale_mat(1.0 / mm_per_uv[0], 1.0 / mm_per_uv[1]) *
     LMatrix3d::translate_mat(LVector2d(0.5, 0.5) + _film_offset_mm);
 

+ 11 - 6
pandaapp/src/stitchviewer/stitchImageVisualizer.cxx

@@ -6,6 +6,7 @@
 #include "stitchImageVisualizer.h"
 #include "config_stitch.h"
 #include "triangleMesh.h"
+#include "stitchLens.h"
 
 #include <luse.h>
 #include <chancfg.h>
@@ -25,6 +26,8 @@
 #include <clockObject.h>
 #include <config_gobj.h>
 #include <allAttributesWrapper.h>
+#include <renderRelation.h>
+#include <dataRelation.h>
 
 #include <algorithm>
 
@@ -177,7 +180,7 @@ setup() {
   _main_win = ChanConfig(_main_pipe, chan_cfg, _cameras, _render, override);
   assert(_main_win != (GraphicsWindow*)0L);
 
-  // Turn on culling.
+  // Turn on backface culling.
   CullFaceAttribute *cfa = new CullFaceAttribute;
   cfa->set_mode(CullFaceProperty::M_cull_clockwise);
   _initial_state.set_attribute(CullFaceTransition::get_class_type(), cfa);
@@ -187,21 +190,21 @@ setup() {
 
   // Create a mouse and put it in the data graph.
   _mak = new MouseAndKeyboard(_main_win, 0);
-  new RenderRelation(_data_root, _mak);
+  new DataRelation(_data_root, _mak);
 
   // Create a trackball to handle the mouse input.
   _trackball = new Trackball("trackball");
 
-  new RenderRelation(_mak, _trackball);
+  new DataRelation(_mak, _trackball);
 
   // Connect the trackball output to the camera's transform.
   PT(Transform2SG) tball2cam = new Transform2SG("tball2cam");
   tball2cam->set_arc(cam_trans);
-  new RenderRelation(_trackball, tball2cam);
+  new DataRelation(_trackball, tball2cam);
   
   // Create an ButtonThrower to throw events from the keyboard.
   PT(ButtonThrower) et = new ButtonThrower("kb-events");
-  new RenderRelation(_mak, et);
+  new DataRelation(_mak, et);
 
   // Create all the images.
   Images::iterator ii;
@@ -253,7 +256,9 @@ create_image_geometry(StitchImageVisualizer::Image &im) {
   int y_verts = 2;
   TriangleMesh mesh(x_verts, y_verts);
 
-  LVector3f center = LCAST(float, im._image->extrude(LPoint2d(0.5, 0.5)));
+  StitchLens *lens = im._image->_lens;
+  LVector3d center = 
+    lens->extrude(LPoint2d(0.0, 0.0), im._image->_size_mm[0]);
   double scale = 10.0 / length(center);
 
   for (int xi = 0; xi < x_verts; xi++) {