Skip to content

Commit

Permalink
Simulation texture replaced by renderer-compatible raw buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
favreau committed Aug 5, 2016
1 parent 4713749 commit 08f3dbb
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 285 deletions.
6 changes: 3 additions & 3 deletions brayns/Brayns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ struct Brayns::Impl
parameter --report)
@return the number of simulation frames loaded
*/
size_t _loadCompartmentReport()
void _loadCompartmentReport()
{
GeometryParameters& geometryParameters =
_parametersManager->getGeometryParameters();
Expand All @@ -463,8 +463,8 @@ struct Brayns::Impl
filename << std::endl;
MorphologyLoader morphologyLoader( geometryParameters );
const servus::URI uri( filename );
return morphologyLoader.importSimulationIntoTexture(
uri, target, report, *_engine->getScene());
if( morphologyLoader.importSimulationData( uri, target, report, *_engine->getScene()))
_engine->getScene()->commitSimulationData();
}

void _buildDefaultScene()
Expand Down
12 changes: 12 additions & 0 deletions brayns/common/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,16 @@
throw exc;\
}

#define BRAYNS_PROGRESS( __value, __maxValue ) \
{\
std::cout << "[";\
size_t __percent = 100 * ( __value + 1 ) / __maxValue;\
for( size_t __progress = 0; __progress < 100; ++__progress )\
std::cout << ( __progress <= __percent ? "=" : " " );\
std::cout << "] " << int( __percent ) << " %\r";\
std::cout.flush();\
if( __value >= __maxValue - 1 )\
std::cout << std::endl;\
}

#endif
5 changes: 1 addition & 4 deletions brayns/common/scene/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ void Scene::setMaterials(
{
MaterialPtr material( new Material );

// Special materials (Simulation, skybox, etc)
// Special materials ( skybox, etc )
switch( i )
{
case MATERIAL_SIMULATION:
material->setTexture( TT_DIFFUSE, TEXTURE_NAME_SIMULATION );
break;
case MATERIAL_BOUNDING_BOX:
material->setColor( Vector3f( 1.f, 1.f, 1.f ));
material->setEmission( 1.f );
Expand Down
10 changes: 10 additions & 0 deletions brayns/common/scene/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class Scene
*/
BRAYNS_API virtual void buildGeometry() = 0;

/**
Attach simulation data to renderer
*/
BRAYNS_API virtual void commitSimulationData() = 0;

/**
Returns the bounding box for the whole scene
*/
Expand Down Expand Up @@ -152,6 +157,8 @@ class Scene
BRAYNS_API TexturesMap& getTextures() { return _textures; }
BRAYNS_API TrianglesMeshMap& getTriangleMeshes() { return _trianglesMeshes; }

BRAYNS_API SimulationData& getSimulationData() { return _simulationData; }

protected:
// Parameters
SceneParameters& _sceneParameters;
Expand All @@ -165,6 +172,9 @@ class Scene
TexturesMap _textures;
Lights _lights;

// Simulation
SimulationData _simulationData;

Boxf _bounds;
bool _isEmpty;
};
Expand Down
11 changes: 8 additions & 3 deletions brayns/common/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,21 @@ struct ExtensionParameters
EnginePtr engine;
};

/** Extension parameters */
struct SimulationData
{
std::map< uint64_t, floats > valuesPerFrame;
};

/** Some 'special' materials are used by Brayns to acomplish specific features
* such as simulations, or skyboxes.
* such as skyboxes.
*/
const size_t NO_MATERIAL = -1;
const size_t NB_MAX_MATERIALS = 200;
const size_t NB_SYSTEM_MATERIALS = 3;
const size_t MATERIAL_SYSTEM = NB_MAX_MATERIALS - NB_SYSTEM_MATERIALS;
const size_t MATERIAL_SKYBOX = MATERIAL_SYSTEM + 0;
const size_t MATERIAL_SIMULATION = MATERIAL_SYSTEM + 1;
const size_t MATERIAL_BOUNDING_BOX = MATERIAL_SYSTEM + 2;
const size_t MATERIAL_BOUNDING_BOX = MATERIAL_SYSTEM + 1;
const std::string TEXTURE_NAME_SKYBOX = "SKYBOX";
const std::string TEXTURE_NAME_SIMULATION = "SIMULATION";

Expand Down
Loading

0 comments on commit 08f3dbb

Please sign in to comment.