Cherrypick remaining changes from the feature/catch2 branch sans the big switch to SGCT 3.0

This commit is contained in:
Alexander Bock
2020-02-11 00:21:42 +01:00
parent 9cb1169d58
commit c8799dcc80
25 changed files with 92 additions and 63 deletions

View File

@@ -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

View File

@@ -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; };

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -75,7 +75,6 @@ void GdalWrapper::create(size_t maximumCacheSize, size_t maximumMaximumCacheSize
}
void GdalWrapper::destroy() {
ghoul_assert(_singleton, "Cannot delete null");
delete _singleton;
}

View File

@@ -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");

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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
);
}

View File

@@ -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);

View File

@@ -22,6 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <ghoul/misc/exception.h>
#include <fstream>
namespace openspace::volume {

View File

@@ -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.

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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(

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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);

View File

@@ -53,7 +53,9 @@ ScriptEngine::ScriptEngine()
{ "scriptingTemplate","${WEB}/documentation/scripting.hbs" },
}
)
{}
{
tracy::LuaRegister(_state);
}
void ScriptEngine::initialize() {
ZoneScoped

View File

@@ -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();
}

View File

@@ -1118,7 +1118,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram
));
}
else {
return glm::dmat3();
return glm::dmat3(1.0);
}
}

View File

@@ -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/")
);