some
This commit is contained in:
1 parent
aca30bfe6a
commit
01594353d8
11 files changed
+265
-330
No files matched your search
@@ -38,7 +38,7 @@ components/ SHARED source-of-truth for all components.
|
||||
pixelSize, startTime, timer)
|
||||
render/renderConst.swift RENDER_CONFIG (raybri_config), RENDER_FPS,
|
||||
RENDER_MODEL_CUBE, RENDER_OPENGL_ATTRS
|
||||
render/renderConstShader.swift RENDER_SHADER_* GLSL sources (GLSL 150)
|
||||
render/renderConstShader.swift Substitutes %VERSION% in the shared templates
|
||||
render/renderAux.swift renderDraw(vm), renderPixelSize(view)
|
||||
render/renderEffect.swift renderInit, renderLoadCubeModel,
|
||||
renderStartTimer, renderDeinit
|
||||
@@ -149,13 +149,21 @@ 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 and render constants live in **Swift**, not in C: GLSL sources are
|
||||
`RENDER_SHADER_*` in `components/render/renderConstShader.swift`, and
|
||||
`RENDER_CONFIG` / `raybri_config` tunables are 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 Apple Silicon the driver
|
||||
still reports 4.1/GLSL 4.10.
|
||||
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`.
|
||||
`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
|
||||
Apple Silicon the driver still reports 4.1/GLSL 4.10.
|
||||
|
||||
## Render architecture
|
||||
|
||||
|
||||
Reference in new issue
Block a user