TriMesh python bindings
parent
103379b6ba
commit
6b01d20b10
|
@ -54,6 +54,7 @@ struct TangentSpace {
|
|||
|
||||
/** \brief Abstract triangle mesh base class
|
||||
* \ingroup librender
|
||||
e \ingroup libpython
|
||||
*/
|
||||
class MTS_EXPORT_RENDER TriMesh : public Shape {
|
||||
public:
|
||||
|
|
|
@ -211,6 +211,25 @@ void export_render() {
|
|||
.def("getPrimitiveCount", &Shape::getPrimitiveCount)
|
||||
.def("getEffectivePrimitiveCount", &Shape::getEffectivePrimitiveCount);
|
||||
|
||||
void (TriMesh::*triMesh_serialize1)(Stream *stream) const = &TriMesh::serialize;
|
||||
void (TriMesh::*triMesh_serialize2)(Stream *stream, InstanceManager *) const = &TriMesh::serialize;
|
||||
|
||||
BP_CLASS(TriMesh, Shape, (bp::init<std::string, size_t, size_t, bool, bool, bool, bool, bool>()))
|
||||
.def(bp::init<Stream *, InstanceManager *>())
|
||||
.def(bp::init<Stream *, int>())
|
||||
.def("getTriangleCount", &TriMesh::getTriangleCount)
|
||||
.def("getVertexCount", &TriMesh::getVertexCount)
|
||||
.def("hasVertexNormals", &TriMesh::hasVertexNormals)
|
||||
.def("hasVertexColors", &TriMesh::hasVertexColors)
|
||||
.def("hasVertexTexcoords", &TriMesh::hasVertexTexcoords)
|
||||
.def("hasUVTangents", &TriMesh::hasUVTangents)
|
||||
.def("computeUVTangents", &TriMesh::computeUVTangents)
|
||||
.def("computeNormals", &TriMesh::computeNormals)
|
||||
.def("rebuildTopology", &TriMesh::rebuildTopology)
|
||||
.def("serialize", triMesh_serialize1)
|
||||
.def("serialize", triMesh_serialize2)
|
||||
.def("writeOBJ", &TriMesh::writeOBJ);
|
||||
|
||||
BP_STRUCT(BSDFSamplingRecord, (bp::init<const Intersection &, Sampler *, ETransportMode>()))
|
||||
.def(bp::init<const Intersection &, const Vector &, ETransportMode>())
|
||||
.def(bp::init<const Intersection &, const Vector &, const Vector &, ETransportMode>())
|
||||
|
|
|
@ -818,9 +818,10 @@ void TriMesh::writeOBJ(const fs::path &path) const {
|
|||
}
|
||||
|
||||
for (size_t i=0; i<m_triangleCount; ++i) {
|
||||
int i0 = m_triangles[i].idx[0] + 1,
|
||||
i1 = m_triangles[i].idx[1] + 1,
|
||||
i2 = m_triangles[i].idx[2] + 1;
|
||||
uint32_t i0 = m_triangles[i].idx[0] + 1,
|
||||
i1 = m_triangles[i].idx[1] + 1,
|
||||
i2 = m_triangles[i].idx[2] + 1;
|
||||
|
||||
if (m_normals && m_texcoords) {
|
||||
os << "f " << i0 << "/" << i0 << "/" << i0 << " "
|
||||
<< i1 << "/" << i1 << "/" << i1 << " "
|
||||
|
|
Loading…
Reference in New Issue