FileInstancing QML Type
Allows reading instance tables from file. More...
Import Statement: | import QtQuick3D |
Since: | Qt 6.2 |
Inherits: |
Properties
- instanceCount : int
(since 6.3)
- source : url
Detailed Description
The FileInstancing type makes it possible to read instance tables from files.
There are two supported file formats: XML, and a Qt-specific binary format. The binary file format uses the same layout as the table that is uploaded to the GPU, so it can be directly mapped to memory. The instancer tool converts from XML to the binary format.
This is an example of the XML file format:
<?xml version="1.0" encoding="UTF-8" ?> <InstanceTable> <Instance position="0 200 0" scale="0.75 0.75 0.75" custom="20 20" color="#ffcf7f"/> <Instance position="0 -100 0" scale="0.5 0.5 0.5" color="red"/> <Instance position="0 -200 0" eulerRotation="0 0 60" color="darkred" custom="10 40 0 0"/> </InstanceTable>
In order to be valid, the XML file must have a top-level InstanceTable
element. Each instance is represented by an Instance
element inside the InstanceTable
. Unknown elements are silently ignored.
An Instance
element can have a number of attributes. color
attributes are specified by the normal Qt SVG color names, or by hexadecimal notation. vector3d
and {vector4d} attributes are specified by a string of space-separated numbers, where missing trailing numbers indicate zeroes. The following attributes are supported:
name | type |
---|---|
position | vector3d |
scale | vector3d |
eulerRotation | vector3d |
quaternion | vector4d |
custom | vector4d |
color | color |
Unknown attributes are silently ignored.
Property Documentation
instanceCount : int |
This read-only property contains the number of instances in the instance table.
This property was introduced in Qt 6.3.
source : url |
This property holds the location of an XML or binary file containing the instance data.
If the file name has a ".bin" extension, it is assumed to refer to a binary file. Otherwise it is assumed to refer to an XML file. If an XML file foo.xml is specified, and the file foo.xml.bin exists, the binary file foo.xml.bin will be loaded instead.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.