PowerVR Software Development Kit


Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

PVRTVertex.h

Go to the documentation of this file.
00001 /*!***************************************************************************
00002  @File          PVRTVertex.h
00003 
00004  @Brief         Utility functions which process vertices.
00005 
00006  @Author        PowerVR
00007 
00008  @Date          Febuary 2003
00009 
00010  @Copyright     Copyright 2003-2004 by Imagination Technologies Limited.
00011                 All rights reserved. No part of this software, either
00012                 material or conceptual may be copied or distributed,
00013                 transmitted, transcribed, stored in a retrieval system
00014                 or translated into any human or computer language in any
00015                 form by any means, electronic, mechanical, manual or
00016                 other-wise, or disclosed to third parties without the
00017                 express written permission of Imagination Technologies
00018                 Limited, Unit 8, HomePark Industrial Estate,
00019                 King's Langley, Hertfordshire, WD4 8LZ, U.K.
00020 
00021  @Platform      ANSI compatible
00022 
00023  @Description   Utility functions which process vertices.
00024 
00025  $Revision: 1.21 $
00026 *****************************************************************************/
00027 #ifndef _PVRTVERTEX_H_
00028 #define _PVRTVERTEX_H_
00029 
00030 
00031 /****************************************************************************
00032 ** Enumerations
00033 ****************************************************************************/
00034 enum EPVRTDataType {
00035     EPODDataNone,
00036     EPODDataFloat,
00037     EPODDataInt,
00038     EPODDataUnsignedShort,
00039     EPODDataRGBA,
00040     EPODDataARGB,
00041     EPODDataD3DCOLOR,
00042     EPODDataUBYTE4,
00043     EPODDataDEC3N,
00044     EPODDataFixed16_16,
00045     EPODDataUnsignedByte,
00046     EPODDataShort,
00047     EPODDataShortNorm,
00048     EPODDataByte,
00049     EPODDataByteNorm
00050 };
00051 
00052 /*****************************************************************************
00053 ** Functions
00054 *****************************************************************************/
00055 
00056 /*!***************************************************************************
00057  @Function          PVRTDataTypeRead
00058  @Output            pV
00059  @Input             pData
00060  @Input             eType
00061  @Input             nCnt
00062  @Description       Read a vector
00063 *****************************************************************************/
00064 void PVRTDataTypeRead(
00065     PVRTVECTOR4f        * const pV,
00066     const void          * const pData,
00067     const EPVRTDataType eType,
00068     const int           nCnt);
00069 void PVRTDataTypeRead(
00070     unsigned int        * const pV,
00071     const void          * const pData,
00072     const EPVRTDataType eType);
00073 
00074 /*!***************************************************************************
00075  @Function          PVRTDataTypeWrite
00076  @Output            pOut
00077  @Input             eType
00078  @Input             nCnt
00079  @Input             pV
00080  @Description       Write a vector
00081 *****************************************************************************/
00082 void PVRTDataTypeWrite(
00083     void                * const pOut,
00084     const EPVRTDataType eType,
00085     const int           nCnt,
00086     const PVRTVECTOR4f  * const pV);
00087 void PVRTDataTypeWrite(
00088     void                * const pOut,
00089     const EPVRTDataType eType,
00090     const unsigned int  V);
00091 
00092 /*!***************************************************************************
00093  @Function          PVRTVertexTangentBinormal
00094  @Output            pvTan
00095  @Output            pvBin
00096  @Input             pvNor
00097  @Input             pfPosA
00098  @Input             pfPosB
00099  @Input             pfPosC
00100  @Input             pfTexA
00101  @Input             pfTexB
00102  @Input             pfTexC
00103  @Description       Calculates the tangent and binormal vectors for
00104                     vertex 'A' of the triangle defined by the 3 supplied
00105                     3D position coordinates (pfPosX) and 2D texture
00106                     coordinates (pfTexX).
00107 *****************************************************************************/
00108 void PVRTVertexTangentBinormal(
00109     PVRTVECTOR3         * const pvTan,
00110     PVRTVECTOR3         * const pvBin,
00111     const PVRTVECTOR3   * const pvNor,
00112     const float         * const pfPosA,
00113     const float         * const pfPosB,
00114     const float         * const pfPosC,
00115     const float         * const pfTexA,
00116     const float         * const pfTexB,
00117     const float         * const pfTexC);
00118 
00119 /*!***************************************************************************
00120  @Function          PVRTVertexGenerateTangentSpace
00121  @Output            pnVtxNumOut         Output vertex count
00122  @Output            pVtxOut             Output vertices (program must free() this)
00123  @Modified          pwIdx               input AND output; index array for triangle list
00124  @Input             nVtxNum             Input vertex count
00125  @Input             pVtx                Input vertices
00126  @Input             nStride             Size of a vertex (in bytes)
00127  @Input             nOffsetPos          Offset in bytes to the vertex position
00128  @Input             eTypePos            Data type of the position
00129  @Input             nOffsetNor          Offset in bytes to the vertex normal
00130  @Input             eTypeNor            Data type of the normal
00131  @Input             nOffsetTex          Offset in bytes to the vertex texture coordinate to use
00132  @Input             eTypeTex            Data type of the texture coordinate
00133  @Input             nOffsetTan          Offset in bytes to the vertex tangent
00134  @Input             eTypeTan            Data type of the tangent
00135  @Input             nOffsetBin          Offset in bytes to the vertex binormal
00136  @Input             eTypeBin            Data type of the binormal
00137  @Input             nTriNum             Number of triangles
00138  @Input             fSplitDifference    Split a vertex if the DP3 of tangents/binormals are below this (range -1..1)
00139  @Return            false if there was a problem.
00140  @Description       Calculates the tangent space for all supplied vertices.
00141                     Writes tangent and binormal vectors to the output
00142                     vertices, copies all other elements from input vertices.
00143                     Will split vertices if necessary - i.e. if two triangles
00144                     sharing a vertex want to assign it different
00145                     tangent-space matrices. The decision whether to split
00146                     uses fSplitDifference - of the DP3 of two desired
00147                     tangents or two desired binormals is higher than this,
00148                     the vertex will be split.
00149 *****************************************************************************/
00150 bool PVRTVertexGenerateTangentSpace(
00151     int             * const pnVtxNumOut,
00152     char            ** const pVtxOut,
00153     unsigned short  * const pwIdx,
00154     const int       nVtxNum,
00155     const char      * const pVtx,
00156     const int       nStride,
00157     const int       nOffsetPos,
00158     EPVRTDataType   eTypePos,
00159     const int       nOffsetNor,
00160     EPVRTDataType   eTypeNor,
00161     const int       nOffsetTex,
00162     EPVRTDataType   eTypeTex,
00163     const int       nOffsetTan,
00164     EPVRTDataType   eTypeTan,
00165     const int       nOffsetBin,
00166     EPVRTDataType   eTypeBin,
00167     const int       nTriNum,
00168     const float     fSplitDifference);
00169 
00170 
00171 #endif /* _PVRTVERTEX_H_ */
00172 
00173 /*****************************************************************************
00174  End of file (PVRTVertex.h)
00175 *****************************************************************************/


Copyright © 1999-2006, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Ltd.


Generated by DOXYGEN 1.3.6