-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for multiple volumes #37
Conversation
@@ -424,7 +423,7 @@ struct Brayns::Impl | |||
TransferFunctionLoader transferFunctionLoader( brayns::Vector2f( 0, nbMaterials )); | |||
transferFunctionLoader.loadFromFile( | |||
transferFunctionFilename, *_engine->getScene( )); | |||
_engine->getScene()->commitSimulationData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, done in the renderer implementation
{ | ||
const Vector3ui& volumeDimensions = scene->getVolumeHandler()->getDimensions(); | ||
const Vector3f& volumeScale = volumeParameters.getScale(); | ||
const Vector3ui& volumeDimensions = scene->getVolumeHandler()->getDimensions( 0.f ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDimensions with a parameter? looks weird...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still there. It feels wrong. All the methods in VolumeHandler take the timestamp as an argument. Since it already is a member, couldn't you have a setTimeStamp method, and then call the getter (without argument) for the volume that is currently set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I have to say that I was no so happy myself with that implementation. Simplified :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I had the same feeling. But having to set the timestamp first before accessing the class members sort of makes the volumeHandler transactional, which is not great either. But I also agree that the API looks ugly with the timestamp for every method. So well, I changed the code as you suggested, just because it's you ;-) And it does look better now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel honored :)
@@ -199,7 +200,8 @@ void Scene::buildDefault( ) | |||
_materials[material]->setColor( colors[material] ); | |||
_materials[material]->setSpecularColor( WHITE ); | |||
_materials[material]->setSpecularExponent( 10.f ); | |||
_materials[material]->setReflectionIndex( material == 4 ? 0.8f : 0.f ); | |||
_materials[material]->setReflectionIndex( 0.5f ); | |||
_materials[material]->setReflectionIndex( material == 4 ? 0.1f : 0.f ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
choose a line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any will do. Does not really matter.
if( !_volumeHandler && ( !volumeFile.empty() || !volumeFolder.empty() )) | ||
{ | ||
_volumeHandler.reset( | ||
new VolumeHandler( _parametersManager.getVolumeParameters(), TM_MODULO )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a while to realize what this TM_MODULO was. I suggest you use enums with a class name, describing the type. See https://github.com/BlueBrain/Fivox/blob/master/fivox/types.h#L80 for examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better indeed. But now I would need to change it everywhere else to be coherent. Done for this one, I will do the rest in a separate PR.
float VolumeHandler::getEpsilon( | ||
const float timestamp , | ||
const Vector3f& elementSpacing, | ||
const uint16_t samplesPerRay ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -563,37 +568,41 @@ void OptiXScene::commitVolumeData() | |||
return; | |||
} | |||
|
|||
float timestamp = _parametersManager.getSceneParameters().getTimestamp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
Vector3f diag = Vector3f( dimensions ) * scale; | ||
Vector3f diag = Vector3f( dimensions ) * elementSpacing; | ||
const float volumeDiag = std::max( diag.x(), std::max( diag.y(), diag.z())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto (find_max and const)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const float n1, | ||
const float n2) | ||
{ | ||
if( n2 == 0.f ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't compare a float to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -42,9 +42,13 @@ class OSPRayRenderer : public brayns::Renderer | |||
|
|||
void setCamera( CameraPtr camera ) final; | |||
|
|||
const std::string& getName() { return _name; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
OSPRenderer impl() { return _renderer; } | ||
|
||
private: | ||
|
||
std::string _name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't check all the code, but it looks it can be const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
And rebase |
Rebased and fixed issues in the OptiX plugin. |
@@ -224,7 +223,7 @@ void Scene::buildDefault( ) | |||
_materials[material]->setSpecularColor( WHITE ); | |||
_materials[material]->setSpecularExponent( 100.f ); | |||
|
|||
// Cylinder | |||
// CyliindexOffsetnder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum.... removed.
if( !_volumeHandler && ( !volumeFile.empty() || !volumeFolder.empty() )) | ||
{ | ||
_volumeHandler.reset( | ||
new VolumeHandler( _parametersManager.getVolumeParameters(), TM_MODULO )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No?
Please add new commits instead of ammending, it's easier to review. Then you can "Squash and merge" to get rid of the unneeded commits. |
Ok, good point. Sorry about that. |
🙃 now you forgot the squash... |
No description provided.