Cache pipeline fixed

This commit is contained in:
Christian Adamsson
2020-06-29 11:45:49 +02:00
parent c82f47301b
commit 3ed3b51a6c
2 changed files with 31 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ namespace {
constexpr const GLuint VaFiltering = 2; // MUST CORRESPOND TO THE SHADER PROGRAM
constexpr const GLuint VaIndex = 3; // MUST CORRESPOND TO THE SHADER PROGRAM
constexpr int8_t CurrentCacheVersion = 1;
constexpr int8_t CurrentCacheVersion = 2;
// ----- KEYS POSSIBLE IN MODFILE. EXPECTED DATA TYPE OF VALUE IN [BRACKETS] ----- //
// ---------------------------- MANDATORY MODFILE KEYS ---------------------------- //
@@ -361,6 +361,32 @@ namespace openspace {
if (!_loadingStatesDynamically) {
std::string _file = "StreamnodesCacheindex";
//if the files doesn't exist we create them, this is just so that we then can cache the actual binary files
if (!FileSys.fileExists(_file)) {
std::ofstream fileStream(_file, std::ofstream::binary);
std::ofstream fileStream2("StreamnodesCacheColor", std::ofstream::binary);
std::ofstream fileStream3("StreamnodesCacheRadius", std::ofstream::binary);
std::ofstream fileStream4("StreamnodesCachePosition", std::ofstream::binary);
fileStream.write(
reinterpret_cast<const char*>(&CurrentCacheVersion),
sizeof(int8_t)
);
fileStream2.write(
reinterpret_cast<const char*>(&CurrentCacheVersion),
sizeof(int8_t)
);
fileStream3.write(
reinterpret_cast<const char*>(&CurrentCacheVersion),
sizeof(int8_t)
);
fileStream4.write(
reinterpret_cast<const char*>(&CurrentCacheVersion),
sizeof(int8_t)
);
}
std::string cachedFile = FileSys.cacheManager()->cachedFilename(
_file,
ghoul::filesystem::CacheManager::Persistent::Yes
@@ -681,6 +707,7 @@ namespace openspace {
return false;
}
// Ensure that the source folder exists and then extract
// the files with the same extension as <inputFileTypeString>
ghoul::filesystem::Directory sourceFolder(sourceFolderPath);
@@ -896,7 +923,7 @@ namespace openspace {
const std::string earth = "Earth";
SceneGraphNode* earthnode = sceneGraphNode(earth);
glm::dvec3 earthpos = earthnode->worldPosition();
LDEBUG("earthpos x: " + std::to_string(earthpos.x));
// LDEBUG("earthpos x: " + std::to_string(earthpos.x));
// Flow/Particles
_shaderProgram->setUniform(_uniformCache.streamColor, _pStreamColor);
_shaderProgram->setUniform(_uniformCache.nodeSize, _pNodeSize);

View File

@@ -84,14 +84,13 @@ namespace openspace {
// ------------------------------------ STRINGS ------------------------------------//
// Name of the Node
std::string _identifier;
// ------------------------------------- FLAGS -------------------------------------//
// Used for 'runtime-states'. True when loading a new state from disk on another
// thread.
bool _isLoadingStateFromDisk = false;
// False => states are stored in RAM (using 'in-RAM-states'), True => states are
// loaded from disk during runtime (using 'runtime-states')
bool _loadingStatesDynamically = true;
bool _loadingStatesDynamically = false;
// Used for 'runtime-states': True if new 'runtime-state' must be loaded from disk.
// False => the previous frame's state should still be shown
bool _mustLoadNewStateFromDisk = true;
@@ -109,7 +108,7 @@ namespace openspace {
// Active index of _startTimes
int _activeTriggerTimeIndex = -1;
// Number of states in the sequence
size_t _nStates = 274;
size_t _nStates = 4;
// In setup it is used to scale JSON coordinates. During runtime it is used to scale
// domain limits.
float _scalingFactor = 1.f;