Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | c87809c | 2006-04-05 03:29:46 +0000 | [diff] [blame] | 3 | * Version: 6.5.1 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 4 | * |
Brian Paul | c87809c | 2006-04-05 03:29:46 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 6 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | * and/or sell copies of the Software, and to permit persons to whom the |
| 12 | * Software is furnished to do so, subject to the following conditions: |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 13 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 14 | * The above copyright notice and this permission notice shall be included |
| 15 | * in all copies or substantial portions of the Software. |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 16 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 21 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #ifndef _M_TRANSLATE_H_ |
| 27 | #define _M_TRANSLATE_H_ |
| 28 | |
Brian | c223c6b | 2007-07-04 13:15:20 -0600 | [diff] [blame] | 29 | #include "main/config.h" |
| 30 | #include "main/mtypes.h" /* hack for GLchan */ |
Brian Paul | 5a9026c | 2000-11-17 21:01:25 +0000 | [diff] [blame] | 31 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 32 | |
Brian Paul | c87809c | 2006-04-05 03:29:46 +0000 | [diff] [blame] | 33 | /** |
| 34 | * Array translation. |
| 35 | * For example, convert array of GLushort[3] to GLfloat[4]. |
| 36 | * The function name specifies the destination format/size. |
| 37 | * \param to the destination address |
| 38 | * \param ptr the source address |
| 39 | * \param stride the source stride (in bytes) between elements |
| 40 | * \param type the source datatype (GL_SHORT, GL_UNSIGNED_INT, etc) |
| 41 | * \param size number of values per element in source array (1,2,3 or 4) |
| 42 | * \param start first element in source array to convert |
| 43 | * \param n number of elements to convert |
| 44 | * |
| 45 | * Note: "element" means a tuple like GLfloat[3] or GLubyte[4]. |
| 46 | */ |
| 47 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 48 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 49 | extern void _math_trans_1f(GLfloat *to, |
| 50 | CONST void *ptr, |
| 51 | GLuint stride, |
| 52 | GLenum type, |
| 53 | GLuint start, |
| 54 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 55 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 56 | extern void _math_trans_1ui(GLuint *to, |
| 57 | CONST void *ptr, |
| 58 | GLuint stride, |
| 59 | GLenum type, |
| 60 | GLuint start, |
| 61 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 62 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 63 | extern void _math_trans_1ub(GLubyte *to, |
| 64 | CONST void *ptr, |
| 65 | GLuint stride, |
| 66 | GLenum type, |
| 67 | GLuint start, |
| 68 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 69 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 70 | extern void _math_trans_4ub(GLubyte (*to)[4], |
| 71 | CONST void *ptr, |
| 72 | GLuint stride, |
| 73 | GLenum type, |
| 74 | GLuint size, |
| 75 | GLuint start, |
| 76 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 77 | |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 78 | extern void _math_trans_4chan( GLchan (*to)[4], |
| 79 | CONST void *ptr, |
| 80 | GLuint stride, |
| 81 | GLenum type, |
| 82 | GLuint size, |
| 83 | GLuint start, |
| 84 | GLuint n ); |
| 85 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 86 | extern void _math_trans_4us(GLushort (*to)[4], |
| 87 | CONST void *ptr, |
| 88 | GLuint stride, |
| 89 | GLenum type, |
| 90 | GLuint size, |
| 91 | GLuint start, |
| 92 | GLuint n ); |
| 93 | |
Brian Paul | c87809c | 2006-04-05 03:29:46 +0000 | [diff] [blame] | 94 | /** Convert to floats w/out normalization (i.e. just cast) */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 95 | extern void _math_trans_4f(GLfloat (*to)[4], |
| 96 | CONST void *ptr, |
| 97 | GLuint stride, |
| 98 | GLenum type, |
| 99 | GLuint size, |
| 100 | GLuint start, |
| 101 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 102 | |
Brian Paul | c87809c | 2006-04-05 03:29:46 +0000 | [diff] [blame] | 103 | /** Convert to normalized floats in [0,1] or [-1, 1] */ |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 104 | extern void _math_trans_4fn(GLfloat (*to)[4], |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame] | 105 | CONST void *ptr, |
| 106 | GLuint stride, |
| 107 | GLenum type, |
| 108 | GLuint size, |
| 109 | GLuint start, |
| 110 | GLuint n ); |
| 111 | |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 112 | extern void _math_trans_3fn(GLfloat (*to)[3], |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 113 | CONST void *ptr, |
| 114 | GLuint stride, |
| 115 | GLenum type, |
| 116 | GLuint start, |
| 117 | GLuint n ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 118 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 119 | extern void _math_init_translate( void ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 120 | |
| 121 | |
| 122 | #endif |