mshtml: Fixed copy&paste typo.
[wine.git] / dlls / d3dx9_36 / math.c
blob3a9595195682834988326446f656a72f7b9e4c84
1 /*
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
21 #include "config.h"
22 #include "windef.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
25 #include "d3dx9.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)
38 unsigned int i;
39 TRACE("\n");
40 for (i = 0; i < elements; ++i) {
41 D3DXVec2Transform(
42 (D3DXVECTOR4*)((char*)out + outstride * i),
43 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
44 matrix);
46 return out;
49 /*************************************************************************
50 * D3DXVec2TransformCoordArray
52 D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray(
53 D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2* in, UINT instride,
54 CONST D3DXMATRIX* matrix, UINT elements)
56 unsigned int i;
57 TRACE("\n");
58 for (i = 0; i < elements; ++i) {
59 D3DXVec2TransformCoord(
60 (D3DXVECTOR2*)((char*)out + outstride * i),
61 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
62 matrix);
64 return out;
67 /*************************************************************************
68 * D3DXVec2TransformNormalArray
70 D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray(
71 D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2 *in, UINT instride,
72 CONST D3DXMATRIX *matrix, UINT elements)
74 unsigned int i;
75 TRACE("\n");
76 for (i = 0; i < elements; ++i) {
77 D3DXVec2TransformNormal(
78 (D3DXVECTOR2*)((char*)out + outstride * i),
79 (CONST D3DXVECTOR2*)((const char*)in + instride * i),
80 matrix);
82 return out;
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)
95 unsigned int i;
96 TRACE("\n");
97 for (i = 0; i < elements; ++i) {
98 D3DXVec3Project(
99 (D3DXVECTOR3*)((char*)out + outstride * i),
100 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
101 viewport, projection, view, world);
103 return out;
106 /*************************************************************************
107 * D3DXVec3TransformArray
109 D3DXVECTOR4* WINAPI D3DXVec3TransformArray(
110 D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
111 CONST D3DXMATRIX* matrix, UINT elements)
113 unsigned int i;
114 TRACE("\n");
115 for (i = 0; i < elements; ++i) {
116 D3DXVec3Transform(
117 (D3DXVECTOR4*)((char*)out + outstride * i),
118 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
119 matrix);
121 return out;
124 /*************************************************************************
125 * D3DXVec3TransformCoordArray
127 D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray(
128 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
129 CONST D3DXMATRIX* matrix, UINT elements)
131 unsigned int i;
132 TRACE("\n");
133 for (i = 0; i < elements; ++i) {
134 D3DXVec3TransformCoord(
135 (D3DXVECTOR3*)((char*)out + outstride * i),
136 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
137 matrix);
139 return out;
142 /*************************************************************************
143 * D3DXVec3TransformNormalArray
145 D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(
146 D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
147 CONST D3DXMATRIX* matrix, UINT elements)
149 unsigned int i;
150 TRACE("\n");
151 for (i = 0; i < elements; ++i) {
152 D3DXVec3TransformNormal(
153 (D3DXVECTOR3*)((char*)out + outstride * i),
154 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
155 matrix);
157 return out;
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)
168 unsigned int i;
169 TRACE("\n");
170 for (i = 0; i < elements; ++i) {
171 D3DXVec3Unproject(
172 (D3DXVECTOR3*)((char*)out + outstride * i),
173 (CONST D3DXVECTOR3*)((const char*)in + instride * i),
174 viewport, projection, view, world);
176 return out;
179 /*************************************************************************
180 * D3DXVec4TransformArray
182 D3DXVECTOR4* WINAPI D3DXVec4TransformArray(
183 D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR4* in, UINT instride,
184 CONST D3DXMATRIX* matrix, UINT elements)
186 unsigned int i;
187 TRACE("\n");
188 for (i = 0; i < elements; ++i) {
189 D3DXVec4Transform(
190 (D3DXVECTOR4*)((char*)out + outstride * i),
191 (CONST D3DXVECTOR4*)((const char*)in + instride * i),
192 matrix);
194 return out;