The following table lists the format of most of the resource types used by Harfang during development.
|Geometry||Document (see Geometry document structure)|
|Shader & SurfaceShader||Custom JSON like format (see Shader and Surface shader).|
|Texture||Development file format (any supported picture file format such as tga, jpg, psd, etc...)|
When packing your project for distribution most resource format will change to a format that is optimized for the target platform. These formats are not suited for development and usually not portable.
The document system supports three different storage backend:
Documents can be read from any supported storage format transparently. For convenience, human-friendly formats are selected whenever possible. However, due to the potential size and performance problems text-based formats can cause geometries are usually exported through the binary backend.
Converting from a document backend to another is easy. The following code converts a document from
import harfang as hg # provide direct access to the file system hg.MountFileDriver(hg.StdFileDriver()) # input/output format is detected from the file extension geo = hg.LoadCoreGeometry("d:/geometry.xml") hg.SaveCoreGeometry("d:/geometry.bin", geo)
Note: Changing the document format of large resources from
JSON might use more memory and cause performance issues.