Skip to content
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

Merged
merged 2 commits into from
Oct 25, 2016
Merged

Conversation

favreau
Copy link
Member

@favreau favreau commented Oct 19, 2016

No description provided.

@@ -424,7 +423,7 @@ struct Brayns::Impl
TransferFunctionLoader transferFunctionLoader( brayns::Vector2f( 0, nbMaterials ));
transferFunctionLoader.loadFromFile(
transferFunctionFilename, *_engine->getScene( ));
_engine->getScene()->commitSimulationData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore?

Copy link
Member Author

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 );
Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Member Author

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.

Copy link
Contributor

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 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

choose a line

Copy link
Member Author

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 ));
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No?

Copy link
Member Author

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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Member Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Member Author

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()));
Copy link
Contributor

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)

Copy link
Member Author

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 )
Copy link
Contributor

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

Copy link
Member Author

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; }
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jafyvilla
Copy link
Contributor

And rebase

@favreau
Copy link
Member Author

favreau commented Oct 24, 2016

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

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 ));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No?

@jafyvilla
Copy link
Contributor

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.

@favreau
Copy link
Member Author

favreau commented Oct 25, 2016

Ok, good point. Sorry about that.

@favreau favreau merged commit 50e84db into BlueBrain:master Oct 25, 2016
@jafyvilla
Copy link
Contributor

🙃 now you forgot the squash...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants