flags
Set of 'switches' to be set in a material definition, separated
by " | ".
All other flags are reset by default.
TANGENT
Calculates the u tangents for the 3rd texture coordinate set (TEXCOORD2).
This has the same effect as defining matTangent in
a shader, and allows shaders to convert vectors to tangent space. The
binormal vector (v tangent) can be calculated by the vertex shader
from the cross product of the vertex normal and the u tangent. On animated
models the tangents need to be recalculated every frame, affecting
the frame rate, so don't use this flag unnecessarily.
TRANSLUCENT
Renders the entity on the translucent pass, i.e. after all non-transparent
objects are rendered. Can be used for transparency effects when the
entity itself has no TRANSLUCENT or TRANSPARENT flag
set. This flag can also be set by defining a bool variable within the .fx file (bool TRANSLUCENT;)
PASS_SOLID
Opposite of TRANSLUCENT: enforces rendering on the solid pass, i.e. together with non-transparent objects. For entities with alpha channel textures that are used for other purposes, such as a height map in a shader. Entities in the solid pass are not sorted, and thus render faster than in the transparent pass.
This flag can also be set by defining a bool variable within the .fx file (bool PASS_SOLID;)
A7.60
AUTORELOAD
Automatically reloads the effect file when it is saved at runtime by SED or another external editor. Can be used for editing shaders and observing the result immediately in the engine window.
This flag can also be set by defining a bool variable within the .fx file (bool AUTORELOAD;) !! The .fx file to be edited must be located in the work folder.
The default.fx library can be also copied in the work folder and edited, but changes in the library sections become only visible when the material's .fx file is saved. A7.10C
OVERRIDE
Overrides the view material setting. Set this flag for materials to be used for rendering objects even when a view material is set. A7.10
ENABLE_RENDER
The material event is
executed immediately before rendering
the entity the material was assigned to.
This can be used to perform
effect calculations based on entity skills or the entity's world matrix.
If the event function returns 1,
the entity is not rendered; for rendering the entity, 0 must
be returned. The mtl pointer
can be used for temporarily switching the entity material depending on
the current view or on other factors. C P
- At event time,
all matrices,
texture and render stages are
already set. Thus, changing entity parameters or the entity material
in this event has no effect on the immediate rendering - use ENABLE_TREE for
this.
-
If the event function returns 1, the entity is not rendered, but is sorted in the visibility list and appears in the statistics panel. A faster method for suppressing entity rendering in a particular view is the NOFLAG1 flag or the ENABLE_TREE flag (see below).
ENABLE_TREE
The material event is
executed for all potentially visible entities
the material was assigned to, just
before sorting them into the
rendering chain. If the event function returns 1, the entity is not rendered in this view; for rendering the entity, 0 must be returned. All entity flags (except INVISIBLE)
as well as the entities' alpha and material parameters can be changed
in this event.
C P
ENABLE_VIEW
The material event is executed immediately before view rendering, for setting up some material properties depending on the view. If the material was assigned to a view through a view.material setting, the event is only executed for the view the material was assigned to; otherwise it's executed for any view. If the event function of a view material returns 1, the view stage is skipped; for rendering the view, 0 must be returned. At event time,
view and projection matrices are already set up and can be changed by the event. This allows rendering nonstandard views, for instance orthogonal projections.
Example: See bmap_rendertarget. C P
Remarks:
In C-Script, a flag is set or reset during gameplay by assigning the ON
or OFF value (like material.TANGENT = ON;). In C, C++, or
Lite-C, a flag is set by or-ing the flags parameter with the flag (material.flags
|= TANGENT;) and reset by and-ing the flags parameter with the inverse
flag (material.flags &= ~TANGENT;).
Example:
MATERIAL* mtlGlow =
{
...
flags = TRANSLUCENT | TANGENT;
...
}
See also:
MATERIAL, material.event, effect
► latest
version online