| 145 | } |
| 146 | |
| 147 | FALCOR_SCRIPT_BINDING(Transform) |
| 148 | { |
| 149 | using namespace pybind11::literals; |
| 150 | |
| 151 | auto init = [](const pybind11::kwargs& args) |
| 152 | { |
| 153 | Transform transform; |
| 154 | |
| 155 | std::optional<float3> position; |
| 156 | std::optional<float3> target; |
| 157 | std::optional<float3> up; |
| 158 | |
| 159 | for (auto a : args) |
| 160 | { |
| 161 | auto key = a.first.cast<std::string>(); |
| 162 | const auto& value = a.second; |
| 163 | |
| 164 | float3 float3Value; |
| 165 | float floatValue; |
| 166 | |
| 167 | bool isFloat3 = pybind11::isinstance<float3>(value); |
| 168 | bool isNumber = pybind11::isinstance<pybind11::int_>(value) || pybind11::isinstance<pybind11::float_>(value); |
| 169 | |
| 170 | if (isFloat3) float3Value = pybind11::cast<float3>(value); |
| 171 | if (isNumber) floatValue = pybind11::cast<float>(value); |
| 172 | |
| 173 | if (key == "translation") |
| 174 | { |
| 175 | if (isFloat3) transform.setTranslation(float3Value); |
| 176 | } |
| 177 | else if (key == "scaling") |
| 178 | { |
| 179 | if (isFloat3) transform.setScaling(float3Value); |
| 180 | if (isNumber) transform.setScaling(float3(floatValue)); |
| 181 | } |
| 182 | else if (key == "rotationEuler") |
| 183 | { |
| 184 | if (isFloat3) transform.setRotationEuler(float3Value); |
| 185 | } |
| 186 | else if (key == "rotationEulerDeg") |
| 187 | { |
| 188 | if (isFloat3) transform.setRotationEulerDeg(float3Value); |
| 189 | } |
| 190 | else if (key == "position") |
| 191 | { |
| 192 | if (isFloat3) position = float3Value; |
| 193 | } |
| 194 | else if (key == "target") |
| 195 | { |
| 196 | if (isFloat3) target = float3Value; |
| 197 | } |
| 198 | else if (key == "up") |
| 199 | { |
| 200 | if (isFloat3) up = float3Value; |
| 201 | } |
| 202 | else if (key == "order") |
| 203 | { |
| 204 | transform.setCompositionOrder(pybind11::cast<Transform::CompositionOrder>(value)); |
nothing calls this directly
no test coverage detected