灵符lingfu

lingmodeler

↓ 0 downloads

LingModeler: box modeling with quads and tris, rigging + weight painting, 2D vector illustration and animation, procedural textures and game assets; .lmesh / .ling native formats, OBJ, glTF and SVG import / export

Windows · x86-64Linux · x86-64LingOS · x86-64LingOS · Pi 5 ARM64Web · WASM
Keywords 3d, modeling, vector, svg, gltf, obj, rigging, animation, textures, ling
lingfu install lingmodeler
LicenseApache-2.0 OR MIT
Authorsling-lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (67)

ling/plat.ling
# ━━━ plat.ling — desktop platform layer (Windows / macOS / Linux builds of ling) ━━━
# Everything that only the desktop runtime has (polygon fill, images, byte files)
# goes through p_* so the LingOS build can swap this one file for plat_os.ling.

fn p_join(l, sep) { return list_join(l, sep) }
fn p_frame_hook(frame) { return 0.0 }
# desktop: always redraw; text input is the runtime's own editable buffer
fn p_idle_frame() { return false }
fn p_text_set(v) { text_set(v) }
fn p_text_poll() { return text_poll() }
fn p_init() { st_set("plat", 0.0) }
fn p_is_os() { return false }
fn p_has_images() { return true }

# filled polygon, flat list [x0,y0,x1,y1,...], colour, alpha (translucent = additive glow)
fn p_poly(pts, c, a) {
    if a < 0.999 {
        px_color(c_tint(c, a))
        set_blend(1)
        draw_poly(pts)
        set_blend(0)
    } else {
        px_color(c)
        draw_poly(pts)
    }
}
fn p_tri(x0, y0, x1, y1, x2, y2, c, a) { p_poly([x0, y0, x1, y1, x2, y2], c, a) }

# images (procedural textures, exports)
fn p_img_new(w, h) { return image_new(w, h) }
fn p_img_set(id, x, y, r, g, b, a) { image_set_pixel(id, x, y, r, g, b, a) }
fn p_img_save(id, path) { return image_save(id, path) }
fn p_img_load(path) { return image_load(path) }
fn p_img_w(id) { return image_width(id) }
fn p_img_h(id) { return image_height(id) }
fn p_img_r(id, x, y) { return image_pixel_r(id, x, y) }
fn p_img_g(id, x, y) { return image_pixel_g(id, x, y) }
fn p_img_b(id, x, y) { return image_pixel_b(id, x, y) }
fn p_img_draw(id, x, y, w, h) { image_draw(id, x, y, w, h) }

# file dialogs: "" when cancelled
fn p_dlg_open(title, exts) { return dlg_open(title, exts, st_get("last_dir", "")) }
fn p_dlg_save(title, exts, name) { return dlg_save(title, exts, name, st_get("last_dir", "")) }
fn p_dlg_folder(title) { return dlg_folder(title, st_get("last_dir", "")) }

# raw bytes (a list of 0..255 numbers) to disk — used for .glb / binary exports
fn p_write_bytes(path, bytes) { file_write_bytes(path, bytes) return true }
fn p_shot(name) { screenshot(name) }
fn p_quit() { close_window() }

← Back to index