2 * Mathematical operations specific to D3DX9.
4 * Copyright (C) 2008 Philip Nilsson
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
29 /*************************************************************************
30 * D3DXVec2TransformArray
32 * Transform an array of vectors by a matrix.
34 D3DXVECTOR4* WINAPI D3DXVec2TransformArray(
35 D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR2* in, UINT instride,
36 CONST D3DXMATRIX* matrix, UINT elements)
40 for (i = 0; i < elements; ++i) {
42 (D3DXVECTOR4*)((char*)out + outstride * i),
43 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
49 /*************************************************************************
50 * D3DXVec2TransformCoordArray
52 D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray(
53 D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2* in, UINT instride,
54 CONST D3DXMATRIX* matrix, UINT elements)
58 for (i = 0; i < elements; ++i) {
59 D3DXVec2TransformCoord(
60 (D3DXVECTOR2*)((char*)out + outstride * i),
61 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
67 /*************************************************************************
68 * D3DXVec2TransformNormalArray
70 D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray(
71 D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2 *in, UINT instride,
72 CONST D3DXMATRIX *matrix, UINT elements)
76 for (i = 0; i < elements; ++i) {
77 D3DXVec2TransformNormal(
78 (D3DXVECTOR2*)((char*)out + outstride * i),
79 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
85 /*************************************************************************
86 * D3DXVec3ProjectArray
88 * Projects an array of vectors to the screen.
90 D3DXVECTOR3* WINAPI D3DXVec3ProjectArray(
91 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
92 CONST D3DVIEWPORT9* viewport, CONST D3DXMATRIX* projection,
93 CONST D3DXMATRIX* view, CONST D3DXMATRIX* world, UINT elements)
97 for (i = 0; i < elements; ++i) {
99 (D3DXVECTOR3*)((char*)out + outstride * i),
100 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
101 viewport, projection, view, world);
106 /*************************************************************************
107 * D3DXVec3TransformArray
109 D3DXVECTOR4* WINAPI D3DXVec3TransformArray(
110 D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
111 CONST D3DXMATRIX* matrix, UINT elements)
115 for (i = 0; i < elements; ++i) {
117 (D3DXVECTOR4*)((char*)out + outstride * i),
118 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
124 /*************************************************************************
125 * D3DXVec3TransformCoordArray
127 D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray(
128 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
129 CONST D3DXMATRIX* matrix, UINT elements)
133 for (i = 0; i < elements; ++i) {
134 D3DXVec3TransformCoord(
135 (D3DXVECTOR3*)((char*)out + outstride * i),
136 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
142 /*************************************************************************
143 * D3DXVec3TransformNormalArray
145 D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(
146 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
147 CONST D3DXMATRIX* matrix, UINT elements)
151 for (i = 0; i < elements; ++i) {
152 D3DXVec3TransformNormal(
153 (D3DXVECTOR3*)((char*)out + outstride * i),
154 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
160 /*************************************************************************
161 * D3DXVec3UnprojectArray
163 D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray(
164 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
165 CONST D3DVIEWPORT9* viewport, CONST D3DXMATRIX* projection,
166 CONST D3DXMATRIX* view, CONST D3DXMATRIX* world, UINT elements)
170 for (i = 0; i < elements; ++i) {
172 (D3DXVECTOR3*)((char*)out + outstride * i),
173 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
174 viewport, projection, view, world);
179 /*************************************************************************
180 * D3DXVec4TransformArray
182 D3DXVECTOR4* WINAPI D3DXVec4TransformArray(
183 D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR4* in, UINT instride,
184 CONST D3DXMATRIX* matrix, UINT elements)
188 for (i = 0; i < elements; ++i) {
190 (D3DXVECTOR4*)((char*)out + outstride * i),
191 (CONST D3DXVECTOR4*)((const char*)in + instride * i),