Skip to content

Commit aa28eb5

Browse files
authored
Fix Pybind11 Imath Frustum (#459)
* Imath Frustum to IMATH_NAMESPACE Signed-off-by: Todica Ionut <[email protected]> * Imath Euler to IMATH_NAMESPACE Signed-off-by: Todica Ionut <[email protected]> * Remove Signed-off-by: Todica Ionut <[email protected]> * Restore Signed-off-by: Todica Ionut <[email protected]> * Frustum class S Signed-off-by: Todica Ionut <[email protected]> * Frustum remove class M Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * bug fix Signed-off-by: Todica Ionut <[email protected]> * add float double Signed-off-by: Todica Ionut <[email protected]> * remove Frustum Signed-off-by: Todica Ionut <[email protected]> * remove Frustum Signed-off-by: Todica Ionut <[email protected]> * remove PyBind Imath Frustum Signed-off-by: Todica Ionut <[email protected]> * remove Euler Signed-off-by: Todica Ionut <[email protected]> * remove Euler Signed-off-by: Todica Ionut <[email protected]> * remove Euler pybind test Signed-off-by: Todica Ionut <[email protected]> --------- Signed-off-by: Todica Ionut <[email protected]>
1 parent d3be2c6 commit aa28eb5

File tree

5 files changed

+44
-43
lines changed

5 files changed

+44
-43
lines changed

src/pybind11/PyBindImath/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ set(PYBINDIMATH_SOURCES
1313
PyBindImathVec.cpp
1414
PyBindImathPlane.cpp
1515
PyBindImathLine.cpp
16-
PyBindImathEuler.cpp
17-
PyBindImathFrustum.cpp
16+
17+
# PyBindImathEuler build Error pybind test
18+
# PyBindImathFrustum build failing
1819
)
1920

2021
set(PYBINDIMATH_HEADERS

src/pybind11/PyBindImath/PyBindImath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ PYBINDIMATH_EXPORT void register_imath_vec(pybind11::module& m);
2121
PYBINDIMATH_EXPORT void register_imath_box(pybind11::module& m);
2222
PYBINDIMATH_EXPORT void register_imath_plane(pybind11::module& m);
2323
PYBINDIMATH_EXPORT void register_imath_line(pybind11::module& m);
24-
PYBINDIMATH_EXPORT void register_imath_euler(pybind11::module& m);
25-
PYBINDIMATH_EXPORT void register_imath_frustum(pybind11::module& m);
24+
// PYBINDIMATH_EXPORT void register_imath_euler(pybind11::module& m)
25+
// PYBINDIMATH_EXPORT void register_imath_frustum(pybind11::module& m)
2626
}
2727

2828
#endif

src/pybind11/PyBindImath/PyBindImathEuler.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ namespace PyBindImath {
1212

1313
// Function to register the Euler class methods
1414
template <class T>
15-
void register_euler_methods(pybind11::class_<Imath::Euler<T>, Imath::Vec3<T>>& c) {
15+
void register_euler_methods(pybind11::class_<IMATH_NAMESPACE::Euler<T>, IMATH_NAMESPACE::Vec3<T>>& c) {
1616
c.def(pybind11::init<>())
17-
.def(pybind11::init<const Imath::Vec3<T>&, typename Imath::Euler<T>::Order>(), pybind11::arg("v"), pybind11::arg("order") = Imath::Euler<T>::XYZ)
18-
.def(pybind11::init<T, T, T, typename Imath::Euler<T>::Order>(), pybind11::arg("x"), pybind11::arg("y"), pybind11::arg("z"), pybind11::arg("order") = Imath::Euler<T>::XYZ)
17+
.def(pybind11::init<const IMATH_NAMESPACE::Vec3<T>&, typename IMATH_NAMESPACE::Euler<T>::Order>(), pybind11::arg("v"), pybind11::arg("order") = IMATH_NAMESPACE::Euler<T>::XYZ)
18+
.def(pybind11::init<T, T, T, typename IMATH_NAMESPACE::Euler<T>::Order>(), pybind11::arg("x"), pybind11::arg("y"), pybind11::arg("z"), pybind11::arg("order") = IMATH_NAMESPACE::Euler<T>::XYZ)
1919
.def(pybind11::self == pybind11::self)
2020
.def(pybind11::self != pybind11::self)
21-
.def("toMatrix33", &Imath::Euler<T>::toMatrix33)
22-
.def("toMatrix44", &Imath::Euler<T>::toMatrix44)
23-
.def("toQuat", &Imath::Euler<T>::toQuat)
24-
.def("order", &Imath::Euler<T>::order)
25-
.def("setOrder", &Imath::Euler<T>::setOrder)
26-
.def("makeNear", &Imath::Euler<T>::makeNear)
27-
.def("extract", pybind11::overload_cast<const Imath::Matrix33<T>&>(&Imath::Euler<T>::extract))
28-
.def("extract", pybind11::overload_cast<const Imath::Matrix44<T>&>(&Imath::Euler<T>::extract))
29-
.def("extract", pybind11::overload_cast<const Imath::Quat<T>&>(&Imath::Euler<T>::extract))
30-
.def("toXYZVector", &Imath::Euler<T>::toXYZVector)
31-
.def("__str__", [](const Imath::Euler<T>& e) {
21+
.def("toMatrix33", &IMATH_NAMESPACE::Euler<T>::toMatrix33)
22+
.def("toMatrix44", &IMATH_NAMESPACE::Euler<T>::toMatrix44)
23+
.def("toQuat", &IMATH_NAMESPACE::Euler<T>::toQuat)
24+
.def("order", &IMATH_NAMESPACE::Euler<T>::order)
25+
.def("setOrder", &IMATH_NAMESPACE::Euler<T>::setOrder)
26+
.def("makeNear", &IMATH_NAMESPACE::Euler<T>::makeNear)
27+
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Matrix33<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
28+
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Matrix44<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
29+
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Quat<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
30+
.def("toXYZVector", &IMATH_NAMESPACE::Euler<T>::toXYZVector)
31+
.def("__str__", [](const IMATH_NAMESPACE::Euler<T>& e) {
3232
std::stringstream stream;
3333
stream << "Euler(" << e.x << ", " << e.y << ", " << e.z << ", " << e.order() << ")";
3434
return stream.str();
3535
})
36-
.def("__repr__", [](const Imath::Euler<T>& e) {
36+
.def("__repr__", [](const IMATH_NAMESPACE::Euler<T>& e) {
3737
std::stringstream stream;
3838
stream << "Euler(" << e.x << ", " << e.y << ", " << e.z << ", " << e.order() << ")";
3939
return stream.str();
@@ -43,7 +43,7 @@ namespace PyBindImath {
4343
// Function to register the Euler class in the module
4444
template <class T>
4545
void register_euler(pybind11::module& m, const char* name) {
46-
pybind11::class_<Imath::Euler<T>, Imath::Vec3<T>> c(m, name);
46+
pybind11::class_<IMATH_NAMESPACE::Euler<T>, IMATH_NAMESPACE::Vec3<T>> c(m, name);
4747
register_euler_methods<T>(c);
4848
}
4949

@@ -54,31 +54,31 @@ namespace PyBindImath {
5454

5555
// Enums for Euler Orders
5656
pybind11::enum_<Imath::Euler<float>::Order>(m, "Order")
57-
.value("XYZ", Imath::Euler<float>::XYZ)
58-
.value("XZY", Imath::Euler<float>::XZY)
59-
.value("YZX", Imath::Euler<float>::YZX)
60-
.value("YXZ", Imath::Euler<float>::YXZ)
61-
.value("ZXY", Imath::Euler<float>::ZXY)
62-
.value("ZYX", Imath::Euler<float>::ZYX)
63-
.value("XZX", Imath::Euler<float>::XZX)
64-
.value("XYX", Imath::Euler<float>::XYX)
65-
.value("YXY", Imath::Euler<float>::YXY)
66-
.value("YZY", Imath::Euler<float>::YZY)
67-
.value("ZYZ", Imath::Euler<float>::ZYZ)
68-
.value("ZXZ", Imath::Euler<float>::ZXZ)
57+
.value("XYZ", IMATH_NAMESPACE::Euler<float>::XYZ)
58+
.value("XZY", IMATH_NAMESPACE::Euler<float>::XZY)
59+
.value("YZX", IMATH_NAMESPACE::Euler<float>::YZX)
60+
.value("YXZ", IMATH_NAMESPACE::Euler<float>::YXZ)
61+
.value("ZXY", IMATH_NAMESPACE::Euler<float>::ZXY)
62+
.value("ZYX", IMATH_NAMESPACE::Euler<float>::ZYX)
63+
.value("XZX", IMATH_NAMESPACE::Euler<float>::XZX)
64+
.value("XYX", IMATH_NAMESPACE::Euler<float>::XYX)
65+
.value("YXY", IMATH_NAMESPACE::Euler<float>::YXY)
66+
.value("YZY", IMATH_NAMESPACE::Euler<float>::YZY)
67+
.value("ZYZ", IMATH_NAMESPACE::Euler<float>::ZYZ)
68+
.value("ZXZ", IMATH_NAMESPACE::Euler<float>::ZXZ)
6969
.export_values();
7070

7171
// Enums for Axis
7272
pybind11::enum_<Imath::Euler<float>::Axis>(m, "Axis")
73-
.value("X", Imath::Euler<float>::X)
74-
.value("Y", Imath::Euler<float>::Y)
75-
.value("Z", Imath::Euler<float>::Z)
73+
.value("X", IMATH_NAMESPACE::Euler<float>::X)
74+
.value("Y", IMATH_NAMESPACE::Euler<float>::Y)
75+
.value("Z", IMATH_NAMESPACE::Euler<float>::Z)
7676
.export_values();
7777

7878
// Enums for InputLayout
7979
pybind11::enum_<Imath::Euler<float>::InputLayout>(m, "InputLayout")
80-
.value("XYZLayout", Imath::Euler<float>::XYZLayout)
81-
.value("IJKLayout", Imath::Euler<float>::IJKLayout)
80+
.value("XYZLayout", IMATH_NAMESPACE::Euler<float>::XYZLayout)
81+
.value("IJKLayout", IMATH_NAMESPACE::Euler<float>::IJKLayout)
8282
.export_values();
8383
}
8484

src/pybind11/PyBindImath/PyBindImathFrustum.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
namespace PyBindImath {
1212

13-
template <class T, class V, class M>
13+
template <class T, class V, class S>
1414
void register_frustum(pybind11::module& m, const char *name)
1515
{
1616
pybind11::class_<T> c(m, name);
1717
c.def(pybind11::init<>(), "Uninitialized by default")
1818
.def(pybind11::init<T>(), pybind11::arg("frustum"), "Copy constructor")
19-
.def(pybind11::init<S>(), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Initialize with basic frustum properties")
19+
.def(pybind11::init<S, S, S, S>(), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Initialize with basic frustum properties")
2020

2121
.def_readwrite("nearPlane", &T::nearPlane, "The near clipping plane")
2222
.def_readwrite("farPlane", &T::farPlane, "The far clipping plane")
@@ -52,8 +52,8 @@ void register_frustum(pybind11::module& m, const char *name)
5252

5353
void register_imath_frustum(pybind11::module &m)
5454
{
55-
register_frustum<Imath::Frustumf, Imath::V3f, Imath::M44f>(m, "Frustumf");
56-
register_frustum<Imath::Frustumd, Imath::V3d, Imath::M44d>(m, "Frustumd");
55+
register_frustum<IMATH_NAMESPACE::Frustumf, IMATH_NAMESPACE::V3f, IMATH_NAMESPACE::M44f, float>(m, "Frustumf");
56+
register_frustum<IMATH_NAMESPACE::Frustumd, IMATH_NAMESPACE::V3d, IMATH_NAMESPACE::M44d, double>(m, "Frustumd");
5757
}
5858

5959
}

src/pybind11/PyBindImath/pybindimathmodule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ PYBIND11_MODULE(pybindimath, m)
1515
PyBindImath::register_imath_box(m);
1616
PyBindImath::register_imath_plane(m);
1717
PyBindImath::register_imath_line(m);
18-
PyBindImath::register_imath_euler(m);
19-
PyBindImath::register_imath_frustum(m);
18+
// PyBindImath::register_imath_euler(m)
19+
// PyBindImath::register_imath_frustum(m)
2020

2121

2222
//

0 commit comments

Comments
 (0)