side by side
lines around each change
Show the changes in full context
White space changes
2012-04-15 16:25:54 (
The material system contains many components. Artists should just care about telling actors to use appropriate materials, and occasionally creating new material XML files by copying old ones and tweaking the uniforms. Graphical programmers might care about all the various shader files.
Unlike ARB/GLSL shaders, these aren't defined by XML files at all. Instead, a shader technique says e.g. `<pass shader="fixed:model_solid"/>` with the magic "`fixed:`" prefix, and [source:ps/trunk/source/graphics/ShaderProgramFFP.cpp CShaderProgram::ConstructFFP] returns an appropriate hard-coded implementation.
== Shader source files ==
ARB vertex/fragment program source files have extensions `.vp` and `.fp` in [source:ps/trunk/binaries/data/mods/public/shaders/arb shaders/arb/].
GLSL vertex/fragment shader source files have extensions `.vs` and `.fs` in [source:ps/trunk/binaries/data/mods/public/shaders/glsl shaders/glsl/].
All source files are passed through a custom preprocessor before being compiled. This recognises basic C preprocessor syntax (`#if`, `#ifdef`, `#define`, etc; unfortunately not `#elif`), and can refer to the defines from all the earlier XML files (passes, techniques, materials, rendering mode, global renderer context, etc).
ARB files should start with "`!!ARBfp1.0`" or "`!!ARBvp1.0`". GLSL files should start with "`#version 120`" (GLSL 1.20 is the lowest version we should bother supporting, and corresponds to GLSL ES 1.00 which should be the highest we require).
Otherwise they're just standard ARB/GLSL shaders, so refer to standard shader-writing documentation.