Repository navigation
ariadne: declarative GLSL shader surface on scene nodes (shader: block) + preset registry - #562
Merged
Merged
Conversation
…k) + preset registry
Make GLSL a first-class Ariadne DSL capability so a mesh that needed host C++ to be shaded can be
authored entirely in the .ari (and run under the generic ariadne_hello host). A geometry node's
`shader:` block either names a host-registered PRESET or splices raw GLSL at VTK injection markers:
shader: terrain_bump # scalar shorthand for a named preset
shader: # or the full form
preset: bark
disable_coord_shift: true
vertex: [ { at: "//VTK::Normal::Dec", code: "…" } ]
fragment: [ { at: "//VTK::Normal::Impl", code: "…" } ]
- scene.h: SceneShader / SceneShaderStage (neutral data) + a `shader` field on SceneNode.
- loader.cpp: parse_scene_shader (scalar-preset shorthand + the map form); `shader` is a known key.
- scene_realize.cpp (cvcGL — GL-specific): a process-global shader-preset registry
(register_shader_preset / has_shader_preset, mirroring the node-type registry) and apply_shader()
called when a realized GeometryNode has a shader: coordinate-shift toggle, then the named preset
(warn, never throw, on an unknown one), then the inline vertex/fragment splices.
register_default_shader_presets() installs the built-ins "terrain_bump" + "bark" (the demo's
GROUND_GLSL/BARK_GLSL, incl. the GLES normal-name platform gate) — presets, not host code.
This is the general capability behind shrinking the lsystem_forest host: the terrain bump + tree
bark move from host addTerrainBump/addBark calls into the .ari. The forest/cvcGL extension bundle
(register_cvcgl_extensions) will call register_default_shader_presets().
Tests: loader (2) — preset shorthand + full block parse, absent shader; realize (6) — presets
register, a known preset applies with no warning, an unknown preset warns but still realizes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What — Phase 2a of the lsystem-forest refactor (a general DSL capability)
Makes GLSL a first-class Ariadne DSL surface, so a mesh that needed host C++ to be shaded can be authored entirely in the
.ari— and run under the genericariadne_hellohost. This is the missing piece that lets the forest's terrain bump + tree bark leave the host.cpp.DSL
A geometry node's
shader:block either names a host-registered preset or splices raw GLSL at VTK injection markers:Pieces
scene.h—SceneShader/SceneShaderStage(neutral data) + ashaderfield onSceneNode.loader.cpp—parse_scene_shader(scalar-preset shorthand + the map form);shaderis a known node key.scene_realize.cpp(cvcGL, GL-specific) — a process-global shader-preset registry (register_shader_preset/has_shader_preset, mirroring the node-type registry) andapply_shader()on a realizedGeometryNode: the coordinate-shift toggle, then the named preset (warn, never throw, on unknown), then the inline splices.register_default_shader_presets()installs the built-insterrain_bump+bark(the demo'sGROUND_GLSL/BARK_GLSL, including the GLES normal-name platform gate) — presets, not host code.The forest/cvcGL extension bundle (
register_cvcgl_extensions, Phase 2b) will callregister_default_shader_presets().Tests