Refactored Model.cpp/hpp to C++x11 loops,
simplified the mesh / bbox handling.
This commit is contained in:
bubnikv 2017-06-13 11:35:24 +02:00
parent 21ddcb8487
commit 5cae4cc614
13 changed files with 314 additions and 500 deletions

View file

@ -58,15 +58,12 @@
size_t material_count() const
%code%{ RETVAL = THIS->materials.size(); %};
bool has_objects_with_no_instances();
bool add_default_instances();
Clone<BoundingBoxf3> bounding_box();
void center_instances_around_point(Pointf* point)
%code%{ THIS->center_instances_around_point(*point); %};
void align_instances_to_origin();
void translate(double x, double y, double z);
Clone<TriangleMesh> mesh();
Clone<TriangleMesh> raw_mesh();
ModelObjectPtrs* objects()
%code%{ RETVAL = &THIS->objects; %};
@ -183,25 +180,10 @@ ModelMaterial::attributes()
%code%{ RETVAL = &THIS->instances; %};
void invalidate_bounding_box();
void update_bounding_box();
Clone<TriangleMesh> mesh();
Clone<TriangleMesh> raw_mesh();
Clone<BoundingBoxf3> raw_bounding_box();
Clone<BoundingBoxf3> instance_bounding_box(int idx);
Ref<BoundingBoxf3> _bounding_box(BoundingBoxf3* new_bbox = NULL)
%code{%
if (NULL != new_bbox) {
THIS->_bounding_box = *new_bbox;
THIS->_bounding_box_valid = true;
}
if (!THIS->_bounding_box_valid) {
XSRETURN_UNDEF;
}
RETVAL = &THIS->_bounding_box;
%};
Clone<BoundingBoxf3> instance_bounding_box(int idx)
%code%{ RETVAL = THIS->instance_bounding_box(idx, true); %};
Clone<BoundingBoxf3> bounding_box();
%name{_add_volume} Ref<ModelVolume> add_volume(TriangleMesh* mesh)