model formats (mca..x3d): comments are specs only

This commit is contained in:
4DBug committed 2026-11-01 01:54:32 -05:00
1 parent 0bd7b87d2b
commit b952c10222
49 files changed
+310 -936

No files matched your search

+11 -20
View File
@@ -1,16 +1,7 @@
--!strict
-- model/x3d: X3D (ISO/IEC 19775-1) in its XML encoding (.x3d, ISO/IEC 19776-1) and its classic VRML encoding (.x3dv,
-- 19776-2), plain or gzipped (.x3dz / .x3dvz), a thin format over codecs/model/Vrml (the engine model/vrml shares).
-- New code.
-- Reads: everything model/vrml reads, plus the X3D nodes: IndexedTriangleSet, TriangleSet, IndexedTriangleFanSet,
-- TriangleFanSet, IndexedTriangleStripSet, TriangleStripSet, IndexedQuadSet, QuadSet, LineSet, ColorRGBA,
-- CoordinateDouble, MultiTexture / MultiTextureCoordinate (the first), PhysicalMaterial / UnlitMaterial /
-- TwoSidedMaterial, OrthoViewpoint, CAD groups; XML ProtoDeclare / ProtoInstance, ROUTE elements, containerField;
-- head meta, components and UNIT length (-> meta.unit).
-- Writes: X3D 3.3 XML (default) or the classic encoding (opts.encoding = "x3dv"; the api passes the extension), the
-- same scene graph as model/vrml writes (ColorRGBA for colours with alpha, OrthoViewpoint for orthographic cameras).
-- Not supported: the binary encodings (.x3db Fast Infoset / EXI: UNSUPPORTED), X3D JSON, Text, NURBS, shaders,
-- H-Anim skinning, scripts.
-- model/x3d: X3D (ISO/IEC 19775-1) XML (.x3d, 19776-1) and classic VRML (.x3dv, 19776-2) encodings, plain or gzipped,
-- over codecs/model/Vrml; new code. Supports: the model/vrml set plus the X3D geometry and material nodes.
-- Not supported: binary encodings (.x3db Fast Infoset / EXI), X3D JSON, Text, NURBS, shaders, H-Anim skinning, scripts.
-- ------------------------------------------------------------------------------------------------ requires
local Err = require("@rosetta/core/Err")
@@ -30,18 +21,18 @@ local X3d = {
-- ------------------------------------------------------------------------------------------------ types
export type DecodeOptions = {
files: { [string]: any }?, -- textures / Inline files by uri or base name (buffer or string)
resolve: ((uri: string) -> any)?, -- or: reads them (the api sets it for paths)
triangulate: boolean?, -- fan-triangulate polygons (default true); false keeps "polygons" primitives
flipV: boolean?, -- texture t -> 1 - t (default true: glTF's convention)
segments: number?, -- Sphere / Cone / Cylinder segments around (default 32)
files: { [string]: any }?, -- by uri or base name
resolve: ((uri: string) -> any)?,
triangulate: boolean?, -- default true
flipV: boolean?, -- default true
segments: number?, -- default 32
maxVertices: number?, -- per geometry (default 2^24)
}
export type EncodeOptions = {
encoding: ("xml" | "x3dv")?, -- default "xml"
format: string?, -- the api passes the extension: "x3dv" / "x3dvz" select the classic encoding
files: { [string]: any }?, -- receives the texture images (else url = texture.uri)
name: string?, -- the destination's file name (names the image files)
format: string?, -- "x3dv" / "x3dvz" select the classic encoding
files: { [string]: any }?, -- else url = texture.uri
name: string?,
flipV: boolean?, -- default true (the inverse of decode)
}