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 properties to materials #667

Merged
merged 6 commits into from
Jan 25, 2019
Merged

Added properties to materials #667

merged 6 commits into from
Jan 25, 2019

Conversation

favreau
Copy link
Member

@favreau favreau commented Jan 22, 2019

Adding properties to materials allows definition of extra properties that can be processed by the renderer.

@@ -387,7 +388,7 @@ class Model
* existing geometry in the model. Missing materials are created with the
* default parameters
*/
BRAYNS_API void createMissingMaterials();
BRAYNS_API void createMissingMaterials(const PropertyMap& properties = {});
Copy link
Contributor

Choose a reason for hiding this comment

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

that is not called other than this anyways, so the parameter is not needed for this function?!

Copy link
Member Author

Choose a reason for hiding this comment

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

Properties are forwarded to the material itself (line 558). It's true that Brayns never calls this method with properties, but this can still be done by a plugin for instance (that's actually what I do and why I need this extra parameter).

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you pass the material type name as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, this createMissingMaterials() shall be gone completely. The CircuitViewer plugin uses it though, but imo that shouldn't be necessary. @hernando could you have a look there?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

@karjonas
Copy link
Contributor

lgtm

{
MaterialPtr material = std::make_shared<OSPRayMaterial>();
material->setName(name);
material->setProperties(properties);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a constructor with these parameters parameters?

@@ -387,7 +388,7 @@ class Model
* existing geometry in the model. Missing materials are created with the
* default parameters
*/
BRAYNS_API void createMissingMaterials();
BRAYNS_API void createMissingMaterials(const PropertyMap& properties = {});
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you pass the material type name as well?

@@ -440,6 +440,9 @@ void Scene::_updateEnvironmentMap()
}

if (_backgroundMaterial->isModified())
{
_backgroundMaterial->resetModified(); // TODO????
Copy link
Contributor

Choose a reason for hiding this comment

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

no, to my knowledge that's wrong. All the materials are reset at some point

Copy link
Member Author

Choose a reason for hiding this comment

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

oops... removed

@@ -702,4 +704,32 @@ PropertyMap MorphologyLoader::getCLIProperties()
pm.setProperty(PROP_USE_SDF_GEOMETRIES);
return pm;
}

void createMissingMaterials(Model& model)
Copy link
Contributor

Choose a reason for hiding this comment

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

that's still nuclear bomb to kill a fly :) The materials that are required to be created should be known in here, but @hernando said he will look into this.

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 would make it a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me figure it out, I was the last one touching that code.

@@ -27,8 +27,8 @@ namespace brayns
{
namespace
{
brion::GIDSet _gidsFromRange(const uint32_t first, const uint32_t last,
const double fraction, const int32_t seed)
inline brion::GIDSet _gidsFromRange(const uint32_t first, const uint32_t last,
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 somewhat had to make this inline in order to avoid a 'defined but not used [-Werror=unused-function]' compilation error :-/

@@ -59,8 +59,8 @@ brion::GIDSet _gidsFromRange(const uint32_t first, const uint32_t last,
return brion::GIDSet(gids.begin(), gids.end());
}

brion::GIDSet _keyToGIDorRange(const std::string& key, const double fraction,
const int32_t seed)
inline brion::GIDSet _keyToGIDorRange(const std::string& key,
Copy link
Member Author

Choose a reason for hiding this comment

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

dito

@@ -440,6 +440,9 @@ void Scene::_updateEnvironmentMap()
}

if (_backgroundMaterial->isModified())
{
_backgroundMaterial->resetModified(); // TODO????
Copy link
Member Author

Choose a reason for hiding this comment

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

oops... removed

@@ -702,4 +704,32 @@ PropertyMap MorphologyLoader::getCLIProperties()
pm.setProperty(PROP_USE_SDF_GEOMETRIES);
return pm;
}

void createMissingMaterials(Model& model)
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 would make it a different PR.

@favreau favreau force-pushed the master branch 2 times, most recently from c59b117 to e4b15bf Compare January 25, 2019 10:43
@@ -107,6 +107,8 @@ class MorphologyLoader : public Loader

PropertyMap _defaults; // command line defaults
};

void createMissingMaterials(Model& model);
Copy link
Contributor

Choose a reason for hiding this comment

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

rm this line aka revert this file

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?

@tribal-tec tribal-tec merged commit d405541 into BlueBrain:master Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants