soul-symphony-ling
↓ 0 downloadsSoul Symphony — Ling Edition. A spiritual 3D adventure in the soul realm: collect the letters of the world-song, clear the monster lattice, and duel in the arcade arena. Wind Waker-style toon renderer with volumetric light pools, SSAO, bloom and oil-slick tilt-shift — all ling-lang vectors.
Keywords game, 3d, toon, music, soul-symphony
lingfu install soul-symphony-lingCode / Files (1947)
game/render_optimized.ling
# render_optimized.ling — Optimized Rendering Utilities
#
# Uses new Ling rendering features:
# - draw_quad_3d() for quads (replaces 2 triangles)
# - (BSDF materials removed — flat unlit rendering)
# - Toon post-processing (shadow_smooth, toon_outlines, toon_highlight)
# - Shared edge deduplication (automatic)
# ═══════════════════════════════════════════════════════════════════════════════
# QUAD HELPERS
# ═══════════════════════════════════════════════════════════════════════════════
# Draw a quad face (replaces 2 triangles)
ฟังก์ชัน drawQuad(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3) {
draw_quad_3d(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3)
คืน 0
}
# Draw a box using 6 quads (replaces 12 triangles)
ฟังก์ชัน drawBoxQuads(x0,y0,z0, x1,y1,z1) {
# Front face (z0)
draw_quad_3d(x0,y0,z0, x1,y0,z0, x1,y1,z0, x0,y1,z0)
# Back face (z1)
draw_quad_3d(x1,y0,z1, x0,y0,z1, x0,y1,z1, x1,y1,z1)
# Left face (x0)
draw_quad_3d(x0,y0,z1, x0,y0,z0, x0,y1,z0, x0,y1,z1)
# Right face (x1)
draw_quad_3d(x1,y0,z0, x1,y0,z1, x1,y1,z1, x1,y1,z0)
# Top face (y1)
draw_quad_3d(x0,y1,z0, x1,y1,z0, x1,y1,z1, x0,y1,z1)
# Bottom face (y0)
draw_quad_3d(x0,y0,z1, x1,y0,z1, x1,y0,z0, x0,y0,z0)
คืน 0
}
# Draw a wall quad (common in level geometry)
ฟังก์ชัน drawWallQuad(x0,z0, x1,z1, y0,y1) {
draw_quad_3d(x0,y0,z0, x1,y0,z1, x1,y1,z1, x0,y1,z0)
คืน 0
}
# Draw a floor/ceiling quad
ฟังก์ชัน drawFloorQuad(x0,z0, x1,z1, y) {
draw_quad_3d(x0,y,z0, x1,y,z0, x1,y,z1, x0,y,z1)
คืน 0
}
# ═══════════════════════════════════════════════════════════════════════════════
# MATERIAL PRESETS
# ═══════════════════════════════════════════════════════════════════════════════
# (Principled-BSDF material presets removed — game renders flat unlit;
# no set_material / reset_material anywhere.)
# ═══════════════════════════════════════════════════════════════════════════════
# TONE RAMP PRESETS
# ═══════════════════════════════════════════════════════════════════════════════
# Default 3-band cel (shadow / mid / lit) — matches engine default
ฟังก์ชัน toneRampCel() {
tone_ramp_clear()
tone_stop(0.25, 0.08) # shadow
tone_stop(0.60, 0.50) # midtone
tone_stop(1.00, 1.00) # lit
tone_smooth(0) # hard snap
tone_bezier_off()
คืน 0
}
# Soft 3-band with linear lerp between stops
ฟังก์ชัน toneRampSoft() {
tone_ramp_clear()
tone_stop(0.20, 0.06)
tone_stop(0.55, 0.48)
tone_stop(1.00, 1.00)
tone_smooth(1) # gradient lerp
tone_bezier_off()
คืน 0
}
# S-curve: slow in shadow, fast in midtone, slow again in highlight
ฟังก์ชัน toneRampSCurve() {
tone_ramp_clear()
tone_stop(0.25, 0.08)
tone_stop(0.60, 0.50)
tone_stop(1.00, 1.00)
tone_smooth(1)
tone_bezier(0.1, 0.9) # S-curve pre-distortion
คืน 0
}
# Anime-style: deep shadow + punchy mid + bright highlight
ฟังก์ชัน toneRampAnime() {
tone_ramp_clear()
tone_stop(0.20, 0.04) # very dark shadow
tone_stop(0.45, 0.55) # snappy midtone
tone_stop(0.75, 0.90) # early lit
tone_stop(1.00, 1.00)
tone_smooth(0) # hard bands
tone_bezier_off()
คืน 0
}
# Reset to engine built-in default (identical to toneRampCel but via reset)
ฟังก์ชัน toneRampReset() {
tone_ramp_reset()
คืน 0
}
# ═══════════════════════════════════════════════════════════════════════════════
# OPTIMIZED HEALTH BAR (using quads)
# ═══════════════════════════════════════════════════════════════════════════════
ฟังก์ชัน drawHealthBarOptimized(x, y, z, current, max, width) {
bind height = 0.6
bind fillWidth = width * (current / max)
# Background (dark)
สีดินสอ(20, 20, 25)
draw_quad_3d(
x, y, z,
x + width, y, z,
x + width, y - height, z,
x, y - height, z
)
# Health fill (gradient effect via material)
ถ้า current > 0.0 {
bind healthPercent = current / max
bind r = floor(255.0 - (healthPercent * 150.0))
bind g = floor(120.0 + (healthPercent * 135.0))
bind b = 30
# flat health-bar fill colour (no BSDF)
สีดินสอ(r, g, b)
draw_quad_3d(
x, y, z,
x + fillWidth, y, z,
x + fillWidth, y - height, z,
x, y - height, z
)
}
คืน 0
}
# ═══════════════════════════════════════════════════════════════════════════════
# OPTIMIZED TILE/TERRAIN (using quads instead of triangle pairs)
# ═══════════════════════════════════════════════════════════════════════════════
ฟังก์ชัน drawTerrainTileQuad(x, z, y, size) {
bind hs = size
# Single quad instead of 2 triangles
draw_quad_3d(
x - hs, y, z - hs,
x + hs, y, z - hs,
x + hs, y, z + hs,
x - hs, y, z + hs
)
คืน 0
}
# ═══════════════════════════════════════════════════════════════════════════════
# MATERIAL-ENHANCED MESH RENDERING
# ═══════════════════════════════════════════════════════════════════════════════
# Render character (flat colour — no BSDF)
ฟังก์ชัน renderCharacterWithMaterial(meshPath, x, y, z, yaw, skinR, skinG, skinB) {
สีดินสอ(skinR, skinG, skinB)
คืน 0
}
# Render weapon (flat colour — no BSDF)
ฟังก์ชัน renderWeaponWithMaterial(weaponType, x, y, z, yaw, metalR, metalG, metalB) {
สีดินสอ(metalR, metalG, metalB)
คืน 0
}
# ═══════════════════════════════════════════════════════════════════════════════
# PERFORMANCE HELPERS
# ═══════════════════════════════════════════════════════════════════════════════
# Draw multiple quads from coordinate list (batch optimization)
ฟังก์ชัน drawQuadBatch(coords, count) {
# coords should be list of [x0,y0,z0, x1,y1,z1, ...]
# Each quad = 12 floats (4 vertices × 3 coords)
bind i = 0
ขณะที่ i < count {
bind idx = i * 12
draw_quad_3d(
coords[idx+0], coords[idx+1], coords[idx+2],
coords[idx+3], coords[idx+4], coords[idx+5],
coords[idx+6], coords[idx+7], coords[idx+8],
coords[idx+9], coords[idx+10], coords[idx+11]
)
bind i = i + 1
}
คืน 0
}