KHRAccessorFloat16

  • experimental

KHR_accessor_float16 enables support for IEEE-754 binary16 ("half-precision" or "float16") Accessors, in all contexts where the base glTF 2.0 specification already allows binary32 ("single-precision" or "float32") Accessors. This extension must be marked as required; implementations that do not support float16 Accessors will be unable to parse the Document correctly.

Example

import {Accessor} from '@gltf-transform/core';
import {KHRAccessorFloat16} from '@gltf-transform/extensions';

// Create an Extension attached to the Document.
document.createExtension(KHRAccessorFloat16).setRequired(true);

// Store Float16Array instances in one or more Accessors.
const mesh = document.getRoot().listMeshes()
  .find((mesh) => mesh.getName() === 'MyMesh');

for (const prim of mesh.listPrimitives()) {
  const position = document.createAccessor()
    .setType('VEC3')
    .setArray(new Float16Array([...]));
  prim.setAttribute('POSITION', position);
}

Hierarchy

Static properties

EXTENSION_NAME: "KHR_accessor_float16"

Properties

extensionName: "KHR_accessor_float16"

Methods

  • dispose(): void
  • isRequired(): boolean
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

  • listProperties(): ExtensionProperty[]
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.