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

+10 -23
View File
@@ -1,20 +1,7 @@
--!strict
-- model/vrml: VRML97 (ISO/IEC 14772-1, `#VRML V2.0 utf8`) .wrl files, plain or gzipped (.wrz), a thin format over
-- codecs/model/Vrml (the scene-graph engine model/x3d shares). New code.
-- Reads: the scene graph (Transform with center / scaleOrientation, Group, Anchor, Billboard, Collision, Switch, LOD,
-- Inline through opts.files / opts.resolve), DEF / USE (shared meshes and materials), PROTO instances (expanded) and
-- EXTERNPROTO, Shape / Appearance / Material / ImageTexture / PixelTexture / TextureTransform, IndexedFaceSet (coord,
-- normal, color, texCoord with their own indices, per-vertex / per-face normals and colours, ccw, solid -> doubleSided),
-- IndexedLineSet, PointSet, ElevationGrid, Extrusion, the primitives Box / Sphere / Cone / Cylinder tessellated
-- (opts.segments), Viewpoint -> cameras, DirectionalLight / PointLight / SpotLight -> lights, TimeSensor ->
-- Position- / OrientationInterpolator -> Transform ROUTEs -> animations, WorldInfo -> meta.source.title / info. Polygons
-- are fan-triangulated unless opts.triangulate = false; texture t is flipped to glTF's top-left origin unless
-- opts.flipV = false. meta.up = "y", meta.unit = 1 (metres).
-- Writes: VRML97 text (see codecs/model/Vrml/Write: Transforms from the node tree, Shapes with IndexedFaceSet /
-- IndexedLineSet / PointSet, Appearance / Material / ImageTexture (texture files into opts.files), Viewpoints, lights,
-- TimeSensor + interpolator animations; DEF / USE for shared meshes and materials).
-- Not supported: VRML 1.0, Text / FontStyle (no glyphs), Script behaviour, sensors, sound, NURBS, morph targets and
-- skins on write (the rest pose is written).
-- model/vrml: VRML97 (ISO/IEC 14772-1, `#VRML V2.0 utf8`) .wrl / .wrz over codecs/model/Vrml; new code. Supports:
-- the scene graph, DEF / USE, PROTO / EXTERNPROTO, the geometry nodes, Viewpoints, lights, interpolator ROUTEs as
-- animations. Not supported: VRML 1.0, Text, Script, sensors, sound, NURBS; morph targets and skins on write.
-- ------------------------------------------------------------------------------------------------ requires
local Err = require("@rosetta/core/Err")
@@ -34,16 +21,16 @@ local Wrl = {
-- ------------------------------------------------------------------------------------------------ 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 = {
files: { [string]: any }?, -- receives the texture images (else url = texture.uri)
name: string?, -- the destination's file name (names the image files)
files: { [string]: any }?, -- else url = texture.uri
name: string?,
flipV: boolean?, -- default true (the inverse of decode)
}