Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with Local Ospray #2430

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Superbuild/Superbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ OPTION(WITH_TETGEN "Build Tetgen." ON)
# Configure ospray
OPTION(WITH_OSPRAY "Build Ospray." OFF)

###########################################
# Use local ospray
OPTION(WITH_OSPRAY_LOCAL "Use Local Ospray." OFF)

###########################################
# Configure data
OPTION(BUILD_WITH_SCIRUN_DATA "Svn checkout data" OFF)
Expand Down Expand Up @@ -191,7 +195,9 @@ IF(WITH_TETGEN)
ADD_EXTERNAL( ${SUPERBUILD_DIR}/TetgenExternal.cmake Tetgen_external )
ENDIF()

IF(WITH_OSPRAY)
IF(WITH_OSPRAY_LOCAL)
find_package(ospray 2.10.0 REQUIRED)
ELSEIF(WITH_OSPRAY)
ADD_EXTERNAL( ${SUPERBUILD_DIR}/OsprayExternal.cmake Ospray_external )
ENDIF()

Expand Down
4 changes: 4 additions & 0 deletions docs/start/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,9 @@ To use the InterfaceWithTetgen module, SCIRun needs to be built with Tetgen, whi
cmake -DWITH_TETGEN=True ../Superbuild/
```

### Configuring SCIRun with Prebuilt OSPRay

To use the OsprayViewer module with a prebuilt binary, you need to download from the [releases page](https://github.com/ospray/OSPRay/releases) and extract the zip. Only OSPRay 2.4 and 2.10 have been tested. Then add the directory to your shell's PATH variable. CMake will automatically find it when the flag `WITH_OSPRAY_LOCAL` is enabled.

## Tagging Releases
On an OSX system, run script `release.sh` in the `src` directory with the release name in format ***beta.XX*** as a parameter.
2 changes: 1 addition & 1 deletion src/Interface/Modules/Render/Ospray/OSPRayRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using namespace Render;
using namespace Core::Datatypes;
using namespace Core::Geometry;

#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define this disjunction in CMake? Then no C++ files need to change.

WITH_OSPRAY --> BUILD_OSPRAY
WITH_OSPRAY_LOCAL --> PREBUILT_OSPRAY
Then add cmake for WITH_OSPRAY = BUILD_OSPRAY || PREBUILT_OSPRAY
A few cmake files will need to change, but no C++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll get this changed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tarkpate I could handle this change if you are too busy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated with these new flags

//int OSPRayRenderer::osprayRendererInstances = 0;
OSPRayDataManager OSPRayRenderer::dataManager;

Expand Down
2 changes: 1 addition & 1 deletion src/Interface/Modules/Render/Ospray/OSPRayRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cstdio>


#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
#include <ospray/ospray.h>
#include <ospray/ospray_util.h>

Expand Down
48 changes: 24 additions & 24 deletions src/Interface/Modules/Render/OsprayViewerDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <Interface/Modules/Render/ES/RendererInterfaceCollaborators.h>
#include <boost/algorithm/string/predicate.hpp>

#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
#include <ospray/ospray.h>

#include <Modules/Render/ViewScene.h>
Expand All @@ -48,7 +48,7 @@ using namespace SCIRun;
using namespace SCIRun::Gui;
using namespace SCIRun::Dataflow::Networks;
using namespace SCIRun::Core::Algorithms;
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
using namespace SCIRun::Core::Algorithms::Render;
#endif
using namespace SCIRun::Core::Datatypes;
Expand All @@ -61,7 +61,7 @@ OsprayViewerDialog::OsprayViewerDialog(const std::string& name, ModuleStateHandl
QWidget* parent)
: ModuleDialogGeneric(state, parent)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
statusBar_ = new QStatusBar(this);

renderer_ = new OSPRayRenderer();
Expand Down Expand Up @@ -133,15 +133,15 @@ OsprayViewerDialog::OsprayViewerDialog(const std::string& name, ModuleStateHandl

OsprayViewerDialog::~OsprayViewerDialog()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
delete viewer_;
delete renderer_;
#endif
}

void OsprayViewerDialog::newGeometryValue()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

auto geomDataTransient = state_->getTransientValue(Parameters::GeomData);
if (!geomDataTransient || geomDataTransient->empty()) return;
Expand Down Expand Up @@ -200,14 +200,14 @@ void OsprayViewerDialog::addConfigurationButton()

void OsprayViewerDialog::configButtonClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
configDialog_->setVisible(!configDialog_->isVisible());
#endif
}

void OsprayViewerDialog::addConfigurationDialog()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
auto name = windowTitle() + " Configuration";
configDialog_ = new ViewOspraySceneConfigDialog(name, this);
#endif
Expand Down Expand Up @@ -298,79 +298,79 @@ void OsprayViewerDialog::toggleLockColor(bool locked)

void OsprayViewerDialog::autoRotateClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::autoViewClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
renderer_->autoView();
#endif
}

void OsprayViewerDialog::screenshotClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::nextTimestepClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::playTimestepsClicked()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::setViewportCamera()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

float OsprayViewerDialog::getFloat(const Name& name) const
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
return static_cast<float>(state_->getValue(name).toDouble());
#endif
return 0;
}

void OsprayViewerDialog::setCameraWidgets()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::setLightColor()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}

void OsprayViewerDialog::setBGColor()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)

#endif
}


void OsprayViewerDialog::pullSpecial()
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
auto ambient = colorFromState(Parameters::AmbientLightColor);
configDialog_->ambientLightColorRDoubleSpinBox_->setValue(ambient.redF());
configDialog_->ambientLightColorGDoubleSpinBox_->setValue(ambient.greenF());
Expand All @@ -385,7 +385,7 @@ void OsprayViewerDialog::pullSpecial()

void OsprayViewerDialog::mousePositionToScreenSpace(int xIn, int yIn, float& xOut, float& yOut)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
int xWindow = xIn - viewer_->pos().x();
int yWindow = yIn - viewer_->pos().y();

Expand All @@ -396,7 +396,7 @@ void OsprayViewerDialog::mousePositionToScreenSpace(int xIn, int yIn, float& xOu

MouseButton OsprayViewerDialog::getRenderButton(QMouseEvent* event)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
auto btn = MouseButton::NONE;
if (event->buttons() & Qt::LeftButton) btn = MouseButton::LEFT;
else if (event->buttons() & Qt::RightButton) btn = MouseButton::RIGHT;
Expand All @@ -408,7 +408,7 @@ MouseButton OsprayViewerDialog::getRenderButton(QMouseEvent* event)

void OsprayViewerDialog::mousePressEvent(QMouseEvent* event)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
float xSS, ySS;
mousePositionToScreenSpace(event->x(), event->y(), xSS, ySS);

Expand All @@ -418,7 +418,7 @@ void OsprayViewerDialog::mousePressEvent(QMouseEvent* event)

void OsprayViewerDialog::mouseMoveEvent(QMouseEvent* event)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
float xSS, ySS;
mousePositionToScreenSpace(event->x(), event->y(), xSS, ySS);

Expand All @@ -428,14 +428,14 @@ void OsprayViewerDialog::mouseMoveEvent(QMouseEvent* event)

void OsprayViewerDialog::mouseReleaseEvent(QMouseEvent* event)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
renderer_->mouseRelease();
#endif
}

void OsprayViewerDialog::wheelEvent(QWheelEvent* event)
{
#ifdef WITH_OSPRAY
#if defined(WITH_OSPRAY) || defined(WITH_OSPRAY_LOCAL)
renderer_->mouseWheel(event->angleDelta().y());
#endif
}