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/glheader.h"
33 * For example, convert array of GLushort[3] to GLfloat[4].
34 * The function name specifies the destination format/size.
35 * \param to the destination address
36 * \param ptr the source address
37 * \param stride the source stride (in bytes) between elements
38 * \param type the source datatype (GL_SHORT, GL_UNSIGNED_INT, etc)
39 * \param size number of values per element in source array (1,2,3 or 4)
40 * \param start first element in source array to convert
41 * \param n number of elements to convert
43 * Note: "element" means a tuple like GLfloat[3] or GLubyte[4].
47 extern void _math_trans_1f(GLfloat
*to
,
54 extern void _math_trans_1ui(GLuint
*to
,
61 extern void _math_trans_1ub(GLubyte
*to
,
68 extern void _math_trans_4ub(GLubyte (*to
)[4],
76 extern void _math_trans_4us(GLushort (*to
)[4],
84 /** Convert to floats w/out normalization (i.e. just cast) */
85 extern void _math_trans_4f(GLfloat (*to
)[4],
93 /** Convert to normalized floats in [0,1] or [-1, 1] */
94 extern void _math_trans_4fn(GLfloat (*to
)[4],
102 extern void _math_trans_3fn(GLfloat (*to
)[3],
109 extern void _math_init_translate( void );