shell32: Fix the Ukrainian translation.
[wine] / dlls / d3dx9_36 / math.c
1 /*
2  * Mathematical operations specific to D3DX9.
3  *
4  * Copyright (C) 2008 Philip Nilsson
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "config.h"
22 #include "windef.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
25 #include "d3dx9.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
28
29 /*************************************************************************
30  * D3DXVec2TransformArray
31  *
32  * Transform an array of vectors by a matrix.
33  */
34 D3DXVECTOR4* WINAPI D3DXVec2TransformArray(
35     D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR2* in, UINT instride,
36     CONST D3DXMATRIX* matrix, UINT elements)
37 {
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);
45     }
46     return out;
47 }
48
49 /*************************************************************************
50  * D3DXVec2TransformCoordArray
51  */
52 D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray(
53     D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2* in, UINT instride,
54     CONST D3DXMATRIX* matrix, UINT elements)
55 {
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);
63     }
64     return out;
65 }
66
67 /*************************************************************************
68  * D3DXVec2TransformNormalArray
69  */
70 D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray(
71     D3DXVECTOR2* out, UINT outstride, CONST D3DXVECTOR2 *in, UINT instride,
72     CONST D3DXMATRIX *matrix, UINT elements)
73 {
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);
81     }
82     return out;
83 }
84
85 /*************************************************************************
86  * D3DXVec3ProjectArray
87  *
88  * Projects an array of vectors to the screen.
89  */
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)
94 {
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);
102     }
103     return out;
104 }
105
106 /*************************************************************************
107  * D3DXVec3TransformArray
108  */
109 D3DXVECTOR4* WINAPI D3DXVec3TransformArray(
110     D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
111     CONST D3DXMATRIX* matrix, UINT elements)
112 {
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);
120     }
121     return out;
122 }
123
124 /*************************************************************************
125  * D3DXVec3TransformCoordArray
126  */
127 D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray(
128     D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
129     CONST D3DXMATRIX* matrix, UINT elements)
130 {
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);
138     }
139     return out;
140 }
141
142 /*************************************************************************
143  * D3DXVec3TransformNormalArray
144  */
145 D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(
146     D3DXVECTOR3* out, UINT outstride, CONST D3DXVECTOR3* in, UINT instride,
147     CONST D3DXMATRIX* matrix, UINT elements)
148 {
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);
156     }
157     return out;
158 }
159
160 /*************************************************************************
161  * D3DXVec3UnprojectArray
162  */
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)
167 {
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);
175     }
176     return out;
177 }
178
179 /*************************************************************************
180  * D3DXVec4TransformArray
181  */
182 D3DXVECTOR4* WINAPI D3DXVec4TransformArray(
183     D3DXVECTOR4* out, UINT outstride, CONST D3DXVECTOR4* in, UINT instride,
184     CONST D3DXMATRIX* matrix, UINT elements)
185 {
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);
193     }
194     return out;
195 }