customizeDefPositionTracker static method
Customizes the SDK's default position tracking object.
Provide binary object data (for example a glTF or texture) and the corresponding SceneObjectFileFormat to replace the default position tracker visual. To apply a flat texture only, pass data with SceneObjectFileFormat.tex.
Parameters
buffer: (List<int>) Binary data for the scene object or texture. Pass an empty list to restore the SDK's default resource.format: (SceneObjectFileFormat) The file format of the provided buffer.
Returns
- (GemError) Error status indicating success or the reason for failure.
Implementation
static GemError customizeDefPositionTracker(
List<int> buffer,
SceneObjectFileFormat format,
) {
if (buffer.isEmpty) {
// Restore-default case: no payload to transfer.
final OperationResult resultString = staticMethod(
'MapSceneObject',
'customizeDefPositionTracker',
args: <String, Object>{'buffer': buffer, 'format': format.id},
);
return GemErrorExtension.fromCode(resultString['gemApiError']);
}
// Pass the model as native memory (pointer + size) instead of embedding it
// in the JSON args. JSON-encoding a multi-MB binary as an int array makes
// the native side parse it element-by-element, which is quadratic and can
// stall the app for minutes on larger models.
final Uint8List bytes = buffer is Uint8List
? buffer
: Uint8List.fromList(buffer);
final dynamic nativePointer = GemKitPlatform.instance.toNativePointer(
bytes,
);
try {
final OperationResult resultString = staticMethod(
'MapSceneObject',
'customizeDefPositionTracker',
args: <String, Object>{
'buffer_ptr': nativePointer.address,
'buffer_size': bytes.length,
'format': format.id,
},
);
return GemErrorExtension.fromCode(resultString['gemApiError']);
} finally {
GemKitPlatform.instance.freeNativePointer(nativePointer);
}
}