Commit 6924a334 authored by Michael Fogleman's avatar Michael Fogleman

Support parallel project in OSPRay

parent 279ff7cd
Pipeline #24769 passed with stage
......@@ -54,23 +54,31 @@ void vtkOSPRayCameraNode::Render(bool prepass)
vtkRenderer *ren = vtkRenderer::SafeDownCast(orn->GetRenderable());
int tiledSize[2];
int tiledOrigin[2];
ren->GetTiledSizeAndOrigin(&tiledSize[0], &tiledSize[1],
&tiledOrigin[0], &tiledOrigin[1]);
OSPCamera ospCamera = ospNewCamera("perspective");
ospSetObject(orn->GetORenderer(),"camera", ospCamera);
ren->GetTiledSizeAndOrigin(
&tiledSize[0], &tiledSize[1], &tiledOrigin[0], &tiledOrigin[1]);
vtkCamera *cam = static_cast<vtkCamera *>(this->Renderable);
ospSetf(ospCamera,"aspect", float(tiledSize[0])/float(tiledSize[1]));
ospSetf(ospCamera,"fovy",cam->GetViewAngle());
OSPCamera ospCamera;
if (cam->GetParallelProjection())
{
ospCamera = ospNewCamera("orthographic");
ospSetf(ospCamera, "height", cam->GetParallelScale() * 2);
}
else
{
ospCamera = ospNewCamera("perspective");
ospSetf(ospCamera, "fovy", cam->GetViewAngle());
}
ospSetObject(orn->GetORenderer(), "camera", ospCamera);
ospSetf(ospCamera, "aspect", float(tiledSize[0]) / float(tiledSize[1]));
double *pos = cam->GetPosition();
ospSet3f(ospCamera,"pos",pos[0], pos[1], pos[2]);
ospSet3f(ospCamera,"up",
cam->GetViewUp()[0], cam->GetViewUp()[1], cam->GetViewUp()[2]);
ospSet3f(ospCamera, "pos", pos[0], pos[1], pos[2]);
double *up = cam->GetViewUp();
ospSet3f(ospCamera, "up", up[0], up[1], up[2]);
double *dop = cam->GetDirectionOfProjection();
ospSet3f(ospCamera,"dir", dop[0], dop[1], dop[2]);
ospSet3f(ospCamera, "dir", dop[0], dop[1], dop[2]);
ospCommit(ospCamera);
ospRelease(ospCamera);
}
......
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