entelechy-export自动生成
层:接口层 · 代码行数:2,328 · 集成测试文件:2
导出器:把 Host 文件写成其他软件能打开的格式。
The exporter: writes the Host’s files as formats other software opens, from outside the runtime
A mesh and a rig as GLB, and a font as TrueType or WOFF, from the
Host’s files. Sounds, scores and pictures are written by
entelechy_formats::encode.
| 内部依赖 | entelechy-formats, entelechy-host |
| 外部依赖 | serde_json |
| 源码 | crates/interface/export |
| 名称 | 简述 |
|---|---|
font |
A font file from a font’s Fields (entelechy_formats::font), the Fields entelechy import reads a font into: TrueType outlines in a .ttf, the same tables compressed in a .woff, or CFF outlines in an .otf. |
gltf |
A mesh as GLB: vertex rows {position, normal, uv} (or with a tangent after them), triangle rows and optional PNGs (a base color, a normal map, an occlusion map) become one glTF 2.0 binary with one mesh, node and scene. |
| 名称 | 简述 |
|---|---|
font::Face |
A font ready to write: its glyphs and which characters map to them. |
gltf::Rig |
A rig’s rows beside the mesh. |
gltf::Options |
What a GLB carries beyond the rows: how its texture is sampled, its joints’ names in skeleton order (joint0, joint1, … when none are given), and whether its material is seen from both sides. |
gltf::Textures |
A GLB’s pictures, each a PNG: the base color, the normal map (in the tangent space the vertices’ tangents give), the occlusion (read from its red), and an ORM map packing occlusion, roughness and metalness in its red, green and blue (glTF’s metallic-roughness texture, its occlusion where no occlusion map is given). |
| 名称 | 简述 |
|---|---|
gltf::Filter |
How a GLB’s texture is sampled. |
| 函数 | 简述 |
|---|---|
fn face(inputs: &[FieldData], family: &str, chars: Option<&str>) -> Result<Face, String> |
The font the Fields inputs hold (glyph rows, segments and, if given, the measures; told apart by layout), named family: of the characters of chars, or of every one the rows map. |
fn ttf(face: &Face) -> Vec<u8> |
The face as a TrueType file. |
fn otf(face: &Face) -> Vec<u8> |
The face as an OpenType file of CFF outlines. |
fn woff(face: &Face) -> Vec<u8> |
The face as a WOFF file: the TrueType file’s tables, each compressed (zlib) where that makes it smaller, head with the TrueType file’s checksum adjustment. |
fn write_rig(vertices: &FieldData, triangles: &FieldData, textures: &Textures<'_>, rig: Option<&Rig<'_>>, name: &str, options: &Options) -> Result<Vec<u8>, String> |
The same, with a skin and one animation per clip. |
fn export(vertices: &Path, triangles: &Path, texture: Option<&Path>, out: &Path) -> Result<(), String> |
Reads the vertex and triangle Field files and optional texture, and writes the GLB at out. |
fn export_rig(vertices: &Path, triangles: &Path, textures: &[&Path], rig: &[&Path], clips: &[&Path], rate: f32, out: &Path, options: &Options) -> Result<(), String> |
The same, with weights, skeleton and clip files, each clip named by its file name before .clip.field, and options. A PNG named <stem>.normal.png is the normal map, <stem>.occlusion.png the occlusion, <stem>.orm.png the occlusion, roughness and metalness, any other the base color; one of each at most. |
font::Face
Section titled “font::Face”crates/interface/export/src/font.rs#L25
A font ready to write: its glyphs and which characters map to them.
方法
| 函数 | 说明 |
|---|---|
fn characters(&self) -> usize |
Characters mapped. |
fn glyphs(&self) -> usize |
Glyphs, the missing character’s counted. |
实现的 Trait: Debug
gltf::Rig
Section titled “gltf::Rig”crates/interface/export/src/gltf.rs#L16
A rig’s rows beside the mesh.
属性
| 名称 | 类型 | 说明 |
|---|---|---|
weights |
&'a FieldData |
Per vertex: four joints, then their weights. |
skeleton |
&'a FieldData |
Per joint: its parent, then its inverse bind matrix. |
clips |
Vec<(String, &'a FieldData, f32)> |
Each clip: name, rows, sample rate. |
gltf::Options
Section titled “gltf::Options”crates/interface/export/src/gltf.rs#L50
What a GLB carries beyond the rows: how its texture is sampled, its
joints’ names in skeleton order (joint0, joint1, … when none are
given), and whether its material is seen from both sides.
属性
| 名称 | 类型 | 说明 |
|---|---|---|
filter |
Filter |
The texture’s sampling. |
joints |
Vec<String> |
One name a skeleton row, or none. |
double_sided |
bool |
Both sides of each triangle drawn and lit (glTF’s doubleSided): a leaf, a sheet, anything one layer thick. |
实现的 Trait: Clone, Debug, Default
gltf::Textures
Section titled “gltf::Textures”crates/interface/export/src/gltf.rs#L66
A GLB’s pictures, each a PNG: the base color, the normal map (in the tangent space the vertices’ tangents give), the occlusion (read from its red), and an ORM map packing occlusion, roughness and metalness in its red, green and blue (glTF’s metallic-roughness texture, its occlusion where no occlusion map is given).
属性
| 名称 | 类型 | 说明 |
|---|---|---|
color |
Option<&'a [u8]> |
|
normal |
Option<&'a [u8]> |
|
occlusion |
Option<&'a [u8]> |
|
orm |
Option<&'a [u8]> |
实现的 Trait: Clone, Copy, Debug, Default
gltf::Filter
Section titled “gltf::Filter”crates/interface/export/src/gltf.rs#L27
How a GLB’s texture is sampled.
变体
| 名称 | 说明 |
|---|---|
Linear |
Blended between texels, with mipmaps. |
Nearest |
The nearest texel, no mipmaps: flat colors stay flat, as pixel art and palette textures want. |
实现的 Trait: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

