@@ -217,43 +217,65 @@ void TapeCore::tape_mesh_set_texture_coords(const YAML::Node& yamlNode, Playback
217
217
yamlNode[2 ].as <int32_t >());
218
218
}
219
219
220
- RGL_API rgl_status_t rgl_mesh_destroy (rgl_mesh_t mesh)
220
+ RGL_API rgl_status_t rgl_mesh_set_bone_weights (rgl_mesh_t mesh, const rgl_bone_weights_t * bone_weights,
221
+ int32_t bone_weights_count)
221
222
{
222
223
auto status = rglSafeCall ([&]() {
223
- RGL_API_LOG (" rgl_mesh_destroy(mesh={})" , (void *) mesh);
224
+ RGL_API_LOG (" rgl_mesh_set_bone_weights(mesh={}, bone_weights={})" , (void *) mesh,
225
+ repr (bone_weights, bone_weights_count));
224
226
CHECK_ARG (mesh != nullptr );
227
+ CHECK_ARG (bone_weights != nullptr );
228
+ CHECK_ARG (bone_weights_count > 0 );
225
229
GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
226
- Mesh::release (mesh);
230
+ Mesh::validatePtr (mesh)-> setBoneWeights (bone_weights, bone_weights_count );
227
231
});
228
- TAPE_HOOK (mesh);
232
+ TAPE_HOOK (mesh, TAPE_ARRAY (bone_weights, bone_weights_count), bone_weights_count );
229
233
return status;
230
234
}
231
235
232
- void TapeCore::tape_mesh_destroy (const YAML::Node& yamlNode, PlaybackState& state)
236
+ void TapeCore::tape_mesh_set_bone_weights (const YAML::Node& yamlNode, PlaybackState& state)
233
237
{
234
- auto meshId = yamlNode[0 ].as <TapeAPIObjectID>();
235
- rgl_mesh_destroy (state.meshes .at (meshId));
236
- state.meshes .erase (meshId);
238
+ rgl_mesh_set_bone_weights (state.meshes .at (yamlNode[0 ].as <TapeAPIObjectID>()),
239
+ state.getPtr <const rgl_bone_weights_t >(yamlNode[1 ]), yamlNode[2 ].as <int32_t >());
237
240
}
238
241
239
- RGL_API rgl_status_t rgl_mesh_update_vertices (rgl_mesh_t mesh, const rgl_vec3f* vertices , int32_t vertex_count )
242
+ RGL_API rgl_status_t rgl_mesh_set_restposes (rgl_mesh_t mesh, const rgl_mat3x4f* restposes , int32_t restposes_count )
240
243
{
241
244
auto status = rglSafeCall ([&]() {
242
- RGL_API_LOG (" rgl_mesh_update_vertices (mesh={}, vertices ={})" , (void *) mesh, repr (vertices, vertex_count ));
245
+ RGL_API_LOG (" rgl_mesh_set_restposes (mesh={}, restposes ={})" , (void *) mesh, repr (restposes, restposes_count ));
243
246
CHECK_ARG (mesh != nullptr );
244
- CHECK_ARG (vertices != nullptr );
245
- CHECK_ARG (vertex_count > 0 );
247
+ CHECK_ARG (restposes != nullptr );
248
+ CHECK_ARG (restposes_count > 0 );
246
249
GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
247
- Mesh::validatePtr (mesh)->updateVertices (reinterpret_cast <const Vec3f *>(vertices ), vertex_count );
250
+ Mesh::validatePtr (mesh)->setRestposes (reinterpret_cast <const Mat3x4f *>(restposes ), restposes_count );
248
251
});
249
- TAPE_HOOK (mesh, TAPE_ARRAY (vertices, vertex_count ), vertex_count );
252
+ TAPE_HOOK (mesh, TAPE_ARRAY (restposes, restposes_count ), restposes_count );
250
253
return status;
251
254
}
252
255
253
- void TapeCore::tape_mesh_update_vertices (const YAML::Node& yamlNode, PlaybackState& state)
256
+ void TapeCore::tape_mesh_set_restposes (const YAML::Node& yamlNode, PlaybackState& state)
254
257
{
255
- rgl_mesh_update_vertices (state.meshes .at (yamlNode[0 ].as <TapeAPIObjectID>()), state.getPtr <const rgl_vec3f>(yamlNode[1 ]),
256
- yamlNode[2 ].as <int32_t >());
258
+ rgl_mesh_set_restposes (state.meshes .at (yamlNode[0 ].as <TapeAPIObjectID>()), state.getPtr <const rgl_mat3x4f>(yamlNode[1 ]),
259
+ yamlNode[2 ].as <int32_t >());
260
+ }
261
+
262
+ RGL_API rgl_status_t rgl_mesh_destroy (rgl_mesh_t mesh)
263
+ {
264
+ auto status = rglSafeCall ([&]() {
265
+ RGL_API_LOG (" rgl_mesh_destroy(mesh={})" , (void *) mesh);
266
+ CHECK_ARG (mesh != nullptr );
267
+ GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
268
+ Mesh::release (mesh);
269
+ });
270
+ TAPE_HOOK (mesh);
271
+ return status;
272
+ }
273
+
274
+ void TapeCore::tape_mesh_destroy (const YAML::Node& yamlNode, PlaybackState& state)
275
+ {
276
+ auto meshId = yamlNode[0 ].as <TapeAPIObjectID>();
277
+ rgl_mesh_destroy (state.meshes .at (meshId));
278
+ state.meshes .erase (meshId);
257
279
}
258
280
259
281
rgl_status_t rgl_mesh_is_alive (rgl_mesh_t mesh, bool * out_alive)
@@ -308,10 +330,10 @@ void TapeCore::tape_entity_destroy(const YAML::Node& yamlNode, PlaybackState& st
308
330
state.entities .erase (entityId);
309
331
}
310
332
311
- RGL_API rgl_status_t rgl_entity_set_pose (rgl_entity_t entity, const rgl_mat3x4f* transform)
333
+ RGL_API rgl_status_t rgl_entity_set_transform (rgl_entity_t entity, const rgl_mat3x4f* transform)
312
334
{
313
335
auto status = rglSafeCall ([&]() {
314
- RGL_API_LOG (" rgl_entity_set_pose (entity={}, transform={})" , (void *) entity, repr (transform, 1 ));
336
+ RGL_API_LOG (" rgl_entity_set_transform (entity={}, transform={})" , (void *) entity, repr (transform, 1 ));
315
337
CHECK_ARG (entity != nullptr );
316
338
CHECK_ARG (transform != nullptr );
317
339
GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
@@ -322,9 +344,30 @@ RGL_API rgl_status_t rgl_entity_set_pose(rgl_entity_t entity, const rgl_mat3x4f*
322
344
return status;
323
345
}
324
346
325
- void TapeCore::tape_entity_set_pose (const YAML::Node& yamlNode, PlaybackState& state)
347
+ void TapeCore::tape_entity_set_transform (const YAML::Node& yamlNode, PlaybackState& state)
348
+ {
349
+ rgl_entity_set_transform (state.entities .at (yamlNode[0 ].as <TapeAPIObjectID>()),
350
+ state.getPtr <const rgl_mat3x4f>(yamlNode[1 ]));
351
+ }
352
+
353
+ RGL_API rgl_status_t rgl_entity_set_pose_world (rgl_entity_t entity, const rgl_mat3x4f* pose, int32_t bones_count)
354
+ {
355
+ auto status = rglSafeCall ([&]() {
356
+ RGL_API_LOG (" rgl_entity_set_pose_world(entity={}, pose={})" , (void *) entity, repr (pose, bones_count));
357
+ CHECK_ARG (entity != nullptr );
358
+ CHECK_ARG (pose != nullptr );
359
+ CHECK_ARG (bones_count > 0 );
360
+ GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
361
+ Entity::validatePtr (entity)->setPoseAndAnimate (reinterpret_cast <const Mat3x4f*>(pose), bones_count);
362
+ });
363
+ TAPE_HOOK (entity, TAPE_ARRAY (pose, bones_count), bones_count);
364
+ return status;
365
+ }
366
+
367
+ void TapeCore::tape_entity_set_pose_world (const YAML::Node& yamlNode, PlaybackState& state)
326
368
{
327
- rgl_entity_set_pose (state.entities .at (yamlNode[0 ].as <TapeAPIObjectID>()), state.getPtr <const rgl_mat3x4f>(yamlNode[1 ]));
369
+ rgl_entity_set_pose_world (state.entities .at (yamlNode[0 ].as <TapeAPIObjectID>()),
370
+ state.getPtr <const rgl_mat3x4f>(yamlNode[1 ]), yamlNode[2 ].as <int32_t >());
328
371
}
329
372
330
373
RGL_API rgl_status_t rgl_entity_set_id (rgl_entity_t entity, int32_t id)
@@ -382,6 +425,27 @@ void TapeCore::tape_entity_set_laser_retro(const YAML::Node& yamlNode, PlaybackS
382
425
yamlNode[1 ].as <Field<LASER_RETRO_F32>::type>());
383
426
}
384
427
428
+ RGL_API rgl_status_t rgl_entity_apply_external_animation (rgl_entity_t entity, const rgl_vec3f* vertices, int32_t vertex_count)
429
+ {
430
+ auto status = rglSafeCall ([&]() {
431
+ RGL_API_LOG (" rgl_entity_apply_external_animation(entity={}, vertices={})" , (void *) entity,
432
+ repr (vertices, vertex_count));
433
+ CHECK_ARG (entity != nullptr );
434
+ CHECK_ARG (vertices != nullptr );
435
+ CHECK_ARG (vertex_count > 0 );
436
+ GraphRunCtx::synchronizeAll (); // Prevent races with graph threads
437
+ Entity::validatePtr (entity)->applyExternalAnimation (reinterpret_cast <const Vec3f*>(vertices), vertex_count);
438
+ });
439
+ TAPE_HOOK (entity, TAPE_ARRAY (vertices, vertex_count), vertex_count);
440
+ return status;
441
+ }
442
+
443
+ void TapeCore::tape_entity_apply_external_animation (const YAML::Node& yamlNode, PlaybackState& state)
444
+ {
445
+ rgl_entity_apply_external_animation (state.entities .at (yamlNode[0 ].as <TapeAPIObjectID>()),
446
+ state.getPtr <const rgl_vec3f>(yamlNode[1 ]), yamlNode[2 ].as <int32_t >());
447
+ }
448
+
385
449
rgl_status_t rgl_entity_is_alive (rgl_entity_t entity, bool * out_alive)
386
450
{
387
451
auto status = rglSafeCall ([&]() {
0 commit comments