mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 11:09:37 -06:00
@@ -43,8 +43,8 @@ local constellations = {
|
||||
File = speck .. "/constellations.speck",
|
||||
LabelFile = speck .. "/constellations.label",
|
||||
TextColor = { 0.8, 0.8, 0.8, 1.0 },
|
||||
TextMinSize = 10.0,
|
||||
TextMaxSize = 30.0,
|
||||
TextSize = 14.5,
|
||||
TextMaxSize = 170.0,
|
||||
TextMinSize = 8.0,
|
||||
MeshColor = { { 0.6, 0.4, 0.4 }, { 0.8, 0.0, 0.0 }, { 0.0, 0.3, 0.8 } },
|
||||
Unit = "pc"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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/cachemanager.h>
|
||||
@@ -464,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)) {
|
||||
@@ -570,7 +577,7 @@ namespace openspace {
|
||||
addProperty(_scaleFactor);
|
||||
|
||||
if (dictionary.hasKey(PolygonSidesInfo.identifier)) {
|
||||
_polygonSides = static_cast<float>(
|
||||
_polygonSides = static_cast<int>(
|
||||
dictionary.value<double>(PolygonSidesInfo.identifier)
|
||||
);
|
||||
_hasPolygon = true;
|
||||
@@ -597,21 +604,19 @@ namespace openspace {
|
||||
|
||||
|
||||
if (dictionary.hasKey(TextSizeInfo.identifier)) {
|
||||
_textSize = dictionary.value<double>(TextSizeInfo.identifier);
|
||||
_textSize = dictionary.value<float>(TextSizeInfo.identifier);
|
||||
}
|
||||
addProperty(_textSize);
|
||||
|
||||
if (dictionary.hasKey(LabelMinSizeInfo.identifier)) {
|
||||
_textMinSize = static_cast<int>(
|
||||
dictionary.value<float>(LabelMinSizeInfo.identifier)
|
||||
);
|
||||
_textMinSize =
|
||||
dictionary.value<float>(LabelMinSizeInfo.identifier);
|
||||
}
|
||||
addProperty(_textMinSize);
|
||||
|
||||
if (dictionary.hasKey(LabelMaxSizeInfo.identifier)) {
|
||||
_textMaxSize = static_cast<int>(
|
||||
dictionary.value<float>(LabelMaxSizeInfo.identifier)
|
||||
);
|
||||
_textMaxSize =
|
||||
dictionary.value<float>(LabelMaxSizeInfo.identifier);
|
||||
}
|
||||
addProperty(_textMaxSize);
|
||||
}
|
||||
@@ -895,19 +900,19 @@ namespace openspace {
|
||||
scale = 1e3;
|
||||
break;
|
||||
case Parsec:
|
||||
scale = PARSEC;
|
||||
scale = static_cast<float>(PARSEC);
|
||||
break;
|
||||
case Kiloparsec:
|
||||
scale = 1e3 * PARSEC;
|
||||
scale = static_cast<float>(1e3 * PARSEC);
|
||||
break;
|
||||
case Megaparsec:
|
||||
scale = 1e6 * PARSEC;
|
||||
scale = static_cast<float>(1e6 * PARSEC);
|
||||
break;
|
||||
case Gigaparsec:
|
||||
scale = 1e9 * PARSEC;
|
||||
scale = static_cast<float>(1e9 * PARSEC);
|
||||
break;
|
||||
case GigalightYears:
|
||||
scale = 306391534.73091 * PARSEC;
|
||||
scale = static_cast<float>(306391534.73091 * PARSEC);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -921,9 +926,9 @@ namespace openspace {
|
||||
*_font,
|
||||
scaledPos,
|
||||
textColor,
|
||||
pow(10.0, _textSize.value()),
|
||||
_textMinSize,
|
||||
_textMaxSize,
|
||||
powf(10.f, _textSize.value()),
|
||||
static_cast<int>(_textMinSize),
|
||||
static_cast<int>(_textMaxSize),
|
||||
modelViewProjectionMatrix,
|
||||
orthoRight,
|
||||
orthoUp,
|
||||
@@ -947,32 +952,32 @@ namespace openspace {
|
||||
scale = 1e3;
|
||||
break;
|
||||
case Parsec:
|
||||
scale = PARSEC;
|
||||
scale = static_cast<float>(PARSEC);
|
||||
break;
|
||||
case Kiloparsec:
|
||||
scale = 1e3 * PARSEC;
|
||||
scale = static_cast<float>(1e3 * PARSEC);
|
||||
break;
|
||||
case Megaparsec:
|
||||
scale = 1e6 * PARSEC;
|
||||
scale = static_cast<float>(1e6 * PARSEC);
|
||||
break;
|
||||
case Gigaparsec:
|
||||
scale = 1e9 * PARSEC;
|
||||
scale = static_cast<float>(1e9 * PARSEC);
|
||||
break;
|
||||
case GigalightYears:
|
||||
scale = 306391534.73091 * PARSEC;
|
||||
scale = static_cast<float>(306391534.73091 * PARSEC);
|
||||
break;
|
||||
}
|
||||
|
||||
float fadeInVariable = 1.0f;
|
||||
if (!_disableFadeInDistance) {
|
||||
float distCamera = glm::length(data.camera.positionVec3());
|
||||
float distCamera = static_cast<float>(glm::length(data.camera.positionVec3()));
|
||||
glm::vec2 fadeRange = _fadeInDistance;
|
||||
float a = 1.0f / ((fadeRange.y - fadeRange.x) * scale);
|
||||
float b = -(fadeRange.x / (fadeRange.y - fadeRange.x));
|
||||
float funcValue = a * distCamera + b;
|
||||
fadeInVariable *= funcValue > 1.0 ? 1.0 : funcValue;
|
||||
fadeInVariable *= funcValue > 1.f ? 1.f : funcValue;
|
||||
|
||||
if (funcValue < 0.01) {
|
||||
if (funcValue < 0.01f) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -989,14 +994,22 @@ namespace openspace {
|
||||
glm::dmat4 modelViewProjectionMatrix = glm::dmat4(projectionMatrix) *
|
||||
modelViewMatrix;
|
||||
|
||||
glm::dvec3 cameraViewDirectionWorld = glm::normalize(data.camera.viewDirectionWorldSpace());
|
||||
glm::dvec3 cameraUpDirectionWorld = glm::normalize(data.camera.lookUpVectorWorldSpace());
|
||||
glm::dvec3 orthoRight = glm::dvec3(glm::cross(cameraUpDirectionWorld, cameraViewDirectionWorld));
|
||||
glm::dvec3 cameraViewDirectionWorld = -data.camera.viewDirectionWorldSpace();
|
||||
glm::dvec3 cameraUpDirectionWorld = data.camera.lookUpVectorWorldSpace();
|
||||
glm::dvec3 orthoRight = glm::normalize(
|
||||
glm::cross(cameraUpDirectionWorld, cameraViewDirectionWorld)
|
||||
);
|
||||
if (orthoRight == glm::dvec3(0.0)) {
|
||||
glm::dvec3 otherVector(cameraUpDirectionWorld.y, cameraUpDirectionWorld.x, cameraUpDirectionWorld.z);
|
||||
orthoRight = glm::dvec3(glm::cross(otherVector, cameraViewDirectionWorld));
|
||||
glm::dvec3 otherVector(
|
||||
cameraUpDirectionWorld.y,
|
||||
cameraUpDirectionWorld.x,
|
||||
cameraUpDirectionWorld.z
|
||||
);
|
||||
orthoRight = glm::normalize(glm::cross(otherVector, cameraViewDirectionWorld));
|
||||
}
|
||||
glm::dvec3 orthoUp = cameraUpDirectionWorld;
|
||||
glm::dvec3 orthoUp = glm::normalize(
|
||||
glm::cross(cameraViewDirectionWorld, orthoRight)
|
||||
);
|
||||
|
||||
if (_hasSpeckFile) {
|
||||
renderBillboards(
|
||||
|
||||
@@ -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>
|
||||
@@ -283,10 +284,14 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_drawElements);
|
||||
}
|
||||
|
||||
// DEBUG:
|
||||
_renderOption.addOption(0, "Camera View Direction");
|
||||
_renderOption.addOption(1, "Camera Position Normal");
|
||||
_renderOption.addOption(2, "Screen center Position Normal");
|
||||
if (OsEng.windowWrapper().isFisheyeRendering()) {
|
||||
_renderOption.set(1);
|
||||
}
|
||||
else {
|
||||
_renderOption.set(0);
|
||||
}
|
||||
addProperty(_renderOption);
|
||||
|
||||
if (dictionary.hasKey(keyUnit)) {
|
||||
@@ -596,6 +601,15 @@ void RenderableDUMeshes::render(const RenderData& data, RendererTasks&) {
|
||||
glm::vec3 orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
);
|
||||
|
||||
if (orthoRight == glm::vec3(0.0)) {
|
||||
glm::vec3 otherVector(lookup.y, lookup.x, lookup.z);
|
||||
right = glm::cross(viewDirection, otherVector);
|
||||
orthoRight = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(right, 0.0))
|
||||
);
|
||||
}
|
||||
|
||||
glm::vec3 orthoUp = glm::normalize(
|
||||
glm::vec3(worldToModelTransform * glm::vec4(up, 0.0))
|
||||
);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user