[Previous] [Next] [Up] [Home] S3D Pascal Bindings
S3DTK_SetState
Set a S3D state.
Method of:
TS3DTK_FUNCTION_LISTSyntax:
S3DTK_SetState: function(
pFuncStruct: Pointer;
State: ULONG;
Value: ULONG): ULONG; cdecl;
Parameters:
- pFuncStruct - Pointer to the TS3DTK_FUNCTION_LIST that contains this method.
- State - One of the state constants described below.
- Value - The new state. The actual value depends on the state constant.
Returns:
S3DTK_OK if successful, S3DTK_ERR otherwise.
Description:
Set a new S3D state. The actual state will be applied once new triangles are rendered.
States:
The valid values for the State parameter and the potential values the Value parameter can have are the following:
- S3DTK_ALPHABLENDING - Controls alpha blending. The value can be one of S3DTK_ALPHAOFF, which disables alpha blending, S3DTK_ALPHATEXTURE, which enables alpha blending and takes alpha from the texture or S3DTK_ALPHASOURCE, which enables alpha blending and takes alpha from the value stored in the vertices. Note that when fog is enabled this cannot be S3DTK_ALPHASOURCE since the alpha value in the vertices is used to control fog density.
- S3DTK_CLIPPING_AREA - Value is a pointer to a TS3DTK_RECTAREA that contains the clipping rectangle inside the rendering surface.
- S3DTK_D_LEVEL_SUPPLIED - If this is set to S3DTK_ON the library will use the D values for mipmapping provided by the vertex data, otherwise it will be calculated automatically (default is off).
- S3DTK_DRAWSURFACE - Value is a pointer to a TS3DTK_SURFACE that will be used for all further rendering operations.
- S3DTK_FOGCOLOR - Controls fog. If the value is S3DTK_FOGOFF (the default), the fog will be turned off. Otherwise the value controls the fog color which is calculated by mixing the color to be written with the fog color using the alpha value stored in the vertex data (i.e. final_pixel = (1.0 - alpha) * fog + alpha * color_to_be_written). The fog color must be in the same format as the current draw surface. Note that fog cannot be used at the same time as alpha blending with vertex sourced alpha values.
- S3DTK_RENDERINGTYPE - Controls how to render the triangles. Can be one of S3DTK_GOURAUD, which only uses vertex colors, S3DTK_LITTEXTURE, which performs affine texture mapping and blends the texture colors with the vertex colors, S3DTK_UNLITTEXTURE, which performs affine texture mapping while ignoring vertex colors, S3DTK_LITTEXTUREPERSPECT, which performs perspective correct texture mapping and blends the texture colors with the vertex colors or S3DTK_UNLITTEXTUREPERSPECT which performs perspective correct texture mapping while ignoring vertex colors.
- S3DTK_TEXBLENDINGMODE - Controls how to combine the texture colors with the vertex colors and can be either S3DTK_TEXMODULATE which multiplies the colors together or S3DTK_TEXDECAL which blends the two colors using the alpha value stored in the texture.
- S3DTK_TEXFILTERINGMODE - Texture filtering mode, can be one of S3DTK_NEAREST, S3DTK_LINEAR, S3DTK_MIP_NEAREST, S3DTK_LINEAR_MIP_NEAREST, S3DTK_MIP_LINEAR or S3DTK_LINEAR_MIP_LINEAR.
- S3DTK_TEXTUREACTIVE - Value is a pointer to a TS3DTK_SURFACE for the texture to use when drawing triangles with a render type that uses textures (ie. anything other than S3DTK_GOURAUD).
- S3DTK_ZBUFFERCOMPAREMODE - Controls zbuffer compare mode. Can be one of S3DTK_ZNEVERPASS (never passes the z test), S3DTK_ZSRCGTZFB (rendered > already there), S3DTK_ZSRCEQZFB (rendered = already there), S3DTK_ZSRCGEZFB (rendered >= already there), S3DTK_ZSRCLSZFB (rendered < already there), S3DTK_ZSRCNEZFB (rendered <> already there), S3DTK_ZSRCLEZFB (rendered <= already there), S3DTK_ZALWAYSPASS (always pass the z test).
- S3DTK_ZBUFFERENABLE - Enable or disable z buffering, can be S3DTK_ON or S3DTK_OFF.
- S3DTK_ZBUFFERSURFACE - Pointer to a TS3DTK_SURFACE to be used as a zbuffer.
- S3DTK_ZBUFFERUPDATEENABLE - When this is set to S3DTK_ON (default) the zbuffer is updated with new values as pixels are drawn on the draw buffer. Setting this to S3DTK_OFF will not disable any writes (comparisons are still being made).
Some state values are actually pointers, in which case the pointers must be casted to ULONG.
Unit: S3DTK
See Also:
S3DTK_GetState (in TS3DTK_FUNCTION_LIST)
[Previous] [Next] [Up] [Home] S3D Pascal Bindings