1 #pragma once
2 
3 #ifndef MESHUTILS_H
4 #define MESHUTILS_H
5 
6 #undef DVAPI
7 #undef DVVAR
8 #ifdef TNZEXT_EXPORTS
9 #define DVAPI DV_EXPORT_API
10 #define DVVAR DV_EXPORT_VAR
11 #else
12 #define DVAPI DV_IMPORT_API
13 #define DVVAR DV_IMPORT_VAR
14 #endif
15 
16 //=======================================================================
17 
18 //    Forward Declarations
19 
20 class TMeshImageP;
21 
22 struct DrawableTextureData;
23 struct PlasticDeformerDataGroup;
24 
25 //=======================================================================
26 
27 //********************************************************************************************
28 //    Mesh Image Utility  functions
29 //********************************************************************************************
30 
31 /*!
32   \brief    Transforms a mesh image by the specified affine transform.
33 */
34 
35 DVAPI void transform(
36     const TMeshImageP &image,  //!< Mesh image to be transformed.
37     const TAffine &aff  //!< Affine transform to be applied on the input image.
38     );
39 
40 //---------------------------------------------------------------------------
41 
42 /*!
43   \brief    Draws the edges of the input meshImage on current OpenGL context.
44 
45   \remark   This function accepts input data associated to a deformation of
46             the mesh image to be drawn. See PlasticDeformerStorage for details.
47 */
48 
49 DVAPI void tglDrawEdges(
50     const TMeshImage &image,  //!< Input mesh image whose edges will be drawn.
51     const PlasticDeformerDataGroup *deformerDatas =
52         0  //!< Optional data about a deformation of the input image.
53     );
54 
55 //---------------------------------------------------------------------------
56 
57 /*!
58   \brief    Draws the faces of the input meshImage on current OpenGL context.
59 
60   \remark   This function accepts input data associated to a deformation of
61             the mesh image to be drawn. See PlasticDeformerStorage for details.
62 */
63 
64 DVAPI void tglDrawFaces(
65     const TMeshImage &image,  //!< Input mesh image whose faces will be drawn.
66     const PlasticDeformerDataGroup *deformerDatas =
67         0  //!< Optional data about a deformation of the input image.
68     );
69 
70 //---------------------------------------------------------------------------
71 
72 /*!
73   \brief    Draws the <I>stacking order</I> information of the input mesh
74   image's
75             faces, on current OpenGL context.
76 */
77 
78 DVAPI void tglDrawSO(
79     const TMeshImage &image,  //!< Input mesh image whose SO will be drawn.
80     double minColor[4],  //!< RGBM color quadruple (in [0, 1]) corresponding to
81                          //! the lowest SO value.
82     double maxColor[4],  //!< RGBM color quadruple corresponding to the highest
83                          //! SO value.
84     const PlasticDeformerDataGroup *deformerDatas =
85         0,  //!< Deformation data structure containing SO data.
86     bool deformedDomain =
87         false  //!< Whether the image data must be drawn \a deformed
88                //!  by the specified deformerDatas, or not.
89     );
90 
91 //---------------------------------------------------------------------------
92 
93 /*!
94   \brief    Draws the \a rigidity information of the input mesh image's
95             faces, on current OpenGL context.
96 */
97 
98 DVAPI void tglDrawRigidity(
99     const TMeshImage
100         &image,          //!< Input mesh image whose rigidity will be drawn.
101     double minColor[4],  //!< RGBM color quadruple (in [0, 1]) corresponding to
102                          //! the lowest rigidity value.
103     double maxColor[4],  //!< RGBM color quadruple corresponding to the highest
104                          //! rigidity value.
105     const PlasticDeformerDataGroup *deformerDatas =
106         0,  //!< Data structure of an optional deformation of the input image.
107     bool deformedDomain =
108         false  //!< Whether the image data must be drawn \a deformed
109                //!  by the specified deformerDatas, or not.
110     );
111 
112 //---------------------------------------------------------------------------
113 
114 /*!
115   \brief    Draws a texturized mesh image on current OpenGL context.
116 
117   \remark   The input textures are assumed to be \a nonpremultiplied,
118             while the drawn image will be \a premultiplied.
119 */
120 
121 DVAPI void tglDraw(
122     const TMeshImage &image,  //!< Mesh image to be drawn.
123     const DrawableTextureData
124         &texData,  //!< Textures data to use for texturing.
125     const TAffine
126         &meshToTexAffine,  //!< Transform from mesh to texture coordinates.
127     const PlasticDeformerDataGroup
128         &deformerDatas  //!< Data structure of a deformation of the input image.
129     );
130 
131 #endif  // MESHUTILS_H
132