Commit dc940b8c authored by hrchilds's avatar hrchilds

Update from June 19, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@16 18c085ea-50e0-402c-830e-de6fd14e8384
parent e1a8c04a
......@@ -201,16 +201,16 @@ fi
rm -f tidalwave
cat <<EOF > tidalwave
#!/bin/sh
if test ! -d /fc/san3/$user ; then
mkdir /fc/san3/$user
if test ! -d /fc/san1/$user ; then
mkdir /fc/san1/$user
fi
if test ! -d /fc/san3/$user/tidalwave ; then
mkdir /fc/san3/$user/tidalwave
if test ! -d /fc/san1/$user/tidalwave ; then
mkdir /fc/san1/$user/tidalwave
fi
rm -rf /fc/san3/$user/tidalwave/visitbuild
mkdir /fc/san3/$user/tidalwave/visitbuild
mv tidalwave_$dist.tar.gz /fc/san3/$user/tidalwave/visitbuild/$dist.tar.gz
cd /fc/san3/$user/tidalwave/visitbuild
rm -rf /fc/san1/$user/tidalwave/visitbuild
mkdir /fc/san1/$user/tidalwave/visitbuild
mv tidalwave_$dist.tar.gz /fc/san1/$user/tidalwave/visitbuild/$dist.tar.gz
cd /fc/san1/$user/tidalwave/visitbuild
gunzip -c $dist.tar.gz | tar xvf - > buildlog 2>&1
cd $dist
env CXXFLAGS=-O2 ./configure --enable-parallel >> ../buildlog 2>&1
......
......@@ -183,7 +183,7 @@ fi
rm -f tidalwave
cat <<EOF > tidalwave
#!/bin/sh
cd /fc/san3/$user/tidalwave/visitbuild
cd /fc/san1/$user/tidalwave/visitbuild
if [ -d /usr/gapps/visit/$ver ]
then
./visit-install -private -a -g bdiv -gw $ver irix6 /usr/gapps/visit > installlog 2>&1
......
......@@ -205,6 +205,10 @@ avtViewInfo::SetViewFromCamera(vtkCamera *vtkcam)
// Eric Brugger, Fri Jun 6 15:30:49 PDT 2003
// I added image pan and image zoom.
//
// Eric Brugger, Wed Jun 18 17:46:36 PDT 2003
// I modified the call to SetWindowCenter since the meaning of its
// arguments changed.
//
// ****************************************************************************
void
......@@ -220,7 +224,7 @@ avtViewInfo::SetCameraFromView(vtkCamera *vtkcam) const
vtkcam->SetFocalPoint(focus);
vtkcam->SetPosition(camera);
vtkcam->SetViewUp(viewUp);
vtkcam->SetWindowCenter(imagePan[0], imagePan[1]);
vtkcam->SetWindowCenter(2.0*imagePan[0], 2.0*imagePan[1]);
vtkcam->SetFocalDisk(imageZoom);
}
......
......@@ -234,11 +234,18 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
// Use new IntersectWithLine routine from cellLocator. It doesn't require
// the calculation of a tolerance.
//
// Kathleen Bonnell, Thu Jun 19 16:50:41 PDT 2003
// Test for no cells in ds.
//
// ****************************************************************************
int
avtLocateCellQuery::LocatorFindCell(vtkDataSet *ds, float &dist, float *isect)
{
if (ds->GetNumberOfCells() == 0)
{
return -1;
}
float *rayPt1 = queryAtts.GetRayPoint1();
float *rayPt2 = queryAtts.GetRayPoint2();
......
......@@ -215,12 +215,16 @@ avtPickQuery::PostExecute(void)
// cell Id retrieved from the array is valid. This is designated by
// avtGhostType AVT_CREATED_GHOSTS. GhostZones determined by the file
// format are designated by AVT_HAS_GHOSTS).
//
// Kathleen Bonnell, Thu Jun 19 16:50:41 PDT 2003
// Test for null ds.
//
// ****************************************************************************
void
avtPickQuery::Execute(vtkDataSet *ds, const int dom)
{
if (dom != pickAtts.GetDomain() || pickAtts.GetFulfilled())
if (dom != pickAtts.GetDomain() || pickAtts.GetFulfilled() || ds == NULL)
{
return;
}
......@@ -504,11 +508,19 @@ avtPickQuery::Execute(vtkDataSet *ds, const int dom)
// Moved transformation of cellPoint to ApplyFilters method, so that
// the transformed point is available to RGridFindCell if necessary.
//
// Kathleen Bonnell, Thu Jun 19 16:50:41 PDT 2003
// Test for no cells in ds.
//
// ****************************************************************************
int
avtPickQuery::LocatorFindCell(vtkDataSet *ds)
{
if (ds->GetNumberOfCells() == 0)
{
return -1;
}
//
// Use the picked point that has been moved towards the cell center.
//
......
......@@ -10,7 +10,6 @@
#include <vtkPolyData.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkWindowToImageFilter.h>
#include <vtkQtRenderWindow.h>
#include <vtkQtRenderWindowInteractor.h>
......@@ -648,6 +647,10 @@ VisWinRendering::Realize(void)
// Added code to get zbuffer data including setting layers so that
// zbuffer data is obtained correctly
//
// Hank Childs, Thu Jun 19 17:28:50 PDT 2003
// Stop using window-to-image filter, since it does not play well with
// the new camera modifications.
//
// ****************************************************************************
avtImage_p
......@@ -657,48 +660,56 @@ VisWinRendering::ScreenCapture(bool doCanvasZBufferToo)
vtkRenderWindow *renWin = GetRenderWindow();
bool extRequestMode = false;
//
// If we want zbuffer for the canvas, we need to take care that
// the canvas is rendered last
//
if (doCanvasZBufferToo)
{
foreground->SetLayer(1);
canvas->SetLayer(0);
//
// If we want zbuffer for the canvas, we need to take care that
// the canvas is rendered last
//
foreground->SetLayer(1);
canvas->SetLayer(0);
}
// Make sure the render window is up to date, particularly z buffer data
debug2 << "Forcing the render window to re-render to make sure it is "
<< "up-to-date" << endl;
renWin->Render();
//
// Make sure that the window is up-to-date.
//
renWin->Render();
int w, h;
w = renWin->GetSize()[0];
h = renWin->GetSize()[1];
// get zbuffer data for the canvas
int w, h;
GetSize(w,h);
zb = renWin->GetZbufferData(0,0,w-1,h-1);
if (doCanvasZBufferToo)
{
// get zbuffer data for the canvas
zb = renWin->GetZbufferData(0,0,w-1,h-1);
// temporarily disable external render requests
extRequestMode = mediator.DisableExternalRenderRequests();
// temporarily disable external render requests
extRequestMode = mediator.DisableExternalRenderRequests();
}
vtkWindowToImageFilter *w2if = vtkWindowToImageFilter::New();
w2if->SetInput(renWin);
vtkImageData *image = w2if->GetOutput();
//
// Read the pixels from the window and copy them over. Sadly, it wasn't
// very easy to avoid copying the buffer.
//
int readFrontBuffer = 1;
unsigned char *pixels = renWin->GetPixelData(0,0,w-1,h-1,readFrontBuffer);
avtSourceFromImage screenCaptureSource(image, zb);
vtkImageData *image = avtImageRepresentation::NewImage(w, h);
unsigned char *img_pix = (unsigned char *)image->GetScalarPointer(0, 0, 0);
memcpy(img_pix, pixels, 3*w*h);
delete [] pixels;
//
// Force some updates so we can let screenCaptureSource be destructed.
// The img->Update forces the window to render, so we explicitly
// disable external render requests
//
image->Update();
image->SetSource(NULL);
avtSourceFromImage screenCaptureSource(image, zb);
avtImage_p img = screenCaptureSource.GetTypedOutput();
img->Update(screenCaptureSource.GetGeneralPipelineSpecification());
img->SetSource(NULL);
w2if->Delete();
//
// If we swapped the foreground & canvas layers to get the canvas' zbuffer,
// swap them back before we leave
......@@ -711,7 +722,6 @@ VisWinRendering::ScreenCapture(bool doCanvasZBufferToo)
mediator.EnableExternalRenderRequests();
}
return img;
}
......
......@@ -9,6 +9,7 @@
#include <vtkDataSet.h>
#include <vtkRenderer.h>
#include <vtkMath.h>
#include <vtkMatrix4x4.h>
#include <ColorAttribute.h>
......@@ -3218,6 +3219,10 @@ VisWindow::ProcessResizeEvent(void *data)
// calculated from the screen coordinates, and passed to the viewer for
// handling by the engine.
//
// Eric Brugger, Wed Jun 18 17:50:24 PDT 2003
// I modified the method so that pick worked properly with the new pan
// and zoom mechanism.
//
// ****************************************************************************
void
......@@ -3233,7 +3238,7 @@ VisWindow::Pick(int x, int y)
float ray[3];
float tF, tB;
float rayPt1[4], rayPt2[4];
float *displayCoords, *worldCoords;
float *displayCoords;
double *clipRange;
float rayLength;
vtkRenderer *ren = GetCanvas();
......@@ -3250,9 +3255,55 @@ VisWindow::Pick(int x, int y)
ren->WorldToDisplay();
displayCoords = ren->GetDisplayPoint();
//
// Transform the point from display to view coordinates.
//
double viewPoint[4];
ren->SetDisplayPoint(x, y, displayCoords[2]);
ren->DisplayToWorld();
worldCoords = ren->GetWorldPoint();
ren->DisplayToView();
float *viewCoords = ren->GetViewPoint();
viewPoint[0] = viewCoords[0];
viewPoint[1] = viewCoords[1];
viewPoint[2] = viewCoords[2];
viewPoint[3] = 1.0;
// Compensate for window centering and scaling.
double *windowCenter = cam->GetWindowCenter();
double focalDisk = cam->GetFocalDisk();
float *aspect = ren->GetAspect();
viewPoint[0] = viewPoint[0] -
(aspect[0] - 1.) * windowCenter[0] * focalDisk;
viewPoint[1] = viewPoint[1] -
(aspect[1] - 1.) * windowCenter[1] * focalDisk;
//
// Transform the point from view to world coordinates.
//
double worldCoords[4];
vtkMatrix4x4 *mat = vtkMatrix4x4::New();
// get the perspective transformation from the active camera
mat->DeepCopy(cam->GetCompositePerspectiveTransformMatrix(1,0,1));
// use the inverse matrix
mat->Invert();
mat->MultiplyPoint(viewPoint, worldCoords);
// Get the transformed vector & set WorldPoint
// while we are at it try to keep w at one
if (worldCoords[3])
{
worldCoords[0] = worldCoords[0] / worldCoords[3];
worldCoords[1] = worldCoords[1] / worldCoords[3];
worldCoords[2] = worldCoords[2] / worldCoords[3];
worldCoords[3] = 1;
}
mat->Delete();
if ( worldCoords[3] == 0.0 )
{
debug5 << "vtkCellPicker could not calculate pick ray." << endl;
......
......@@ -746,8 +746,8 @@ void vtkCamera::ComputePerspectiveTransform(double aspect,
matrix[0][0] = this->FocalDisk;
matrix[1][1] = this->FocalDisk;
matrix[0][3] = this->FocalDisk * this->WindowCenter[0] * 2.0;
matrix[1][3] = this->FocalDisk * this->WindowCenter[1] * 2.0;
matrix[0][3] = this->FocalDisk * this->WindowCenter[0];
matrix[1][3] = this->FocalDisk * this->WindowCenter[1];
// concatenate with the current matrix
this->PerspectiveTransform->Concatenate(*matrix);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment