Changeset View
Changeset View
Standalone View
Standalone View
intern/openvdb/intern/openvdb_level_set.h
- This file was added.
| /* | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License | |||||
| * as published by the Free Software Foundation; either version 2 | |||||
| * of the License, or (at your option) any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * You should have received a copy of the GNU General Public License | |||||
| * along with this program; if not, write to the Free Software Foundation, | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
| * | |||||
| * The Original Code is Copyright (C) 2015 Blender Foundation. | |||||
| * All rights reserved. | |||||
| */ | |||||
| #ifndef __OPENVDB_LEVEL_SET_H__ | |||||
| #define __OPENVDB_LEVEL_SET_H__ | |||||
| #include <openvdb/openvdb.h> | |||||
| #include <openvdb/math/FiniteDifference.h> | |||||
| #include <openvdb/tools/MeshToVolume.h> | |||||
| #include <openvdb/tools/VolumeToMesh.h> | |||||
| #include <openvdb/tools/LevelSetFilter.h> | |||||
| #include <openvdb/tools/GridTransformer.h> | |||||
| #include "openvdb_capi.h" | |||||
| struct OpenVDBLevelSet { | |||||
| private: | |||||
| openvdb::FloatGrid::Ptr grid; | |||||
| public: | |||||
| OpenVDBLevelSet(); | |||||
| ~OpenVDBLevelSet(); | |||||
| const openvdb::FloatGrid::Ptr &get_grid(); | |||||
| void set_grid(const openvdb::FloatGrid::Ptr &grid); | |||||
brecht: The member function names in this class don't need an `OpenVDB_` or `OpenVDB_level_set_` prefix… | |||||
Not Done Inline ActionsThe grid pointer here should be passed by reference: void OpenVDB_level_set_set_grid(const openvdb::FloatGrid::Ptr& grid) Not a performance issue in this case, but copying shared pointers like these is not a cheap operation in general, so best to have the habit of passing them around more efficiently. This goes for all the OpenVDB ::Ptr types. brecht: The grid pointer here should be passed by reference:
```
void OpenVDB_level_set_set_grid(const… | |||||
Not Done Inline ActionsThis should be: const openvdb::FloatGrid::Ptr &get_grid(); void set_grid(const openvdb::FloatGrid::Ptr& grid); The const is important, we don't want callers to be able to modifier the grid pointer inside OpenVDBLevelSet, we just want to avoid copying it when it's not needed. brecht: This should be:
```
const openvdb::FloatGrid::Ptr &get_grid();
void set_grid(const openvdb… | |||||
| void mesh_to_level_set(const float *vertices, | |||||
Not Done Inline ActionsThis function is not implemented? brecht: This function is not implemented? | |||||
| const unsigned int *faces, | |||||
| const unsigned int totvertices, | |||||
| const unsigned int totfaces, | |||||
| const openvdb::math::Transform::Ptr &transform); | |||||
Not Done Inline ActionsAdd const brecht: Add `const` | |||||
| void volume_to_mesh(struct OpenVDBVolumeToMeshData *mesh, | |||||
| const double isovalue, | |||||
| const double adaptivity, | |||||
| const bool relax_disoriented_triangles); | |||||
| void filter(OpenVDBLevelSet_FilterType filter_type, | |||||
| int width, | |||||
| float distance, | |||||
Not Done Inline ActionsThis function is not implemented? brecht: This function is not implemented? | |||||
| OpenVDBLevelSet_FilterBias filter_bias); | |||||
| openvdb::FloatGrid::Ptr CSG_operation_apply(const openvdb::FloatGrid::Ptr &gridA, | |||||
| const openvdb::FloatGrid::Ptr &gridB, | |||||
| OpenVDBLevelSet_CSGOperation operation); | |||||
Not Done Inline ActionsAdd const for both brecht: Add `const ` for both | |||||
| }; | |||||
| #endif /* __OPENVDB_LEVEL_SET_H__ */ | |||||
Not Done Inline Actionsint -> OpenVDBLevelSet_FilterBias brecht: `int` -> `OpenVDBLevelSet_FilterBias` | |||||
The member function names in this class don't need an OpenVDB_ or OpenVDB_level_set_ prefix, it's redundant.