mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Merge branch 'develop' of openspace.itn.liu.se:/openspace into develop
Conflicts: src/rendering/renderengine.cpp
This commit is contained in:
+1
-1
@@ -109,7 +109,7 @@ set(DEPENDENT_LIBS ${DEPENDENT_LIBS} ${GLEW_LIBRARIES})
|
||||
|
||||
# Lua
|
||||
set(LUA_ROOT_DIR "${GHOUL_ROOT_DIR}/ext/lua")
|
||||
include_directories("${LUA_ROOT_DIR}/include")
|
||||
include_directories("${LUA_ROOT_DIR}/src")
|
||||
|
||||
# Spice
|
||||
set(SPICE_ROOT_DIR "${OPENSPACE_EXT_DIR}/spice")
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
</Settings>
|
||||
<Node address="localhost" port="20401">
|
||||
<Window fullScreen="false" fxaa="false">
|
||||
<Stereo type="anaglyph_red_cyan" />
|
||||
<Stereo type="none" />
|
||||
<!-- <Res x="4096" y="2304" /> -->
|
||||
<!-- <Res x="1920" y="1080" /> -->
|
||||
|
||||
@@ -6,6 +6,17 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
find_package(Qt5Widgets)
|
||||
find_package(Qt5Network)
|
||||
if (APPLE)
|
||||
add_executable(TimelineView MACOSX_BUNDLE main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp)
|
||||
else (APPLE)
|
||||
add_executable(TimelineView main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp)
|
||||
#add_executable(TimelineView WIN32 main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(TimelineView Qt5::Widgets Qt5::Network)
|
||||
|
||||
if (APPLE)
|
||||
INSTALL(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/MacOS/TimelineView\" \"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/plugins/platforms/libqcocoa.dylib\" \"\")
|
||||
" COMPONENT Runtime)
|
||||
endif ()
|
||||
|
||||
@@ -33,19 +33,19 @@ class ABufferFixed: public ABuffer {
|
||||
public:
|
||||
|
||||
ABufferFixed();
|
||||
virtual ~ABufferFixed();
|
||||
virtual bool initialize();
|
||||
~ABufferFixed();
|
||||
bool initialize() override;
|
||||
|
||||
virtual void clear();
|
||||
virtual void preRender();
|
||||
virtual void postRender();
|
||||
void clear() override;
|
||||
void preRender() override;
|
||||
void postRender() override;
|
||||
|
||||
std::vector<fragmentData> pixelData() override;
|
||||
|
||||
std::vector<fragmentData> pixelData();
|
||||
protected:
|
||||
virtual bool reinitializeInternal();
|
||||
virtual bool reinitializeInternal() override;
|
||||
|
||||
private:
|
||||
|
||||
GLuint *_data;
|
||||
GLuint _anchorPointerTexture;
|
||||
GLuint _anchorPointerTextureInitializer;
|
||||
@@ -53,11 +53,8 @@ private:
|
||||
GLuint _atomicCounterTexture;
|
||||
GLuint _fragmentBuffer;
|
||||
GLuint _fragmentTexture;
|
||||
|
||||
|
||||
|
||||
|
||||
}; // ABufferFixed
|
||||
|
||||
} // openspace
|
||||
|
||||
#endif // __ABUFFERFIXED_H__
|
||||
@@ -83,8 +83,8 @@ public:
|
||||
void keyboardCallback(int key, int action);
|
||||
void charCallback(unsigned int codepoint);
|
||||
void mouseButtonCallback(int key, int action);
|
||||
void mousePositionCallback(int x, int y);
|
||||
void mouseScrollWheelCallback(int pos);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
void encode();
|
||||
void decode();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#ifndef __RENDERABLEPLANETPROJECTION_H__
|
||||
#define __RENDERABLEPLANETPROJECTION_H__
|
||||
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
// open space includes
|
||||
|
||||
@@ -54,10 +54,6 @@ private:
|
||||
properties::IntProperty _segments;
|
||||
std::string _name;
|
||||
|
||||
properties::IntProperty _vaoID;
|
||||
properties::IntProperty _vBufferID;
|
||||
properties::IntProperty _iBufferID;
|
||||
|
||||
PowerScaledSphere* _planet;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
bool initialize();
|
||||
bool initialize(const std::string& renderingMethod);
|
||||
|
||||
void setSceneGraph(Scene* sceneGraph);
|
||||
Scene* scene();
|
||||
@@ -113,6 +113,7 @@ private:
|
||||
Camera* _mainCamera;
|
||||
Scene* _sceneGraph;
|
||||
ABuffer* _abuffer;
|
||||
int _abufferImplementation;
|
||||
ScreenLog* _log;
|
||||
|
||||
bool _showInfo;
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
};
|
||||
|
||||
bool nodeIsDependentOnRoot(SceneGraphNodeInternal* node);
|
||||
bool sortTopologially();
|
||||
bool sortTopologically();
|
||||
|
||||
SceneGraphNodeInternal* nodeByName(const std::string& name);
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
/*
|
||||
* returns true if instrumentID is within a capture range.
|
||||
*/
|
||||
bool instumentActive(std::string instrumentID);
|
||||
bool instrumentActive(std::string instrumentID);
|
||||
|
||||
float instrumentActiveTime(const std::string& instrumentID) const;
|
||||
|
||||
|
||||
+36
-28
@@ -1,26 +1,36 @@
|
||||
return {
|
||||
Paths = {
|
||||
SGCT = "${BASE_PATH}/config/sgct",
|
||||
SCRIPTS = "${BASE_PATH}/scripts",
|
||||
SHADERS = "${BASE_PATH}/shaders",
|
||||
SHADERS_GENERATED = "${SHADERS}/generated",
|
||||
OPENSPACE_DATA = "${BASE_PATH}/openspace-data",
|
||||
TESTDIR = "${BASE_PATH}/tests",
|
||||
CONFIG = "${BASE_PATH}/config",
|
||||
CACHE = "${BASE_PATH}/cache",
|
||||
FONTS = "${OPENSPACE_DATA}/fonts",
|
||||
PLUTO_KERNELS = "${OPENSPACE_DATA}/spice/Pluto",
|
||||
JP_KERNELS = "${OPENSPACE_DATA}/spice/JP_KERNELS"
|
||||
},
|
||||
SpiceKernel = {
|
||||
Time = "${OPENSPACE_DATA}/spice/naif0010.tls",
|
||||
LeapSecond = "${OPENSPACE_DATA}/spice/pck00010.tpc",
|
||||
NewHorizons = "${OPENSPACE_DATA}/spice/nhmeta.tm"
|
||||
},
|
||||
Fonts = {
|
||||
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
|
||||
Light = "${FONTS}/Roboto/Roboto-Regular.ttf"
|
||||
},
|
||||
-- Determines which SGCT configuration file is loaded, that is, if there rendering
|
||||
-- occurs in a single window, a fisheye projection, or a dome cluster system
|
||||
SGCTConfig = "${SGCT}/single.xml",
|
||||
--SGCTConfig = "${SGCT}/single_fisheye.xml",
|
||||
--SGCTConfig = "${SGCT}/two_nodes.xml",
|
||||
|
||||
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
|
||||
-- of all entities that will be visible during an instance of OpenSpace
|
||||
Scene = "${OPENSPACE_DATA}/scene/default_nh.scene",
|
||||
|
||||
Paths = {
|
||||
SGCT = "${BASE_PATH}/config/sgct",
|
||||
SCRIPTS = "${BASE_PATH}/scripts",
|
||||
SHADERS = "${BASE_PATH}/shaders",
|
||||
SHADERS_GENERATED = "${SHADERS}/generated",
|
||||
OPENSPACE_DATA = "${BASE_PATH}/openspace-data",
|
||||
TESTDIR = "${BASE_PATH}/tests",
|
||||
CONFIG = "${BASE_PATH}/config",
|
||||
CACHE = "${BASE_PATH}/cache",
|
||||
FONTS = "${OPENSPACE_DATA}/fonts",
|
||||
PLUTO_KERNELS = "${OPENSPACE_DATA}/spice/Pluto",
|
||||
JP_KERNELS = "${OPENSPACE_DATA}/spice/JP_KERNELS"
|
||||
},
|
||||
SpiceKernel = {
|
||||
Time = "${OPENSPACE_DATA}/spice/naif0010.tls",
|
||||
LeapSecond = "${OPENSPACE_DATA}/spice/pck00010.tpc",
|
||||
NewHorizons = "${OPENSPACE_DATA}/spice/nhmeta.tm"
|
||||
},
|
||||
Fonts = {
|
||||
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
|
||||
Light = "${FONTS}/Roboto/Roboto-Regular.ttf"
|
||||
},
|
||||
StartupScripts = {
|
||||
"${SCRIPTS}/default_startup.lua"
|
||||
},
|
||||
@@ -39,11 +49,9 @@ return {
|
||||
File = "${BASE_PATH}/LuaScripting.txt"
|
||||
},
|
||||
PropertyDocumentationFile = {
|
||||
Type = "text",
|
||||
File = "${BASE_PATH}/Properties.txt"
|
||||
Type = "text",
|
||||
File = "${BASE_PATH}/Properties.txt"
|
||||
},
|
||||
SGCTConfig = "${SGCT}/single.xml",
|
||||
--SGCTConfig = "${SGCT}/single_fisheye.xml",
|
||||
--SGCTConfig = "${SGCT}/two_nodes.xml",
|
||||
Scene = "${OPENSPACE_DATA}/scene/default_nh.scene",
|
||||
RenderingMethod = "ABufferSingleLinked" -- On Windows and Unix
|
||||
-- RenderingMethod = "ABufferFrameBuffer" -- On Mac due to OpenGL 4.1 restrictions
|
||||
}
|
||||
@@ -78,7 +78,7 @@ openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_RALPH_MVIC_FT.r
|
||||
openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_RALPH_MVIC_METHANE.renderable.solidDraw'); openspace.setPropertyValue('NH_RALPH_MVIC_METHANE.renderable.solidDraw', not b)")
|
||||
openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_RALPH_MVIC_NIR.renderable.solidDraw'); openspace.setPropertyValue('NH_RALPH_MVIC_NIR.renderable.solidDraw', not b)")
|
||||
openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_ALICE_AIRGLOW.renderable.solidDraw'); openspace.setPropertyValue('NH_ALICE_AIRGLOW.renderable.solidDraw', not b)")
|
||||
openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_ALICE_SOC.renderable.solidDraw'); openspace.setPropertyValue('NH_ALICE_AIRGLOW.renderable.solidDraw', not b)")
|
||||
openspace.bindKey("m", "local b = openspace.getPropertyValue('NH_ALICE_SOC.renderable.solidDraw'); openspace.setPropertyValue('NH_ALICE_SOC.renderable.solidDraw', not b)")
|
||||
|
||||
openspace.bindKey("p", "local b = openspace.getPropertyValue('JupiterProjection.renderable.performProjection'); openspace.setPropertyValue('JupiterProjection.renderable.performProjection', not b)")
|
||||
openspace.bindKey("p", "local b = openspace.getPropertyValue('Io.renderable.performProjection'); openspace.setPropertyValue('Io.renderable.performProjection', not b)")
|
||||
|
||||
@@ -12,4 +12,6 @@ openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.75)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.changeCoordinateSystem("Jupiter")
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
@@ -57,9 +57,9 @@ int build_local_fragments_list() {
|
||||
return int(frag_count);
|
||||
#endif
|
||||
|
||||
#if ABUFFER_IMPLEMENTATION == ABUFFER_FRAMEBUFFER
|
||||
// #if ABUFFER_IMPLEMENTATION == ABUFFER_FRAMEBUFFER
|
||||
return 0;
|
||||
#endif
|
||||
// #endif
|
||||
}
|
||||
|
||||
float pscLength(vec4 v1, vec4 v2) {
|
||||
|
||||
@@ -52,6 +52,7 @@ void main()
|
||||
{
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
//depth = length(campos - position);
|
||||
vec4 diffuse = texture(texture1, vs_st);
|
||||
|
||||
diffuse[3] = fading;
|
||||
@@ -89,5 +90,5 @@ void main()
|
||||
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
|
||||
addToBuffer(frag);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void main()
|
||||
vec4 position = vs_position;
|
||||
// This has to be fixed with the ScaleGraph in place (precision deficiency in depth buffer) ---abock
|
||||
// float depth = pscDepth(position);
|
||||
float depth = 1000.0;
|
||||
float depth = 200;
|
||||
vec4 diffuse;
|
||||
|
||||
vec2 texCoord = vs_st;
|
||||
@@ -54,6 +54,8 @@ void main()
|
||||
|
||||
diffuse.a *= alpha;
|
||||
|
||||
// diffuse.a = 0.0;
|
||||
|
||||
//vec4 diffuse = vec4(1,vs_st,1);
|
||||
//vec4 diffuse = vec4(1,0,0,1);
|
||||
// if(position.w > 9.0) {
|
||||
@@ -71,7 +73,7 @@ void main()
|
||||
// diffuse = vec4(0.0);
|
||||
// #endif
|
||||
|
||||
// diffuse = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
//diffuse = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
|
||||
addToBuffer(frag);
|
||||
|
||||
@@ -91,4 +91,7 @@ void main() {
|
||||
|
||||
ABufferStruct_t frag = createGeometryFragment(fullColor, position, depth);
|
||||
addToBuffer(frag);
|
||||
|
||||
if (fullColor.a == 0)
|
||||
discard;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ ABufferFixed::ABufferFixed(): _data(0), _anchorPointerTexture(0),
|
||||
{}
|
||||
|
||||
ABufferFixed::~ABufferFixed() {
|
||||
if(_data != 0)
|
||||
delete _data;
|
||||
|
||||
glDeleteTextures(1,&_anchorPointerTexture);
|
||||
glDeleteTextures(1,&_fragmentTexture);
|
||||
// glDeleteTextures(1,&_atomicCounterTexture);
|
||||
@@ -188,5 +185,4 @@ std::vector<ABuffer::fragmentData> ABufferFixed::pixelData() {
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
} // openspace
|
||||
} // openspace
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/abuffer/abufferSingleLinked.h>
|
||||
#include <openspace/abuffer/abuffersinglelinked.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
@@ -68,12 +68,17 @@ bool ABufferSingleLinked::initialize() {
|
||||
// BUFFERS
|
||||
// ============================
|
||||
glGenTextures(1, &_anchorPointerTexture);
|
||||
LDEBUG("AnchorPointerTexture ID: " << _anchorPointerTexture);
|
||||
glGenBuffers(1, &_anchorPointerTextureInitializer);
|
||||
LDEBUG("AnchorPointerTextureInitializer ID: " << _anchorPointerTextureInitializer);
|
||||
glGenBuffers(1, &_atomicCounterBuffer);
|
||||
LDEBUG("AtomicCounterBuffer ID: " << _atomicCounterBuffer);
|
||||
glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, _atomicCounterBuffer);
|
||||
glBufferData(GL_ATOMIC_COUNTER_BUFFER, sizeof(GLuint), NULL, GL_DYNAMIC_COPY);
|
||||
glGenBuffers(1, &_fragmentBuffer);
|
||||
LDEBUG("FragmentBuffer ID: " << _fragmentBuffer);
|
||||
glGenTextures(1, &_fragmentTexture);
|
||||
LDEBUG("FragmentTexture ID: " << _fragmentTexture);
|
||||
|
||||
reinitialize();
|
||||
|
||||
@@ -75,6 +75,9 @@ namespace {
|
||||
|
||||
const std::string _sgctConfigArgumentCommand = "-config";
|
||||
|
||||
const std::string KeyRenderingMethod = "RenderingMethod";
|
||||
const std::string DefaultRenderingMethod = "ABufferSingleLinked";
|
||||
|
||||
const std::string DefaultOpenGlVersion = "4.3";
|
||||
|
||||
struct {
|
||||
@@ -103,7 +106,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName)
|
||||
{
|
||||
SpiceManager::initialize();
|
||||
Time::initialize();
|
||||
ImageSequencer2::initialize();
|
||||
FactoryManager::initialize();
|
||||
ghoul::systemcapabilities::SystemCapabilities::initialize();
|
||||
}
|
||||
@@ -222,6 +224,8 @@ bool OpenSpaceEngine::create(
|
||||
FileSys.createCacheManager(absPath("${" + constants::configurationmanager::keyCache + "}"));
|
||||
_engine->_console->initialize();
|
||||
|
||||
ImageSequencer2::initialize();
|
||||
|
||||
// Register the provided shader directories
|
||||
ghoul::opengl::ShaderObject::addIncludePath("${SHADERS}");
|
||||
|
||||
@@ -240,7 +244,8 @@ bool OpenSpaceEngine::create(
|
||||
}
|
||||
|
||||
openGlVersion = commandlineArgumentPlaceholders.openGlVersion;
|
||||
LINFO("Using OpenGL version " << openGlVersion);
|
||||
if (openGlVersion != DefaultOpenGlVersion)
|
||||
LINFO("Using OpenGL version " << openGlVersion);
|
||||
|
||||
// Prepend the outgoing sgctArguments with the program name
|
||||
// as well as the configuration file that sgct is supposed to use
|
||||
@@ -317,7 +322,11 @@ bool OpenSpaceEngine::initialize() {
|
||||
_renderEngine->setSceneGraph(sceneGraph);
|
||||
|
||||
// initialize the RenderEngine
|
||||
_renderEngine->initialize();
|
||||
if (_configurationManager->hasKeyAndValue<std::string>(KeyRenderingMethod))
|
||||
_renderEngine->initialize(_configurationManager->value<std::string>(KeyRenderingMethod));
|
||||
else
|
||||
_renderEngine->initialize(DefaultRenderingMethod);
|
||||
|
||||
sceneGraph->initialize();
|
||||
|
||||
std::string sceneDescriptionPath;
|
||||
@@ -681,13 +690,13 @@ void OpenSpaceEngine::mouseButtonCallback(int key, int action) {
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::mousePositionCallback(int x, int y) {
|
||||
void OpenSpaceEngine::mousePositionCallback(double x, double y) {
|
||||
if (_isMaster) {
|
||||
_interactionHandler->mousePositionCallback(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::mouseScrollWheelCallback(int pos) {
|
||||
void OpenSpaceEngine::mouseScrollWheelCallback(double pos) {
|
||||
if (_isMaster) {
|
||||
if (_gui->isEnabled()) {
|
||||
bool isConsumed = _gui->mouseWheelCallback(pos);
|
||||
|
||||
+33
-43
@@ -79,6 +79,10 @@ int main(int argc, char** argv) {
|
||||
sgct::MessageHandler::instance()->setLogToCallback(true);
|
||||
sgct::MessageHandler::instance()->setLogCallback(mainLogCallback);
|
||||
|
||||
#ifdef __APPLE__
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
#endif
|
||||
|
||||
LDEBUG("Creating SGCT Engine");
|
||||
_sgctEngine = new sgct::Engine(newArgc, newArgv);
|
||||
|
||||
@@ -130,7 +134,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
//is this node the master? (must be set after call to _sgctEngine->init())
|
||||
OsEng.ref().setMaster(_sgctEngine->isMaster());
|
||||
OsEng.setMaster(_sgctEngine->isMaster());
|
||||
|
||||
// Main loop
|
||||
LDEBUG("Starting rendering loop");
|
||||
@@ -147,8 +151,7 @@ int main(int argc, char** argv) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void mainInitFunc()
|
||||
{
|
||||
void mainInitFunc() {
|
||||
bool success = OsEng.initialize();
|
||||
if (success)
|
||||
success = OsEng.initializeGL();
|
||||
@@ -164,83 +167,70 @@ void mainInitFunc()
|
||||
setupPostFX();
|
||||
}
|
||||
|
||||
void mainPreSyncFunc()
|
||||
{
|
||||
void mainPreSyncFunc() {
|
||||
OsEng.preSynchronization();
|
||||
}
|
||||
|
||||
void mainPostSyncPreDrawFunc()
|
||||
{
|
||||
void mainPostSyncPreDrawFunc() {
|
||||
OsEng.postSynchronizationPreDraw();
|
||||
}
|
||||
|
||||
void mainRenderFunc()
|
||||
{
|
||||
void mainRenderFunc() {
|
||||
using glm::mat4;
|
||||
using glm::translate;
|
||||
//not the most efficient, but for clarity @JK
|
||||
|
||||
glm::mat4 userMatrix = glm::translate(glm::mat4(1.f), _sgctEngine->getDefaultUserPtr()->getPos());
|
||||
glm::mat4 sceneMatrix = _sgctEngine->getModelMatrix();
|
||||
glm::mat4 viewMatrix = _sgctEngine->getActiveViewMatrix() * userMatrix;
|
||||
mat4 userMatrix = translate(mat4(1.f), _sgctEngine->getDefaultUserPtr()->getPos());
|
||||
mat4 sceneMatrix = _sgctEngine->getModelMatrix();
|
||||
mat4 viewMatrix = _sgctEngine->getActiveViewMatrix() * userMatrix;
|
||||
|
||||
//dont shift nav-direction on master, makes it very tricky to navigate @JK
|
||||
if (!OsEng.ref().isMaster()){
|
||||
if (!OsEng.ref().isMaster())
|
||||
viewMatrix = viewMatrix * sceneMatrix;
|
||||
}
|
||||
|
||||
glm::mat4 projectionMatrix = _sgctEngine->getActiveProjectionMatrix();
|
||||
mat4 projectionMatrix = _sgctEngine->getActiveProjectionMatrix();
|
||||
OsEng.render(projectionMatrix, viewMatrix);
|
||||
}
|
||||
|
||||
void mainPostDrawFunc()
|
||||
{
|
||||
void mainPostDrawFunc() {
|
||||
OsEng.postDraw();
|
||||
}
|
||||
|
||||
void mainExternalControlCallback(const char* receivedChars, int size)
|
||||
{
|
||||
if (OsEng.ref().isMaster())
|
||||
void mainExternalControlCallback(const char* receivedChars, int size) {
|
||||
if (OsEng.isMaster())
|
||||
OsEng.externalControlCallback(receivedChars, size, 0);
|
||||
}
|
||||
|
||||
void mainKeyboardCallback(int key, int action)
|
||||
{
|
||||
if (OsEng.ref().isMaster())
|
||||
void mainKeyboardCallback(int key, int action) {
|
||||
if (OsEng.isMaster())
|
||||
OsEng.keyboardCallback(key, action);
|
||||
}
|
||||
|
||||
void mainMouseButtonCallback(int key, int action)
|
||||
{
|
||||
if (OsEng.ref().isMaster())
|
||||
void mainMouseButtonCallback(int key, int action) {
|
||||
if (OsEng.isMaster())
|
||||
OsEng.mouseButtonCallback(key, action);
|
||||
}
|
||||
|
||||
void mainMousePosCallback(double x, double y)
|
||||
{
|
||||
// TODO use float instead
|
||||
if (OsEng.ref().isMaster())
|
||||
OsEng.mousePositionCallback(static_cast<int>(x), static_cast<int>(y));
|
||||
void mainMousePosCallback(double x, double y) {
|
||||
if (OsEng.isMaster())
|
||||
OsEng.mousePositionCallback(x, y);
|
||||
}
|
||||
|
||||
void mainMouseScrollCallback(double posX, double posY)
|
||||
{
|
||||
// TODO use float instead
|
||||
if (OsEng.ref().isMaster())
|
||||
OsEng.mouseScrollWheelCallback(static_cast<int>(posY));
|
||||
void mainMouseScrollCallback(double posX, double posY) {
|
||||
if (OsEng.isMaster())
|
||||
OsEng.mouseScrollWheelCallback(posY);
|
||||
}
|
||||
|
||||
void mainCharCallback(unsigned int codepoint) {
|
||||
|
||||
if (OsEng.ref().isMaster())
|
||||
if (OsEng.isMaster())
|
||||
OsEng.charCallback(codepoint);
|
||||
}
|
||||
|
||||
void mainEncodeFun()
|
||||
{
|
||||
void mainEncodeFun() {
|
||||
OsEng.encode();
|
||||
}
|
||||
|
||||
void mainDecodeFun()
|
||||
{
|
||||
void mainDecodeFun() {
|
||||
OsEng.decode();
|
||||
}
|
||||
|
||||
@@ -255,7 +245,7 @@ void postFXPass(){
|
||||
if (OsEng.isMaster())
|
||||
glUniform1f(_postFXOpacityLoc, 1.f);
|
||||
else
|
||||
glUniform1f(_postFXOpacityLoc, OsEng.ref().renderEngine()->globalBlackOutFactor());
|
||||
glUniform1f(_postFXOpacityLoc, OsEng.renderEngine()->globalBlackOutFactor());
|
||||
}
|
||||
|
||||
void setupPostFX(){
|
||||
|
||||
@@ -45,9 +45,6 @@ SimpleSphereGeometryProjection::SimpleSphereGeometryProjection(const ghoul::Dict
|
||||
, _realRadius("radius", "Radius", glm::vec4(1.f, 1.f, 1.f, 0.f), glm::vec4(-10.f, -10.f, -10.f, -20.f),
|
||||
glm::vec4(10.f, 10.f, 10.f, 20.f))
|
||||
, _segments("segments", "Segments", 20, 1, 1000)
|
||||
, _vaoID("vaoID", "Vao", 1, 1, 1)
|
||||
, _vBufferID("vboID", "Vbo", 1, 1, 1)
|
||||
, _iBufferID("iboID", "Ibo", 1, 1, 1)
|
||||
, _planet(nullptr)
|
||||
{
|
||||
using constants::scenegraphnode::keyName;
|
||||
@@ -100,12 +97,6 @@ bool SimpleSphereGeometryProjection::initialize(RenderablePlanetProjection* pare
|
||||
createSphere();
|
||||
|
||||
//need to have this accessible in planetgeometryprojection for now -- Michal
|
||||
_vaoID = static_cast<int>(_planet->_vaoID);
|
||||
_vBufferID = static_cast<int>(_planet->_vBufferID);
|
||||
_iBufferID = static_cast<int>(_planet->_iBufferID);
|
||||
addProperty(_vaoID);
|
||||
addProperty(_vBufferID);
|
||||
addProperty(_iBufferID);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ void RenderableFov::render(const RenderData& data) {
|
||||
setPscUniforms(_programObject, &data.camera, data.position);
|
||||
|
||||
if (openspace::ImageSequencer2::ref().isReady()){
|
||||
drawFOV = ImageSequencer2::ref().instumentActive(_instrumentID);
|
||||
drawFOV = ImageSequencer2::ref().instrumentActive(_instrumentID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -183,9 +183,7 @@ void RenderablePlane::update(const UpdateData& data) {
|
||||
}
|
||||
|
||||
void RenderablePlane::loadTexture() {
|
||||
LDEBUG("loadTexture");
|
||||
if (_texturePath.value() != "") {
|
||||
LDEBUG("loadTexture2");
|
||||
ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");
|
||||
|
||||
@@ -186,9 +186,7 @@ void RenderableSphere::update(const UpdateData& data) {
|
||||
}
|
||||
|
||||
void RenderableSphere::loadTexture() {
|
||||
LDEBUG("loadTexture");
|
||||
if (_texturePath.value() != "") {
|
||||
LDEBUG("loadTexture2");
|
||||
ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");
|
||||
|
||||
+768
-757
File diff suppressed because it is too large
Load Diff
@@ -174,8 +174,9 @@ bool RenderableStars::deinitialize() {
|
||||
}
|
||||
|
||||
void RenderableStars::render(const RenderData& data) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
|
||||
//glEnable(GL_BLEND);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
_program->activate();
|
||||
|
||||
@@ -221,7 +222,8 @@ void RenderableStars::render(const RenderData& data) {
|
||||
_program->setIgnoreUniformLocationError(false);
|
||||
_program->deactivate();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void RenderableStars::update(const UpdateData& data) {
|
||||
|
||||
@@ -44,8 +44,6 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
SceneGraph::SceneGraph() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SceneGraph::clear() {
|
||||
@@ -261,12 +259,12 @@ bool SceneGraph::loadFromFile(const std::string& sceneDescription) {
|
||||
}
|
||||
}
|
||||
|
||||
bool s = sortTopologially();
|
||||
bool s = sortTopologically();
|
||||
if (!s) {
|
||||
LERROR("Topological sort failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -283,7 +281,7 @@ bool SceneGraph::nodeIsDependentOnRoot(SceneGraphNodeInternal* node) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SceneGraph::sortTopologially() {
|
||||
bool SceneGraph::sortTopologically() {
|
||||
if (_nodes.empty())
|
||||
return true;
|
||||
|
||||
@@ -316,6 +314,32 @@ bool SceneGraph::sortTopologially() {
|
||||
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
auto it = std::find_if(
|
||||
_topologicalSortedNodes.begin(),
|
||||
_topologicalSortedNodes.end(),
|
||||
[](SceneGraphNode* node) {
|
||||
return node->name() == "Stars";
|
||||
}
|
||||
);
|
||||
SceneGraphNode* n = *it;
|
||||
_topologicalSortedNodes.erase(it);
|
||||
_topologicalSortedNodes.insert(_topologicalSortedNodes.begin() + 3, n);
|
||||
|
||||
it = std::find_if(
|
||||
_topologicalSortedNodes.begin(),
|
||||
_topologicalSortedNodes.end(),
|
||||
[](SceneGraphNode* node) {
|
||||
return node->name() == "MilkyWay";
|
||||
}
|
||||
);
|
||||
n = *it;
|
||||
_topologicalSortedNodes.erase(it);
|
||||
_topologicalSortedNodes.insert(_topologicalSortedNodes.begin() + 2, n);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,7 @@ namespace openspace {
|
||||
ImageSequencer2* ImageSequencer2::_instance = nullptr;
|
||||
|
||||
ImageSequencer2::ImageSequencer2()
|
||||
: _defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder_blank.png"))
|
||||
, _latestImage()
|
||||
: _latestImage()
|
||||
, _hasData(false)
|
||||
{}
|
||||
|
||||
@@ -58,6 +57,7 @@ ImageSequencer2& ImageSequencer2::ref() {
|
||||
void ImageSequencer2::initialize() {
|
||||
assert(_instance == nullptr);
|
||||
_instance = new ImageSequencer2;
|
||||
_instance->_defaultCaptureImage = absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder_blank.png");
|
||||
}
|
||||
|
||||
void ImageSequencer2::deinitialize() {
|
||||
@@ -174,7 +174,7 @@ std::map<std::string, bool> ImageSequencer2::getActiveInstruments(){
|
||||
// for each spice-instrument
|
||||
for (auto instrumentID : key.second->getTranslation()){
|
||||
// check if the spice-instrument is active
|
||||
if (instumentActive(instrumentID)){
|
||||
if (instrumentActive(instrumentID)){
|
||||
// go over switching map
|
||||
for (auto instrument : _switchingMap){
|
||||
// if instrument is present in switching map
|
||||
@@ -189,7 +189,7 @@ std::map<std::string, bool> ImageSequencer2::getActiveInstruments(){
|
||||
// return entire map, seen in GUI.
|
||||
return _switchingMap;
|
||||
}
|
||||
bool ImageSequencer2::instumentActive(std::string instrumentID){
|
||||
bool ImageSequencer2::instrumentActive(std::string instrumentID){
|
||||
for (auto i : _instrumentTimes){
|
||||
//check if this instrument is in range
|
||||
if (i.second.inRange(_currentTime)){
|
||||
@@ -227,7 +227,7 @@ bool ImageSequencer2::getImagePaths(std::vector<Image>& captures,
|
||||
std::string projectee,
|
||||
std::string instrumentID){
|
||||
|
||||
if (!instumentActive(instrumentID) && !Time::ref().timeJumped()) return false;
|
||||
if (!instrumentActive(instrumentID) && !Time::ref().timeJumped()) return false;
|
||||
// dev. note: this is only due to LORRI being the only instrument implemented so far.
|
||||
return getImagePaths(captures, projectee);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user