#include <section>
Statement for including common shader code from the external
code\default.fx file
that is separated into different sections. This way functions
or variable declaration shared by all shaders are placed in an external file.
The file default.fx contains
often-used shader variables and functions for lighting, fog, and transformations.
Type
statement
Remarks
You can copy the default.fx file into your work folder
and modify it if desired. It is a customizable script. For defining a
new section in the default.fx file,
enter a section comment tag, like "//section:
sectionname". The "#include
<sectionname>" statement will then include this section
in the shader code, up to the next section. The following include sections
are currently available:
- <transform> - contains the DoTransform function
for transforming and projecting vertex coordinates.
- <sun> - contains the DoSun function for adding sun light.
- <light> - contains the DoLight function for adding dynamic lights.
- <fog> - contains the DoFog function for adding fog.
- <pos> - contains the DoPos function for transforming
the vertex position to world coordinates.
- <normal> - contains the DoNormal function for transforming
the vertex normal orientation to world coordinates.
-
<view> - contains the DoView function for transforming
a vertex position to view space.
-
<tangent> - contains CreateTangents for creating a tangent
matrix, and DoTangent for converting a vector to tangent space.
Examples
for shaders with included sections can be found in the
code\mtlFX.c file.
Although the common code will make shader programming easier, understanding
shader code is still required.
Example (shader code)
#include <transform>
...
out.Pos = DoTransform(in.Pos);
See also:
MATERIAL, shaders, effect
parameters
► latest
version online