mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-18 03:20:33 -05:00
Merge branch 'develop' of github.com:OpenSpace/OpenSpace into feature/parallelconnection
Conflicts: include/openspace/engine/openspaceengine.h src/engine/openspaceengine.cpp src/interaction/interactionhandler.cpp src/network/parallelconnection.cpp src/scripting/scriptengine.cpp
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/rendering/volumeraycaster.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
#include <openspace/util/camera.h>
|
||||
@@ -260,7 +261,12 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
|
||||
glBindImageTexture(1, _fragmentTexture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32UI);
|
||||
|
||||
// Render the scene to the fragment buffer. Collect renderer tasks (active raycasters)
|
||||
RenderData data{ *_camera, psc(), doPerformanceMeasurements };
|
||||
int renderBinMask = static_cast<int>(Renderable::RenderBin::Background) |
|
||||
static_cast<int>(Renderable::RenderBin::Opaque) |
|
||||
static_cast<int>(Renderable::RenderBin::Transparent) |
|
||||
static_cast<int>(Renderable::RenderBin::Overlay);
|
||||
|
||||
RenderData data{ *_camera, psc(), doPerformanceMeasurements, renderBinMask };
|
||||
RendererTasks tasks;
|
||||
_scene->render(data, tasks);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <openspace/scene/scene.h>
|
||||
#include <openspace/util/camera.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/rendering/volumeraycaster.h>
|
||||
#include <openspace/rendering/raycastermanager.h>
|
||||
|
||||
@@ -329,7 +330,7 @@ void FramebufferRenderer::render(float blackoutFactor, bool doPerformanceMeasure
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
RenderData data = { *_camera, psc(), doPerformanceMeasurements };
|
||||
RenderData data = { *_camera, psc(), doPerformanceMeasurements, 0 };
|
||||
RendererTasks tasks;
|
||||
|
||||
// Capture standard fbo
|
||||
@@ -339,7 +340,13 @@ void FramebufferRenderer::render(float blackoutFactor, bool doPerformanceMeasure
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _mainFramebuffer);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// bind new fbo A with color and depth buffer.
|
||||
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Background);
|
||||
_scene->render(data, tasks);
|
||||
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Opaque);
|
||||
_scene->render(data, tasks);
|
||||
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Transparent);
|
||||
_scene->render(data, tasks);
|
||||
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Overlay);
|
||||
_scene->render(data, tasks);
|
||||
|
||||
for (const RaycasterTask& raycasterTask : tasks.raycasterTasks) {
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
|
||||
// ghoul
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
@@ -44,22 +44,37 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Documentation Renderable::Documentation() {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
return {
|
||||
"Renderable",
|
||||
"renderable",
|
||||
{
|
||||
{
|
||||
KeyType,
|
||||
new StringAnnotationVerifier("A valid Renderable created by a factory"),
|
||||
"This key specifies the type of Renderable that gets created. It has to be one"
|
||||
"of the valid Renderables that are available for creation (see the "
|
||||
"FactoryDocumentation for a list of possible Renderables), which depends on "
|
||||
"the configration of the application",
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Renderable* Renderable::createFromDictionary(const ghoul::Dictionary& dictionary) {
|
||||
// The name is passed down from the SceneGraphNode
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
assert(success);
|
||||
ghoul_assert(success, "The SceneGraphNode did not set the 'name' key");
|
||||
|
||||
std::string renderableType;
|
||||
success = dictionary.getValue(KeyType, renderableType);
|
||||
documentation::testSpecificationAndThrow(Documentation(), dictionary, "Renderable");
|
||||
|
||||
if (!success) {
|
||||
LERROR("Renderable '" << name << "' did not have key '" << KeyType << "'");
|
||||
return nullptr;
|
||||
}
|
||||
std::string renderableType = dictionary.value<std::string>(KeyType);
|
||||
|
||||
ghoul::TemplateFactory<Renderable>* factory
|
||||
= FactoryManager::ref().factory<Renderable>();
|
||||
auto factory = FactoryManager::ref().factory<Renderable>();
|
||||
Renderable* result = factory->create(renderableType, dictionary);
|
||||
if (result == nullptr) {
|
||||
LERROR("Failed to create a Renderable object of type '" << renderableType << "'");
|
||||
@@ -71,66 +86,55 @@ Renderable* Renderable::createFromDictionary(const ghoul::Dictionary& dictionary
|
||||
|
||||
Renderable::Renderable()
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _renderBin(RenderBin::Opaque)
|
||||
, _startTime("")
|
||||
, _endTime("")
|
||||
, _hasTimeInterval(false)
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
Renderable::Renderable(const ghoul::Dictionary& dictionary)
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _renderBin(RenderBin::Opaque)
|
||||
, _startTime("")
|
||||
, _endTime("")
|
||||
, _hasTimeInterval(false)
|
||||
{
|
||||
setName("renderable");
|
||||
#ifndef NDEBUG
|
||||
std::string name;
|
||||
ghoul_assert(dictionary.getValue(SceneGraphNode::KeyName, name),
|
||||
"Scenegraphnode need to specify '" << SceneGraphNode::KeyName
|
||||
<< "' because renderables is going to use this for debugging!");
|
||||
#endif
|
||||
|
||||
ghoul_assert(
|
||||
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
|
||||
"SceneGraphNode must specify '" << SceneGraphNode::KeyName << "'"
|
||||
);
|
||||
|
||||
dictionary.getValue(keyStart, _startTime);
|
||||
dictionary.getValue(keyEnd, _endTime);
|
||||
|
||||
if (_startTime != "" && _endTime != "")
|
||||
if (_startTime != "" && _endTime != "") {
|
||||
_hasTimeInterval = true;
|
||||
}
|
||||
|
||||
addProperty(_enabled);
|
||||
}
|
||||
|
||||
Renderable::~Renderable() {
|
||||
Renderable::~Renderable() {}
|
||||
|
||||
void Renderable::setBoundingSphere(PowerScaledScalar boundingSphere) {
|
||||
boundingSphere_ = std::move(boundingSphere);
|
||||
}
|
||||
|
||||
void Renderable::setBoundingSphere(const PowerScaledScalar& boundingSphere)
|
||||
{
|
||||
boundingSphere_ = boundingSphere;
|
||||
}
|
||||
|
||||
const PowerScaledScalar& Renderable::getBoundingSphere()
|
||||
{
|
||||
PowerScaledScalar Renderable::getBoundingSphere() {
|
||||
return boundingSphere_;
|
||||
}
|
||||
|
||||
void Renderable::update(const UpdateData&)
|
||||
{
|
||||
}
|
||||
void Renderable::update(const UpdateData&) {}
|
||||
|
||||
void Renderable::render(const RenderData& data, RendererTasks& tasks)
|
||||
{
|
||||
(void) tasks;
|
||||
void Renderable::render(const RenderData& data, RendererTasks&) {
|
||||
render(data);
|
||||
}
|
||||
|
||||
void Renderable::render(const RenderData& data)
|
||||
{
|
||||
}
|
||||
void Renderable::render(const RenderData& data) {}
|
||||
|
||||
void Renderable::postRender(const RenderData& data)
|
||||
{
|
||||
}
|
||||
void Renderable::postRender(const RenderData& data) {}
|
||||
|
||||
void Renderable::setPscUniforms(
|
||||
ghoul::opengl::ProgramObject& program,
|
||||
@@ -143,6 +147,18 @@ void Renderable::setPscUniforms(
|
||||
program.setUniform("scaling", camera.scaling());
|
||||
}
|
||||
|
||||
Renderable::RenderBin Renderable::renderBin() const {
|
||||
return _renderBin;
|
||||
}
|
||||
|
||||
void Renderable::setRenderBin(RenderBin bin) {
|
||||
_renderBin = bin;
|
||||
}
|
||||
|
||||
bool Renderable::matchesRenderBinMask(int binMask) {
|
||||
return binMask & static_cast<int>(renderBin());
|
||||
}
|
||||
|
||||
bool Renderable::isVisible() const {
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <openspace/performance/performancemanager.h>
|
||||
|
||||
#include <openspace/documentation/documentationengine.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/interaction/interactionhandler.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
@@ -124,10 +125,12 @@ RenderEngine::RenderEngine()
|
||||
, _showInfo(true)
|
||||
, _showLog(true)
|
||||
, _takeScreenshot(false)
|
||||
, _showFrameNumber(false)
|
||||
, _globalBlackOutFactor(1.f)
|
||||
, _fadeDuration(2.f)
|
||||
, _currentFadeTime(0.f)
|
||||
, _fadeDirection(0)
|
||||
, _frameNumber(0)
|
||||
, _frametimeType(FrametimeType::DtTimeAvg)
|
||||
// , _sgctRenderStatisticsVisible(false)
|
||||
{
|
||||
@@ -180,6 +183,7 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) {
|
||||
}
|
||||
|
||||
bool RenderEngine::initialize() {
|
||||
_frameNumber = 0;
|
||||
std::string renderingMethod = DefaultRenderingMethod;
|
||||
|
||||
// If the user specified a rendering method that he would like to use, use that
|
||||
@@ -228,6 +232,7 @@ bool RenderEngine::initialize() {
|
||||
MissionManager::initialize();
|
||||
#endif
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -240,6 +245,8 @@ bool RenderEngine::initializeGL() {
|
||||
OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 1000.f);
|
||||
|
||||
try {
|
||||
const float fontSizeBig = 50.f;
|
||||
_fontBig = OsEng.fontManager().font(KeyFontMono, fontSizeBig);
|
||||
const float fontSizeTime = 15.f;
|
||||
_fontDate = OsEng.fontManager().font(KeyFontMono, fontSizeTime);
|
||||
const float fontSizeMono = 10.f;
|
||||
@@ -334,23 +341,69 @@ bool RenderEngine::initializeGL() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderEngine::preSynchronization() {
|
||||
//if (_mainCamera)
|
||||
// _mainCamera->preSynchronization();
|
||||
void RenderEngine::updateSceneGraph() {
|
||||
_sceneGraph->update({
|
||||
glm::dvec3(0),
|
||||
glm::dmat3(1),
|
||||
1,
|
||||
Time::ref().j2000Seconds(),
|
||||
Time::ref().timeJumped(),
|
||||
Time::ref().deltaTime(),
|
||||
_performanceManager != nullptr
|
||||
});
|
||||
|
||||
_sceneGraph->evaluate(_mainCamera);
|
||||
|
||||
//Allow focus node to update camera (enables camera-following)
|
||||
//FIX LATER: THIS CAUSES MASTER NODE TO BE ONE FRAME AHEAD OF SLAVES
|
||||
//if (const SceneGraphNode* node = OsEng.ref().interactionHandler().focusNode()){
|
||||
//node->updateCamera(_mainCamera);
|
||||
//}
|
||||
}
|
||||
|
||||
void RenderEngine::postSynchronizationPreDraw() {
|
||||
void RenderEngine::updateShaderPrograms() {
|
||||
for (auto program : _programs) {
|
||||
try {
|
||||
if (program->isDirty()) {
|
||||
program->rebuildFromFile();
|
||||
}
|
||||
}
|
||||
catch (const ghoul::opengl::ShaderObject::ShaderCompileError& e) {
|
||||
LERRORC(e.component, e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::updateRenderer() {
|
||||
bool windowResized = OsEng.windowWrapper().windowHasResized();
|
||||
|
||||
if (windowResized) {
|
||||
glm::ivec2 res = OsEng.windowWrapper().currentDrawBufferResolution();
|
||||
_renderer->setResolution(res);
|
||||
ghoul::fontrendering::FontRenderer::defaultRenderer().setFramebufferSize(glm::vec2(res));
|
||||
}
|
||||
|
||||
_renderer->update();
|
||||
}
|
||||
|
||||
void RenderEngine::updateScreenSpaceRenderables() {
|
||||
for (auto screenspacerenderable : _screenSpaceRenderables) {
|
||||
screenspacerenderable->update();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::updateFade() {
|
||||
//temporary fade funtionality
|
||||
float fadedIn = 1.0;
|
||||
float fadedOut = 0.0;
|
||||
// Don't restart the fade if you've already done it in that direction
|
||||
if ( (_fadeDirection > 0 && _globalBlackOutFactor == fadedIn)
|
||||
|| (_fadeDirection < 0 && _globalBlackOutFactor == fadedOut)) {
|
||||
if ((_fadeDirection > 0 && _globalBlackOutFactor == fadedIn)
|
||||
|| (_fadeDirection < 0 && _globalBlackOutFactor == fadedOut)) {
|
||||
_fadeDirection = 0;
|
||||
}
|
||||
|
||||
if (_fadeDirection != 0) {
|
||||
if (_currentFadeTime > _fadeDuration){
|
||||
if (_currentFadeTime > _fadeDuration) {
|
||||
_globalBlackOutFactor = _fadeDirection > 0 ? fadedIn : fadedOut;
|
||||
_fadeDirection = 0;
|
||||
}
|
||||
@@ -362,52 +415,6 @@ void RenderEngine::postSynchronizationPreDraw() {
|
||||
_currentFadeTime += static_cast<float>(OsEng.windowWrapper().averageDeltaTime());
|
||||
}
|
||||
}
|
||||
|
||||
//if (_mainCamera)
|
||||
// _mainCamera->postSynchronizationPreDraw();
|
||||
|
||||
bool windowResized = OsEng.windowWrapper().windowHasResized();
|
||||
|
||||
if (windowResized) {
|
||||
glm::ivec2 res = OsEng.windowWrapper().currentDrawBufferResolution();
|
||||
_renderer->setResolution(res);
|
||||
ghoul::fontrendering::FontRenderer::defaultRenderer().setFramebufferSize(glm::vec2(res));
|
||||
}
|
||||
|
||||
// update and evaluate the scene starting from the root node
|
||||
_sceneGraph->update({
|
||||
glm::dvec3(0),
|
||||
glm::dmat3(1),
|
||||
1,
|
||||
Time::ref().currentTime(),
|
||||
Time::ref().timeJumped(),
|
||||
Time::ref().deltaTime(),
|
||||
_performanceManager != nullptr
|
||||
});
|
||||
_sceneGraph->evaluate(_mainCamera);
|
||||
|
||||
_renderer->update();
|
||||
|
||||
for (auto program : _programs) {
|
||||
try {
|
||||
if (program->isDirty()) {
|
||||
program->rebuildFromFile();
|
||||
}
|
||||
}
|
||||
catch (const ghoul::opengl::ShaderObject::ShaderCompileError& e) {
|
||||
LERRORC(e.component, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
for (auto screenspacerenderable : _screenSpaceRenderables) {
|
||||
screenspacerenderable->update();
|
||||
}
|
||||
//Allow focus node to update camera (enables camera-following)
|
||||
//FIX LATER: THIS CAUSES MASTER NODE TO BE ONE FRAME AHEAD OF SLAVES
|
||||
//if (const SceneGraphNode* node = OsEng.ref().interactionHandler().focusNode()){
|
||||
//node->updateCamera(_mainCamera);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
void RenderEngine::render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix){
|
||||
@@ -420,10 +427,20 @@ void RenderEngine::render(const glm::mat4& projectionMatrix, const glm::mat4& vi
|
||||
|
||||
// Print some useful information on the master viewport
|
||||
if (OsEng.isMaster() && OsEng.windowWrapper().isSimpleRendering()) {
|
||||
if (_showInfo) {
|
||||
renderInformation();
|
||||
}
|
||||
renderInformation();
|
||||
}
|
||||
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
OsEng.windowWrapper().viewportPixelCoordinates().y / 2 - 50,
|
||||
OsEng.windowWrapper().viewportPixelCoordinates().w / 3
|
||||
);
|
||||
|
||||
if(_showFrameNumber) {
|
||||
RenderFontCr(*_fontBig, penPosition, "%i", _frameNumber);
|
||||
}
|
||||
|
||||
_frameNumber++;
|
||||
|
||||
|
||||
for (auto screenSpaceRenderable : _screenSpaceRenderables) {
|
||||
if (screenSpaceRenderable->isEnabled() && screenSpaceRenderable->isReady())
|
||||
@@ -462,7 +479,7 @@ void RenderEngine::postDraw() {
|
||||
}
|
||||
|
||||
if (_takeScreenshot) {
|
||||
OsEng.windowWrapper().takeScreenshot();
|
||||
OsEng.windowWrapper().takeScreenshot(_applyWarping);
|
||||
_takeScreenshot = false;
|
||||
}
|
||||
|
||||
@@ -471,8 +488,9 @@ void RenderEngine::postDraw() {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::takeScreenshot() {
|
||||
void RenderEngine::takeScreenshot(bool applyWarping) {
|
||||
_takeScreenshot = true;
|
||||
_applyWarping = applyWarping;
|
||||
}
|
||||
|
||||
void RenderEngine::toggleInfoText(bool b) {
|
||||
@@ -495,8 +513,7 @@ void RenderEngine::toggleFrametimeType(int t) {
|
||||
}
|
||||
|
||||
Scene* RenderEngine::scene() {
|
||||
// TODO custom assert (ticket #5)
|
||||
assert(_sceneGraph);
|
||||
ghoul_assert(_sceneGraph, "Scenegraph not initialized");
|
||||
return _sceneGraph;
|
||||
}
|
||||
|
||||
@@ -508,29 +525,6 @@ void RenderEngine::setSceneGraph(Scene* sceneGraph) {
|
||||
_sceneGraph = sceneGraph;
|
||||
}
|
||||
|
||||
void RenderEngine::serialize(SyncBuffer* syncBuffer) {
|
||||
if (_mainCamera){
|
||||
_mainCamera->serialize(syncBuffer);
|
||||
}
|
||||
|
||||
|
||||
syncBuffer->encode(_onScreenInformation._node);
|
||||
syncBuffer->encode(_onScreenInformation._position.x);
|
||||
syncBuffer->encode(_onScreenInformation._position.y);
|
||||
syncBuffer->encode(_onScreenInformation._size);
|
||||
}
|
||||
|
||||
void RenderEngine::deserialize(SyncBuffer* syncBuffer) {
|
||||
if (_mainCamera){
|
||||
_mainCamera->deserialize(syncBuffer);
|
||||
}
|
||||
syncBuffer->decode(_onScreenInformation._node);
|
||||
syncBuffer->decode(_onScreenInformation._position.x);
|
||||
syncBuffer->decode(_onScreenInformation._position.y);
|
||||
syncBuffer->decode(_onScreenInformation._size);
|
||||
|
||||
}
|
||||
|
||||
Camera* RenderEngine::camera() const {
|
||||
return _mainCamera;
|
||||
}
|
||||
@@ -720,14 +714,16 @@ void RenderEngine::setNAaSamples(int nAaSamples) {
|
||||
}
|
||||
|
||||
scripting::LuaLibrary RenderEngine::luaLibrary() {
|
||||
return {
|
||||
return{
|
||||
"",
|
||||
{
|
||||
{
|
||||
"takeScreenshot",
|
||||
&luascriptfunctions::takeScreenshot,
|
||||
"",
|
||||
"Renders the current image to a file on disk"
|
||||
"(optional bool)",
|
||||
"Renders the current image to a file on disk. If the boolean parameter "
|
||||
"is set to 'true', the screenshot will include the blending and the "
|
||||
"meshes. If it is 'false', the straight FBO will be recorded."
|
||||
},
|
||||
{
|
||||
"setRenderer",
|
||||
@@ -739,7 +735,7 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
|
||||
"setNAaSamples",
|
||||
&luascriptfunctions::setNAaSamples,
|
||||
"int",
|
||||
"Sets the number of anti-aliasing (msaa) samples"
|
||||
"Sets the number of anti-aliasing (MSAA) samples"
|
||||
},
|
||||
{
|
||||
"showRenderInformation",
|
||||
@@ -1202,6 +1198,10 @@ void RenderEngine::changeViewPoint(std::string origin) {
|
||||
LFATAL("This function is being misused with an argument of '" << origin << "'");
|
||||
}
|
||||
|
||||
void RenderEngine::setShowFrameNumber(bool enabled){
|
||||
_showFrameNumber = enabled;
|
||||
}
|
||||
|
||||
void RenderEngine::setDisableRenderingOnMaster(bool enabled) {
|
||||
_disableMasterRendering = enabled;
|
||||
}
|
||||
@@ -1281,7 +1281,7 @@ void RenderEngine::renderInformation() {
|
||||
using Font = ghoul::fontrendering::Font;
|
||||
using ghoul::fontrendering::RenderFont;
|
||||
|
||||
if (_showInfo && _fontDate && _fontInfo) {
|
||||
if (_fontDate) {
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
10.f,
|
||||
OsEng.windowWrapper().viewportPixelCoordinates().w
|
||||
@@ -1291,45 +1291,46 @@ void RenderEngine::renderInformation() {
|
||||
RenderFontCr(*_fontDate,
|
||||
penPosition,
|
||||
"Date: %s",
|
||||
Time::ref().currentTimeUTC().c_str()
|
||||
Time::ref().UTC().c_str()
|
||||
);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Simulation increment (s): %.0f",
|
||||
Time::ref().deltaTime()
|
||||
if (_showInfo && _fontInfo) {
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Simulation increment (s): %.0f",
|
||||
Time::ref().deltaTime()
|
||||
);
|
||||
|
||||
switch (_frametimeType) {
|
||||
case FrametimeType::DtTimeAvg:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. Frametime: %.5f",
|
||||
OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
case FrametimeType::FPS:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"FPS: %3.2f",
|
||||
1.0 / OsEng.windowWrapper().deltaTime()
|
||||
);
|
||||
break;
|
||||
case FrametimeType::FPSAvg:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. FPS: %3.2f",
|
||||
1.0 / OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
default:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. Frametime: %.5f",
|
||||
OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
}
|
||||
switch (_frametimeType) {
|
||||
case FrametimeType::DtTimeAvg:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. Frametime: %.5f",
|
||||
OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
case FrametimeType::FPS:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"FPS: %3.2f",
|
||||
1.0 / OsEng.windowWrapper().deltaTime()
|
||||
);
|
||||
break;
|
||||
case FrametimeType::FPSAvg:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. FPS: %3.2f",
|
||||
1.0 / OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
default:
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
"Avg. Frametime: %.5f",
|
||||
OsEng.windowWrapper().averageDeltaTime()
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
network::Status status = OsEng.parallelConnection().status();
|
||||
size_t nConnections = OsEng.parallelConnection().nConnections();
|
||||
@@ -1371,260 +1372,270 @@ void RenderEngine::renderInformation() {
|
||||
|
||||
|
||||
#ifdef OPENSPACE_MODULE_NEWHORIZONS_ENABLED
|
||||
//<<<<<<< HEAD
|
||||
bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons");
|
||||
double currentTime = Time::ref().currentTime();
|
||||
double currentTime = Time::ref().j2000Seconds();
|
||||
|
||||
if (MissionManager::ref().hasCurrentMission()) {
|
||||
|
||||
const Mission& mission = MissionManager::ref().currentMission();
|
||||
//=======
|
||||
// bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons");
|
||||
// double currentTime = Time::ref().currentTime();
|
||||
//>>>>>>> develop
|
||||
//
|
||||
// if (MissionManager::ref().hasCurrentMission()) {
|
||||
//
|
||||
// const Mission& mission = MissionManager::ref().currentMission();
|
||||
|
||||
if (mission.phases().size() > 0) {
|
||||
if (mission.phases().size() > 0) {
|
||||
|
||||
static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1);
|
||||
//static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1);
|
||||
static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1);
|
||||
static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1);
|
||||
static const glm::vec4 currentLeafMissionColor = missionProgressColor;
|
||||
static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1);
|
||||
static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1);
|
||||
//static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1);
|
||||
static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1);
|
||||
static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1);
|
||||
static const glm::vec4 currentLeafMissionColor = missionProgressColor;
|
||||
static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1);
|
||||
|
||||
// Add spacing
|
||||
RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " ");
|
||||
// Add spacing
|
||||
RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " ");
|
||||
|
||||
std::list<const MissionPhase*> phaseTrace = mission.phaseTrace(currentTime);
|
||||
std::list<const MissionPhase*> phaseTrace = mission.phaseTrace(currentTime);
|
||||
|
||||
if (phaseTrace.size()) {
|
||||
std::string title = "Current Mission Phase: " + phaseTrace.back()->name();
|
||||
RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str());
|
||||
double remaining = phaseTrace.back()->timeRange().end - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / phaseTrace.back()->timeRange().duration());
|
||||
std::string progress = progressToStr(25, t);
|
||||
//RenderFontCr(*_fontInfo, penPosition, missionProgressColor,
|
||||
// "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100);
|
||||
}
|
||||
else {
|
||||
RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:");
|
||||
double remaining = mission.timeRange().start - currentTime;
|
||||
RenderFontCr(*_fontInfo, penPosition, nextMissionColor,
|
||||
"%.0f s", remaining);
|
||||
}
|
||||
|
||||
bool showAllPhases = false;
|
||||
|
||||
typedef std::pair<const MissionPhase*, int> PhaseWithDepth;
|
||||
std::stack<PhaseWithDepth> S;
|
||||
int pixelIndentation = 20;
|
||||
S.push({ &mission, 0 });
|
||||
while (!S.empty()) {
|
||||
const MissionPhase* phase = S.top().first;
|
||||
int depth = S.top().second;
|
||||
S.pop();
|
||||
|
||||
bool isCurrentPhase = phase->timeRange().includes(currentTime);
|
||||
|
||||
penPosition.x += depth * pixelIndentation;
|
||||
if (isCurrentPhase) {
|
||||
double remaining = phase->timeRange().end - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / phase->timeRange().duration());
|
||||
if (phaseTrace.size()) {
|
||||
std::string title = "Current Mission Phase: " + phaseTrace.back()->name();
|
||||
RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str());
|
||||
double remaining = phaseTrace.back()->timeRange().end - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / phaseTrace.back()->timeRange().duration());
|
||||
std::string progress = progressToStr(25, t);
|
||||
RenderFontCr(*_fontInfo, penPosition, currentMissionColor,
|
||||
"%s %s %.1f %%",
|
||||
phase->name().c_str(),
|
||||
progress.c_str(),
|
||||
t * 100
|
||||
);
|
||||
//RenderFontCr(*_fontInfo, penPosition, missionProgressColor,
|
||||
// "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100);
|
||||
}
|
||||
else {
|
||||
RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str());
|
||||
RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:");
|
||||
double remaining = mission.timeRange().start - currentTime;
|
||||
RenderFontCr(*_fontInfo, penPosition, nextMissionColor,
|
||||
"%.0f s", remaining);
|
||||
}
|
||||
penPosition.x -= depth * pixelIndentation;
|
||||
|
||||
if (isCurrentPhase || showAllPhases) {
|
||||
// phases are sorted increasingly by start time, and will be popped
|
||||
// last-in-first-out from the stack, so add them in reversed order.
|
||||
int indexLastPhase = phase->phases().size() - 1;
|
||||
for (int i = indexLastPhase; 0 <= i; --i) {
|
||||
S.push({ &phase->phase(i), depth + 1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool showAllPhases = false;
|
||||
|
||||
typedef std::pair<const MissionPhase*, int> PhaseWithDepth;
|
||||
std::stack<PhaseWithDepth> S;
|
||||
int pixelIndentation = 20;
|
||||
S.push({ &mission, 0 });
|
||||
while (!S.empty()) {
|
||||
const MissionPhase* phase = S.top().first;
|
||||
int depth = S.top().second;
|
||||
S.pop();
|
||||
|
||||
bool isCurrentPhase = phase->timeRange().includes(currentTime);
|
||||
|
||||
if (openspace::ImageSequencer::ref().isReady()) {
|
||||
penPosition.y -= 25.f;
|
||||
|
||||
glm::vec4 targetColor(0.00, 0.75, 1.00, 1);
|
||||
|
||||
if (hasNewHorizons) {
|
||||
try {
|
||||
double lt;
|
||||
glm::dvec3 p =
|
||||
SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt);
|
||||
psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
float a, b, c;
|
||||
glm::dvec3 radii;
|
||||
SpiceManager::ref().getValue("PLUTO", "RADII", radii);
|
||||
a = radii.x;
|
||||
b = radii.y;
|
||||
float radius = (a + b) / 2.f;
|
||||
float distToSurf = glm::length(nhPos.vec3()) - radius;
|
||||
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
"Distance to Pluto: % .1f (KM)",
|
||||
distToSurf
|
||||
);
|
||||
penPosition.y -= _fontInfo->height();
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength());
|
||||
|
||||
std::string str = SpiceManager::ref().dateFromEphemerisTime(
|
||||
ImageSequencer::ref().getNextCaptureTime(),
|
||||
"YYYY MON DD HR:MN:SC"
|
||||
);
|
||||
|
||||
glm::vec4 active(0.6, 1, 0.00, 1);
|
||||
glm::vec4 brigther_active(0.9, 1, 0.75, 1);
|
||||
|
||||
if (remaining > 0) {
|
||||
|
||||
std::string progress = progressToStr(25, t);
|
||||
brigther_active *= (1 - t);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active * t + brigther_active,
|
||||
"Next instrument activity:"
|
||||
);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active * t + brigther_active,
|
||||
"%.0f s %s %.1f %%",
|
||||
remaining, progress.c_str(), t * 100
|
||||
);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
"Data acquisition time: %s",
|
||||
str.c_str()
|
||||
);
|
||||
}
|
||||
std::pair<double, std::string> nextTarget = ImageSequencer::ref().getNextTarget();
|
||||
std::pair<double, std::string> currentTarget = ImageSequencer::ref().getCurrentTarget();
|
||||
|
||||
if (currentTarget.first > 0.0) {
|
||||
int timeleft = static_cast<int>(nextTarget.first - currentTime);
|
||||
|
||||
int hour = timeleft / 3600;
|
||||
int second = timeleft % 3600;
|
||||
int minute = second / 60;
|
||||
second = second % 60;
|
||||
|
||||
std::string hh, mm, ss;
|
||||
|
||||
if (hour < 10)
|
||||
hh.append("0");
|
||||
if (minute < 10)
|
||||
mm.append("0");
|
||||
if (second < 10)
|
||||
ss.append("0");
|
||||
|
||||
hh.append(std::to_string(hour));
|
||||
mm.append(std::to_string(minute));
|
||||
ss.append(std::to_string(second));
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
targetColor,
|
||||
"Data acquisition adjacency: [%s:%s:%s]",
|
||||
hh.c_str(), mm.c_str(), ss.c_str()
|
||||
);
|
||||
|
||||
#if 0
|
||||
// Why is it (2) in the original? ---abock
|
||||
//std::pair<double, std::vector<std::string>> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0);
|
||||
//std::pair<double, std::vector<std::string>> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2);
|
||||
std::string space;
|
||||
glm::vec4 color;
|
||||
size_t isize = incidentTargets.second.size();
|
||||
for (size_t p = 0; p < isize; p++) {
|
||||
double t = static_cast<double>(p + 1) / static_cast<double>(isize + 1);
|
||||
t = (p > isize / 2) ? 1 - t : t;
|
||||
t += 0.3;
|
||||
color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1);
|
||||
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
color,
|
||||
"%s%s",
|
||||
space.c_str(), incidentTargets.second[p].c_str()
|
||||
);
|
||||
|
||||
|
||||
for (int k = 0; k < incidentTargets.second[p].size() + 2; k++)
|
||||
space += " ";
|
||||
}
|
||||
#endif
|
||||
penPosition.y -= _fontInfo->height();
|
||||
|
||||
std::map<std::string, bool> activeMap = ImageSequencer::ref().getActiveInstruments();
|
||||
glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1);
|
||||
glm::vec4 notFiring(0.5, 0.5, 0.5, 1);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
"Active Instruments:"
|
||||
);
|
||||
|
||||
for (auto t : activeMap) {
|
||||
if (t.second == false) {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
"| |"
|
||||
);
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
" %5s",
|
||||
t.first.c_str()
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
"|"
|
||||
);
|
||||
if (t.first == "NH_LORRI") {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
firing,
|
||||
" + "
|
||||
penPosition.x += depth * pixelIndentation;
|
||||
if (isCurrentPhase) {
|
||||
double remaining = phase->timeRange().end - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / phase->timeRange().duration());
|
||||
std::string progress = progressToStr(25, t);
|
||||
RenderFontCr(*_fontInfo, penPosition, currentMissionColor,
|
||||
"%s %s %.1f %%",
|
||||
phase->name().c_str(),
|
||||
progress.c_str(),
|
||||
t * 100
|
||||
);
|
||||
}
|
||||
else {
|
||||
RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str());
|
||||
}
|
||||
penPosition.x -= depth * pixelIndentation;
|
||||
|
||||
if (isCurrentPhase || showAllPhases) {
|
||||
// phases are sorted increasingly by start time, and will be popped
|
||||
// last-in-first-out from the stack, so add them in reversed order.
|
||||
int indexLastPhase = phase->phases().size() - 1;
|
||||
for (int i = indexLastPhase; 0 <= i; --i) {
|
||||
S.push({ &phase->phase(i), depth + 1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (openspace::ImageSequencer::ref().isReady()) {
|
||||
penPosition.y -= 25.f;
|
||||
|
||||
glm::vec4 targetColor(0.00, 0.75, 1.00, 1);
|
||||
|
||||
if (hasNewHorizons) {
|
||||
try {
|
||||
double lt;
|
||||
glm::dvec3 p =
|
||||
SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt);
|
||||
psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
float a, b, c;
|
||||
glm::dvec3 radii;
|
||||
SpiceManager::ref().getValue("PLUTO", "RADII", radii);
|
||||
a = radii.x;
|
||||
b = radii.y;
|
||||
float radius = (a + b) / 2.f;
|
||||
float distToSurf = glm::length(nhPos.vec3()) - radius;
|
||||
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
"Distance to Pluto: % .1f (KM)",
|
||||
distToSurf
|
||||
);
|
||||
penPosition.y -= _fontInfo->height();
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime;
|
||||
float t = static_cast<float>(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength());
|
||||
|
||||
std::string str = SpiceManager::ref().dateFromEphemerisTime(
|
||||
ImageSequencer::ref().getNextCaptureTime(),
|
||||
"YYYY MON DD HR:MN:SC"
|
||||
);
|
||||
|
||||
glm::vec4 active(0.6, 1, 0.00, 1);
|
||||
glm::vec4 brigther_active(0.9, 1, 0.75, 1);
|
||||
|
||||
if (remaining > 0) {
|
||||
|
||||
std::string progress = progressToStr(25, t);
|
||||
brigther_active *= (1 - t);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active * t + brigther_active,
|
||||
"Next instrument activity:"
|
||||
);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active * t + brigther_active,
|
||||
"%.0f s %s %.1f %%",
|
||||
remaining, progress.c_str(), t * 100
|
||||
);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
"Data acquisition time: %s",
|
||||
str.c_str()
|
||||
);
|
||||
}
|
||||
std::pair<double, std::string> nextTarget = ImageSequencer::ref().getNextTarget();
|
||||
std::pair<double, std::string> currentTarget = ImageSequencer::ref().getCurrentTarget();
|
||||
|
||||
if (currentTarget.first > 0.0) {
|
||||
int timeleft = static_cast<int>(nextTarget.first - currentTime);
|
||||
|
||||
int hour = timeleft / 3600;
|
||||
int second = timeleft % 3600;
|
||||
int minute = second / 60;
|
||||
second = second % 60;
|
||||
|
||||
std::string hh, mm, ss;
|
||||
|
||||
if (hour < 10)
|
||||
hh.append("0");
|
||||
if (minute < 10)
|
||||
mm.append("0");
|
||||
if (second < 10)
|
||||
ss.append("0");
|
||||
|
||||
hh.append(std::to_string(hour));
|
||||
mm.append(std::to_string(minute));
|
||||
ss.append(std::to_string(second));
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
targetColor,
|
||||
"Data acquisition adjacency: [%s:%s:%s]",
|
||||
hh.c_str(), mm.c_str(), ss.c_str()
|
||||
);
|
||||
|
||||
#if 0
|
||||
// Why is it (2) in the original? ---abock
|
||||
//std::pair<double, std::vector<std::string>> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0);
|
||||
//std::pair<double, std::vector<std::string>> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2);
|
||||
std::string space;
|
||||
glm::vec4 color;
|
||||
size_t isize = incidentTargets.second.size();
|
||||
for (size_t p = 0; p < isize; p++) {
|
||||
double t = static_cast<double>(p + 1) / static_cast<double>(isize + 1);
|
||||
t = (p > isize / 2) ? 1 - t : t;
|
||||
t += 0.3;
|
||||
color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1);
|
||||
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
" |"
|
||||
);
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
" %5s",
|
||||
t.first.c_str()
|
||||
color,
|
||||
"%s%s",
|
||||
space.c_str(), incidentTargets.second[p].c_str()
|
||||
);
|
||||
|
||||
|
||||
for (int k = 0; k < incidentTargets.second[p].size() + 2; k++)
|
||||
space += " ";
|
||||
}
|
||||
#endif
|
||||
penPosition.y -= _fontInfo->height();
|
||||
|
||||
std::map<std::string, bool> activeMap = ImageSequencer::ref().getActiveInstruments();
|
||||
glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1);
|
||||
glm::vec4 notFiring(0.5, 0.5, 0.5, 1);
|
||||
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
"Active Instruments:"
|
||||
);
|
||||
|
||||
for (auto t : activeMap) {
|
||||
if (t.second == false) {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
"| |"
|
||||
);
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
" %5s",
|
||||
t.first.c_str()
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
"|"
|
||||
);
|
||||
if (t.first == "NH_LORRI") {
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
firing,
|
||||
" + "
|
||||
);
|
||||
}
|
||||
RenderFont(*_fontInfo,
|
||||
penPosition,
|
||||
glm::vec4(0.3, 0.3, 0.3, 1),
|
||||
" |"
|
||||
);
|
||||
RenderFontCr(*_fontInfo,
|
||||
penPosition,
|
||||
active,
|
||||
" %5s",
|
||||
t.first.c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1723,6 +1734,12 @@ void RenderEngine::renderScreenLog() {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Syncable*> RenderEngine::getSyncables(){
|
||||
std::vector<Syncable*> syncables = _mainCamera->getSyncables();
|
||||
syncables.push_back(&_onScreenInformation);
|
||||
return syncables;
|
||||
}
|
||||
|
||||
void RenderEngine::sortScreenspaceRenderables() {
|
||||
std::sort(
|
||||
_screenSpaceRenderables.begin(),
|
||||
|
||||
@@ -33,11 +33,18 @@ namespace luascriptfunctions {
|
||||
*/
|
||||
int takeScreenshot(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 0) {
|
||||
if (nArguments == 0) {
|
||||
OsEng.renderEngine().takeScreenshot();
|
||||
return 0;
|
||||
}
|
||||
else if (nArguments == 1) {
|
||||
bool b = lua_toboolean(L, -1) != 0;
|
||||
OsEng.renderEngine().takeScreenshot(b);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
|
||||
}
|
||||
OsEng.renderEngine().takeScreenshot();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <openspace/util/camera.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
@@ -50,16 +52,36 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Documentation ScreenSpaceRenderable::Documentation() {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
return {
|
||||
"Screenspace Renderable",
|
||||
"core_screenspacerenderable",
|
||||
{
|
||||
{
|
||||
KeyType,
|
||||
new StringAnnotationVerifier("Must name a valid Screenspace renderable"),
|
||||
"The type of the Screenspace renderable that is to be created. The "
|
||||
"available types of Screenspace renderable depend on the configuration of"
|
||||
"the application and can be written to disk on application startup into "
|
||||
"the FactoryDocumentation.",
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ScreenSpaceRenderable* ScreenSpaceRenderable::createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
{
|
||||
std::string renderableType;
|
||||
bool success = dictionary.getValue(KeyType, renderableType);
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"ScreenSpaceRenderable"
|
||||
);
|
||||
|
||||
if (!success) {
|
||||
LERROR("ScreenSpaceRenderable did not have key '" << KeyType << "'");
|
||||
return nullptr;
|
||||
}
|
||||
std::string renderableType = dictionary.value<std::string>(KeyType);
|
||||
|
||||
auto factory = FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
||||
ScreenSpaceRenderable* result = factory->create(renderableType, dictionary);
|
||||
|
||||
Reference in New Issue
Block a user