Files
__mahjong/components/render/renderConstShader.swift
T
2026-10-22 16:21:10 +03:00

22 lines
971 B
Swift

import RaylibBridge
// The GLSL bodies live in components/raybri/renderShaders.c so the macOS and
// iOS builds share a single copy. Only the #version directive differs, and it
// is substituted here (it must be the first token, so it cannot be selected by
// a preprocessor conditional inside the shader).
let RENDER_SHADER_MAIN_FS = renderShaderSource(RENDER_SHADER_MAIN_FS_T, RENDER_SHADER_VERSION_GL)
let RENDER_SHADER_MAIN_VS = renderShaderSource(RENDER_SHADER_MAIN_VS_T, RENDER_SHADER_VERSION_GL)
let RENDER_SHADER_SHADOW_FS = renderShaderSource(RENDER_SHADER_SHADOW_FS_T, RENDER_SHADER_VERSION_GL)
let RENDER_SHADER_SHADOW_VS = renderShaderSource(RENDER_SHADER_SHADOW_VS_T, RENDER_SHADER_VERSION_GL)
private func renderShaderSource(
_ template: UnsafePointer<CChar>,
_ version: UnsafePointer<CChar>
) -> String {
String(cString: template).replacingOccurrences(
of: RENDER_SHADER_VERSION_TOKEN,
with: String(cString: version)
)
}