2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
26 #ifndef _M_TRANSLATE_H_
27 #define _M_TRANSLATE_H_
29 #include "main/compiler.h"
30 #include "main/glheader.h"
34 * For example, convert array of GLushort[3] to GLfloat[4].
35 * The function name specifies the destination format/size.
36 * \param to the destination address
37 * \param ptr the source address
38 * \param stride the source stride (in bytes) between elements
39 * \param type the source datatype (GL_SHORT, GL_UNSIGNED_INT, etc)
40 * \param size number of values per element in source array (1,2,3 or 4)
41 * \param start first element in source array to convert
42 * \param n number of elements to convert
44 * Note: "element" means a tuple like GLfloat[3] or GLubyte[4].
48 extern void _math_trans_1f(GLfloat
*to
,
55 extern void _math_trans_1ui(GLuint
*to
,
62 extern void _math_trans_1ub(GLubyte
*to
,
69 extern void _math_trans_4ub(GLubyte (*to
)[4],
77 extern void _math_trans_4us(GLushort (*to
)[4],
85 /** Convert to floats w/out normalization (i.e. just cast) */
86 extern void _math_trans_4f(GLfloat (*to
)[4],
94 /** Convert to normalized floats in [0,1] or [-1, 1] */
95 extern void _math_trans_4fn(GLfloat (*to
)[4],
103 extern void _math_trans_3fn(GLfloat (*to
)[3],
110 extern void _math_init_translate( void );