/* * Data structures for 2d toolkit * * Copyright (c) Criterion Software Limited */ /*************************************************************************** * * * Module : rt2d.h * * * * Purpose : * * * **************************************************************************/ #ifndef RT2D_H #define RT2D_H /** * \defgroup rt2d Rt2d * \ingroup 2dtools * * 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 "rpworld.h" #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)) #if defined (GCN_DRVMODEL_H) #define VERTEXCACHESIZE 64 #else #define VERTEXCACHESIZE 256 #endif /**************************************************************************** Global Types */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * rt2dShadeParameters * typedef for a structure describing Shade Parameters */ typedef struct rt2dShadeParameters rt2dShadeParameters; /* * * rt2dShadeParameters * describes Shade Parameters */ #if (!defined(DOXYGEN)) struct rt2dShadeParameters { RwRGBAReal col; /* col */ RwV2d uv; /* uv */ }; #endif /* (!defined(DOXYGEN)) */ /** * \ingroup rt2ddatatypes * \struct Rt2dBrush * Brush object. * This should be considered an opaque type. * Use Rt2dBrush API functions to access. */ typedef struct Rt2dBrush Rt2dBrush; /* * Rt2dBrush * structure describing a Brush */ #if (!defined(DOXYGEN)) struct Rt2dBrush { rt2dShadeParameters top; rt2dShadeParameters dtop; rt2dShadeParameters bottom; rt2dShadeParameters dbottom; RwRGBA colorCache; RwInt32 flag; RwTexture *texture; RpMaterial *material; RwReal halfwidth; RwInt32 refCount; }; #endif /* (!defined(DOXYGEN)) */ /** * \ingroup rt2ddatatypes * \struct Rt2dPath * Path object. * This should be considered an opaque type. * Use Rt2dPath API functions to access. */ typedef struct Rt2dPath Rt2dPath; /** * \ingroup rt2ddatatypes * \struct Rt2dFont * Font object. * This should be considered an opaque type. * Use Rt2dFont API functions to access. */ typedef struct Rt2dFont Rt2dFont; /* * typedef used for referencing a spot in a font dictionary */ typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode; 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 * \struct Rt2dObject * 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; #if (!defined(DOXYGEN)) /* * 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 */ }; #endif /* (!defined(DOXYGEN)) */ /* * typedef for a structure describing a shape (opaque) */ typedef struct _rt2dShape _rt2dShape; #if (!defined(DOXYGEN)) typedef struct _rt2dShapeRep _rt2dShapeRep; struct _rt2dShapeRep { RwSList *nodes; /* individual stroked/filled regions of the shape */ RwUInt32 refCount; /* number of shapes referencing this rep */ RpGeometry *geometry; /* Shareable geometry */ }; extern _rt2dShapeRep * _rt2dShapeRepCreate(); extern RwBool _rt2dShapeRepDestroy(_rt2dShapeRep *); extern RwUInt32 _rt2dShapeRepAddRef(_rt2dShapeRep *); typedef struct _rt2dSceneResourcePool _rt2dSceneResourcePool; struct _rt2dSceneResourcePool { _rt2dShapeRep **shapeReps; RwUInt32 numShapeReps; }; extern RwBool _rt2dSceneResourcePoolFindShapeRep(const _rt2dSceneResourcePool * pool, const _rt2dShapeRep * rep, RwInt32 * npIndex); struct _rt2dShape { _rt2dShapeRep *rep; RwRGBA *colorCache; /* Shape's color cache */ RpAtomic *atomic; /* Atomic repn */ }; /* * 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 */ }; #endif /* (!defined(DOXYGEN)) */ /* * typedef for a renderable string */ typedef struct _rt2dObjectString _rt2dObjectString; /** * \ingroup rt2ddatatypes * \ref Rt2dObjectTypeEnum * enumeration describing types of Rt2dObject */ enum Rt2dObjectTypeEnum { rt2DOBJECTTYPEOBJECT=0, /**