| 228 | } |
| 229 | |
| 230 | EMSCRIPTEN_BINDINGS(benchmark) { |
| 231 | using namespace emscripten; |
| 232 | |
| 233 | class_<GameObject>("GameObject") |
| 234 | .smart_ptr<GameObjectPtr>("GameObjectPtr") |
| 235 | .function("GetTransform", &GameObject::GetTransform); |
| 236 | |
| 237 | class_<Transform>("Transform") |
| 238 | .smart_ptr<TransformPtr>("TransformPtr") |
| 239 | .function("GetPosition", &Transform::GetPosition) |
| 240 | .function("GetRotation", &Transform::GetRotation) |
| 241 | .function("GetScale", &Transform::GetScale) |
| 242 | .function("SetPosition", &Transform::SetPosition) |
| 243 | .function("SetRotation", &Transform::SetRotation) |
| 244 | .function("SetScale", &Transform::SetScale); |
| 245 | |
| 246 | value_array<Vec3>("Vec3") |
| 247 | .element(&Vec3::x) |
| 248 | .element(&Vec3::y) |
| 249 | .element(&Vec3::z); |
| 250 | |
| 251 | function("create_game_object", &create_game_object); |
| 252 | function("pass_gameobject_ptr", &pass_gameobject_ptr); |
| 253 | function("add", &add); |
| 254 | |
| 255 | function("get_counter", &get_counter); |
| 256 | function("increment_counter", &increment_counter); |
| 257 | function("returns_input", &returns_input); |
| 258 | function("sum_int", &sum_int); |
| 259 | function("sum_float", &sum_float); |
| 260 | |
| 261 | class_<Foo>("Foo") |
| 262 | .constructor<>() |
| 263 | .function("incr_global_counter", &Foo::incr_global_counter) |
| 264 | .function("incr_class_counter", &Foo::incr_class_counter) |
| 265 | .function("class_counter_val", &Foo::class_counter_val) |
| 266 | ; |
| 267 | |
| 268 | class_<Interface>("Interface") |
| 269 | .allow_subclass<InterfaceWrapper>("InterfaceWrapper") |
| 270 | ; |
| 271 | |
| 272 | function("callInterface0", &callInterface0); |
| 273 | function("callInterface1", &callInterface1); |
| 274 | function("callInterface2", &callInterface2); |
| 275 | function("callInterface3", &callInterface3); |
| 276 | |
| 277 | function("returns_val", &returns_val); |
| 278 | } |
| 279 | |
| 280 | void __attribute__((noinline)) emscripten_get_now_benchmark(int N) { |
| 281 | volatile float t = emscripten_get_now(); |