API Reference GE Extensions editor gen Gen Mesh Module Core 3D mesh creation, manipulation, and DAE export module for the gen editor.
Core 3D mesh creation, manipulation, and DAE export module for the gen editor.
The mesh module provides low-level 3D mesh operations: vertex/face/UV construction, DAE (Collada) export, material creation, mesh positioning via matrix transforms, and graph/set/text output buffers. It is the foundational geometry module used by all gen editor tools. At 6800+ lines, this is one of the largest modules in the gen editor.
Function Signature Description M.to(daedesc, pos, vang, scale)Places a DAE mesh at position/angle/scale via MatrixF transform. Returns scene item. M.fillSegment(a, b, daedesc, turn, dbg)Fills segment between two points with repeated DAE mesh placements M.space(am, sam, dir, val, L, daedata)Spaces meshes along a direction
Function Signature Description M.log(av, af, auv)Creates a test box mesh (8 verts, 24 faces). Returns av, af, auv, an M.rc(u, v, av, af, pos, withback)Creates a rectangle from u/v vectors M.rect(u, v, av, af, pos, hasfront)Creates a rectangle with optional front face M.tri(a, b, c, av, af, auv, ref, orig)Creates a triangle from 3 points M.zip(aiv, af, withback, withnorm, withuv)Zips vertex strips into mesh faces M.zip2(base, ai, an, auv, af, uvscale, uvflip, dbg)Extended zip with UV/normal control M.forBeam(base, L, uvflip, mat, w)Creates beam geometry from base points M.tri2mdata(av, ai, istart, dnorm, an, auv, af, iuvini, uvscale)Converts triangle data to mesh data format M.flipSide(af, an)Flips face winding and normals M.meshUp(data, nm, group)Creates a ProceduralMesh from mesh data M.joint(a, b, dbg)Creates joint geometry between two elements M.forJoint(fbag, m)Processes joint data for a mesh
Function Signature Description M.fromGrid(u, v, ax, ay, skip, av, af, X, Y, uvstart)Creates mesh from grid coordinates M.grid2mesh(u, v, ax, ay, uext, vext, av, af, auv, skip)Converts grid to mesh with UV mapping M.grid2plate(u, v, ax, ay, askip, av, af, auv, an, uvx, uvy)Converts grid to plate mesh with normals M.forPlate(m)Processes plate mesh data M.forBags(m)Processes bag mesh data
Function Signature Description M.uvTransform(auv, shift, scale)Transforms UV coordinates by shift and scale M.uv4poly(base, istart, auv, dbg)Computes UVs for a polygon from 3D positions M.uv4grid(uvx, uvy, ax, ay, X, Y, auv)Computes UVs for grid vertices M.forUV(base, istart, uvini, w, scale, auv)Computes UVs for a base shape
Function Signature Description M.rcPave(base, aloop, mrc, dbg)Paves rectangles along loops (primary) M.rcPave_(rc, aloop, mrc, apatch, istest)Paves rectangles (variant with patches) M.rcPave__(ae, aloop, mrc)Paves rectangles (variant with edges) M.framePave(aloop, dir, astep)Creates frame paving along loops M.frameSpline(base, ahole, ap, adist, astep)Creates frame along spline with holes
Function Signature Description M.daeFrom(p)Parses DAE file, returns mesh data M.daeParse(fname)Parses DAE file by filename M.toDAE(am, pth)Exports mesh array to DAE file M.toXML(m, ndmesh)Converts mesh to XML node M.xmlOn(fname)Opens/parses XML file M.xml2file(xml, fname)Writes XML document to file M.dae2proc(fname, showlist, step)Converts DAE to ProceduralMesh M.save(ageom, fname)Saves geometry array to file
Function Signature Description M.forNode(node, path, lvl, ind, dbg)Traverses XML node tree recursively M.ofChild(prn, path, obj)Gets child node by path M.forChild(nd, name, cb)Iterates children matching name, calls callback M.text2node(nd, txt)Sets text content of XML node M.toNode(nd, name, obj)Creates/finds XML child node M.ofNode(nd, obj)Gets node data as object
Function Signature Description M.d2buf(ad, map)Converts data array to buffer using field map M.toSource(ndsrc, s, count, stride)Reads source data from XML node M.toGeo(m, xml, id, ndgeo)Processes geometry node into mesh data M.gpuFrom(id)Extracts GPU mesh data by object ID M.toLOD(desc, fname, arc, T)Creates LOD (Level of Detail) variant M.forLOD(template, dist, geosrc)Processes LOD template
Function Signature Description M.forBeams(aobeam, anode)Creates beam geometry from vehicle beam/node data M.vehFrom(data)Extracts mesh data from vehicle data M.toGhost(am)Creates ghost (transparent) version of meshes M.geoFrom(nd, dmat)Extracts geometry from DAE node with material
Function Signature Description M.matUp(nm, c)Creates/registers material with color. Returns material name M.matReplace(fname, mat)Replaces material in a DAE file M.matSet(fname, mat, aind, xml)Sets material on specific geometry indices M.forAMat(fname)Extracts material array from DAE file M.colorOn(mat, c)Sets color on existing material
Function Signature Description M.pop(fr, to)Pops/extrudes mesh faces between two states M.move(list, fr, to, mat, mode)Moves mesh elements M.copy(list, fr, to, mat)Copies mesh elements M.cut(list, fr, to, mat)Cuts mesh elements M.clone(tmesh)Deep clones a mesh M.update(tmesh)Updates procedural mesh in scene M.mark(mdata, out)Marks mesh data for selection/highlight M.step(base, ind)Steps through base array by index
Function Signature Description M.ifHit(adata, pfr, pto, forall)Ray-mesh hit test M.faceHit(am)Face-level hit detection M.dissect(pos, dir, mdata)Dissects mesh at position along direction M.valid(am)Validates mesh data integrity
Function Signature Description M.align(m, pfr, pto, space)Aligns mesh between two points (stub) M.onUpdate()Per-frame update hook
These local functions are used internally but not exposed on M:
reload() - Hot-reloads utils and render deps (called once at load)
forNorm(a, b, c, vn) - Computes face normal key
xml2mesh(node, lvl) - Recursive XML-to-mesh converter
toKids(node, ageom) - Processes child nodes into geometry
vec2buf(v, av) - Writes vec3 to buffer array
kidsList(node, lvl, prop, aind, val, dbg) - Lists XML children by property
zip2_(aiv, av, af) - Internal zip variant
zip_(base, av, af, auv, ref, orig) - Internal zip variant
pop___, pop__, pop_ - Internal pop/extrude variants
Array of vec3 positions.
Array of face entries: {v = vertexIndex, n = normalIndex, u = uvIndex}
Array of UV entries: {u = float, v = float}
Array of vec3 normal directions.
Module Path Utils /lua/ge/extensions/editor/gen/utilsRender /lua/ge/extensions/editor/gen/render
local M = require ( '/lua/ge/extensions/editor/gen/mesh' )
-- Place a DAE mesh in the scene
local desc = {fo = myFileObject}
M. to (desc, vec3 ( 100 , 200 , 50 ), vec3 ( 0 , 0 , math.pi / 4 ), 1.5 )
-- Create a test box mesh
local verts, faces, uvs, normals = M. log ({}, {}, {})
-- Create a grey material
local matName = M. matUp ( 1 , { 0.6 , 0.6 , 0.6 })
-- Fill a segment with repeated meshes
M. fillSegment ( vec3 ( 0 , 0 , 0 ), vec3 ( 100 , 0 , 0 ), desc, 0 )
-- Export meshes to DAE
M. toDAE (meshArray, '/path/to/output' )
-- Parse a DAE file
local meshData = M. daeFrom ( '/path/to/model.dae' )
-- Validate mesh
local ok = M. valid (meshArray)