Index: trunk/packages/vizservers/nanovis/VolumeRenderer.cpp
===================================================================
--- trunk/packages/vizservers/nanovis/VolumeRenderer.cpp	(revision 3452)
+++ trunk/packages/vizservers/nanovis/VolumeRenderer.cpp	(revision 3492)
@@ -23,9 +23,15 @@
 #include <tcl.h>
 
+#include <vrmath/Vector3f.h>
+#include <vrmath/Matrix4x4d.h>
+
 #include "nanovis.h"
 #include "VolumeRenderer.h"
+#include "Plane.h"
 #include "ConvexPolygon.h"
 #include "NvStdVertexShader.h"
 #include "Trace.h"
+
+using namespace vrmath;
 
 VolumeRenderer::VolumeRenderer()
@@ -142,6 +148,6 @@
 
         //volume start location
-        Vector3 volPos = volPtr->location();
-        Vector3 volScaling = volPtr->getPhysicalScaling();
+        Vector3f volPos = volPtr->location();
+        Vector3f volScaling = volPtr->getPhysicalScaling();
 
         TRACE("VOL POS: %g %g %g",
@@ -154,9 +160,9 @@
         double z0 = 0;
 
-        Mat4x4 model_view_no_trans, model_view_trans;
-        Mat4x4 model_view_no_trans_inverse, model_view_trans_inverse;
+        Matrix4x4d model_view_no_trans, model_view_trans;
+        Matrix4x4d model_view_no_trans_inverse, model_view_trans_inverse;
 
         //initialize volume plane with world coordinates
-        Plane volume_planes[6];
+        nv::Plane volume_planes[6];
         volume_planes[0].setCoeffs( 1,  0,  0, -x0);
         volume_planes[1].setCoeffs(-1,  0,  0,  x0+1);
@@ -172,8 +178,8 @@
         glEnable(GL_DEPTH_TEST);
 
-        GLfloat mv_no_trans[16];
-        glGetFloatv(GL_MODELVIEW_MATRIX, mv_no_trans);
-
-        model_view_no_trans = Mat4x4(mv_no_trans);
+        GLdouble mv_no_trans[16];
+        glGetDoublev(GL_MODELVIEW_MATRIX, mv_no_trans);
+
+        model_view_no_trans = Matrix4x4d(mv_no_trans);
         model_view_no_trans_inverse = model_view_no_trans.inverse();
 
@@ -185,9 +191,11 @@
         glScalef(volScaling.x, volScaling.y, volScaling.z);
 
-        GLfloat mv_trans[16];
-        glGetFloatv(GL_MODELVIEW_MATRIX, mv_trans);
-
-        model_view_trans = Mat4x4(mv_trans);
+        GLdouble mv_trans[16];
+        glGetDoublev(GL_MODELVIEW_MATRIX, mv_trans);
+
+        model_view_trans = Matrix4x4d(mv_trans);
         model_view_trans_inverse = model_view_trans.inverse();
+
+        model_view_trans.print();
 
         //draw volume bounding box with translation (the correct location in
@@ -234,5 +242,5 @@
               zNear, zFar, eyeMinX, eyeMaxX, eyeMinY, eyeMaxY, z_step, n_actual_slices);
 
-        Vector4 vert1, vert2, vert3, vert4;
+        Vector4f vert1, vert2, vert3, vert4;
 
         // Render cutplanes first with depth test enabled.  They will mark the
@@ -250,28 +258,28 @@
             switch (axis) {
             case 1:
-                vert1 = Vector4(offset, 0, 0, 1);
-                vert2 = Vector4(offset, 1, 0, 1);
-                vert3 = Vector4(offset, 1, 1, 1);
-                vert4 = Vector4(offset, 0, 1, 1);
+                vert1 = Vector4f(offset, 0, 0, 1);
+                vert2 = Vector4f(offset, 1, 0, 1);
+                vert3 = Vector4f(offset, 1, 1, 1);
+                vert4 = Vector4f(offset, 0, 1, 1);
                 break;
             case 2:
-                vert1 = Vector4(0, offset, 0, 1);
-                vert2 = Vector4(1, offset, 0, 1);
-                vert3 = Vector4(1, offset, 1, 1);
-                vert4 = Vector4(0, offset, 1, 1);
+                vert1 = Vector4f(0, offset, 0, 1);
+                vert2 = Vector4f(1, offset, 0, 1);
+                vert3 = Vector4f(1, offset, 1, 1);
+                vert4 = Vector4f(0, offset, 1, 1);
                 break;
             case 3:
             default:
-                vert1 = Vector4(0, 0, offset, 1);
-                vert2 = Vector4(1, 0, offset, 1);
-                vert3 = Vector4(1, 1, offset, 1);
-                vert4 = Vector4(0, 1, offset, 1);
+                vert1 = Vector4f(0, 0, offset, 1);
+                vert2 = Vector4f(1, 0, offset, 1);
+                vert3 = Vector4f(1, 1, offset, 1);
+                vert4 = Vector4f(0, 1, offset, 1);
                 break;
             }
 
-            Vector4 texcoord1 = vert1;
-            Vector4 texcoord2 = vert2;
-            Vector4 texcoord3 = vert3;
-            Vector4 texcoord4 = vert4;
+            Vector4f texcoord1 = vert1;
+            Vector4f texcoord2 = vert2;
+            Vector4f texcoord3 = vert3;
+            Vector4f texcoord4 = vert4;
 
             _cutplaneShader->bind();
@@ -310,8 +318,8 @@
         // Initialize view-aligned quads with eye space bounds of
         // volume
-        vert1 = Vector4(eyeMinX, eyeMinY, -0.5, 1);
-        vert2 = Vector4(eyeMaxX, eyeMinY, -0.5, 1);
-        vert3 = Vector4(eyeMaxX, eyeMaxY, -0.5, 1);
-        vert4 = Vector4(eyeMinX, eyeMaxY, -0.5, 1);
+        vert1 = Vector4f(eyeMinX, eyeMinY, -0.5, 1);
+        vert2 = Vector4f(eyeMaxX, eyeMinY, -0.5, 1);
+        vert3 = Vector4f(eyeMaxX, eyeMaxY, -0.5, 1);
+        vert4 = Vector4f(eyeMinX, eyeMaxY, -0.5, 1);
 
         size_t counter = 0;
@@ -389,5 +397,5 @@
         volPtr = volumes[volume_index];
 
-        Vector3 volScaling = volPtr->getPhysicalScaling();
+        Vector3f volScaling = volPtr->getPhysicalScaling();
 
         glPushMatrix();
@@ -510,5 +518,5 @@
 }
 
-void VolumeRenderer::getEyeSpaceBounds(const Mat4x4& mv,
+void VolumeRenderer::getEyeSpaceBounds(const Matrix4x4d& mv,
                                        double& xMin, double& xMax,
                                        double& yMin, double& yMax,
@@ -542,8 +550,8 @@
 
     for (int i = 0; i < 8; i++) {
-        Vector4 eyeVert = mv.transform(Vector4(vertex[i][0],
-                                               vertex[i][1],
-                                               vertex[i][2],
-                                               vertex[i][3]));
+        Vector4f eyeVert = mv.transform(Vector4f(vertex[i][0],
+                                                 vertex[i][1],
+                                                 vertex[i][2],
+                                                 vertex[i][3]));
         if (eyeVert.x < xMin) xMin = eyeVert.x;
         if (eyeVert.x > xMax) xMax = eyeVert.x;
