drawMesh method

void drawMesh(
  1. Mesh? mesh,
  2. Texture2D? texture, {
  3. Transform2D? transform,
  4. Color? modulate,
})

Implementation

void drawMesh(Mesh? mesh, Texture2D? texture, {Transform2D? transform, Color? modulate}) {
  using((arena) {
    transform ??= Transform2D.fromXAxisYAxisOrigin(Vector2.fromXY(1,  0), Vector2.fromXY( 0,  1), Vector2.fromXY( 0,  0),);
    modulate ??= Color.fromRGBA(1, 1, 1, 1);
    final ptrArgArray = arena.allocate<GDExtensionConstTypePtr>(sizeOf<GDExtensionConstTypePtr>() * 4);
    final meshPtr = arena.allocate<GDExtensionConstTypePtr>(sizeOf<GDExtensionObjectPtr>())..value = mesh?.nativePtr ?? nullptr;
    (ptrArgArray + 0).value = meshPtr.cast();
    final texturePtr = arena.allocate<GDExtensionConstTypePtr>(sizeOf<GDExtensionObjectPtr>())..value = texture?.nativePtr ?? nullptr;
    (ptrArgArray + 1).value = texturePtr.cast();
    (ptrArgArray + 2).value = transform!.nativePtr.cast();
    (ptrArgArray + 3).value = modulate!.nativePtr.cast();
    gde.ffiBindings.gde_object_method_bind_ptrcall(
      _bindings.methodDrawMesh, nativePtr.cast(), ptrArgArray, nullptr.cast());
  });
}