PVRTTrans_8h-source.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  3. <title>PowerVR SDK</title>
  4. <link href="doxygen.css" rel="stylesheet" type="text/css">
  5. <link href="tabs.css" rel="stylesheet" type="text/css">
  6. <table width="100%">
  7. <tr>
  8. <td width="33%">
  9. <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
  10. </td>
  11. <td width="33%">
  12. <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
  13. </td>
  14. <td width="34%">
  15. <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
  16. </td>
  17. </tr>
  18. </table>
  19. <hr>
  20. </head><body>
  21. <!-- Generated by Doxygen 1.3.6 -->
  22. <div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
  23. <h1>PVRTTrans.h</h1><a href="PVRTTrans_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
  24. 00002 <span class="comment"></span>
  25. 00003 <span class="comment"> @File PVRTTrans.h</span>
  26. 00004 <span class="comment"></span>
  27. 00005 <span class="comment"> @Title PVRTTrans</span>
  28. 00006 <span class="comment"></span>
  29. 00007 <span class="comment"> @Version </span>
  30. 00008 <span class="comment"></span>
  31. 00009 <span class="comment"> @Copyright Copyright (C) Imagination Technologies Limited.</span>
  32. 00010 <span class="comment"></span>
  33. 00011 <span class="comment"> @Platform ANSI compatible</span>
  34. 00012 <span class="comment"></span>
  35. 00013 <span class="comment"> @Description Set of functions used for 3D transformations and projections.</span>
  36. 00014 <span class="comment"></span>
  37. 00015 <span class="comment">******************************************************************************/</span>
  38. 00016 <span class="preprocessor">#ifndef _PVRTTRANS_H_</span>
  39. 00017 <span class="preprocessor"></span><span class="preprocessor">#define _PVRTTRANS_H_</span>
  40. 00018 <span class="preprocessor"></span>
  41. 00019
  42. 00020 <span class="comment">/****************************************************************************</span>
  43. 00021 <span class="comment">** Typedefs</span>
  44. 00022 <span class="comment">****************************************************************************/</span>
  45. 00023 <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structPVRTBOUNDINGBOX__TAG.html">PVRTBOUNDINGBOX_TAG</a>
  46. 00024 {
  47. 00025 <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> <a class="code" href="structPVRTBOUNDINGBOX__TAG.html#o0">Point</a>[8];
  48. 00026 } <a class="code" href="structPVRTBOUNDINGBOX__TAG.html">PVRTBOUNDINGBOX</a>, *<a class="code" href="structPVRTBOUNDINGBOX__TAG.html">LPPVRTBOUNDINGBOX</a>;
  49. <a name="l00027"></a><a class="code" href="structPVRTBOUNDINGBOX__TAG.html">00027</a>
  50. 00028 <span class="comment">/****************************************************************************</span>
  51. <a name="l00029"></a><a class="code" href="structPVRTBOUNDINGBOX__TAG.html#o0">00029</a> <span class="comment">** Functions</span>
  52. 00030 <span class="comment">****************************************************************************/</span>
  53. 00031
  54. 00032 <span class="comment">/*!***************************************************************************</span>
  55. 00033 <span class="comment"> @Function PVRTBoundingBoxCompute</span>
  56. 00034 <span class="comment"> @Output pBoundingBox</span>
  57. 00035 <span class="comment"> @Input pV</span>
  58. 00036 <span class="comment"> @Input nNumberOfVertices</span>
  59. 00037 <span class="comment"> @Description Calculate the eight vertices that surround an object.</span>
  60. 00038 <span class="comment"> This "bounding box" is used later to determine whether</span>
  61. 00039 <span class="comment"> the object is visible or not.</span>
  62. 00040 <span class="comment"> This function should only be called once to determine the</span>
  63. 00041 <span class="comment"> object's bounding box.</span>
  64. 00042 <span class="comment">*****************************************************************************/</span>
  65. 00043 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a2">PVRTBoundingBoxCompute</a>(
  66. 00044 <a class="code" href="structPVRTBOUNDINGBOX__TAG.html">PVRTBOUNDINGBOX</a> * <span class="keyword">const</span> pBoundingBox,
  67. 00045 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pV,
  68. 00046 <span class="keyword">const</span> <span class="keywordtype">int</span> nNumberOfVertices);
  69. 00047
  70. 00048 <span class="comment">/*!***************************************************************************</span>
  71. 00049 <span class="comment"> @Function PVRTBoundingBoxComputeInterleaved</span>
  72. 00050 <span class="comment"> @Output pBoundingBox</span>
  73. 00051 <span class="comment"> @Input pV</span>
  74. 00052 <span class="comment"> @Input nNumberOfVertices</span>
  75. 00053 <span class="comment"> @Input i32Offset</span>
  76. 00054 <span class="comment"> @Input i32Stride</span>
  77. 00055 <span class="comment"> @Description Calculate the eight vertices that surround an object.</span>
  78. 00056 <span class="comment"> This "bounding box" is used later to determine whether</span>
  79. 00057 <span class="comment"> the object is visible or not.</span>
  80. 00058 <span class="comment"> This function should only be called once to determine the</span>
  81. 00059 <span class="comment"> object's bounding box.</span>
  82. 00060 <span class="comment"> Takes interleaved data using the first vertex's offset</span>
  83. 00061 <span class="comment"> and the stride to the next vertex thereafter</span>
  84. 00062 <span class="comment">*****************************************************************************/</span>
  85. 00063 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a3">PVRTBoundingBoxComputeInterleaved</a>(
  86. 00064 <a class="code" href="structPVRTBOUNDINGBOX__TAG.html">PVRTBOUNDINGBOX</a> * <span class="keyword">const</span> pBoundingBox,
  87. 00065 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * <span class="keyword">const</span> pV,
  88. 00066 <span class="keyword">const</span> <span class="keywordtype">int</span> nNumberOfVertices,
  89. 00067 <span class="keyword">const</span> <span class="keywordtype">int</span> i32Offset,
  90. 00068 <span class="keyword">const</span> <span class="keywordtype">int</span> i32Stride);
  91. 00069
  92. 00070 <span class="comment">/*!******************************************************************************</span>
  93. 00071 <span class="comment"> @Function PVRTBoundingBoxIsVisible</span>
  94. 00072 <span class="comment"> @Output pNeedsZClipping</span>
  95. 00073 <span class="comment"> @Input pBoundingBox</span>
  96. 00074 <span class="comment"> @Input pMatrix</span>
  97. 00075 <span class="comment"> @Return TRUE if the object is visible, FALSE if not.</span>
  98. 00076 <span class="comment"> @Description Determine if a bounding box is "visible" or not along the</span>
  99. 00077 <span class="comment"> Z axis.</span>
  100. 00078 <span class="comment"> If the function returns TRUE, the object is visible and should</span>
  101. 00079 <span class="comment"> be displayed (check bNeedsZClipping to know if Z Clipping needs</span>
  102. 00080 <span class="comment"> to be done).</span>
  103. 00081 <span class="comment"> If the function returns FALSE, the object is not visible and thus</span>
  104. 00082 <span class="comment"> does not require to be displayed.</span>
  105. 00083 <span class="comment"> bNeedsZClipping indicates whether the object needs Z Clipping</span>
  106. 00084 <span class="comment"> (i.e. the object is partially visible).</span>
  107. 00085 <span class="comment"> - *pBoundingBox is a pointer to the bounding box structure.</span>
  108. 00086 <span class="comment"> - *pMatrix is the World, View &amp; Projection matrices combined.</span>
  109. 00087 <span class="comment"> - *bNeedsZClipping is TRUE if Z clipping is required.</span>
  110. 00088 <span class="comment">*****************************************************************************/</span>
  111. 00089 <span class="keywordtype">bool</span> <a class="code" href="PVRTTrans_8h.html#a4">PVRTBoundingBoxIsVisible</a>(
  112. 00090 <span class="keyword">const</span> <a class="code" href="structPVRTBOUNDINGBOX__TAG.html">PVRTBOUNDINGBOX</a> * <span class="keyword">const</span> pBoundingBox,
  113. 00091 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pMatrix,
  114. 00092 <span class="keywordtype">bool</span> * <span class="keyword">const</span> pNeedsZClipping);
  115. 00093
  116. 00094 <span class="comment">/*!***************************************************************************</span>
  117. 00095 <span class="comment"> @Function Name PVRTTransformVec3Array</span>
  118. 00096 <span class="comment"> @Output pOut Destination for transformed vectors</span>
  119. 00097 <span class="comment"> @Input nOutStride Stride between vectors in pOut array</span>
  120. 00098 <span class="comment"> @Input pV Input vector array</span>
  121. 00099 <span class="comment"> @Input nInStride Stride between vectors in pV array</span>
  122. 00100 <span class="comment"> @Input pMatrix Matrix to transform the vectors</span>
  123. 00101 <span class="comment"> @Input nNumberOfVertices Number of vectors to transform</span>
  124. 00102 <span class="comment"> @Description Transform all vertices [X Y Z 1] in pV by pMatrix and</span>
  125. 00103 <span class="comment"> store them in pOut.</span>
  126. 00104 <span class="comment">*****************************************************************************/</span>
  127. 00105 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a5">PVRTTransformVec3Array</a>(
  128. 00106 <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a> * <span class="keyword">const</span> pOut,
  129. 00107 <span class="keyword">const</span> <span class="keywordtype">int</span> nOutStride,
  130. 00108 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pV,
  131. 00109 <span class="keyword">const</span> <span class="keywordtype">int</span> nInStride,
  132. 00110 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pMatrix,
  133. 00111 <span class="keyword">const</span> <span class="keywordtype">int</span> nNumberOfVertices);
  134. 00112
  135. 00113 <span class="comment">/*!***************************************************************************</span>
  136. 00114 <span class="comment"> @Function PVRTTransformArray</span>
  137. 00115 <span class="comment"> @Output pTransformedVertex Destination for transformed vectors</span>
  138. 00116 <span class="comment"> @Input pV Input vector array</span>
  139. 00117 <span class="comment"> @Input nNumberOfVertices Number of vectors to transform</span>
  140. 00118 <span class="comment"> @Input pMatrix Matrix to transform the vectors</span>
  141. 00119 <span class="comment"> @Input fW W coordinate of input vector (e.g. use 1 for position, 0 for normal)</span>
  142. 00120 <span class="comment"> @Description Transform all vertices in pVertex by pMatrix and store them in</span>
  143. 00121 <span class="comment"> pTransformedVertex</span>
  144. 00122 <span class="comment"> - pTransformedVertex is the pointer that will receive transformed vertices.</span>
  145. 00123 <span class="comment"> - pVertex is the pointer to untransformed object vertices.</span>
  146. 00124 <span class="comment"> - nNumberOfVertices is the number of vertices of the object.</span>
  147. 00125 <span class="comment"> - pMatrix is the matrix used to transform the object.</span>
  148. 00126 <span class="comment">*****************************************************************************/</span>
  149. 00127 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a6">PVRTTransformArray</a>(
  150. 00128 <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pTransformedVertex,
  151. 00129 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pV,
  152. 00130 <span class="keyword">const</span> <span class="keywordtype">int</span> nNumberOfVertices,
  153. 00131 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pMatrix,
  154. 00132 <span class="keyword">const</span> VERTTYPE fW = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1.0f));
  155. 00133
  156. 00134 <span class="comment">/*!***************************************************************************</span>
  157. 00135 <span class="comment"> @Function PVRTTransformArrayBack</span>
  158. 00136 <span class="comment"> @Output pTransformedVertex</span>
  159. 00137 <span class="comment"> @Input pVertex</span>
  160. 00138 <span class="comment"> @Input nNumberOfVertices</span>
  161. 00139 <span class="comment"> @Input pMatrix</span>
  162. 00140 <span class="comment"> @Description Transform all vertices in pVertex by the inverse of pMatrix</span>
  163. 00141 <span class="comment"> and store them in pTransformedVertex.</span>
  164. 00142 <span class="comment"> - pTransformedVertex is the pointer that will receive transformed vertices.</span>
  165. 00143 <span class="comment"> - pVertex is the pointer to untransformed object vertices.</span>
  166. 00144 <span class="comment"> - nNumberOfVertices is the number of vertices of the object.</span>
  167. 00145 <span class="comment"> - pMatrix is the matrix used to transform the object.</span>
  168. 00146 <span class="comment">*****************************************************************************/</span>
  169. 00147 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a7">PVRTTransformArrayBack</a>(
  170. 00148 <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pTransformedVertex,
  171. 00149 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a> * <span class="keyword">const</span> pVertex,
  172. 00150 <span class="keyword">const</span> <span class="keywordtype">int</span> nNumberOfVertices,
  173. 00151 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pMatrix);
  174. 00152
  175. 00153 <span class="comment">/*!***************************************************************************</span>
  176. 00154 <span class="comment"> @Function PVRTTransformBack</span>
  177. 00155 <span class="comment"> @Output pOut</span>
  178. 00156 <span class="comment"> @Input pV</span>
  179. 00157 <span class="comment"> @Input pM</span>
  180. 00158 <span class="comment"> @Description Transform vertex pV by the inverse of pMatrix</span>
  181. 00159 <span class="comment"> and store in pOut.</span>
  182. 00160 <span class="comment">*****************************************************************************/</span>
  183. 00161 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a8">PVRTTransformBack</a>(
  184. 00162 <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a> * <span class="keyword">const</span> pOut,
  185. 00163 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a> * <span class="keyword">const</span> pV,
  186. 00164 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pM);
  187. 00165
  188. 00166 <span class="comment">/*!***************************************************************************</span>
  189. 00167 <span class="comment"> @Function PVRTTransform</span>
  190. 00168 <span class="comment"> @Output pOut</span>
  191. 00169 <span class="comment"> @Input pV</span>
  192. 00170 <span class="comment"> @Input pM</span>
  193. 00171 <span class="comment"> @Description Transform vertex pV by pMatrix and store in pOut.</span>
  194. 00172 <span class="comment">*****************************************************************************/</span>
  195. 00173 <span class="keywordtype">void</span> <a class="code" href="PVRTTrans_8h.html#a9">PVRTTransform</a>(
  196. 00174 <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a> * <span class="keyword">const</span> pOut,
  197. 00175 <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a> * <span class="keyword">const</span> pV,
  198. 00176 <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a> * <span class="keyword">const</span> pM);
  199. 00177
  200. 00178
  201. 00179 <span class="preprocessor">#endif </span><span class="comment">/* _PVRTTRANS_H_ */</span>
  202. 00180
  203. 00181 <span class="comment">/*****************************************************************************</span>
  204. 00182 <span class="comment"> End of file (PVRTTrans.h)</span>
  205. 00183 <span class="comment">*****************************************************************************/</span>
  206. 00184
  207. </pre></div><br>
  208. <br>
  209. <P align=left><FONT size=2><STRONG><A
  210. href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> ©
  211. 1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
  212. <hr>
  213. <address style="align: left;"><small><FONT color=f0f>
  214. Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
  215. </body>
  216. </html>