uploadImage method

Future<GpuTexture?> uploadImage(
  1. Uint8List bytes, {
  2. bool srgb = true,
})

Decodes the encoded image bytes (PNG, JPEG, …) and uploads it with a full chain of mips, as a colour (srgb) or a data map; null when it cannot be decoded.

Implementation

Future<GpuTexture?> uploadImage(Uint8List bytes, {bool srgb = true}) =>
    _texture(
      ModelData(
        name: 'image',
        meshes: const [],
        materials: const [],
        textures: const [TextureData(0, SamplerData())],
        images: [ImageData(bytes, null, 'image')],
        nodes: const [],
        roots: const [],
        lights: const [],
        bounds: Aabb3(),
      ),
      const TextureData(0, SamplerData()),
      srgb,
    );