PowerVR Software Development Kit |
00001 /*!*************************************************************************** 00002 @File PVRTMisc.h 00003 00004 @Brief Miscellaneous functions used in 3D rendering. 00005 00006 @Author PowerVR 00007 00008 @Date August 1999 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 Miscellaneous functions used in 3D rendering. 00024 00025 $Revision: 1.15 $ 00026 *****************************************************************************/ 00027 #ifndef _PVRTMISC_H_ 00028 #define _PVRTMISC_H_ 00029 00030 00031 /**************************************************************************** 00032 ** Functions 00033 ****************************************************************************/ 00034 00035 /*!*************************************************************************** 00036 @Function PVRTMiscCalculateIntersectionLinePlane 00037 @Input pfPlane Length 4 [A,B,C,D], values for plane 00038 equation 00039 @Input pv0 A point on the line 00040 @Input pv1 Another point on the line 00041 @Output pvIntersection The point of intersection 00042 @Description Calculates coords of the intersection of a line and an 00043 infinite plane 00044 *****************************************************************************/ 00045 void PVRTMiscCalculateIntersectionLinePlane( 00046 PVRTVECTOR3 * const pvIntersection, 00047 const VERTTYPE pfPlane[4], 00048 const PVRTVECTOR3 * const pv0, 00049 const PVRTVECTOR3 * const pv1); 00050 00051 /*!*************************************************************************** 00052 @Function PVRTMiscCalculateInfinitePlane 00053 @Input nStride Size of each vertex structure containing pfVtx 00054 @Input pvPlane Length 4 [A,B,C,D], values for plane equation 00055 @Input pmViewProjInv The inverse of the View Projection matrix 00056 @Input pFrom Position of the camera 00057 @Input fFar Far clipping distance 00058 @Output pfVtx Position of the first of 3 floats to receive 00059 the position of vertex 0; up to 5 vertex positions 00060 will be written (5 is the maximum number of vertices 00061 required to draw an infinite polygon clipped to screen 00062 and far clip plane). 00063 @Returns Number of vertices in the polygon fan (Can be 0, 3, 4 or 5) 00064 @Description Calculates world-space coords of a screen-filling 00065 representation of an infinite plane The resulting vertices run 00066 counter-clockwise around the screen, and can be simply drawn using 00067 non-indexed TRIANGLEFAN 00068 *****************************************************************************/ 00069 int PVRTMiscCalculateInfinitePlane( 00070 VERTTYPE * const pfVtx, 00071 const int nStride, 00072 const PVRTVECTOR4 * const pvPlane, 00073 const PVRTMATRIX * const pmViewProjInv, 00074 const PVRTVECTOR3 * const pFrom, 00075 const VERTTYPE fFar); 00076 00077 /*!*************************************************************************** 00078 @Function PVRTCreateSkybox 00079 @Input scale Scale the skybox 00080 @Input adjustUV Adjust or not UVs for PVRT compression 00081 @Input textureSize Texture size in pixels 00082 @Output Vertices Array of vertices 00083 @Output UVs Array of UVs 00084 @Description Creates the vertices and texture coordinates for a skybox 00085 *****************************************************************************/ 00086 void PVRTCreateSkybox(float scale, bool adjustUV, int textureSize, VERTTYPE** Vertices, VERTTYPE** UVs); 00087 00088 /*!*************************************************************************** 00089 @Function PVRTDestroySkybox 00090 @Input Vertices Vertices array to destroy 00091 @Input UVs UVs array to destroy 00092 @Description Destroy the memory allocated for a skybox 00093 *****************************************************************************/ 00094 void PVRTDestroySkybox(VERTTYPE* Vertices, VERTTYPE* UVs); 00095 00096 /*!*************************************************************************** 00097 @Function PVRTMiscTwiddle 00098 @Output a Twiddled value 00099 @Input u Coordinate axis 0 00100 @Input v Coordinate axis 1 00101 @Description Combine a 2D coordinate into a twiddled value 00102 *****************************************************************************/ 00103 void PVRTMiscTwiddle(unsigned int &a, const unsigned int u, const unsigned int v); 00104 00105 /*!*************************************************************************** 00106 @Function PVRTMiscDeTwiddle 00107 @Output u Coordinate axis 0 00108 @Output v Coordinate axis 1 00109 @Input a Twiddled value 00110 @Description Extract 2D coordinates from a twiddled value. 00111 *****************************************************************************/ 00112 void PVRTMiscDeTwiddle(unsigned int &u, unsigned int &v, const unsigned int a); 00113 00114 00115 #endif /* _PVRTMISC_H_ */ 00116 00117 00118 /***************************************************************************** 00119 End of file (PVRTMisc.h) 00120 *****************************************************************************/
Copyright © 1999-2006, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Ltd.