mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Cherrypick remaining changes from the feature/catch2 branch sans the big switch to SGCT 3.0
This commit is contained in:
@@ -1105,11 +1105,6 @@ void setSgctDelegateFunctions() {
|
||||
return glm::ivec4(data[0], data[2], data[1], data[3]);
|
||||
}
|
||||
};
|
||||
sgctDelegate.isExternalControlConnected = []() {
|
||||
ZoneScoped
|
||||
|
||||
return sgct::Engine::instance()->isExternalControlConnected();
|
||||
};
|
||||
sgctDelegate.sendMessageToExternalControl = [](const std::vector<char>& message) {
|
||||
ZoneScoped
|
||||
|
||||
@@ -1118,12 +1113,6 @@ void setSgctDelegateFunctions() {
|
||||
static_cast<int>(message.size())
|
||||
);
|
||||
};
|
||||
sgctDelegate.isSimpleRendering = []() {
|
||||
ZoneScoped
|
||||
|
||||
return (sgct::Engine::instance()->getCurrentRenderTarget() !=
|
||||
sgct::Engine::NonLinearBuffer);
|
||||
};
|
||||
sgctDelegate.isFisheyeRendering = []() {
|
||||
ZoneScoped
|
||||
|
||||
|
||||
@@ -96,13 +96,9 @@ struct WindowDelegate {
|
||||
|
||||
glm::ivec4 (*viewportPixelCoordinates)() = []() { return glm::ivec4(0, 0, 0, 0); };
|
||||
|
||||
bool (*isExternalControlConnected)() = []() { return false; };
|
||||
|
||||
void (*sendMessageToExternalControl)(const std::vector<char>& message) =
|
||||
[](const std::vector<char>&) {};
|
||||
|
||||
bool (*isSimpleRendering)() = []() { return true; };
|
||||
|
||||
bool (*isFisheyeRendering)() = []() { return false; };
|
||||
|
||||
unsigned int(*takeScreenshot)(bool applyWarping) = [](bool) { return 0u; };
|
||||
|
||||
@@ -61,7 +61,7 @@ class AssetListener;
|
||||
|
||||
class AssetLoader {
|
||||
public:
|
||||
AssetLoader(ghoul::lua::LuaState& luaState, SynchronizationWatcher* syncWatcher,
|
||||
AssetLoader(ghoul::lua::LuaState* luaState, SynchronizationWatcher* syncWatcher,
|
||||
std::string assetRootDirectory);
|
||||
|
||||
~AssetLoader();
|
||||
|
||||
@@ -166,11 +166,11 @@ private:
|
||||
float _miePhaseConstant = 0.f;
|
||||
float _sunRadianceIntensity = 5.f;
|
||||
|
||||
glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _mieScatteringCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _mieExtinctionCoeff = glm::vec3(0.0);
|
||||
glm::dvec3 _ellipsoidRadii = glm::vec3(0.0);
|
||||
glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _mieScatteringCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _mieExtinctionCoeff = glm::vec3(0.f);
|
||||
glm::dvec3 _ellipsoidRadii = glm::vec3(0.f);
|
||||
|
||||
// Atmosphere Textures Dimmensions
|
||||
int _transmittance_table_width = 256;
|
||||
|
||||
@@ -124,10 +124,10 @@ private:
|
||||
float _sunRadianceIntensity = 5.f;
|
||||
float _mieScattExtPropCoefProp = 1.f;
|
||||
|
||||
glm::vec3 _mieExtinctionCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.0);
|
||||
glm::vec3 _mieScatteringCoeff = glm::dvec3(0.0);
|
||||
glm::vec3 _mieExtinctionCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.f);
|
||||
glm::vec3 _mieScatteringCoeff = glm::dvec3(0.f);
|
||||
|
||||
// Atmosphere Debug
|
||||
bool _saveCalculationsToTexture = false;
|
||||
|
||||
@@ -57,5 +57,10 @@ set_folder_location(cfitsio "External")
|
||||
add_subdirectory(${CCFITS_ROOT_DIR})
|
||||
set_folder_location(CCfits "External")
|
||||
|
||||
if (GHOUL_DISABLE_EXTERNAL_WARNINGS)
|
||||
disable_external_warnings(cfitsio)
|
||||
disable_external_warnings(CCfits)
|
||||
endif ()
|
||||
|
||||
target_include_directories(${MODULE_NAME} SYSTEM PUBLIC ${INCLUDES_FOR_TARGET})
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE CCfits)
|
||||
|
||||
@@ -75,7 +75,6 @@ void GdalWrapper::create(size_t maximumCacheSize, size_t maximumMaximumCacheSize
|
||||
}
|
||||
|
||||
void GdalWrapper::destroy() {
|
||||
ghoul_assert(_singleton, "Cannot delete null");
|
||||
delete _singleton;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,33 +24,33 @@
|
||||
|
||||
#include <modules/iswa/iswamodule.h>
|
||||
|
||||
#include <modules/iswa/rendering/dataplane.h>
|
||||
#include <modules/iswa/rendering/datasphere.h>
|
||||
#include <modules/iswa/rendering/kameleonplane.h>
|
||||
#include <modules/iswa/rendering/screenspacecygnet.h>
|
||||
#include <modules/iswa/rendering/textureplane.h>
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#include <openspace/engine/globalscallbacks.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/rendering/screenspacerenderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/misc/templatefactory.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
#include <openspace/engine/globalscallbacks.h>
|
||||
|
||||
#include <modules/iswa/rendering/textureplane.h>
|
||||
#include <modules/iswa/rendering/dataplane.h>
|
||||
#include <modules/iswa/rendering/kameleonplane.h>
|
||||
#include <modules/iswa/rendering/datasphere.h>
|
||||
#include <modules/iswa/rendering/screenspacecygnet.h>
|
||||
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <ghoul/misc/templatefactory.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
IswaModule::IswaModule() : OpenSpaceModule(Name) {
|
||||
global::callback::initialize.push_back([]() { IswaManager::initialize(); });
|
||||
global::callback::initialize.push_back([]() {
|
||||
ZoneScopedN("IswaModule")
|
||||
IswaManager::initialize();
|
||||
});
|
||||
}
|
||||
|
||||
void IswaModule::internalInitialize(const ghoul::Dictionary&) {
|
||||
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "No renderable factory existed");
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
mutable glm::dmat3 _orbitPlaneRotation = glm::dmat3(1.0);
|
||||
|
||||
/// The cached position for the last time with which the update method was called
|
||||
glm::dvec3 _position = glm::vec3(0.f);
|
||||
glm::dvec3 _position = glm::dvec3(0.0);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
properties::StringProperty _observer;
|
||||
properties::StringProperty _frame;
|
||||
|
||||
glm::dvec3 _position = glm::vec3(0.f);
|
||||
glm::dvec3 _position = glm::dvec3(0.0);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
|
||||
bool _planeIsDirty = false;
|
||||
|
||||
glm::dmat3 _stateMatrix = glm::dmat3(0.0);
|
||||
glm::dmat3 _stateMatrix = glm::dmat3(1.0);
|
||||
std::string _frame;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
@@ -536,8 +536,8 @@ void RenderablePlanetProjection::attitudeParameters(double time) {
|
||||
lightTime
|
||||
) * 1000.0;
|
||||
|
||||
float distance = glm::length(p);
|
||||
float radius = boundingSphere();
|
||||
const double distance = glm::length(p);
|
||||
const double radius = boundingSphere();
|
||||
_projectorMatrix = _projectionComponent.computeProjectorMatrix(
|
||||
p,
|
||||
bs,
|
||||
@@ -545,8 +545,8 @@ void RenderablePlanetProjection::attitudeParameters(double time) {
|
||||
_instrumentMatrix,
|
||||
_projectionComponent.fieldOfViewY(),
|
||||
_projectionComponent.aspectRatio(),
|
||||
distance - radius,
|
||||
distance + radius,
|
||||
static_cast<float>(distance - radius),
|
||||
static_cast<float>(distance + radius),
|
||||
_boresight
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) {
|
||||
ghoul::lua::LuaState luaState;
|
||||
scriptEngine.initializeLuaState(luaState);
|
||||
|
||||
AssetLoader loader(luaState, &watcher, "${ASSETS}");
|
||||
AssetLoader loader(&luaState, &watcher, "${ASSETS}");
|
||||
|
||||
RequestListener listener;
|
||||
loader.addAssetListener(&listener);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <fstream>
|
||||
|
||||
namespace openspace::volume {
|
||||
|
||||
@@ -183,6 +183,7 @@ if (OS_WINDOWS)
|
||||
add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${WEBBROWSER_MODULE_PATH}" "${CEF_HELPER_TARGET}" "exe")
|
||||
endif (OS_WINDOWS)
|
||||
|
||||
set_property(TARGET ${CEF_HELPER_TARGET} PROPERTY FOLDER "Helper")
|
||||
|
||||
##########################################################################################
|
||||
# Create OpenSpace module.
|
||||
|
||||
@@ -347,7 +347,7 @@ void OpenSpaceEngine::initialize() {
|
||||
|
||||
global::openSpaceEngine._assetManager = std::make_unique<AssetManager>(
|
||||
std::make_unique<AssetLoader>(
|
||||
*global::scriptEngine.luaState(),
|
||||
global::scriptEngine.luaState(),
|
||||
rawWatcher,
|
||||
FileSys.absPath("${ASSETS}")
|
||||
),
|
||||
@@ -890,6 +890,8 @@ void OpenSpaceEngine::deinitialize() {
|
||||
global::sessionRecording.deinitialize();
|
||||
global::versionChecker.cancel();
|
||||
|
||||
_assetManager = nullptr;
|
||||
|
||||
global::deinitialize();
|
||||
|
||||
FactoryManager::deinitialize();
|
||||
|
||||
@@ -156,6 +156,7 @@ LoadingScreen::~LoadingScreen() {
|
||||
|
||||
void LoadingScreen::render() {
|
||||
ZoneScoped
|
||||
FrameMarkStart("Loading")
|
||||
|
||||
if (_phase == Phase::PreStart) {
|
||||
return;
|
||||
@@ -490,6 +491,7 @@ void LoadingScreen::render() {
|
||||
|
||||
std::this_thread::sleep_for(RefreshRate);
|
||||
global::windowDelegate.swapBuffer();
|
||||
FrameMarkEnd("Loading")
|
||||
}
|
||||
|
||||
void LoadingScreen::postMessage(std::string message) {
|
||||
|
||||
@@ -181,12 +181,11 @@ void Renderable::update(const UpdateData&) {}
|
||||
void Renderable::render(const RenderData&, RendererTasks&) {}
|
||||
|
||||
void Renderable::setBoundingSphere(float boundingSphere) {
|
||||
|
||||
_boundingSphere.setValue(boundingSphere);
|
||||
_boundingSphere = boundingSphere;
|
||||
}
|
||||
|
||||
float Renderable::boundingSphere() const {
|
||||
return _boundingSphere.value();
|
||||
return _boundingSphere;
|
||||
}
|
||||
|
||||
SurfacePositionHandle Renderable::calculateSurfacePositionHandle(
|
||||
|
||||
@@ -89,13 +89,13 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
AssetLoader::AssetLoader(ghoul::lua::LuaState& luaState,
|
||||
AssetLoader::AssetLoader(ghoul::lua::LuaState* luaState,
|
||||
SynchronizationWatcher* syncWatcher,
|
||||
std::string assetRootDirectory)
|
||||
: _rootAsset(std::make_shared<Asset>(this, syncWatcher))
|
||||
, _synchronizationWatcher(syncWatcher)
|
||||
, _assetRootDirectory(std::move(assetRootDirectory))
|
||||
, _luaState(&luaState)
|
||||
, _luaState(luaState)
|
||||
{
|
||||
setCurrentAsset(_rootAsset);
|
||||
|
||||
|
||||
@@ -46,6 +46,25 @@ namespace {
|
||||
constexpr const char* _loggerCat = "Scene";
|
||||
constexpr const char* KeyIdentifier = "Identifier";
|
||||
constexpr const char* KeyParent = "Parent";
|
||||
|
||||
constexpr const char* renderBinToString(int renderBin) {
|
||||
// Synced with Renderable::RenderBin
|
||||
if (renderBin == 1) {
|
||||
return "Background";
|
||||
}
|
||||
else if (renderBin == 2) {
|
||||
return "Opaque";
|
||||
}
|
||||
else if (renderBin == 4) {
|
||||
return "Transparent";
|
||||
}
|
||||
else if (renderBin == 8) {
|
||||
return "Overlay";
|
||||
}
|
||||
else {
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -309,6 +328,10 @@ void Scene::update(const UpdateData& data) {
|
||||
|
||||
void Scene::render(const RenderData& data, RendererTasks& tasks) {
|
||||
ZoneScoped
|
||||
ZoneName(
|
||||
renderBinToString(data.renderBinMask),
|
||||
strlen(renderBinToString(data.renderBinMask))
|
||||
)
|
||||
|
||||
for (SceneGraphNode* node : _topologicallySortedNodes) {
|
||||
try {
|
||||
|
||||
@@ -313,6 +313,7 @@ SceneGraphNode::~SceneGraphNode() {} // NOLINT
|
||||
|
||||
void SceneGraphNode::initialize() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
LDEBUG(fmt::format("Initializing: {}", identifier()));
|
||||
|
||||
@@ -336,6 +337,7 @@ void SceneGraphNode::initialize() {
|
||||
|
||||
void SceneGraphNode::initializeGL() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
LDEBUG(fmt::format("Initializing GL: {}", identifier()));
|
||||
|
||||
@@ -349,6 +351,7 @@ void SceneGraphNode::initializeGL() {
|
||||
|
||||
void SceneGraphNode::deinitialize() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
LDEBUG(fmt::format("Deinitializing: {}", identifier()));
|
||||
|
||||
@@ -365,6 +368,7 @@ void SceneGraphNode::deinitialize() {
|
||||
|
||||
void SceneGraphNode::deinitializeGL() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
LDEBUG(fmt::format("Deinitializing GL: {}", identifier()));
|
||||
|
||||
@@ -537,6 +541,8 @@ void SceneGraphNode::render(const RenderData& data, RendererTasks& tasks) {
|
||||
_performanceRecord.renderTime = (end - start).count();
|
||||
}
|
||||
else {
|
||||
TracyGpuZone("Render")
|
||||
|
||||
_renderable->render(newData, tasks);
|
||||
if (_computeScreenSpaceValues) {
|
||||
computeScreenSpaceData(newData);
|
||||
|
||||
@@ -53,7 +53,9 @@ ScriptEngine::ScriptEngine()
|
||||
{ "scriptingTemplate","${WEB}/documentation/scripting.hbs" },
|
||||
}
|
||||
)
|
||||
{}
|
||||
{
|
||||
tracy::LuaRegister(_state);
|
||||
}
|
||||
|
||||
void ScriptEngine::initialize() {
|
||||
ZoneScoped
|
||||
|
||||
@@ -51,6 +51,7 @@ void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine,
|
||||
const ghoul::Dictionary& configuration)
|
||||
{
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
std::string upperIdentifier = identifier();
|
||||
std::transform(
|
||||
@@ -76,18 +77,21 @@ void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine,
|
||||
|
||||
void OpenSpaceModule::initializeGL() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
internalInitializeGL();
|
||||
}
|
||||
|
||||
void OpenSpaceModule::deinitialize() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
internalDeinitialize();
|
||||
}
|
||||
|
||||
void OpenSpaceModule::deinitializeGL() {
|
||||
ZoneScoped
|
||||
ZoneName(identifier().c_str(), identifier().size())
|
||||
|
||||
internalDeinitializeGL();
|
||||
}
|
||||
|
||||
@@ -1118,7 +1118,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram
|
||||
));
|
||||
}
|
||||
else {
|
||||
return glm::dmat3();
|
||||
return glm::dmat3(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ TEST_CASE("AssetLoader: Assertion", "[assetloader]") {
|
||||
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
|
||||
openspace::SynchronizationWatcher syncWatcher;
|
||||
openspace::AssetLoader assetLoader(
|
||||
*state,
|
||||
state,
|
||||
&syncWatcher,
|
||||
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
|
||||
);
|
||||
@@ -69,7 +69,7 @@ TEST_CASE("AssetLoader: Basic Export Import", "[assetloader]") {
|
||||
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
|
||||
openspace::SynchronizationWatcher syncWatcher;
|
||||
openspace::AssetLoader assetLoader(
|
||||
*state,
|
||||
state,
|
||||
&syncWatcher,
|
||||
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
|
||||
);
|
||||
@@ -82,7 +82,7 @@ TEST_CASE("AssetLoader: Asset Functions", "[assetloader]") {
|
||||
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
|
||||
openspace::SynchronizationWatcher syncWatcher;
|
||||
openspace::AssetLoader assetLoader(
|
||||
*state,
|
||||
state,
|
||||
&syncWatcher,
|
||||
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
|
||||
);
|
||||
@@ -95,7 +95,7 @@ TEST_CASE("AssetLoader: Asset Initialization", "[assetloader]") {
|
||||
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
|
||||
openspace::SynchronizationWatcher syncWatcher;
|
||||
openspace::AssetLoader assetLoader(
|
||||
*state,
|
||||
state,
|
||||
&syncWatcher,
|
||||
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user