scene 0.1.0 copy "scene: ^0.1.0" to clipboard
scene: ^0.1.0 copied to clipboard

The engine-agnostic scene document core, the .fscene document model, stable ids, serialization, prefab composition, and diffing.

example/scene_example.dart

// Builds a small scene document, attaches a component, and round-trips it
// through the `.fscene` text and `.fsceneb` binary formats.
// ignore_for_file: avoid_print
import 'package:scene/scene.dart';

void main() {
  final document = SceneDocument();

  // Add a root node carrying one component with a property.
  final id = document.allocator.mint();
  document.addNode(
    NodeSpec(
      id: id,
      name: 'root',
      components: [
        ComponentSpec('audioSource', properties: {'volume': DoubleValue(0.8)}),
      ],
    ),
    root: true,
  );

  // Serialize to both formats and read the text form back.
  final text = writeFscene(document);
  final bytes = writeFsceneb(document);
  final reread = readFscene(text);

  print('nodes: ${reread.nodes.length}');
  print('.fscene text: ${text.length} chars');
  print('.fsceneb binary: ${bytes.length} bytes');
}
4
likes
160
points
0
downloads

Documentation

API reference

Publisher

verified publisherbdero.dev

Weekly Downloads

The engine-agnostic scene document core, the .fscene document model, stable ids, serialization, prefab composition, and diffing.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

vector_math

More

Packages that depend on scene