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

Reworked geometry memory management #259

Merged
merged 3 commits into from
Dec 14, 2017
Merged

Conversation

favreau
Copy link
Member

@favreau favreau commented Dec 14, 2017

No description provided.

@favreau favreau requested a review from tribal-tec December 14, 2017 12:56
{
_centerRadius = radius;
center = c;
Copy link
Contributor

Choose a reason for hiding this comment

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

use init list

Cylinder(const Vector3f c, const Vector3f u, const float r,
const float ts = 0.f, const Vector2f v = Vector2f(0.f, 0.f))
{
center = c;
Copy link
Contributor

Choose a reason for hiding this comment

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

dito

Sphere(const Vector3f c, float r, float ts = 0.f,
const Vector2f v = Vector2f(0.f, 0.f))
{
center = c;
Copy link
Contributor

Choose a reason for hiding this comment

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

dito

}

size_t material = NB_SYSTEM_MATERIALS + 7;

// Sphere
{
_spheres[material].push_back(
SpherePtr(new Sphere(Vector3f(0.25f, 0.26f, 0.30f), 0.25f)));
addSphere(material, Sphere(Vector3f(0.25f, 0.26f, 0.30f), 0.25f));
Copy link
Contributor

Choose a reason for hiding this comment

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

brace-initializers {} should work too, so you can omit the redundant Sphere()

{
++material;
addCylinder(material, Cylinder(Vector3f(0.25f, 0.126f, 0.75f),
Copy link
Contributor

Choose a reason for hiding this comment

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

dito

{
++material;
addCone(material, Cone(Vector3f(0.75f, 0.01f, 0.25f),
Copy link
Contributor

Choose a reason for hiding this comment

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

dito. Actually also for Vector3f

@@ -621,4 +605,68 @@ bool Scene::empty() const
return _spheres.empty() && _cylinders.empty() && _cones.empty() &&
_trianglesMeshes.empty();
}

uint64_t Scene::addSphere(const size_t materialId, const Sphere& sphere)
Copy link
Contributor

Choose a reason for hiding this comment

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

We could consider using Sphere&&. i guess usually things will be moved it here

TrianglesMeshMap& _trianglesMeshes;
MaterialsMap& _materials;
Boxf& _worldBounds;
void add(const size_t materialId, const Sphere& sphere)
Copy link
Contributor

Choose a reason for hiding this comment

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

use addSphere etc. here also to be consistent with Scene?

@favreau favreau merged commit cfbba5e into BlueBrain:master Dec 14, 2017
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.

2 participants