1848b8605Smrg
2848b8605Smrg/*
3848b8605Smrg * Mesa 3-D graphics library
4848b8605Smrg *
5848b8605Smrg * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
6848b8605Smrg *
7848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
8848b8605Smrg * copy of this software and associated documentation files (the "Software"),
9848b8605Smrg * to deal in the Software without restriction, including without limitation
10848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
12848b8605Smrg * Software is furnished to do so, subject to the following conditions:
13848b8605Smrg *
14848b8605Smrg * The above copyright notice and this permission notice shall be included
15848b8605Smrg * in all copies or substantial portions of the Software.
16848b8605Smrg *
17848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE.
24848b8605Smrg *
25848b8605Smrg * Authors:
26848b8605Smrg *    Gareth Hughes
27848b8605Smrg */
28848b8605Smrg
29848b8605Smrg#ifndef X86_XFORM_H
30848b8605Smrg#define X86_XFORM_H
31848b8605Smrg
32848b8605Smrg
33848b8605Smrg/* =============================================================
34848b8605Smrg * Transformation function declarations:
35848b8605Smrg */
36848b8605Smrg
37848b8605Smrg#define XFORM_ARGS	GLvector4f *to_vec,				\
38848b8605Smrg			const GLfloat m[16],				\
39848b8605Smrg			const GLvector4f *from_vec
40848b8605Smrg
41848b8605Smrg#define DECLARE_XFORM_GROUP( pfx, sz ) \
42b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS );		\
43b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS );	\
44b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS );	\
45b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS );	\
46b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS );		\
47b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS );	\
48b8e80941Smrgextern void _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS );
49848b8605Smrg
50848b8605Smrg#define ASSIGN_XFORM_GROUP( pfx, sz )					\
51848b8605Smrg   _mesa_transform_tab[sz][MATRIX_GENERAL] =				\
52848b8605Smrg      _mesa_##pfx##_transform_points##sz##_general;			\
53848b8605Smrg   _mesa_transform_tab[sz][MATRIX_IDENTITY] =				\
54848b8605Smrg      _mesa_##pfx##_transform_points##sz##_identity;			\
55848b8605Smrg   _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] =				\
56848b8605Smrg      _mesa_##pfx##_transform_points##sz##_3d_no_rot;			\
57848b8605Smrg   _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] =			\
58848b8605Smrg      _mesa_##pfx##_transform_points##sz##_perspective;			\
59848b8605Smrg   _mesa_transform_tab[sz][MATRIX_2D] =					\
60848b8605Smrg      _mesa_##pfx##_transform_points##sz##_2d;				\
61848b8605Smrg   _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] =				\
62848b8605Smrg      _mesa_##pfx##_transform_points##sz##_2d_no_rot;			\
63848b8605Smrg   _mesa_transform_tab[sz][MATRIX_3D] =					\
64848b8605Smrg      _mesa_##pfx##_transform_points##sz##_3d;
65848b8605Smrg
66848b8605Smrg
67848b8605Smrg/* =============================================================
68848b8605Smrg * Normal transformation function declarations:
69848b8605Smrg */
70848b8605Smrg
71848b8605Smrg#define NORM_ARGS	const GLmatrix *mat,				\
72848b8605Smrg			GLfloat scale,					\
73848b8605Smrg			const GLvector4f *in,				\
74848b8605Smrg			const GLfloat *lengths,				\
75848b8605Smrg			GLvector4f *dest
76848b8605Smrg
77848b8605Smrg#define DECLARE_NORM_GROUP( pfx ) \
78b8e80941Smrgextern void _mesa_##pfx##_rescale_normals( NORM_ARGS );				\
79b8e80941Smrgextern void _mesa_##pfx##_normalize_normals( NORM_ARGS );			\
80b8e80941Smrgextern void _mesa_##pfx##_transform_normals( NORM_ARGS );			\
81b8e80941Smrgextern void _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS );		\
82b8e80941Smrgextern void _mesa_##pfx##_transform_rescale_normals( NORM_ARGS );		\
83b8e80941Smrgextern void _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS );	\
84b8e80941Smrgextern void _mesa_##pfx##_transform_normalize_normals( NORM_ARGS );		\
85b8e80941Smrgextern void _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS );
86848b8605Smrg
87848b8605Smrg#define ASSIGN_NORM_GROUP( pfx )					\
88848b8605Smrg   _mesa_normal_tab[NORM_RESCALE] =					\
89848b8605Smrg      _mesa_##pfx##_rescale_normals;					\
90848b8605Smrg   _mesa_normal_tab[NORM_NORMALIZE] =					\
91848b8605Smrg      _mesa_##pfx##_normalize_normals;					\
92848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM] =					\
93848b8605Smrg      _mesa_##pfx##_transform_normals;					\
94848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =				\
95848b8605Smrg      _mesa_##pfx##_transform_normals_no_rot;				\
96848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =			\
97848b8605Smrg      _mesa_##pfx##_transform_rescale_normals;				\
98848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =		\
99848b8605Smrg      _mesa_##pfx##_transform_rescale_normals_no_rot;			\
100848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =			\
101848b8605Smrg      _mesa_##pfx##_transform_normalize_normals;			\
102848b8605Smrg   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =		\
103848b8605Smrg      _mesa_##pfx##_transform_normalize_normals_no_rot;
104848b8605Smrg
105848b8605Smrg
106848b8605Smrg#endif
107