/* * Data structures for 2d toolkit * * Copyright (c) Criterion Software Limited */ /*************************************************************************** * * * Module : rt2d.h * * * * Purpose : * * * **************************************************************************/ #ifndef RT2D_H #define RT2D_H /** * \defgroup rt2d Rt2d * \ingroup rttool * * 2D Rendering Toolkit for RenderWare. */ /** * \defgroup rt2ddatatypes Data Types * \ingroup rt2d * * Basic Data Types */ /** * \defgroup rt2dsub Rt2d * \ingroup rt2d * * Rt2d functions */ /** * \defgroup rt2dbrush Rt2dBrush * \ingroup rt2d * * Brush functions */ /** * \defgroup rt2dctm Rt2dCTM * \ingroup rt2d * * Current Transformation Matrix (CTM) */ /** * \defgroup rt2ddevice Rt2dDevice * \ingroup rt2d * * Camera device functions */ /** * \defgroup rt2dfont Rt2dFont * \ingroup rt2d * * Font functions */ /** * \defgroup rt2dobject Rt2dObject * \ingroup rt2d * * Objects */ /** * \defgroup rt2dobjectstring Rt2dObjectString * \ingroup rt2d * * String functions */ /** * \defgroup rt2dpath Rt2dPath * \ingroup rt2d * * Path functions */ /** * \defgroup rt2dpickregion Rt2dPickRegion * \ingroup rt2d * * Pick regions */ /** * \defgroup rt2dscene Rt2dScene * \ingroup rt2d * * Scenes */ /** * \defgroup rt2dshape Rt2dShape * \ingroup rt2d * * Shapes */ /** * \defgroup rt2drwv2d RwV2d * \ingroup rt2d * * Rt2d plugin directly extends the Core Library's RwV2d API functions. */ /**************************************************************************** Includes */ #include "rt2d.rpe" /* automatically generated header file */ /**************************************************************************** Defines */ #define Rt2dBrushSetWidthMacro(_brush, _width) \ ( ( (_brush)->halfwidth = ((_width) * 0.5f) ), (_brush) ) #define Rt2dBrushGetWidthMacro(_brush) \ ( (_brush)->halfwidth * 2.0f ) #define Rt2dCTMReadMacro(_result) \ (RwMatrixCopy((_result), _rt2dCTMGet()), (_result)) /**************************************************************************** Global Types */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * rt2dShadeParameters * typedef for a structure describing Shade Parameters */ typedef struct rt2dShadeParameters rt2dShadeParameters; /* * * rt2dShadeParameters * describes Shade Parameters */ struct rt2dShadeParameters { RwRGBAReal col; /* col */ RwV2d uv; /* uv */ }; /** * \ingroup rt2ddatatypes * \typedef Rt2dBrush * typedef for a structure describing a Brush (opaque) */ typedef struct Rt2dBrush Rt2dBrush; /* * Rt2dBrush * structure describing a Brush */ #if defined (GCN_DRVMODEL_H) #define VERTEXCACHESIZE 64 #else #define VERTEXCACHESIZE 256 #endif struct Rt2dBrush { RWIM3DVERTEX vertex[VERTEXCACHESIZE]; rt2dShadeParameters top; rt2dShadeParameters dtop; rt2dShadeParameters bottom; rt2dShadeParameters dbottom; RwInt32 calcFields; RwTexture *texture; RwReal halfwidth; }; /** * \ingroup rt2ddatatypes * \typedef Rt2dPath * typedef for a structure describing a Path (opaque) */ typedef struct Rt2dPath Rt2dPath; /** * \ingroup rt2ddatatypes * \typedef Rt2dFont * typedef for a structure describing a Font (opaque) */ typedef struct Rt2dFont Rt2dFont; /* * typedef used for referencing a spot in a font dictionary */ typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode; /** * \ingroup rt2ddatatypes * \typedef Rt2dBBox * typedef for a structure describing a Bounding Box */ typedef struct Rt2dBBox Rt2dBBox; /** * \ingroup rt2ddatatypes * \struct Rt2dBBox * structure describing a Bounding Box */ struct Rt2dBBox { RwReal x; /**< x-coordinate of lower-left corner */ RwReal y; /**< y-coordinate of lower-left corner */ RwReal w; /**< Width */ RwReal h; /**< Height */ }; /** * \ingroup rt2ddatatypes * \typedef Rt2dObject * typedef for a structure describing a 2d Object * This should be considered an opaque type. * Use Rt2dObject, Rt2dScene, Rt2dShape, Rt2dPickRegion or Rt2dObjectString * API functions to access. */ typedef struct Rt2dObject Rt2dObject; /* * typedef for a structure describing a scene of shapes (opaque) */ typedef struct _rt2dScene _rt2dScene; /* * typedef for a structure describing the depth of an object */ typedef struct _rt2dDepthOfObject _rt2dDepthOfObject; /* * typedef for a structure describing the depth of an object */ struct _rt2dDepthOfObject { Rt2dObject *object; RwInt32 depth; }; /* * structure describing a scene of shapes */ struct _rt2dScene { RwSList *objects; /* collection of objects in scene */ RwInt32 objectCount; /* number of objects */ RwSList *depths; /* depths for depthsort */ RwBool isDirtyDepths; /* depthsort needs updating */ }; /* * typedef for a structure describing a shape (opaque) */ typedef struct _rt2dShape _rt2dShape; struct _rt2dShape { RwSList *nodes; /* individual stroked/filled regions of the shape */ }; /* * typedef for a structure describing a pick region that can be tested for point inclusion (opaque) */ typedef struct _rt2dPickRegion _rt2dPickRegion; /* * structure describing a pick region that can be tested for point inclusion */ struct _rt2dPickRegion { Rt2dPath *path; /* path that defines region for testing */ Rt2dBBox bbox; /* bounding box of path */ RwMatrix transformation; /* ivnert transformation used to place the pick region */ }; /* * structure describing a renderable text string */ struct _rt2dObjectString { RwChar *textString; /* Text string to be rendered */ Rt2dBrush *brush; /* Brush to be used to draw text */ RwInt32 maxLength; /* Maximum string length before reallocation, excluding null */ RwReal height; /* Font rendering Height */ _rt2dFontDictionaryNode *font; /* Dictionary node identifying font to be used */ }; /* * typedef for a renderable string */ typedef struct _rt2dObjectString _rt2dObjectString; /** * \ingroup rt2ddatatypes * \ref Rt2dObjectTypeEnum * enumeration describing types of Rt2dObject */ enum Rt2dObjectTypeEnum { rt2DOBJECTTYPEOBJECT=0, /**