some
This commit is contained in:
1 parent
01594353d8
commit
96a5684709
12 files changed
+262
-250
No files matched your search
@@ -149,17 +149,16 @@ behind the SwiftUI UI in a `ZStack`. A textured cube is drawn from `Resources/as
|
||||
node-rotation glTF animation cannot be played by the renderer — hence the cube is
|
||||
app-driven.) `packageMac` bundles `Resources/assets/` into the app.
|
||||
|
||||
Shaders live in **C** so the macOS and iOS builds share one copy: the GLSL
|
||||
bodies are the `RENDER_SHADER_*_T` templates in
|
||||
`components/raybri/renderShaders.c`, each starting with the `%VERSION%`
|
||||
placeholder, and `components/render/renderConstShader.swift` builds the
|
||||
`RENDER_SHADER_*` sources the macOS side passes to `raybri_init` by replacing
|
||||
`%VERSION%` with `RENDER_SHADER_VERSION_GL` (`#version 150`); the iOS bridge
|
||||
(`components/render/ios/renderIOS.mm`) substitutes `RENDER_SHADER_VERSION_ES`
|
||||
(`#version 300 es`). The directive must be the first shader token, so it cannot
|
||||
be picked by an `#ifdef` inside the GLSL. Fragment templates also carry
|
||||
`precision highp float;` — required by GLSL ES, accepted and ignored by desktop
|
||||
GLSL. `RENDER_CONFIG` / `raybri_config` tunables stay in `renderConst.swift`.
|
||||
Shaders live in **Swift** and are shared by both builds: the GLSL bodies are
|
||||
the `RENDER_SHADER_*_T` templates in
|
||||
`components/render/renderConstShader.swift`, each starting with the `%VERSION%`
|
||||
placeholder. The `RENDER_SHADER_*` sources passed to `raybri_init` are produced
|
||||
by `replacingOccurrences`, choosing `RENDER_SHADER_VERSION_GL` (`#version 150`)
|
||||
or `RENDER_SHADER_VERSION_ES` (`#version 300 es`) via `#if os(iOS)`. The
|
||||
directive must be the first shader token, so it cannot be picked by an `#ifdef`
|
||||
inside the GLSL. Fragment templates also carry `precision highp float;` —
|
||||
required by GLSL ES, accepted and ignored by desktop GLSL. The iOS ObjC++ bridge
|
||||
reaches the strings through `@_cdecl` accessors in `RenderIOS.swift`. `RENDER_CONFIG` / `raybri_config` tunables stay in `renderConst.swift`.
|
||||
`raybri_init` compiles the shaders in place (no storage/`strdup`).
|
||||
`cube_normal.png` drives tangentless normal mapping via the derivative-based
|
||||
`cotangentFrame`. The context is OpenGL 3.2 Core (`RENDER_OPENGL_ATTRS`); on
|
||||
|
||||
Reference in new issue
Block a user