#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.
#include <filename.fx>
Statement for including code from an external file. The file name must end with ".fx" and contain the relative or absolute path to the file.
A8.50
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.
- <vecskill> - set vecSkill41 to default values from the entity skills1..4.
- <bump_vs> - a standard bumpmapping function for two lights.
Examples
for shaders with included sections can be found in the
include\mtlFX.c
file.
Although the common code will make shader programming easier, understanding
shader code is still required.
Example (shader code)
#include <transform>
#include <fog>
...
out.Pos = DoTransform(in.Pos);
out.Fog = DoFog(in.Pos);
See also:
MATERIAL, shaders, effect
parameters
► latest
version online