Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Oct 18, 2017
1 parent 7d91f5b commit dca5c7f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 35 deletions.
12 changes: 7 additions & 5 deletions brayns/Brayns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,15 @@ struct Brayns::Impl

scene.buildEnvironment();

if (_parametersManager->getGeometryParameters()
.getLoadCacheFile()
.empty())
const auto& geomParams = _parametersManager->getGeometryParameters();
if (geomParams.getLoadCacheFile().empty())
{
scene.buildMaterials();
loadingProgress.setMessage("Building geometry ...");
scene.buildGeometry();

if (!geomParams.getSaveCacheFile().empty())
scene.saveCacheFile();
}

loadingProgress += LOADING_PROGRESS_STEP;
Expand Down Expand Up @@ -450,7 +452,7 @@ struct Brayns::Impl

if (!geometryParameters.getLoadCacheFile().empty())
{
scene.loadSceneFromCacheFile();
scene.loadromCacheFile();

This comment has been minimized.

Copy link
@rdumusc

rdumusc Oct 18, 2017

loadromCacheFile

This comment has been minimized.

Copy link
@tribal-tec

tribal-tec Oct 18, 2017

Author Contributor

Yeah, noticed it while compiling :)

loadingProgress += tic;
}

Expand Down Expand Up @@ -1182,7 +1184,7 @@ struct Brayns::Impl
void _saveSceneToCacheFile()
{
auto& scene = _engine->getScene();
scene.saveSceneToCacheFile();
scene.saveToCacheFile();
}

void _resetCamera()
Expand Down
4 changes: 2 additions & 2 deletions brayns/common/scene/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ class Scene
Loads geometry a binary cache file defined by the --load-cache-file
command line parameter
*/
BRAYNS_API virtual void loadSceneFromCacheFile() = 0;
BRAYNS_API virtual void loadFromCacheFile() = 0;

/**
Saves geometry a binary cache file defined by the --save-cache-file
command line parameter
*/
BRAYNS_API virtual void saveSceneToCacheFile() = 0;
BRAYNS_API virtual void saveToCacheFile() = 0;

/**
* @return true if the given volume file is supported by the engines' scene.
Expand Down
4 changes: 2 additions & 2 deletions plugins/engines/livre/LivreScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ void LivreScene::commitSimulationData()
{
}

void LivreScene::loadSceneFromCacheFile()
void LivreScene::loadFromCacheFile()
{
}

void LivreScene::saveSceneToCacheFile()
void LivreScene::saveToCacheFile()
{
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/engines/livre/LivreScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class LivreScene : public Scene
void commitSimulationData() final;

/** Unsupported by Livre. */
void loadSceneFromCacheFile() final;
void loadFromCacheFile() final;

/** Unsupported by Livre. */
void saveSceneToCacheFile() final;
void saveToCacheFile() final;

/** @copydoc Scene::isVolumeSupported */
bool isVolumeSupported(const std::string& volumeFile) const final;
Expand Down
7 changes: 3 additions & 4 deletions plugins/engines/optix/OptiXScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void OptiXScene::unload()
_optixTextureSamplers.clear();
}

void OptiXScene::loadSceneFromCacheFile()
void OptiXScene::loadFromCacheFile()
{
}

Expand Down Expand Up @@ -1034,10 +1034,9 @@ uint64_t OptiXScene::_getBvhSize(const uint64_t nbElements) const
return 64 * 1.3f * nbElements;
}

void OptiXScene::saveSceneToCacheFile()
void OptiXScene::saveToCacheFile()
{
BRAYNS_ERROR << "OptiXScene::saveSceneToCacheFile not implemented"
<< std::endl;
BRAYNS_ERROR << "OptiXScene::saveToCacheFile not implemented" << std::endl;
}

bool OptiXScene::isVolumeSupported(const std::string& volumeFile) const
Expand Down
8 changes: 4 additions & 4 deletions plugins/engines/optix/OptiXScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class OptiXScene : public brayns::Scene
/** @copydoc Scene::unload */
void unload() final;

/** @copydoc Scene::loadSceneFromCacheFile */
void loadSceneFromCacheFile() final;
/** @copydoc Scene::loadFromCacheFile */
void loadFromCacheFile() final;

/** @copydoc Scene::saveSceneToCacheFile */
void saveSceneToCacheFile() final;
/** @copydoc Scene::saveToCacheFile */
void saveToCacheFile() final;

/** @copydoc Scene::isVolumeSupported */
bool isVolumeSupported(const std::string& volumeFile) const final;
Expand Down
12 changes: 2 additions & 10 deletions plugins/engines/ospray/OSPRayScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ OSPModel OSPRayScene::modelImpl(const uint32_t index)
return lastModel->second;
}

void OSPRayScene::_saveCacheFile()
void OSPRayScene::saveToCacheFile()
{
const std::string& filename =
_parametersManager.getGeometryParameters().getSaveCacheFile();
Expand Down Expand Up @@ -369,7 +369,7 @@ void OSPRayScene::_saveCacheFile()
BRAYNS_INFO << "Scene successfully saved" << std::endl;
}

void OSPRayScene::loadSceneFromCacheFile()
void OSPRayScene::loadFromCacheFile()
{
const auto& geomParams = _parametersManager.getGeometryParameters();

Expand Down Expand Up @@ -905,9 +905,6 @@ void OSPRayScene::buildGeometry()
BRAYNS_INFO << "Total : " << size << " bytes" << std::endl;
BRAYNS_INFO << "---------------------------------------------------"
<< std::endl;

if (!geomParams.getSaveCacheFile().empty())
_saveCacheFile();
}

uint64_t OSPRayScene::_buildMeshOSPGeometry(const size_t materialId)
Expand Down Expand Up @@ -1313,11 +1310,6 @@ OSPTexture2D OSPRayScene::_createTexture2D(const std::string& textureName)
return ospTexture;
}

void OSPRayScene::saveSceneToCacheFile()
{
_saveCacheFile();
}

bool OSPRayScene::isVolumeSupported(const std::string& volumeFile) const
{
return boost::algorithm::ends_with(volumeFile, ".raw");
Expand Down
10 changes: 4 additions & 6 deletions plugins/engines/ospray/OSPRayScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class OSPRayScene : public brayns::Scene
/** @copydoc Scene::unload */
void unload() final;

/** @copydoc Scene::loadSceneFromCacheFile */
void loadSceneFromCacheFile() final;
/** @copydoc Scene::loadFromCacheFile */
void loadFromCacheFile() final;

/** @copydoc Scene::saveSceneToCacheFile */
void saveSceneToCacheFile() final;
/** @copydoc Scene::saveToCacheFile */
void saveToCacheFile() final;

/** @copydoc Scene::isVolumeSupported */
bool isVolumeSupported(const std::string& volumeFile) const final;
Expand All @@ -94,8 +94,6 @@ class OSPRayScene : public brayns::Scene
uint64_t _serializeCones(const size_t materialId);
uint64_t _buildMeshOSPGeometry(const size_t materialId);

void _saveCacheFile();

std::map<uint32_t, OSPModel> _models;
OSPModel _simulationModel;
std::vector<OSPMaterial> _ospMaterials;
Expand Down

0 comments on commit dca5c7f

Please sign in to comment.