C4 Engine
C4 Engine API Documentation

struct MarkingData

Defined in:  C4Markings.h
The MarkingData structure defines the parameters of a surface marking effect.
Constructor

MarkingData(uint32 flags = 0, MarkingList *list = nullptr);

MarkingData(const Vector2D& scale, const Vector2D& offset, uint32 flags = 0, MarkingList *list = nullptr);

Parameters
flags The marking effect flags.
list A pointer to the MarkingList object into which each MarkingEffect is inserted.
scale A scale to apply to the (s, t) texture coordinates used by the marking.
offset An offset to apply to the (s, t) texture coordinates used by the marking.
Data Members
uint32              markingFlags; The marking effect flags. This is set to zero by the MarkingData constructors.
float               markingOffset; The depth offset distance used by the marking effect. This is set to 1/128 by the default constructor.
MarkingList         *markingList; A pointer to a MarkingList (or a subclass) to which marking effects are added.
Point3D             center; The world-space center of the surface marking.
Bivector3D          normal; The world-space normal direction of the surface marking. This bivector must have unit length.
Vector3D            tangent; The world-space tangent direction of the surface marking. (This determines texture orientation.) This vector does not have to be unit length.
float               radius; The radius of the surface marking.
Range<float>        clip; The range of depths, with respect to the center and normal direction, to which the marking is clipped if the kMarkingClipRange flag is specified. If kMarkingClipRange is not specified, then the range is [−r, r], where r is the radius of the marking.
Vector2D            texcoordScale; The (s, t) scale to apply to the texture coordinates of the marking. This is set to (1, 1) by the default constructor.
Vector2D            texcoordOffset; The (s, t) offset to apply to the texture coordinates of the marking. This is set to (0, 0) by the default constructor.
const char      *textureName; A pointer to the name of the texture map used by the surface marking. This occupies the same space as materialObject and should not be specified if the kMarkingLight is set in the markingFlags field.
MaterialObject  *materialObject; A pointer to the material object used by the surface marking. This occupies the same space as textureName and should only be specified if the kMarkingLight is set in the markingFlags field.
ColorRGBA           color; The marking color, in linear space. Ignored if a material object containing a DiffuseAttribute is specified.
int32               lifeTime; The time for which the surface marking is rendered. If this is set to -1, then the marking is rendered for exactly one frame.
Description
The MarkingData structure holds information that is passed to the constructor for the MarkingEffect class. The markingFlags member can be a combination (through logical OR) of the following constants.
kMarkingLight The marking receives full lighting.
kMarkingBlendLight Alpha blending is applied to a lighted marking (valid only if the kMarkingLight flag is set).
kMarkingDepthWrite The marking writes to the depth buffer (valid only if the kMarkingLight flag is set).
kMarkingTwoSided The marking is rendered two-sided (valid only if the kMarkingLight flag is not set).
kMarkingClipRange The minimum and maximum depths to which the marking is clipped are given by the clip field of the MarkingData structure.
kMarkingBlendAdd The blend mode for the marking adds to the color channels and ignores the alpha channel (valid only if the kMarkingLight flag is not set).
If the list parameter is not nullptr, then each MarkingEffect node created during a call to the MarkingEffect::NewMarkingEffect function is added to the MarkingList object (which can be a subclass of MarkingList).

If the scale and offset parameters are specified, then the texcoordScale and texcoordOffset members of the MarkingData structure are initialized to those values. Otherwise, the scale is initialized to (1, 1), and the offset is initialized to (0, 0) so that the entire texture map is used by the marking.

Polygons belonging to the marking effect are ordinarily created by clipping polygons belonging to a geometry node to the bounding box if the marking effect. If the kMarkingFullPolygon flag is specified, then the geometry's polygons are not clipped but are instead copied so that an exact duplicate appears in the marking effect's mesh. This results in larger polygons being rendered, but it avoids depth testing issues related to offsetting coplanar polygons. In this case, the markingOffset member of the MarkingData structure is ignored, and the marking effect is always offset by the minimum amount possible toward the camera in viewport space.
See Also

MarkingEffect