Automatic billboard orientation based on projection type.

This commit is contained in:
Jonathas Costa
2018-06-04 16:28:54 -04:00
parent 8d4b682851
commit 29d0a94782
6 changed files with 33 additions and 3 deletions

View File

@@ -78,6 +78,7 @@ public:
void sendMessageToExternalControl(const std::vector<char>& message) const override;
bool isSimpleRendering() const override;
bool isFisheyeRendering() const override;
void takeScreenshot(bool applyWarping = false) const override;

View File

@@ -282,6 +282,13 @@ public:
*/
virtual bool isSimpleRendering() const;
/**
* Returns <code>true</code> if the rendering is being done using a Fisheye lens;
* <code>false</code> otherwise. On default, this method returns
* <code>false</code>
*/
virtual bool isFisheyeRendering() const;
/**
* Advises the windowing system to take a screenshot. This method defaults to a no-op.
*/

View File

@@ -29,7 +29,7 @@
#include <openspace/documentation/verifier.h>
#include <openspace/util/updatestructures.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/configuration.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/cachemanager.h>
@@ -465,7 +465,13 @@ namespace openspace {
// DEBUG:
_renderOption.addOption(0, "Camera View Direction");
_renderOption.addOption(1, "Camera Position Normal");
_renderOption.set(1);
if (OsEng.windowWrapper().isFisheyeRendering()) {
_renderOption.set(1);
}
else {
_renderOption.set(0);
}
addProperty(_renderOption);
if (dictionary.hasKey(keyUnit)) {

View File

@@ -29,6 +29,7 @@
#include <openspace/documentation/verifier.h>
#include <openspace/util/updatestructures.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem.h>
@@ -285,7 +286,12 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary)
_renderOption.addOption(0, "Camera View Direction");
_renderOption.addOption(1, "Camera Position Normal");
_renderOption.set(1);
if (OsEng.windowWrapper().isFisheyeRendering()) {
_renderOption.set(1);
}
else {
_renderOption.set(0);
}
addProperty(_renderOption);
if (dictionary.hasKey(keyUnit)) {

View File

@@ -275,6 +275,12 @@ bool SGCTWindowWrapper::isSimpleRendering() const {
sgct::Engine::NonLinearBuffer);
}
bool SGCTWindowWrapper::isFisheyeRendering() const {
return dynamic_cast<sgct_core::FisheyeProjection *>(
sgct::Engine::instance()->getCurrentWindowPtr()->getViewport(0)->getNonLinearProjectionPtr()
);
}
void SGCTWindowWrapper::takeScreenshot(bool applyWarping) const {
sgct::SGCTSettings::instance()->setCaptureFromBackBuffer(applyWarping);
sgct::Engine::instance()->takeScreenshot();

View File

@@ -190,6 +190,10 @@ bool WindowWrapper::isSimpleRendering() const {
return true;
}
bool WindowWrapper::isFisheyeRendering() const {
return false;
}
void WindowWrapper::takeScreenshot(bool) const {}
void WindowWrapper::swapBuffer() const {}