Change vtkm::rendering::View to Camera
This commit is contained in:
parent
985cb971ea
commit
1934049df9
@ -69,30 +69,30 @@ void displayCall()
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
// Allow rotations of the view
|
||||
// Allow rotations of the camera
|
||||
void mouseMove(int x, int y)
|
||||
{
|
||||
//std::cout<<"MOUSE MOVE: "<<x<<" "<<y<<std::endl;
|
||||
|
||||
//Map to XY
|
||||
y = window->View.Height-y;
|
||||
y = window->Camera.Height-y;
|
||||
|
||||
if (lastx != -1 && lasty != -1)
|
||||
{
|
||||
vtkm::Float32 x1 = ((lastx*2.0f)/window->View.Width) - 1.0f;
|
||||
vtkm::Float32 y1 = ((lasty*2.0f)/window->View.Height) - 1.0f;
|
||||
vtkm::Float32 x2 = ((x*2.0f)/window->View.Width) - 1.0f;
|
||||
vtkm::Float32 y2 = ((y*2.0f)/window->View.Height) - 1.0f;
|
||||
vtkm::Float32 x1 = ((lastx*2.0f)/window->Camera.Width) - 1.0f;
|
||||
vtkm::Float32 y1 = ((lasty*2.0f)/window->Camera.Height) - 1.0f;
|
||||
vtkm::Float32 x2 = ((x*2.0f)/window->Camera.Width) - 1.0f;
|
||||
vtkm::Float32 y2 = ((y*2.0f)/window->Camera.Height) - 1.0f;
|
||||
|
||||
if (buttonStates[0] == GLUT_DOWN)
|
||||
{
|
||||
if (shiftKey)
|
||||
window->View.Pan3D(x2-x1, y2-y1);
|
||||
window->Camera.Pan3D(x2-x1, y2-y1);
|
||||
else
|
||||
window->View.TrackballRotate(x1,y1, x2,y2);
|
||||
window->Camera.TrackballRotate(x1,y1, x2,y2);
|
||||
}
|
||||
else if (buttonStates[1] == GLUT_DOWN)
|
||||
window->View.Zoom3D(y2-y1);
|
||||
window->Camera.Zoom3D(y2-y1);
|
||||
}
|
||||
|
||||
lastx = x;
|
||||
@ -118,7 +118,7 @@ void mouseCall(int button, int state, int vtkmNotUsed(x), int vtkmNotUsed(y))
|
||||
}
|
||||
}
|
||||
|
||||
void Set3DView(vtkm::rendering::View &view,
|
||||
void Set3DView(vtkm::rendering::Camera &camera,
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::Int32 w, vtkm::Int32 h)
|
||||
{
|
||||
@ -132,15 +132,15 @@ void Set3DView(vtkm::rendering::View &view,
|
||||
vtkm::Float32 mag = vtkm::Magnitude(totalExtent);
|
||||
vtkm::Normalize(totalExtent);
|
||||
|
||||
view = vtkm::rendering::View(vtkm::rendering::View::VIEW_3D);
|
||||
view.View3d.Position = totalExtent * (mag * 2.f);
|
||||
view.View3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
view.View3d.LookAt = totalExtent * (mag * .5f);
|
||||
view.View3d.FieldOfView = 60.f;
|
||||
view.NearPlane = 1.f;
|
||||
view.FarPlane = 100.f;
|
||||
view.Width = w;
|
||||
view.Height = h;
|
||||
camera = vtkm::rendering::Camera(vtkm::rendering::Camera::VIEW_3D);
|
||||
camera.Camera3d.Position = totalExtent * (mag * 2.f);
|
||||
camera.Camera3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
camera.Camera3d.LookAt = totalExtent * (mag * .5f);
|
||||
camera.Camera3d.FieldOfView = 60.f;
|
||||
camera.NearPlane = 1.f;
|
||||
camera.FarPlane = 100.f;
|
||||
camera.Width = w;
|
||||
camera.Height = h;
|
||||
}
|
||||
|
||||
// Compute and render an isosurface for a uniform grid example
|
||||
@ -163,8 +163,8 @@ main(int argc, char* argv[])
|
||||
|
||||
const vtkm::cont::CoordinateSystem coords = ds.GetCoordinateSystem();
|
||||
|
||||
vtkm::rendering::View view;
|
||||
Set3DView(view, coords, W, H);
|
||||
vtkm::rendering::Camera camera;
|
||||
Set3DView(camera, coords, W, H);
|
||||
|
||||
vtkm::rendering::Color bg(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
vtkm::rendering::RenderSurfaceGL surface(W,H,bg);
|
||||
@ -180,7 +180,7 @@ main(int argc, char* argv[])
|
||||
window = new vtkm::rendering::Window3D<vtkm::rendering::SceneRendererGL<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>,
|
||||
vtkm::rendering::RenderSurfaceGL,
|
||||
vtkm::rendering::WorldAnnotatorGL>(scene, sceneRenderer,
|
||||
surface, view, bg);
|
||||
surface, camera, bg);
|
||||
window->Initialize();
|
||||
glutMainLoop();
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
@ -160,7 +160,7 @@ public:
|
||||
min_proportions.clear();
|
||||
min_proportions.insert(min_proportions.begin(), prop.begin(), prop.end());
|
||||
}
|
||||
virtual void Render(View &view,
|
||||
virtual void Render(Camera &camera,
|
||||
WorldAnnotator &worldAnnotator,
|
||||
RenderSurface &renderSurface)
|
||||
{
|
||||
@ -224,7 +224,7 @@ public:
|
||||
|
||||
for (unsigned int i=0; i<nmajor; ++i)
|
||||
{
|
||||
labels[i]->Render(view, worldAnnotator, renderSurface);
|
||||
labels[i]->Render(camera, worldAnnotator, renderSurface);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
#include <vtkm/rendering/AxisAnnotation.h>
|
||||
@ -119,7 +119,7 @@ public:
|
||||
lower = l;
|
||||
upper = u;
|
||||
}
|
||||
virtual void Render(View &view,
|
||||
virtual void Render(Camera &camera,
|
||||
WorldAnnotator &worldAnnotator,
|
||||
RenderSurface &renderSurface)
|
||||
{
|
||||
@ -230,7 +230,7 @@ public:
|
||||
|
||||
for (unsigned int i=0; i<nmajor; ++i)
|
||||
{
|
||||
labels[i]->Render(view, worldAnnotator, renderSurface);
|
||||
labels[i]->Render(camera, worldAnnotator, renderSurface);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
this->Color = c;
|
||||
}
|
||||
virtual void Render(vtkm::rendering::View &, //view,
|
||||
virtual void Render(vtkm::rendering::Camera &,
|
||||
WorldAnnotator &annotator)
|
||||
{
|
||||
//win->SetupForWorldSpace();
|
||||
|
@ -25,6 +25,7 @@ set(headers
|
||||
BitmapFont.h
|
||||
BitmapFontFactory.h
|
||||
BoundingBoxAnnotation.h
|
||||
Camera.h
|
||||
Color.h
|
||||
ColorBarAnnotation.h
|
||||
ColorTable.h
|
||||
@ -38,7 +39,6 @@ set(headers
|
||||
SceneRendererVolume.h
|
||||
TextAnnotation.h
|
||||
Triangulator.h
|
||||
View.h
|
||||
Window.h
|
||||
WorldAnnotator.h
|
||||
)
|
||||
|
@ -17,8 +17,8 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_rendering_View_h
|
||||
#define vtk_m_rendering_View_h
|
||||
#ifndef vtk_m_rendering_Camera_h
|
||||
#define vtk_m_rendering_Camera_h
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Matrix.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
@ -27,13 +27,13 @@
|
||||
namespace vtkm {
|
||||
namespace rendering {
|
||||
|
||||
class View
|
||||
class Camera
|
||||
{
|
||||
class View3D
|
||||
class Camera3D
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
View3D() : FieldOfView(0.f), XPan(0), YPan(0), Zoom(1)
|
||||
Camera3D() : FieldOfView(0.f), XPan(0), YPan(0), Zoom(1)
|
||||
{}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -86,11 +86,11 @@ class View
|
||||
vtkm::Float32 Zoom;
|
||||
};
|
||||
|
||||
class View2D
|
||||
class Camera2D
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
View2D() : Left(0.f), Right(0.f), Top(0.f), Bottom(0.f), XScale(1.f)
|
||||
Camera2D() : Left(0.f), Right(0.f), Top(0.f), Bottom(0.f), XScale(1.f)
|
||||
{}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -137,8 +137,8 @@ class View
|
||||
public:
|
||||
enum ViewTypeEnum { VIEW_2D, VIEW_3D };
|
||||
ViewTypeEnum ViewType;
|
||||
View3D View3d;
|
||||
View2D View2d;
|
||||
Camera3D Camera3d;
|
||||
Camera2D Camera2d;
|
||||
|
||||
vtkm::Int32 Width;
|
||||
vtkm::Int32 Height;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
vtkm::Float32 ViewportTop;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
View(ViewTypeEnum vtype=View::VIEW_3D)
|
||||
Camera(ViewTypeEnum vtype=Camera::VIEW_3D)
|
||||
: ViewType(vtype),
|
||||
Width(-1),
|
||||
Height(-1),
|
||||
@ -166,34 +166,34 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Matrix<vtkm::Float32,4,4> CreateViewMatrix()
|
||||
{
|
||||
if (this->ViewType == View::VIEW_3D)
|
||||
if (this->ViewType == Camera::VIEW_3D)
|
||||
{
|
||||
return this->View3d.CreateViewMatrix();
|
||||
return this->Camera3d.CreateViewMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->View2d.CreateViewMatrix();
|
||||
return this->Camera2d.CreateViewMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Matrix<vtkm::Float32,4,4> CreateProjectionMatrix()
|
||||
{
|
||||
if (this->ViewType == View::VIEW_3D)
|
||||
if (this->ViewType == Camera::VIEW_3D)
|
||||
{
|
||||
return this->View3d.CreateProjectionMatrix(
|
||||
return this->Camera3d.CreateProjectionMatrix(
|
||||
this->Width, this->Height, this->NearPlane, this->FarPlane);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::Float32 size = vtkm::Abs(this->View2d.Top - this->View2d.Bottom);
|
||||
vtkm::Float32 size = vtkm::Abs(this->Camera2d.Top - this->Camera2d.Bottom);
|
||||
vtkm::Float32 left,right,bottom,top;
|
||||
this->GetRealViewport(left,right,bottom,top);
|
||||
vtkm::Float32 aspect =
|
||||
(static_cast<vtkm::Float32>(this->Width)*(right-left)) /
|
||||
(static_cast<vtkm::Float32>(this->Height)*(top-bottom));
|
||||
|
||||
return this->View2d.CreateProjectionMatrix(
|
||||
return this->Camera2d.CreateProjectionMatrix(
|
||||
size, this->NearPlane, this->FarPlane, aspect);
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ public:
|
||||
void GetRealViewport(vtkm::Float32 &left, vtkm::Float32 &right,
|
||||
vtkm::Float32 &bottom, vtkm::Float32 &top)
|
||||
{
|
||||
if (this->ViewType == View::VIEW_3D)
|
||||
if (this->ViewType == Camera::VIEW_3D)
|
||||
{
|
||||
left = this->ViewportLeft;
|
||||
right = this->ViewportRight;
|
||||
@ -214,8 +214,8 @@ public:
|
||||
vtkm::Float32 maxvw = (this->ViewportRight-this->ViewportLeft) * static_cast<vtkm::Float32>(this->Width);
|
||||
vtkm::Float32 maxvh = (this->ViewportTop-this->ViewportBottom) * static_cast<vtkm::Float32>(this->Height);
|
||||
vtkm::Float32 waspect = maxvw / maxvh;
|
||||
vtkm::Float32 daspect = (this->View2d.Right - this->View2d.Left) / (this->View2d.Top - this->View2d.Bottom);
|
||||
daspect *= this->View2d.XScale;
|
||||
vtkm::Float32 daspect = (this->Camera2d.Right - this->Camera2d.Left) / (this->Camera2d.Top - this->Camera2d.Bottom);
|
||||
daspect *= this->Camera2d.XScale;
|
||||
//cerr << "waspect="<<waspect << " \tdaspect="<<daspect<<endl;
|
||||
const bool center = true; // if false, anchor to bottom-left
|
||||
if (waspect > daspect)
|
||||
@ -269,8 +269,8 @@ public:
|
||||
void Pan3D(vtkm::Float32 dx, vtkm::Float32 dy)
|
||||
{
|
||||
//std::cout<<"Pan3d: "<<dx<<" "<<dy<<std::endl;
|
||||
this->View3d.XPan += dx;
|
||||
this->View3d.YPan += dy;
|
||||
this->Camera3d.XPan += dx;
|
||||
this->Camera3d.YPan += dy;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -278,9 +278,9 @@ public:
|
||||
{
|
||||
vtkm::Float32 factor = powf(4, zoom);
|
||||
//std::cout<<"Zoom3D: "<<zoom<<" --> "<<factor<<std::endl;
|
||||
this->View3d.Zoom *= factor;
|
||||
this->View3d.XPan *= factor;
|
||||
this->View3d.YPan *= factor;
|
||||
this->Camera3d.Zoom *= factor;
|
||||
this->Camera3d.XPan *= factor;
|
||||
this->Camera3d.YPan *= factor;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -289,10 +289,10 @@ public:
|
||||
vtkm::Matrix<vtkm::Float32,4,4> R1 = MatrixHelpers::TrackballMatrix(x1,y1, x2,y2);
|
||||
|
||||
//Translate matrix
|
||||
vtkm::Matrix<vtkm::Float32,4,4> T1 = MatrixHelpers::TranslateMatrix(-this->View3d.LookAt);
|
||||
vtkm::Matrix<vtkm::Float32,4,4> T1 = MatrixHelpers::TranslateMatrix(-this->Camera3d.LookAt);
|
||||
|
||||
//Translate matrix
|
||||
vtkm::Matrix<vtkm::Float32,4,4> T2 = MatrixHelpers::TranslateMatrix(this->View3d.LookAt);
|
||||
vtkm::Matrix<vtkm::Float32,4,4> T2 = MatrixHelpers::TranslateMatrix(this->Camera3d.LookAt);
|
||||
|
||||
vtkm::Matrix<vtkm::Float32,4,4> V1 = this->CreateViewMatrix();
|
||||
V1(0,3) = 0;
|
||||
@ -307,12 +307,12 @@ public:
|
||||
vtkm::MatrixMultiply(V2,
|
||||
vtkm::MatrixMultiply(R1,
|
||||
vtkm::MatrixMultiply(V1,T1))));
|
||||
this->View3d.Position = MultVector(MM, this->View3d.Position);
|
||||
this->View3d.LookAt = MultVector(MM, this->View3d.LookAt);
|
||||
this->View3d.Up = MultVector(MM, this->View3d.Up);
|
||||
this->Camera3d.Position = MultVector(MM, this->Camera3d.Position);
|
||||
this->Camera3d.LookAt = MultVector(MM, this->Camera3d.LookAt);
|
||||
this->Camera3d.Up = MultVector(MM, this->Camera3d.Up);
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace vtkm::rendering
|
||||
|
||||
#endif // vtk_m_rendering_View_h
|
||||
#endif // vtk_m_rendering_Camera_h
|
@ -22,9 +22,9 @@
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/AxisAnnotation2D.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
|
||||
|
||||
namespace vtkm {
|
||||
@ -62,7 +62,7 @@ public:
|
||||
this->SetRange(range.Min, range.Max, nticks);
|
||||
}
|
||||
|
||||
virtual void Render(vtkm::rendering::View &view,
|
||||
virtual void Render(vtkm::rendering::Camera &camera,
|
||||
vtkm::rendering::WorldAnnotator &worldAnnotator,
|
||||
vtkm::rendering::RenderSurface &renderSurface)
|
||||
{
|
||||
@ -79,7 +79,7 @@ public:
|
||||
axis.SetMinorTickSize(0,0,0); // no minor ticks
|
||||
axis.SetLabelAlignment(TextAnnotation::HCenter,
|
||||
TextAnnotation::Top);
|
||||
axis.Render(view, worldAnnotator, renderSurface);
|
||||
axis.Render(camera, worldAnnotator, renderSurface);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define vtk_m_rendering_Plot_h
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm {
|
||||
@ -54,7 +54,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void Render(SceneRendererType &sceneRenderer,
|
||||
SurfaceType &surface,
|
||||
vtkm::rendering::View &view)
|
||||
vtkm::rendering::Camera &camera)
|
||||
{
|
||||
sceneRenderer.SetRenderSurface(&surface);
|
||||
sceneRenderer.SetActiveColorTable(this->ColorTable);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
this->Coordinates,
|
||||
this->ScalarField,
|
||||
this->ColorTable,
|
||||
view,
|
||||
camera,
|
||||
this->ScalarRange);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define vtk_m_rendering_RenderSurface_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
|
||||
@ -53,11 +53,11 @@ public:
|
||||
virtual void Finish() {}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SetViewToWorldSpace(vtkm::rendering::View &, bool) {}
|
||||
virtual void SetViewToWorldSpace(vtkm::rendering::Camera &, bool) {}
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SetViewToScreenSpace(vtkm::rendering::View &, bool) {}
|
||||
virtual void SetViewToScreenSpace(vtkm::rendering::Camera &, bool) {}
|
||||
VTKM_CONT_EXPORT
|
||||
void SetViewportClipping(vtkm::rendering::View &, bool) {}
|
||||
void SetViewportClipping(vtkm::rendering::Camera &, bool) {}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SaveAs(const std::string &) {}
|
||||
@ -67,7 +67,7 @@ public:
|
||||
vtkm::Float32,
|
||||
const vtkm::rendering::Color &) {}
|
||||
virtual void AddColorBar(vtkm::Float32, vtkm::Float32,
|
||||
vtkm::Float32, vtkm::Float32,
|
||||
vtkm::Float32, vtkm::Float32,
|
||||
const vtkm::rendering::ColorTable &,
|
||||
bool) {}
|
||||
virtual void AddText(vtkm::Float32, vtkm::Float32,
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define vtk_m_rendering_RenderSurfaceGL_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/BitmapFont.h>
|
||||
@ -62,22 +62,22 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SetViewToWorldSpace(vtkm::rendering::View &v, bool clip)
|
||||
virtual void SetViewToWorldSpace(vtkm::rendering::Camera &camera, bool clip)
|
||||
{
|
||||
vtkm::Float32 oglP[16], oglM[16];
|
||||
|
||||
MatrixHelpers::CreateOGLMatrix(v.CreateProjectionMatrix(), oglP);
|
||||
MatrixHelpers::CreateOGLMatrix(camera.CreateProjectionMatrix(), oglP);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf(oglP);
|
||||
MatrixHelpers::CreateOGLMatrix(v.CreateViewMatrix(), oglM);
|
||||
MatrixHelpers::CreateOGLMatrix(camera.CreateViewMatrix(), oglM);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf(oglM);
|
||||
|
||||
SetViewportClipping(v, clip);
|
||||
SetViewportClipping(camera, clip);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SetViewToScreenSpace(vtkm::rendering::View &v, bool clip)
|
||||
virtual void SetViewToScreenSpace(vtkm::rendering::Camera &camera, bool clip)
|
||||
{
|
||||
vtkm::Float32 oglP[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
|
||||
vtkm::Float32 oglM[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
|
||||
@ -98,27 +98,27 @@ public:
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf(oglM);
|
||||
|
||||
SetViewportClipping(v, clip);
|
||||
SetViewportClipping(camera, clip);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void SetViewportClipping(vtkm::rendering::View &v, bool clip)
|
||||
virtual void SetViewportClipping(vtkm::rendering::Camera &camera, bool clip)
|
||||
{
|
||||
if (clip)
|
||||
{
|
||||
vtkm::Float32 vl, vr, vb, vt;
|
||||
v.GetRealViewport(vl,vr,vb,vt);
|
||||
vtkm::Float32 _x = static_cast<vtkm::Float32>(v.Width)*(1.f+vl)/2.f;
|
||||
vtkm::Float32 _y = static_cast<vtkm::Float32>(v.Height)*(1.f+vb)/2.f;
|
||||
vtkm::Float32 _w = static_cast<vtkm::Float32>(v.Width)*(vr-vl)/2.f;
|
||||
vtkm::Float32 _h = static_cast<vtkm::Float32>(v.Height)*(vt-vb)/2.f;
|
||||
camera.GetRealViewport(vl,vr,vb,vt);
|
||||
vtkm::Float32 _x = static_cast<vtkm::Float32>(camera.Width)*(1.f+vl)/2.f;
|
||||
vtkm::Float32 _y = static_cast<vtkm::Float32>(camera.Height)*(1.f+vb)/2.f;
|
||||
vtkm::Float32 _w = static_cast<vtkm::Float32>(camera.Width)*(vr-vl)/2.f;
|
||||
vtkm::Float32 _h = static_cast<vtkm::Float32>(camera.Height)*(vt-vb)/2.f;
|
||||
|
||||
glViewport(static_cast<int>(_x), static_cast<int>(_y),
|
||||
static_cast<int>(_w), static_cast<int>(_h));
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(0,0, v.Width, v.Height);
|
||||
glViewport(0,0, camera.Width, camera.Height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,8 +161,8 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void AddColorBar(vtkm::Float32 x, vtkm::Float32 y,
|
||||
vtkm::Float32 w, vtkm::Float32 h,
|
||||
virtual void AddColorBar(vtkm::Float32 x, vtkm::Float32 y,
|
||||
vtkm::Float32 w, vtkm::Float32 h,
|
||||
const vtkm::rendering::ColorTable &ct,
|
||||
bool horizontal)
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define vtk_m_rendering_RenderSurfaceGLX_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/RenderSurfaceGL.h>
|
||||
|
||||
@ -58,7 +57,7 @@ public:
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
virtual void Clear()
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define vtk_m_rendering_RenderSurfaceOSMesa_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/RenderSurfaceGL.h>
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
@ -20,8 +20,8 @@
|
||||
#ifndef vtk_m_rendering_Scene_h
|
||||
#define vtk_m_rendering_Scene_h
|
||||
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Plot.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm {
|
||||
@ -38,14 +38,14 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void Render(SceneRendererType &sceneRenderer,
|
||||
SurfaceType &surface,
|
||||
vtkm::rendering::View &view)
|
||||
vtkm::rendering::Camera &camera)
|
||||
{
|
||||
vtkm::Bounds bounds;
|
||||
|
||||
sceneRenderer.StartScene();
|
||||
for (std::size_t i = 0; i < this->Plots.size(); i++)
|
||||
{
|
||||
this->Plots[i].Render(sceneRenderer, surface, view);
|
||||
this->Plots[i].Render(sceneRenderer, surface, camera);
|
||||
|
||||
// accumulate all Plots' spatial bounds into the scene spatial bounds
|
||||
bounds.Include(this->Plots[i].SpatialBounds);
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define vtk_m_rendering_SceneRenderer_h
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
namespace vtkm {
|
||||
namespace rendering {
|
||||
@ -44,7 +44,7 @@ public:
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::cont::Field &scalarField, //This should be const
|
||||
const vtkm::rendering::ColorTable &colorTable,
|
||||
vtkm::rendering::View &view,
|
||||
vtkm::rendering::Camera &camera,
|
||||
const vtkm::Range &scalarRange) = 0;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Triangulator.h>
|
||||
#include <vtkm/rendering/internal/OpenGLHeaders.h>
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::cont::Field &scalarField,
|
||||
const vtkm::rendering::ColorTable &colorTable,
|
||||
vtkm::rendering::View &,
|
||||
vtkm::rendering::Camera &,
|
||||
const vtkm::Range &scalarRange)
|
||||
{
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Id, 4> > indices;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <vtkm/rendering/raytracing/RayTracer.h>
|
||||
#include <vtkm/rendering/raytracing/Camera.h>
|
||||
#include <vtkm/rendering/RenderSurfaceRayTracer.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
namespace vtkm {
|
||||
namespace rendering {
|
||||
|
||||
@ -70,15 +70,14 @@ public:
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::cont::Field &scalarField,
|
||||
const vtkm::rendering::ColorTable &vtkmNotUsed(colorTable),
|
||||
vtkm::rendering::View &view,
|
||||
vtkm::rendering::Camera &camera,
|
||||
const vtkm::Range &scalarRange)
|
||||
{
|
||||
|
||||
vtkm::cont::Timer<DeviceAdapter> timer;
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Id, 4> > indices;
|
||||
vtkm::rendering::raytracing::Camera<DeviceAdapter> &camera = Tracer.GetCamera();
|
||||
camera.SetParameters(view);
|
||||
Tracer.GetCamera().SetParameters(camera);
|
||||
vtkm::Id numberOfTriangles;
|
||||
|
||||
vtkm::Bounds dataBounds = coords.GetBounds(DeviceAdapter());
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <vtkm/rendering/raytracing/VolumeRendererStructured.h>
|
||||
#include <vtkm/rendering/raytracing/Camera.h>
|
||||
#include <vtkm/rendering/RenderSurfaceRayTracer.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::cont::Field &scalarField,
|
||||
const vtkm::rendering::ColorTable &, //colorTable
|
||||
vtkm::rendering::View &view,
|
||||
vtkm::rendering::Camera &camera,
|
||||
const vtkm::Range &scalarRange)
|
||||
{
|
||||
// vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
@ -88,8 +88,7 @@ public:
|
||||
vtkm::cont::CellSetStructured<3> cellSetStructured3D = cellset.Cast<vtkm::cont::CellSetStructured<3> >();
|
||||
//vtkm::cont::ArrayHandleUniformPointCoordinates vertices;
|
||||
//vertices = dynamicCoordsHandle.Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
||||
vtkm::rendering::raytracing::Camera<DeviceAdapter> &camera = Tracer.GetCamera();
|
||||
camera.SetParameters(view);
|
||||
Tracer.GetCamera().SetParameters(camera);
|
||||
Tracer.SetData(coords, scalarField, coordsBounds, cellSetStructured3D, scalarRange);
|
||||
Tracer.SetColorMap(ColorMap);
|
||||
Tracer.SetBackgroundColor(this->BackgroundColor);
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define vtk_m_rendering_TextAnnotation_h
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
namespace vtkm {
|
||||
@ -99,7 +99,7 @@ public:
|
||||
{
|
||||
Scale = s;
|
||||
}
|
||||
virtual void Render(View &view,
|
||||
virtual void Render(Camera &camera,
|
||||
WorldAnnotator &worldAnnotator,
|
||||
RenderSurface &renderSurface) = 0;
|
||||
};
|
||||
@ -123,12 +123,12 @@ public:
|
||||
XPos = ox;
|
||||
YPos = oy;
|
||||
}
|
||||
virtual void Render(View &view,
|
||||
virtual void Render(Camera &camera,
|
||||
WorldAnnotator &,
|
||||
RenderSurface &renderSurface)
|
||||
{
|
||||
vtkm::Float32 WindowAspect = vtkm::Float32(view.Width) /
|
||||
vtkm::Float32(view.Height);
|
||||
vtkm::Float32 WindowAspect = vtkm::Float32(camera.Width) /
|
||||
vtkm::Float32(camera.Height);
|
||||
|
||||
renderSurface.AddText(XPos,YPos,
|
||||
Scale,
|
||||
@ -162,19 +162,19 @@ public:
|
||||
ZPos = oz;
|
||||
}
|
||||
|
||||
virtual void Render(View &view,
|
||||
virtual void Render(Camera &camera,
|
||||
WorldAnnotator &worldAnnotator,
|
||||
RenderSurface &renderSurface)
|
||||
{
|
||||
vtkm::Matrix<vtkm::Float32, 4, 4> V, P;
|
||||
V = view.CreateViewMatrix();
|
||||
P = view.CreateProjectionMatrix();
|
||||
V = camera.CreateViewMatrix();
|
||||
P = camera.CreateProjectionMatrix();
|
||||
|
||||
vtkm::Vec<vtkm::Float32,4> p4w(XPos,YPos,ZPos,1);
|
||||
vtkm::Vec<vtkm::Float32,4> p4s =
|
||||
vtkm::MatrixMultiply(vtkm::MatrixMultiply(P,V), p4w);
|
||||
|
||||
renderSurface.SetViewToScreenSpace(view,true);
|
||||
renderSurface.SetViewToScreenSpace(camera,true);
|
||||
|
||||
vtkm::Float32 psx = p4s[0] / p4s[3];
|
||||
vtkm::Float32 psy = p4s[1] / p4s[3];
|
||||
@ -185,7 +185,7 @@ public:
|
||||
T = MatrixHelpers::TranslateMatrix(psx,psy,-psz);
|
||||
|
||||
vtkm::Float32 WindowAspect =
|
||||
vtkm::Float32(view.Width) / vtkm::Float32(view.Height);
|
||||
vtkm::Float32(camera.Width) / vtkm::Float32(camera.Height);
|
||||
|
||||
vtkm::Matrix<vtkm::Float32, 4, 4> SW;
|
||||
SW = MatrixHelpers::ScaleMatrix(1.f/WindowAspect, 1, 1);
|
||||
@ -195,7 +195,7 @@ public:
|
||||
//if view type == 2D?
|
||||
{
|
||||
vtkm::Float32 vl, vr, vb, vt;
|
||||
view.GetRealViewport(vl,vr,vb,vt);
|
||||
camera.GetRealViewport(vl,vr,vb,vt);
|
||||
vtkm::Float32 xs = (vr-vl);
|
||||
vtkm::Float32 ys = (vt-vb);
|
||||
SV = MatrixHelpers::ScaleMatrix(2.f/xs, 2.f/ys, 1);
|
||||
@ -240,7 +240,7 @@ public:
|
||||
AnchorX, AnchorY,
|
||||
TextColor, Text);
|
||||
|
||||
renderSurface.SetViewToWorldSpace(view,true);
|
||||
renderSurface.SetViewToWorldSpace(camera,true);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,12 +24,12 @@
|
||||
#include <vtkm/rendering/BoundingBoxAnnotation.h>
|
||||
#include <vtkm/rendering/AxisAnnotation3D.h>
|
||||
#include <vtkm/rendering/AxisAnnotation2D.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/ColorBarAnnotation.h>
|
||||
#include <vtkm/rendering/TextAnnotation.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace rendering {
|
||||
@ -42,18 +42,18 @@ class Window
|
||||
public:
|
||||
SceneRendererType SceneRenderer;
|
||||
SurfaceType Surface;
|
||||
vtkm::rendering::View View;
|
||||
vtkm::rendering::Camera Camera;
|
||||
Color BackgroundColor;
|
||||
WorldAnnotatorType WorldAnnotator;
|
||||
|
||||
Window(const SceneRendererType &sceneRenderer,
|
||||
const SurfaceType &surface,
|
||||
const vtkm::rendering::View &view,
|
||||
const vtkm::rendering::Camera &camera,
|
||||
const vtkm::rendering::Color &backgroundColor =
|
||||
vtkm::rendering::Color(0,0,0,1))
|
||||
: SceneRenderer(sceneRenderer),
|
||||
Surface(surface),
|
||||
View(view),
|
||||
Camera(camera),
|
||||
BackgroundColor(backgroundColor)
|
||||
{
|
||||
this->SceneRenderer.SetBackgroundColor(this->BackgroundColor);
|
||||
@ -79,15 +79,15 @@ protected:
|
||||
VTKM_CONT_EXPORT
|
||||
void SetupForWorldSpace(bool viewportClip=true)
|
||||
{
|
||||
//this->View.SetupMatrices();
|
||||
this->Surface.SetViewToWorldSpace(this->View,viewportClip);
|
||||
//this->Camera.SetupMatrices();
|
||||
this->Surface.SetViewToWorldSpace(this->Camera,viewportClip);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetupForScreenSpace(bool viewportClip=false)
|
||||
{
|
||||
//this->View.SetupMatrices();
|
||||
this->Surface.SetViewToScreenSpace(this->View,viewportClip);
|
||||
//this->Camera.SetupMatrices();
|
||||
this->Surface.SetViewToScreenSpace(this->Camera,viewportClip);
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,10 +111,10 @@ public:
|
||||
Window3D(const vtkm::rendering::Scene &scene,
|
||||
const SceneRendererType &sceneRenderer,
|
||||
const SurfaceType &surface,
|
||||
const vtkm::rendering::View &view,
|
||||
const vtkm::rendering::Camera &camera,
|
||||
const vtkm::rendering::Color &backgroundColor =
|
||||
vtkm::rendering::Color(0,0,0,1))
|
||||
: Superclass(sceneRenderer,surface,view,backgroundColor),
|
||||
: Superclass(sceneRenderer,surface,camera,backgroundColor),
|
||||
Scene(scene)
|
||||
{
|
||||
}
|
||||
@ -125,7 +125,7 @@ public:
|
||||
this->Surface.Activate();
|
||||
this->Surface.Clear();
|
||||
this->SetupForWorldSpace();
|
||||
this->Scene.Render(this->SceneRenderer, this->Surface, this->View);
|
||||
this->Scene.Render(this->SceneRenderer, this->Surface, this->Camera);
|
||||
this->RenderWorldAnnotations();
|
||||
|
||||
this->SetupForScreenSpace();
|
||||
@ -142,7 +142,7 @@ public:
|
||||
//this->ColorBarAnnotation.SetAxisColor(vtkm::rendering::Color(1,1,1));
|
||||
this->ColorBarAnnotation.SetRange(this->Scene.Plots[0].ScalarRange, 5);
|
||||
this->ColorBarAnnotation.SetColorTable(this->Scene.Plots[0].ColorTable);
|
||||
this->ColorBarAnnotation.Render(this->View, this->WorldAnnotator, this->Surface);
|
||||
this->ColorBarAnnotation.Render(this->Camera, this->WorldAnnotator, this->Surface);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,11 +158,11 @@ public:
|
||||
|
||||
this->BoxAnnotation.SetColor(Color(.5f,.5f,.5f));
|
||||
this->BoxAnnotation.SetExtents(this->Scene.GetSpatialBounds());
|
||||
this->BoxAnnotation.Render(this->View, this->WorldAnnotator);
|
||||
this->BoxAnnotation.Render(this->Camera, this->WorldAnnotator);
|
||||
|
||||
bool xtest = this->View.View3d.LookAt[0] > this->View.View3d.Position[0];
|
||||
bool ytest = this->View.View3d.LookAt[1] > this->View.View3d.Position[1];
|
||||
bool ztest = this->View.View3d.LookAt[2] > this->View.View3d.Position[2];
|
||||
bool xtest = this->Camera.Camera3d.LookAt[0] > this->Camera.Camera3d.Position[0];
|
||||
bool ytest = this->Camera.Camera3d.LookAt[1] > this->Camera.Camera3d.Position[1];
|
||||
bool ztest = this->Camera.Camera3d.LookAt[2] > this->Camera.Camera3d.Position[2];
|
||||
|
||||
const bool outsideedges = true; // if false, do closesttriad
|
||||
if (outsideedges)
|
||||
@ -189,7 +189,7 @@ public:
|
||||
this->XAxisAnnotation.SetMinorTickSize(size / 80.f, 0);
|
||||
this->XAxisAnnotation.SetLabelFontOffset(vtkm::Float32(size / 15.f));
|
||||
this->XAxisAnnotation.SetMoreOrLessTickAdjustment(xrel < .3 ? -1 : 0);
|
||||
this->XAxisAnnotation.Render(this->View, this->WorldAnnotator, this->Surface);
|
||||
this->XAxisAnnotation.Render(this->Camera, this->WorldAnnotator, this->Surface);
|
||||
|
||||
this->YAxisAnnotation.SetAxis(1);
|
||||
this->YAxisAnnotation.SetColor(Color(1,1,1));
|
||||
@ -205,7 +205,7 @@ public:
|
||||
this->YAxisAnnotation.SetMinorTickSize(size / 80.f, 0);
|
||||
this->YAxisAnnotation.SetLabelFontOffset(vtkm::Float32(size / 15.f));
|
||||
this->YAxisAnnotation.SetMoreOrLessTickAdjustment(yrel < .3 ? -1 : 0);
|
||||
this->YAxisAnnotation.Render(this->View, this->WorldAnnotator, this->Surface);
|
||||
this->YAxisAnnotation.Render(this->Camera, this->WorldAnnotator, this->Surface);
|
||||
|
||||
this->ZAxisAnnotation.SetAxis(2);
|
||||
this->ZAxisAnnotation.SetColor(Color(1,1,1));
|
||||
@ -221,7 +221,7 @@ public:
|
||||
this->ZAxisAnnotation.SetMinorTickSize(size / 80.f, 0);
|
||||
this->ZAxisAnnotation.SetLabelFontOffset(vtkm::Float32(size / 15.f));
|
||||
this->ZAxisAnnotation.SetMoreOrLessTickAdjustment(zrel < .3 ? -1 : 0);
|
||||
this->ZAxisAnnotation.Render(this->View, this->WorldAnnotator, this->Surface);
|
||||
this->ZAxisAnnotation.Render(this->Camera, this->WorldAnnotator, this->Surface);
|
||||
}
|
||||
};
|
||||
|
||||
@ -242,10 +242,10 @@ public:
|
||||
Window2D(const vtkm::rendering::Scene &scene,
|
||||
const SceneRendererType &sceneRenderer,
|
||||
const SurfaceType &surface,
|
||||
const vtkm::rendering::View &view,
|
||||
const vtkm::rendering::Camera &camera,
|
||||
const vtkm::rendering::Color &backgroundColor =
|
||||
vtkm::rendering::Color(0,0,0,1))
|
||||
: Superclass(sceneRenderer, surface, view, backgroundColor),
|
||||
: Superclass(sceneRenderer, surface, camera, backgroundColor),
|
||||
Scene(scene)
|
||||
{
|
||||
}
|
||||
@ -257,7 +257,7 @@ public:
|
||||
this->Surface.Clear();
|
||||
this->SetupForWorldSpace();
|
||||
|
||||
this->Scene.Render(this->SceneRenderer, this->Surface, this->View);
|
||||
this->Scene.Render(this->SceneRenderer, this->Surface, this->Camera);
|
||||
this->RenderWorldAnnotations();
|
||||
|
||||
this->SetupForScreenSpace();
|
||||
@ -273,35 +273,35 @@ public:
|
||||
vtkm::Float32 viewportRight;
|
||||
vtkm::Float32 viewportTop;
|
||||
vtkm::Float32 viewportBottom;
|
||||
this->View.GetRealViewport(
|
||||
this->Camera.GetRealViewport(
|
||||
viewportLeft, viewportRight, viewportBottom, viewportTop);
|
||||
|
||||
this->HorizontalAxisAnnotation.SetColor(vtkm::rendering::Color(1,1,1));
|
||||
this->HorizontalAxisAnnotation.SetScreenPosition(
|
||||
viewportLeft, viewportBottom, viewportRight, viewportBottom);
|
||||
this->HorizontalAxisAnnotation.SetRangeForAutoTicks(this->View.View2d.Left,
|
||||
this->View.View2d.Right);
|
||||
this->HorizontalAxisAnnotation.SetRangeForAutoTicks(this->Camera.Camera2d.Left,
|
||||
this->Camera.Camera2d.Right);
|
||||
this->HorizontalAxisAnnotation.SetMajorTickSize(0, .05, 1.0);
|
||||
this->HorizontalAxisAnnotation.SetMinorTickSize(0, .02, 1.0);
|
||||
this->HorizontalAxisAnnotation.SetLabelAlignment(TextAnnotation::HCenter,
|
||||
TextAnnotation::Top);
|
||||
this->HorizontalAxisAnnotation.Render(
|
||||
this->View, this->WorldAnnotator, this->Surface);
|
||||
this->Camera, this->WorldAnnotator, this->Surface);
|
||||
|
||||
vtkm::Float32 windowaspect =
|
||||
vtkm::Float32(this->View.Width) / vtkm::Float32(this->View.Height);
|
||||
vtkm::Float32(this->Camera.Width) / vtkm::Float32(this->Camera.Height);
|
||||
|
||||
this->VerticalAxisAnnotation.SetColor(Color(1,1,1));
|
||||
this->VerticalAxisAnnotation.SetScreenPosition(
|
||||
viewportLeft, viewportBottom, viewportLeft, viewportTop);
|
||||
this->VerticalAxisAnnotation.SetRangeForAutoTicks(this->View.View2d.Bottom,
|
||||
this->View.View2d.Top);
|
||||
this->VerticalAxisAnnotation.SetRangeForAutoTicks(this->Camera.Camera2d.Bottom,
|
||||
this->Camera.Camera2d.Top);
|
||||
this->VerticalAxisAnnotation.SetMajorTickSize(.05 / windowaspect, 0, 1.0);
|
||||
this->VerticalAxisAnnotation.SetMinorTickSize(.02 / windowaspect, 0, 1.0);
|
||||
this->VerticalAxisAnnotation.SetLabelAlignment(TextAnnotation::Right,
|
||||
TextAnnotation::VCenter);
|
||||
this->VerticalAxisAnnotation.Render(
|
||||
this->View, this->WorldAnnotator, this->Surface);
|
||||
this->Camera, this->WorldAnnotator, this->Surface);
|
||||
|
||||
if (this->Scene.Plots.size() > 0)
|
||||
{
|
||||
@ -311,7 +311,7 @@ public:
|
||||
5);
|
||||
this->ColorBarAnnotation.SetColorTable(this->Scene.Plots[0].ColorTable);
|
||||
this->ColorBarAnnotation.Render(
|
||||
this->View, this->WorldAnnotator, this->Surface);
|
||||
this->Camera, this->WorldAnnotator, this->Surface);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
|
||||
namespace vtkm {
|
||||
|
@ -22,15 +22,14 @@
|
||||
|
||||
#include <vtkm/Matrix.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
#include <vtkm/rendering/BitmapFont.h>
|
||||
#include <vtkm/rendering/BitmapFontFactory.h>
|
||||
#include <vtkm/rendering/TextureGL.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/MatrixHelpers.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/SceneRenderer.h>
|
||||
#include <vtkm/rendering/TextureGL.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
|
||||
#include <vtkm/rendering/internal/OpenGLHeaders.h>
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/Camera.h>
|
||||
#include <vtkm/rendering/raytracing/Ray.h>
|
||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||
#include <vtkm/rendering/raytracing/Worklets.h>
|
||||
@ -205,7 +205,7 @@ private:
|
||||
vtkm::Vec< vtkm::Float32, 3> Up;
|
||||
vtkm::Vec< vtkm::Float32, 3> LookAt;
|
||||
vtkm::Vec< vtkm::Float32, 3> Position;
|
||||
View CameraView;
|
||||
vtkm::rendering::Camera CameraView;
|
||||
vtkm::Matrix<vtkm::Float32,4,4> ViewProjectionMat;
|
||||
|
||||
|
||||
@ -245,15 +245,15 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void SetParameters(View &view)
|
||||
void SetParameters(vtkm::rendering::Camera &camera)
|
||||
{
|
||||
this->SetUp(view.View3d.Up);
|
||||
this->SetLookAt(view.View3d.LookAt);
|
||||
this->SetPosition(view.View3d.Position);
|
||||
this->SetFieldOfView(view.View3d.FieldOfView);
|
||||
this->SetHeight(view.Height);
|
||||
this->SetWidth(view.Width);
|
||||
this->CameraView = view;
|
||||
this->SetUp(camera.Camera3d.Up);
|
||||
this->SetLookAt(camera.Camera3d.LookAt);
|
||||
this->SetPosition(camera.Camera3d.Position);
|
||||
this->SetFieldOfView(camera.Camera3d.FieldOfView);
|
||||
this->SetHeight(camera.Height);
|
||||
this->SetWidth(camera.Width);
|
||||
this->CameraView = camera;
|
||||
}
|
||||
|
||||
|
||||
@ -350,7 +350,7 @@ public:
|
||||
if(newFOVY != this->FovY) { this->IsViewDirty = true; }
|
||||
this->FovX = newFOVX;
|
||||
this->FovY = newFOVY;
|
||||
this->CameraView.View3d.FieldOfView = this->FovX;
|
||||
this->CameraView.Camera3d.FieldOfView = this->FovX;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
void Set3DView(vtkm::rendering::View &view,
|
||||
void Set3DView(vtkm::rendering::Camera &camera,
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::Int32 w, vtkm::Int32 h)
|
||||
{
|
||||
@ -43,21 +43,21 @@ void Set3DView(vtkm::rendering::View &view,
|
||||
vtkm::Float32 mag = vtkm::Magnitude(totalExtent);
|
||||
vtkm::Normalize(totalExtent);
|
||||
|
||||
view = vtkm::rendering::View(vtkm::rendering::View::VIEW_3D);
|
||||
view.View3d.Position = totalExtent * (mag * 2.f);
|
||||
view.View3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
view.View3d.LookAt = totalExtent * (mag * .5f);
|
||||
view.View3d.FieldOfView = 60.f;
|
||||
view.NearPlane = 1.f;
|
||||
view.FarPlane = 100.f;
|
||||
view.Width = w;
|
||||
view.Height = h;
|
||||
camera = vtkm::rendering::Camera(vtkm::rendering::Camera::VIEW_3D);
|
||||
camera.Camera3d.Position = totalExtent * (mag * 2.f);
|
||||
camera.Camera3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
camera.Camera3d.LookAt = totalExtent * (mag * .5f);
|
||||
camera.Camera3d.FieldOfView = 60.f;
|
||||
camera.NearPlane = 1.f;
|
||||
camera.FarPlane = 100.f;
|
||||
camera.Width = w;
|
||||
camera.Height = h;
|
||||
|
||||
std::cout<<"View3d: pos: "<<view.View3d.Position<<std::endl;
|
||||
std::cout<<" lookAt: "<<view.View3d.LookAt<<std::endl;
|
||||
std::cout<<" up: "<<view.View3d.Up<<std::endl;
|
||||
std::cout<<"near/far/fov: "<<view.NearPlane<<"/"<<view.FarPlane<<" "<<view.View3d.FieldOfView<<std::endl;
|
||||
std::cout<<" w/h: "<<view.Width<<"/"<<view.Height<<std::endl;
|
||||
std::cout<<"Camera3d: pos: "<<camera.Camera3d.Position<<std::endl;
|
||||
std::cout<<" lookAt: "<<camera.Camera3d.LookAt<<std::endl;
|
||||
std::cout<<" up: "<<camera.Camera3d.Up<<std::endl;
|
||||
std::cout<<" near/far/fov: "<<camera.NearPlane<<"/"<<camera.FarPlane<<" "<<camera.Camera3d.FieldOfView<<std::endl;
|
||||
std::cout<<" w/h: "<<camera.Width<<"/"<<camera.Height<<std::endl;
|
||||
}
|
||||
|
||||
void Render(const vtkm::cont::DataSet &ds,
|
||||
@ -69,8 +69,8 @@ void Render(const vtkm::cont::DataSet &ds,
|
||||
const vtkm::cont::CoordinateSystem coords = ds.GetCoordinateSystem();
|
||||
vtkm::rendering::SceneRendererRayTracer<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> sceneRenderer;
|
||||
|
||||
vtkm::rendering::View view;
|
||||
Set3DView(view, coords, W, H);
|
||||
vtkm::rendering::Camera camera;
|
||||
Set3DView(camera, coords, W, H);
|
||||
|
||||
vtkm::rendering::Scene scene;
|
||||
vtkm::rendering::Color bg(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
@ -84,7 +84,7 @@ void Render(const vtkm::cont::DataSet &ds,
|
||||
vtkm::rendering::Window3D<vtkm::rendering::SceneRendererRayTracer<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>,
|
||||
vtkm::rendering::RenderSurfaceRayTracer,
|
||||
vtkm::rendering::WorldAnnotator>
|
||||
w(scene, sceneRenderer, surface, view, bg);
|
||||
w(scene, sceneRenderer, surface, camera, bg);
|
||||
|
||||
w.Initialize();
|
||||
w.Paint();
|
||||
|
@ -18,19 +18,19 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/rendering/Window.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/Plot.h>
|
||||
#include <vtkm/rendering/SceneRendererVolume.h>
|
||||
#include <vtkm/rendering/RenderSurface.h>
|
||||
#include <vtkm/rendering/RenderSurfaceRayTracer.h>
|
||||
#include <vtkm/rendering/Scene.h>
|
||||
#include <vtkm/rendering/SceneRendererVolume.h>
|
||||
#include <vtkm/rendering/Window.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
namespace {
|
||||
|
||||
void Set3DView(vtkm::rendering::View &view,
|
||||
void Set3DView(vtkm::rendering::Camera &camera,
|
||||
const vtkm::cont::CoordinateSystem &coords,
|
||||
vtkm::Int32 w, vtkm::Int32 h)
|
||||
{
|
||||
@ -44,21 +44,21 @@ void Set3DView(vtkm::rendering::View &view,
|
||||
vtkm::Float32 mag = vtkm::Magnitude(totalExtent);
|
||||
vtkm::Normalize(totalExtent);
|
||||
|
||||
view = vtkm::rendering::View(vtkm::rendering::View::VIEW_3D);
|
||||
view.View3d.Position = totalExtent * (mag * 2.f);
|
||||
view.View3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
view.View3d.LookAt = totalExtent * (mag * .5f);
|
||||
view.View3d.FieldOfView = 60.f;
|
||||
view.NearPlane = 1.f;
|
||||
view.FarPlane = 100.f;
|
||||
view.Width = w;
|
||||
view.Height = h;
|
||||
camera = vtkm::rendering::Camera(vtkm::rendering::Camera::VIEW_3D);
|
||||
camera.Camera3d.Position = totalExtent * (mag * 2.f);
|
||||
camera.Camera3d.Up = vtkm::Vec<vtkm::Float32,3>(0.f, 1.f, 0.f);
|
||||
camera.Camera3d.LookAt = totalExtent * (mag * .5f);
|
||||
camera.Camera3d.FieldOfView = 60.f;
|
||||
camera.NearPlane = 1.f;
|
||||
camera.FarPlane = 100.f;
|
||||
camera.Width = w;
|
||||
camera.Height = h;
|
||||
|
||||
std::cout<<"View3d: pos: "<<view.View3d.Position<<std::endl;
|
||||
std::cout<<" lookAt: "<<view.View3d.LookAt<<std::endl;
|
||||
std::cout<<" up: "<<view.View3d.Up<<std::endl;
|
||||
std::cout<<"near/far/fov: "<<view.NearPlane<<"/"<<view.FarPlane<<" "<<view.View3d.FieldOfView<<std::endl;
|
||||
std::cout<<" w/h: "<<view.Width<<"/"<<view.Height<<std::endl;
|
||||
std::cout<<"Camera3d: pos: "<<camera.Camera3d.Position<<std::endl;
|
||||
std::cout<<" lookAt: "<<camera.Camera3d.LookAt<<std::endl;
|
||||
std::cout<<" up: "<<camera.Camera3d.Up<<std::endl;
|
||||
std::cout<<" near/far/fov: "<<camera.NearPlane<<"/"<<camera.FarPlane<<" "<<camera.Camera3d.FieldOfView<<std::endl;
|
||||
std::cout<<" w/h: "<<camera.Width<<"/"<<camera.Height<<std::endl;
|
||||
}
|
||||
|
||||
void Render(const vtkm::cont::DataSet &ds,
|
||||
@ -70,8 +70,8 @@ void Render(const vtkm::cont::DataSet &ds,
|
||||
const vtkm::cont::CoordinateSystem coords = ds.GetCoordinateSystem();
|
||||
vtkm::rendering::SceneRendererVolume<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> sceneRenderer;
|
||||
|
||||
vtkm::rendering::View view;
|
||||
Set3DView(view, coords, W, H);
|
||||
vtkm::rendering::Camera camera;
|
||||
Set3DView(camera, coords, W, H);
|
||||
|
||||
vtkm::rendering::ColorTable colorTable(ctName);
|
||||
colorTable.AddAlphaControlPoint(0.0f, .01f);
|
||||
@ -89,7 +89,7 @@ void Render(const vtkm::cont::DataSet &ds,
|
||||
vtkm::rendering::Window3D<vtkm::rendering::SceneRendererVolume<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>,
|
||||
vtkm::rendering::RenderSurfaceRayTracer,
|
||||
vtkm::rendering::WorldAnnotator>
|
||||
w(scene, sceneRenderer, surface, view, bg);
|
||||
w(scene, sceneRenderer, surface, camera, bg);
|
||||
|
||||
w.Initialize();
|
||||
w.Paint();
|
||||
|
Loading…
Reference in New Issue
Block a user