Ktx2
Updated
A GPU-compressed image, fast to load and light on memory.
- Type
comp-ktx2- Script class
KTX2Component- Per entity
- One
- Version
- 1.1.0
Read about it in Images: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
grayscale |
0 ≤ x ≤ 1 |
|
height |
0 ≤ x ≤ 10000 |
|
opacity |
0 ≤ x ≤ 1 |
|
width |
0 ≤ x ≤ 10000 |
|
zoom |
0. |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
KTX2::readyKTX2::error
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Show a GPU-compressed KTX2 imageA framed picture on an easel shows a .ktx2 texture, which stays compressed in GPU memory. The script logs its pixel size when it is ready.
The picture on the easel is a KTX2 texture; the log gives its size. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(KTX2Component); if (component) log(component.props);}