Commit 4b8486f6 authored by hrchilds's avatar hrchilds

Initial Manta changes from Carson Brownlee.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@18880 18c085ea-50e0-402c-830e-de6fd14e8384
parent f00250f1
###############################################################################
# This scripts prompts the user to set the variable MANTA_SOURCE_DIR and
# MANTA_BUILD_PREFIX. After this is done, the script sets variables:
#
# MANTA_INCLUDE -- Paths containing Manta header files.
# MANTA_TARGET_LINK_LIBRARIES -- List of Manta shared libraries. (-l on link line)
# MANTA_LINK_DIRECTORIES -- Path containing shared libraries (-L on link line)
#
# Additionally several .cmake scripts from the Manta build are executed to
# insure a similar build environment will be used by the project.
#
###############################################################################
IF (MANTA_SOURCE_DIR AND MANTA_BUILD_PREFIX)
# Set the include and link variables.
SET(MANTA_INCLUDE
${MANTA_SOURCE_DIR}
${MANTA_SOURCE_DIR}/SCIRun
${MANTA_SOURCE_DIR}/SCIRun/include
${MANTA_BUILD_PREFIX}/include
)
SET(MANTA_TARGET_LINK_LIBRARIES
Manta_Factory
Manta_UserInterface
Manta_Engine
Manta_Model
Manta_Image
Manta_Interface
Manta_Core_XUtils
Manta_Core
# SCIRun_Core
About
)
SET(MANTA_LINK_DIRECTORIES
${MANTA_BUILD_PREFIX}/lib
)
# Include Manta header files.
INCLUDE_DIRECTORIES(
${MANTA_INCLUDE}
)
# Include Manta library directory.
LINK_DIRECTORIES(
${MANTA_LINK_DIRECTORIES}
)
# Initialize Python/SWIG.
SET(CMAKE_SWIG_OUTDIR ${LIBRARY_OUTPUT_PATH})
FIND_PATH(SWIG_DIR swig)
FIND_PACKAGE(SWIG)
# Important: Must use Manta's copy of UseSWIG.cmake
INCLUDE(${MANTA_SOURCE_DIR}/CMake/MantaUseSWIG.cmake)
FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}
)
# Load Manta macros.
INCLUDE(${MANTA_SOURCE_DIR}/CMake/Macros.cmake)
# Set flags based on the architecture we are on (no compiler stuff)
INCLUDE (${MANTA_SOURCE_DIR}/CMake/ConfigArchitecture.cmake)
# Determine information about the compiler
INCLUDE (${MANTA_SOURCE_DIR}/CMake/CompilerInfo.cmake)
# Set various options based on the build type.
INCLUDE (${MANTA_SOURCE_DIR}/CMake/BuildType.cmake)
# Check if the build supports SSE
INCLUDE (${MANTA_SOURCE_DIR}/CMake/CheckSSE.cmake)
# Force compilation options for all code that includes Manta headers.
FORCE_ADD_FLAGS("-DSCI_NOPERSISTENT")
# Otherwise prompt the user to enter the desired Manta build to use.
ELSE (MANTA_SOURCE_DIR AND MANTA_BUILD_PREFIX)
SET(MANTA_SOURCE_DIR "" CACHE PATH "Directory Manta was checked out into.")
SET(MANTA_BUILD_PREFIX "" CACHE PATH "Build directory containing lib/ bin/ etc. sub-directories.")
MESSAGE(FATAL_ERROR "Manually set the paths MANTA_SOURCE_DIR and MANTA_BUILD_PREFIX")
ENDIF(MANTA_SOURCE_DIR AND MANTA_BUILD_PREFIX)
#include <emmintrin.h>
static __m128 float_sse_var = _mm_set_ps1(1.f);
static __m128i int_sse_var = _mm_set1_epi32(2);
#ifdef MANTA_TEST_GCC
static __m128i gcc_guy = _mm_set1_epi64x( (long long)1 );
#endif
#ifdef MANTA_TEST_CAST
static __m128i cast_float_to_int = _mm_castps_si128(float_sse_var);
static __m128 cast_int_to_float = _mm_castsi128_ps(cast_float_to_int);
static __m128d cast_float_to_double = _mm_castps_pd(float_sse_var);
static __m128 cast_double_to_float = _mm_castpd_ps(cast_float_to_double);
#endif
int main()
{
return 0;
}
......@@ -502,6 +502,11 @@ OPTION(VISIT_CREATE_SOCKET_RELAY_EXECUTABLE "Create a separate executable that f
OPTION(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH "Install rpath relative to executable location using \$ORIGIN tag" OFF)
OPTION(VISIT_FORTRAN "Enable compilation of Fortran example progams" OFF)
OPTION(VISIT_DATA_MANUAL_EXAMPLES "Build Getting Data Into VisIt examples" OFF)
OPTION(VISIT_MANTA "Use Manta ray tracer for polygonal rendering" OFF)
IF (VISIT_MANTA)
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindManta.cmake)
#FIND_PACKAGE(Manta)
ENDIF(VISIT_MANTA)
OPTION(IGNORE_THIRD_PARTY_LIB_PROBLEMS "Ignore problems finding requested third party libraries")
OPTION(VISIT_FORCE_SSH_TUNNELING "Force ssh tunnelling for sockets" OFF)
......
......@@ -65,6 +65,7 @@ LightList avtCallback::lightList;
bool avtCallback::nowinMode = false;
bool avtCallback::swRendering = false;
bool avtCallback::useManta = false;
bool avtCallback::safeMode = false;
UpdatePlotAttributesCallback avtCallback::updatePlotAttributesCallback = NULL;
......
......@@ -141,6 +141,11 @@ class PIPELINE_API avtCallback
static bool GetSoftwareRendering(void)
{ return swRendering; };
static void SetMantaMode(bool b)
{ useManta = b; }
static bool UseManta(void)
{ return useManta; }
static void RegisterGetDatabaseCallback(
GetDatabaseCallback, void *);
static ref_ptr<avtDatabase> GetDatabase(const std::string &, int,
......@@ -180,6 +185,7 @@ class PIPELINE_API avtCallback
static bool nowinMode;
static bool swRendering;
static bool useManta;
static bool safeMode;
static std::string auxSessionKey;
......
......@@ -42,8 +42,31 @@
# I moved some mappers to a different library since they may contain Qt. I
# also cleaned up obsolete stuff in this file.
#
# Carson Brownlee, Sun May 6 16:25:28 PDT 2012
# Add support for Manta.
#
#****************************************************************************/
SET(VISIT_VTK_MANTA_SOURCES
Manta/vtkMantaPolyDataMapper.C
Manta/vtkMantaTexture.C
Manta/vtkMantaProperty.C
Manta/vtkMantaActor.C
Manta/vtkMantaCamera.C
Manta/vtkMantaLight.C
Manta/vtkMantaDataSetMapper.C
Manta/vtkMantaObjectFactory.C
Manta/vtkMantaRenderer.C
Manta/vtkMantaManager.C
Manta/vtkMantaCubeAxesActor.C
)
# create configuration file to pass off cmake options
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/avt/Plotter/vtk/InitVTKRenderingConfig.h.in"
"${PROJECT_BINARY_DIR}/avt/Plotter/vtk/InitVTKRenderingConfig.h"
)
SET(AVTPLOTTER_OPENGL_SOURCES
avtGLEWInitializer.C
avtOpenGLSurfaceAndWireframeRenderer.C
......@@ -121,6 +144,11 @@ ${AVTPLOTTER_VTK_SOURCES}
${AVTPLOTTER_OPENGL_SOURCES}
)
IF(VISIT_MANTA)
SET(AVTPLOTTER_SOURCES ${AVTPLOTTER_SOURCES} ${VISIT_VTK_MANTA_SOURCES} )
ENDIF(VISIT_MANTA)
INCLUDE_DIRECTORIES(
${VISIT_COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
......@@ -136,6 +164,7 @@ ${VISIT_SOURCE_DIR}/avt/Pipeline/Data
${VISIT_SOURCE_DIR}/avt/Pipeline/Pipeline
${VISIT_SOURCE_DIR}/avt/Pipeline/Sinks
${VISIT_SOURCE_DIR}/avt/Pipeline/Sources
${VISIT_SOURCE_DIR}/avt/Plotter/Manta
${VISIT_SOURCE_DIR}/avt/View
${VISIT_SOURCE_DIR}/visit_vtk/full
${VISIT_SOURCE_DIR}/visit_vtk/lightweight
......@@ -151,11 +180,24 @@ LINK_DIRECTORIES(${LIBRARY_OUTPUT_DIRECTORY} ${VTK_LIBRARY_DIRS} ${MESA_LIBRARY_
#********************************* SERIAL ************************************
ADD_LIBRARY(avtplotter_ser ${AVTPLOTTER_SOURCES})
TARGET_LINK_LIBRARIES(avtplotter_ser visitcommon avtmath avtview avtfilters_ser avtpipeline_ser visit_vtk lightweight_visit_vtk vtkHybrid ${GLEW_LIB})
IF(VISIT_MANTA)
TARGET_LINK_LIBRARIES(avtplotter_ser ${MANTA_TARGET_LINK_LIBRARIES})
ENDIF(VISIT_MANTA)
VISIT_INSTALL_TARGETS(avtplotter_ser)
#********************************* PARALLEL **********************************
IF(VISIT_PARALLEL)
ADD_PARALLEL_LIBRARY(avtplotter_par ${AVTPLOTTER_SOURCES})
TARGET_LINK_LIBRARIES(avtplotter_par visitcommon avtmath avtview avtfilters_par avtpipeline_par visit_vtk lightweight_visit_vtk vtkHybrid ${GLEW_LIB})
IF(VISIT_MANTA)
TARGET_LINK_LIBRARIES(avtplotter_par ${MANTA_TARGET_LINK_LIBRARIES})
#IF(ICET_FOUND)
# INCLUDE_DIRECTORIES(${ICET_INCLUDE_DIR})
# LINK_DIRECTORIES(${ICET_LIBRARY_DIR})
#ENDIF(ICET_FOUND)
ENDIF(VISIT_MANTA)
VISIT_INSTALL_TARGETS(avtplotter_par)
ENDIF(VISIT_PARALLEL)
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkManta.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: $RCSfile: vtkManta.h,v $
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
// .NAME vtkManta.h -
// .SECTION Description
//
#ifndef __vtkManta_h
#define __vtkManta_h
#include "vtkConfigure.h"
//#include "vtkMantaConfigure.h"
#if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA))
# include <OpenGL/gl.h> // Include OpenGL API.
#else
#include "vtkgl.h"
#endif
#endif
This diff is collapsed.
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkMantaActor.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: $RCSfile: vtkMantaActor.h,v $
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
// .NAME vtkMantaActor - vtkActor for Manta Ray traced scenes
// .SECTION Description
// vtkMantaActor is a concrete implementation of the abstract class vtkActor.
// vtkMantaActor interfaces to the Manta Raytracer library.
#ifndef __vtkMantaActor_h
#define __vtkMantaActor_h
//#include "vtkMantaConfigure.h"
#include "vtkActor.h"
//BTX
namespace Manta {
class Group;
class AccelerationStructure;
class Object;
};
//ETX
class vtkTimeStamp;
class vtkMantaProperty;
class vtkMantaRenderer;
class vtkMantaManager;
class MoleculeAttributes;
class vtkMantaActor : public vtkActor
{
public:
static vtkMantaActor *New();
vtkTypeRevisionMacro(vtkMantaActor,vtkActor);
virtual void PrintSelf(ostream& os, vtkIndent indent);
//Description:
// Overriden to help ensure that a Manta compatible class is created.
vtkProperty * MakeProperty();
// Description:
// This causes the actor to be rendered. It in turn will render the actor's
// property, texture map and then mapper. If a property hasn't been
// assigned, then the actor will create one automatically. Note that a side
// effect of this method is that the pipeline will be updated.
void Render(vtkRenderer *ren, vtkMapper *mapper);
// Description:
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
void ReleaseGraphicsResources(vtkWindow *);
//Description:
// Overridden to schedule a transaction to hide the object
virtual void SetVisibility(int);
//Description:
// Transaction callback that hides the object
void RemoveObjects();
//BTX
//TODO: This leaks whatever was there, but must schedule its
//deletion because of threading
void SetGroup( Manta::Group * group );
Manta::Group * GetGroup()
{
return this->Group;
}
Manta::AccelerationStructure * GetMantaAS()
{
return this->MantaAS;
}
//ETX
void SetMoleculeAtts(MoleculeAttributes* atts) { moleculeAtts = atts; }
MoleculeAttributes* GetMoleculeAtts() { return moleculeAtts; }
size_t numPolys; //CARSON DEBUG
protected:
vtkMantaActor();
~vtkMantaActor();
private:
vtkMantaActor(const vtkMantaActor&); // Not implemented.
void operator=(const vtkMantaActor&); // Not implemented.
void UpdateObjects(vtkRenderer *);
vtkTimeStamp MeshMTime;
//BTX
Manta::Group * Group; //geometry
Manta::AccelerationStructure * MantaAS; //acceleration structure for that geometry
//ETX
vtkMantaManager *MantaManager;
MoleculeAttributes* moleculeAtts;
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkMantaCamera.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: $RCSfile: vtkMantaCamera.cxx,v $
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkManta.h"
#include "vtkMantaCamera.h"
#include "vtkMantaManager.h"
#include "vtkMantaRenderer.h"
#include "vtkObjectFactory.h"
#include <Interface/Camera.h>
#include <Engine/Control/RTRT.h>
#include <math.h>
#include <fstream>
#include <Core/Math/MiscMath.h>
#include <Core/Math/Trig.h>
vtkCxxRevisionMacro(vtkMantaCamera, "$Revision: 1.7 $");
vtkStandardNewMacro(vtkMantaCamera);
//----------------------------------------------------------------------------
vtkMantaCamera::vtkMantaCamera() : MantaCamera (0)
{
//TODO: Observe my own modified event, and call OrientCamera then
//cerr << "MC(" << this << ") CREATE" << endl;
this->MantaManager = NULL;
}
//----------------------------------------------------------------------------
vtkMantaCamera::~vtkMantaCamera()
{
//cerr << "MC(" << this << ") DESTROY" << endl;
if (this->MantaManager)
{
//cerr << "MC(" << this << ") DESTROY " << this->MantaManager << " "
// << this->MantaManager->GetReferenceCount() << endl;
this->MantaManager->Delete();
}
}
//----------------------------------------------------------------------------
void vtkMantaCamera::OrientMantaCamera(vtkRenderer *ren)
{
// cerr << "MC(" << this << ") ORIENT" << endl;
vtkMantaRenderer * mantaRenderer = vtkMantaRenderer::SafeDownCast(ren);
if (!mantaRenderer)
{
return;
}
if (!this->MantaCamera)
{
this->MantaCamera = mantaRenderer->GetMantaCamera();
if (!this->MantaCamera)
{
return;
}
}
// for figuring out aspect ratio
int lowerLeft[2];
int usize, vsize;
ren->GetTiledSizeAndOrigin(&usize, &vsize, lowerLeft, lowerLeft + 1);
double *eye, *lookat, *up, vfov;
eye = this->Position;
lookat = this->FocalPoint;
up = this->ViewUp;
vfov = this->ViewAngle;
Manta::Real disk = this->GetFocalDisk();
Manta::Real hfov = vfov;
Manta::Real fov_min = 0;
Manta::Real fov_max = 180;
hfov = Manta::RtoD(2*Manta::Atan(disk*Manta::Tan(Manta::DtoR(hfov/2))));
hfov = Manta::Clamp((Manta::Real)hfov, (Manta::Real)fov_min, (Manta::Real)fov_max);
vfov = Manta::RtoD(2*Manta::Atan(disk*Manta::Tan(Manta::DtoR(vfov/2))));
vfov = Manta::Clamp((Manta::Real)vfov, (Manta::Real)fov_min, (Manta::Real)fov_max);
// hfov = vfov*usize/vsize;
//Carson: import camera data
#if 0
static std::string path("");
static bool once1 = false;
if (!once1)
{
once1 = true;
char* cpath = getenv("VISIT_MANTA_CAMERA_FILENAME");
if (cpath)
path = std::string(cpath);
}
if (path != "")
{
static double teye[3], tlookat[3], tup[3], thfov, tvfov;
static bool once = false;
if (!once)
{
std::ifstream in(path.c_str());
once = true;
std::string str;
while (in >> str)
{
if (str == "BasicCameraData:")
{
in >> teye[0] >> teye[1] >> teye[2];
in >> tlookat[0] >> tlookat[1] >> tlookat[2];
in >> tup[0] >> tup[1] >> tup[2];
in >> thfov >> tvfov;
}
}
}
printf("found camera data:\n%f%f%f\n", teye[0], teye[1], teye[2]);
eye[0] = teye[0]; eye[1] = teye[1]; eye[2] = teye[2];
lookat[0] = tlookat[0]; lookat[1] = tlookat[1]; lookat[2] = tlookat[2];
up[0] = tup[0]; up[1] = tup[1]; up[2] = tup[2];
hfov = thfov;
vfov = tvfov;
}
#endif
const Manta::BasicCameraData bookmark
(
Manta::Vector(eye[0], eye[1], eye[2]),
Manta::Vector(lookat[0], lookat[1], lookat[2]),
Manta::Vector(up[0], up[1], up[2]),
vfov * usize / vsize, vfov
);
//cout << "updating camera info " << eye[0] << " " << eye[1] << " " << eye[2] << " " << vfov << " " << disk << "\n";
//cout << lookat[0] << " " << lookat[1] << " " << lookat[2] << endl;
mantaRenderer->GetMantaEngine()->addTransaction
("update camera",
Manta::Callback::create(this->MantaCamera,
&Manta::Camera::setBasicCameraData, bookmark)
);
}
//----------------------------------------------------------------------------
// called by Renderer::UpdateCamera()
void vtkMantaCamera::Render(vtkRenderer *ren)
{
if (this->GetMTime() > this->LastRenderTime)
{
this->OrientMantaCamera(ren);
this->LastRenderTime.Modified();
}
}
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkMantaCamera.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: $RCSfile: vtkMantaCamera.h,v $
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,