📄 ctl.h
字号:
} CTL_ARRAY;
/* ************************************************************************* *\
** Type definitions
\* ************************************************************************* */
typedef struct _RASTER_CALLBACKS
{
// BeginPrimitiveList - Called when the fixed-size clip buffers overflow
// The buffers are a fixed size and are sufficient for all but the most severe
// clip situations.
//
// Param: context pointer (client defined)
// Param: vertex 1 & vertex 2
// Param: strip winding order 0=CCW (cull CW), 1=CW (cull CCW)
// Return: context pointer
//
void* (*BeginPrimitiveList)( void* pvContext, void* pVtx1, void* pVtx2,
CTLU32 u32StripDirection );
// BeginClipList
void* (*BeginClipList)( void* pvContext );
// Vertex - Called when ready to rasterize a single triangle
//
// Param: context pointer
// Param: three vertices that make up the triangle
// Return: context pointer
//
void* (*Vertex)( void* pvContext, void* pVtx0, void* pVtx1, void* pVtx2 );
// EndPrimitiveList - Called when a triangle is clipped or culled
// The CTL engine only submits each triangle to the rasterizer once. So for
// triangle strips and fans, the current vertex state must be reset, in terms
// of the last 2 vertices needed to define a triangle.
//
// Param: context pointer
// Return: context pointer
//
void* (*EndPrimitiveList)( void* pvContext );
} CTL_RASTER_CALLBACKS;
/* ************************************************************************* *\
CTLProfilerProc
\* ************************************************************************* */
typedef void (*CTLProfilerProc)( int type, CTLBOOL bStartStop );
/* ************************************************************************* *\
** Prototypes
\* ************************************************************************* */
/* ************************************************************************* *\
CTL_Init
Initializes the CTL and prepares it for data
Return: A handle to a new CTL instance, to be used in future CTL calls
\* ************************************************************************* */
CTLHANDLE CTL_Init ( void );
/* ************************************************************************* *\
CTL_Done
Shuts down the CTL
Param: handle to the CTL instance to destroy
Return: CTLTRUE if shutdown succeeds, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_Done ( CTLHANDLE h );
/* ************************************************************************* *\
CTL_DrawPrimitives
Transforms and lights the primitives set into the engine and renders them
via the rasterizer callback functions
Param: handle to the CTL engine that will be doing the transform & light
Param: type of primitives to render
Param: offset into vertex array to start pulling vertices
Param: number of vertices to transform & light
Param: number of primtives to transform & light
Return: CTLTRUE if all vertices are valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_DrawPrimitives ( CTLHANDLE h, CTL_PRIMITIVE_TYPE eType,
CTLU32 u32BaseVertexIndex, CTLU32 u32NumVertices,
CTLU32 u32PrimitiveCount );
/* ************************************************************************* *\
CTL_EnableLight
Enable/disable the specified light for use by the engine
Param: handle to the CTL instance that owns the light
Param: index of light to enable/disable
Param: CTLTRUE to enable light, CTLFALSE to disable
Return: CTLTRUE if light enabled or already enabled, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_EnableLight ( CTLHANDLE h, CTLU32 u32Index, CTLBOOL bEnable );
/* ************************************************************************* *\
CTL_GetLight
Get the light parameters of the specified light
Param: handle to the CTL instance that owns the light
Param: index of light to get the parameters for
Param: buffer to hold light parameters
Return: CTLTRUE if returned light parameters are valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetLight ( CTLHANDLE h, CTLU32 u32Index, CTL_LIGHT* psLight );
/* ************************************************************************* *\
CTL_GetMaterial
Get the current material parameters
Param: handle to the CTL instance that owns the material
Param: buffer to hold material parameters
Return: CTLTRUE if returned material parameters are valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetMaterial ( CTLHANDLE h, CTL_MATERIAL* psMaterial );
/* ************************************************************************* *\
CTL_GetProfileVariable
Get the value of a profiler variable
Param: handle to the CTL instance that owns the profile variable
Param: which profiler variable to retrieve
Param: buffer to hold profiler variable
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetProfileVariable ( CTLHANDLE h, CTL_PROFILEVAR eWhich,
CTLU32* pu32Param );
/* ************************************************************************* *\
CTL_GetRasterVariable
Get the value of a rasterizer variable
Param: handle to the CTL instance that owns the rasterizer
Param: which rasterizer variable to retrieve
Param: buffer to hold rasterizer variable, format depends on which one
was requested
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetRasterVariableV ( CTLHANDLE h, CTL_RASTERVAR eWhich, void* pvParams );
/* ************************************************************************* *\
CTL_GetStateVariable
Get the value of a T&L state variable
Param: handle to the CTL instance that owns the state variable
Param: which state variable to retrieve
Param: buffer to hold state variable
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetStateVariable ( CTLHANDLE h, CTL_STATEVAR eWhich, CTLU32* pu32Param );
/* ************************************************************************* *\
CTL_GetStateVariable
Gets a multi-component T&L state variable
Param: handle to the CTL instance that owns the state variable
Param: which state variable to retrieve
Param: buffer to hold state variable, format depends on which one was requested
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetStateVariableV ( CTLHANDLE h, CTL_STATEVAR eWhich, void* pvParams );
/* ************************************************************************* *\
CTL_GetTransform
Get the current transform matrix
Param: handle to the CTL instance that owns the transform
Param: which transform matrix to get
Param: transform matrix
Return: CTLTRUE if transform is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetTransform ( CTLHANDLE h, CTL_TRANSFORM_TYPE eType,
CTLMATRIX44* psMatrix );
/* ************************************************************************* *\
CTL_GetVertexSize
Gets the size of a single vertex (sum of all components)
Param: handle to the CTL instance that owns the state variable
Return: vertex size
\* ************************************************************************* */
CTLU32 CTL_GetVertexSize ( CTLHANDLE h );
/* ************************************************************************* *\
CTL_GetViewport
Gets the current viewport used by the T&L engine
Param: handle to the CTL instance that owns the viewport
Param: buffer to hold viewport
Return: CTLTRUE if returned viewport is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_GetViewport ( CTLHANDLE h, CTL_VIEWPORT* psViewport );
/* ************************************************************************* *\
CTL_SetIndices
Sets the index buffer to use for assembling primitives
Param: handle to the CTL instance that is to use the indices
Param: array of indices (must be 16-bit)
Return: CTLTRUE if indices set, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetIndices ( CTLHANDLE h, CTLU16* pu16Indices );
/* ************************************************************************* *\
CTL_SetLight
Set the light parameters of the specified light
Param: handle to the CTL instance that will own the light
Param: index of light to set the parameters for
Param: buffer of light parameters
Return: CTLTRUE if light set, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetLight ( CTLHANDLE h, CTLU32 u32Index, CTL_LIGHT* psLight );
/* ************************************************************************* *\
CTL_SetMaterial
Set the current material parameters
Param: handle to the CTL instance that will own the material
Param: buffer of material parameters
Return: CTLTRUE if material set, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetMaterial ( CTLHANDLE h, CTL_MATERIAL* psMaterial );
/* ************************************************************************* *\
CTL_SetPointer
Sets one of the vertex arrays to be used by the T&L engine
Param: handle to the CTL instance that will own the array
Param: type of array being set
Param: array data
Param: array element stride
Return: CTLTRUE if array set, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetPointer ( CTLHANDLE h, void* pvArray, CTL_ARRAY_TYPE eType,
CTL_ARRAY_FORMAT eFmt, CTLU32 u32Size, CTLU32 u32Stride );
/* ************************************************************************* *\
CTL_SetRasterCallbacks
Param: handle to the CTL instance that will call the callbacks
Param: see callback definitions
\* ************************************************************************* */
CTLBOOL CTL_SetRasterCallbacks ( CTLHANDLE h, CTL_RASTER_CALLBACKS* psCallbacks );
/* ************************************************************************* *\
CTL_SetRasterVariable
Set the value of a rasterizer variable
Param: handle to the CTL instance that owns the rasterizer
Param: which rasterizer variable to set
Param: buffer of rasterizer variables, format depends on which one was requested
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetRasterVariable ( CTLHANDLE h, CTL_RASTERVAR eWhich, CTLU32 u32Param );
/* ************************************************************************* *\
CTL_SetRasterVariable
Set the value of a rasterizer variable
Param: handle to the CTL instance that owns the rasterizer
Param: which rasterizer variable to set
Param: buffer of rasterizer variables, format depends on which one was requested
Return: CTLTRUE if returned variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetRasterVariableV ( CTLHANDLE h, CTL_RASTERVAR eWhich, void* pvParams );
/* ************************************************************************* *\
CTL_SetStateVariable
Set the value of a T&L state variable
Param: handle to the CTL instance that owns the state variable
Param: which state variable to set
Param: state variable
Return: CTLTRUE if variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetStateVariable ( CTLHANDLE h, CTL_STATEVAR eWhich, CTLU32 u32Param );
/* ************************************************************************* *\
CTL_SetStateVariable
Set the value of a multi-component T&L state variable
Param: handle to the CTL instance that owns the state variable
Param: which state variable to set
Param: buffer of state variable components
Return: CTLTRUE if variable is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetStateVariableV ( CTLHANDLE h, CTL_STATEVAR eWhich, void* pvParams );
/* ************************************************************************* *\
CTL_SetTransform
Set the current transform matrix
Param: handle to the CTL instance that will own the transform
Param: which transform matrix to set
Param: transform matrix
Return: CTLTRUE if transform is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetTransform ( CTLHANDLE h, CTL_TRANSFORM_TYPE eType,
CTLMATRIX44* psMatrix );
/* ************************************************************************* *\
CTL_SetViewport
Sets the current viewport used by the T&L engine
Param: handle to the CTL instance that will own the viewport
Param: buffer of viewport parameters
Return: CTLTRUE if viewport is valid, CTLFALSE otherwise
\* ************************************************************************* */
CTLBOOL CTL_SetViewport ( CTLHANDLE h, CTL_VIEWPORT* psViewport );
/* ************************************************************************* *\
\* ************************************************************************* */
#if defined( __cplusplus )
} // extern "C"
#endif /* __cplusplus */
/* ************************************************************************* *\
\* ************************************************************************* */
#endif /* __CTL_H__ */
/* ************************************************************************* *\
** EOF
\* ************************************************************************* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -