Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1f85d64b
Commit
1f85d64b
authored
Sep 17, 2012
by
Nozomi Kodama
Committed by
Alexandre Julliard
Sep 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXSHRotate.
parent
c69a4964
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
1 deletion
+163
-1
d3dx9_36.spec
dlls/d3dx9_36/d3dx9_36.spec
+1
-1
math.c
dlls/d3dx9_36/math.c
+94
-0
math.c
dlls/d3dx9_36/tests/math.c
+67
-0
d3dx9math.h
include/d3dx9math.h
+1
-0
No files found.
dlls/d3dx9_36/d3dx9_36.spec
View file @
1f85d64b
...
...
@@ -287,7 +287,7 @@
@ stub D3DXSHProjectCubeMap(long ptr ptr ptr ptr)
@ stub D3DXSHPRTCompSplitMeshSC(ptr long long ptr long ptr long long ptr ptr long ptr ptr ptr ptr ptr)
@ stub D3DXSHPRTCompSuperCluster(ptr ptr long long ptr ptr)
@ st
ub
D3DXSHRotate(ptr long ptr ptr)
@ st
dcall
D3DXSHRotate(ptr long ptr ptr)
@ stdcall D3DXSHRotateZ(ptr long float ptr)
@ stdcall D3DXSHScale(ptr long ptr float)
@ stub D3DXSimplifyMesh(ptr ptr ptr ptr long long ptr)
...
...
dlls/d3dx9_36/math.c
View file @
1f85d64b
...
...
@@ -2372,6 +2372,100 @@ FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, CONST FLOAT *a, CONST FLOAT *b)
return
out
;
}
static
void
rotate_X
(
FLOAT
*
out
,
UINT
order
,
FLOAT
a
,
FLOAT
*
in
)
{
out
[
0
]
=
in
[
0
];
if
(
order
<
2
)
return
;
out
[
1
]
=
a
*
in
[
2
];
out
[
2
]
=
-
a
*
in
[
1
];
out
[
3
]
=
in
[
3
];
if
(
order
==
2
)
return
;
out
[
4
]
=
a
*
in
[
7
];
out
[
5
]
=
-
in
[
5
];
out
[
6
]
=
-
0
.
5
f
*
in
[
6
]
-
0
.
8660253882
f
*
in
[
8
];
out
[
7
]
=
-
a
*
in
[
4
];
out
[
8
]
=
-
0
.
8660253882
f
*
in
[
6
]
+
0
.
5
f
*
in
[
8
];
out
[
9
]
=
-
a
*
0
.
7905694842
f
*
in
[
12
]
+
a
*
0
.
6123724580
f
*
in
[
14
];
if
(
order
==
3
)
return
;
out
[
10
]
=
-
in
[
10
];
out
[
11
]
=
-
a
*
0
.
6123724580
f
*
in
[
12
]
-
a
*
0
.
7905694842
f
*
in
[
14
];
out
[
12
]
=
a
*
0
.
7905694842
f
*
in
[
9
]
+
a
*
0
.
6123724580
f
*
in
[
11
];
out
[
13
]
=
-
0
.
25
f
*
in
[
13
]
-
0
.
9682458639
f
*
in
[
15
];
out
[
14
]
=
-
a
*
0
.
6123724580
f
*
in
[
9
]
+
a
*
0
.
7905694842
f
*
in
[
11
];
out
[
15
]
=
-
0
.
9682458639
f
*
in
[
13
]
+
0
.
25
f
*
in
[
15
];
if
(
order
==
4
)
return
;
out
[
16
]
=
-
a
*
0
.
9354143739
f
*
in
[
21
]
+
a
*
0
.
3535533845
f
*
in
[
23
];
out
[
17
]
=
-
0
.
75
f
*
in
[
17
]
+
0
.
6614378095
f
*
in
[
19
];
out
[
18
]
=
-
a
*
0
.
3535533845
f
*
in
[
21
]
-
a
*
0
.
9354143739
f
*
in
[
23
];
out
[
19
]
=
0
.
6614378095
f
*
in
[
17
]
+
0
.
75
f
*
in
[
19
];
out
[
20
]
=
0
.
375
f
*
in
[
20
]
+
0
.
5590170026
f
*
in
[
22
]
+
0
.
7395099998
f
*
in
[
24
];
out
[
21
]
=
a
*
0
.
9354143739
f
*
in
[
16
]
+
a
*
0
.
3535533845
f
*
in
[
18
];
out
[
22
]
=
0
.
5590170026
f
*
in
[
20
]
+
0
.
5
f
*
in
[
22
]
-
0
.
6614378691
f
*
in
[
24
];
out
[
23
]
=
-
a
*
0
.
3535533845
f
*
in
[
16
]
+
a
*
0
.
9354143739
f
*
in
[
18
];
out
[
24
]
=
0
.
7395099998
f
*
in
[
20
]
-
0
.
6614378691
f
*
in
[
22
]
+
0
.
125
f
*
in
[
24
];
if
(
order
==
5
)
return
;
out
[
25
]
=
a
*
0
.
7015607357
f
*
in
[
30
]
-
a
*
0
.
6846531630
f
*
in
[
32
]
+
a
*
0
.
1976423711
f
*
in
[
34
];
out
[
26
]
=
-
0
.
5
f
*
in
[
26
]
+
0
.
8660253882
f
*
in
[
28
];
out
[
27
]
=
a
*
0
.
5229125023
f
*
in
[
30
]
+
a
*
0
.
3061861992
f
*
in
[
32
]
-
a
*
0
.
7954951525
*
in
[
34
];
out
[
28
]
=
0
.
8660253882
f
*
in
[
26
]
+
0
.
5
f
*
in
[
28
];
out
[
29
]
=
a
*
0
.
4841229022
f
*
in
[
30
]
+
a
*
0
.
6614378691
f
*
in
[
32
]
+
a
*
0
.
5728219748
f
*
in
[
34
];
out
[
30
]
=
-
a
*
0
.
7015607357
f
*
in
[
25
]
-
a
*
0
.
5229125023
f
*
in
[
27
]
-
a
*
0
.
4841229022
f
*
in
[
29
];
out
[
31
]
=
0
.
125
f
*
in
[
31
]
+
0
.
4050463140
f
*
in
[
33
]
+
0
.
9057110548
f
*
in
[
35
];
out
[
32
]
=
a
*
0
.
6846531630
f
*
in
[
25
]
-
a
*
0
.
3061861992
f
*
in
[
27
]
-
a
*
0
.
6614378691
f
*
in
[
29
];
out
[
33
]
=
0
.
4050463140
f
*
in
[
31
]
+
0
.
8125
f
*
in
[
33
]
-
0
.
4192627370
f
*
in
[
35
];
out
[
34
]
=
-
a
*
0
.
1976423711
f
*
in
[
25
]
+
a
*
0
.
7954951525
f
*
in
[
27
]
-
a
*
0
.
5728219748
f
*
in
[
29
];
out
[
35
]
=
0
.
9057110548
f
*
in
[
31
]
-
0
.
4192627370
f
*
in
[
33
]
+
0
.
0624
999329
f
*
in
[
35
];
}
FLOAT
*
WINAPI
D3DXSHRotate
(
FLOAT
*
out
,
UINT
order
,
CONST
D3DXMATRIX
*
matrix
,
CONST
FLOAT
*
in
)
{
FLOAT
alpha
,
beta
,
gamma
,
sinb
,
temp
[
36
];
TRACE
(
"out %p, order %u, matrix %p, in %p
\n
"
,
out
,
order
,
matrix
,
in
);
out
[
0
]
=
in
[
0
];
if
(
(
order
>
D3DXSH_MAXORDER
)
||
(
order
<
D3DXSH_MINORDER
)
)
return
out
;
/* TODO: Implement handy computations for order <= 3. They are faster than the general algorithm. */
if
(
order
<
4
)
WARN
(
"Using general algorithm for order = %u
\n
"
,
order
);
if
(
fabsf
(
matrix
->
u
.
m
[
2
][
2
]
)
!=
1
.
0
f
)
{
sinb
=
sqrtf
(
1
.
0
f
-
matrix
->
u
.
m
[
2
][
2
]
*
matrix
->
u
.
m
[
2
][
2
]
);
alpha
=
atan2f
(
matrix
->
u
.
m
[
2
][
1
]
/
sinb
,
matrix
->
u
.
m
[
2
][
0
]
/
sinb
);
beta
=
atan2f
(
sinb
,
matrix
->
u
.
m
[
2
][
2
]
);
gamma
=
atan2f
(
matrix
->
u
.
m
[
1
][
2
]
/
sinb
,
-
matrix
->
u
.
m
[
0
][
2
]
/
sinb
);
}
else
{
alpha
=
atan2f
(
matrix
->
u
.
m
[
0
][
1
],
matrix
->
u
.
m
[
0
][
0
]
);
beta
=
0
.
0
f
;
gamma
=
0
.
0
f
;
}
D3DXSHRotateZ
(
out
,
order
,
gamma
,
in
);
rotate_X
(
temp
,
order
,
1
.
0
f
,
out
);
D3DXSHRotateZ
(
out
,
order
,
beta
,
temp
);
rotate_X
(
temp
,
order
,
-
1
.
0
f
,
out
);
D3DXSHRotateZ
(
out
,
order
,
alpha
,
temp
);
return
out
;
}
FLOAT
*
WINAPI
D3DXSHRotateZ
(
FLOAT
*
out
,
UINT
order
,
FLOAT
angle
,
CONST
FLOAT
*
in
)
{
FLOAT
c1a
,
c2a
,
c3a
,
c4a
,
c5a
,
s1a
,
s2a
,
s3a
,
s4a
,
s5a
;
...
...
dlls/d3dx9_36/tests/math.c
View file @
1f85d64b
...
...
@@ -2640,6 +2640,72 @@ static void test_D3DXSHMultiply3(void)
ok
(
relative_error
(
c
[
i
],
expected
[
i
])
<
admitted_error
,
"Expected[%d] = %f, received = %f
\n
"
,
i
,
expected
[
i
],
c
[
i
]);
}
static
void
test_D3DXSHRotate
(
void
)
{
D3DXMATRIX
m
[
4
];
FLOAT
expected
,
in
[
49
],
out
[
49
],
*
received_ptr
;
static
const
FLOAT
table
[]
=
{
/* Rotation around X-axis Pi/2 */
1
.
01
f
,
-
3
.
01
f
,
2
.
01
f
,
4
.
01
f
,
-
8
.
01
f
,
-
6
.
01
f
,
-
11
.
307890
f
,
5
.
01
f
,
-
1
.
565839
f
,
1
.
093598
f
,
-
11
.
01
f
,
19
.
833414
f
,
-
15
.
268191
f
,
-
19
.
00411
8
f
,
-
3
.
364889
f
,
-
9
.
562627
f
,
12
.
099654
f
,
-
0
.
272131
f
,
30
.
241013
f
,
26
.
919991
f
,
39
.
236877
f
,
-
22
.
632446
f
,
6
.
707388
f
,
-
11
.
768282
f
,
3
.
443672
f
,
-
6
.
07445
f
,
11
.
61839
f
,
1
.
527561
f
,
37
.
89633
f
,
-
56
.
9012
f
,
47
.
42289
f
,
50
.
39153
f
,
10
.
61819
f
,
25
.
50101
f
,
0
.
04
9241
f
,
16
.
98330
f
,
/* Rotation around X-axis -Pi/2 */
1
.
01
f
,
3
.
01
f
,
-
2
.
01
f
,
4
.
01
f
,
8
.
01
f
,
-
6
.
01
f
,
-
11
.
307890
f
,
-
5
.
01
f
,
-
1
.
565839
f
,
-
1
.
093598
f
,
-
11
.
01
f
,
-
19
.
833414
f
,
15
.
268191
f
,
-
19
.
00411
8
f
,
3
.
364889
f
,
-
9
.
562627
f
,
-
12
.
099654
f
,
-
0
.
272131
f
,
-
30
.
241013
f
,
26
.
919991
f
,
39
.
236877
f
,
22
.
632446
f
,
6
.
707388
f
,
11
.
768282
f
,
3
.
443672
f
,
6
.
07445
f
,
11
.
61839
f
,
-
1
.
527561
f
,
37
.
89633
f
,
56
.
9012
f
,
-
47
.
42289
f
,
50
.
39153
f
,
-
10
.
61819
f
,
25
.
50101
f
,
-
0
.
04
9248
f
,
16
.
98330
f
,
/* Yaw Pi/3, Pitch Pi/4, Roll Pi/5 */
1
.
01
f
,
4
.
944899
f
,
1
.
442301
f
,
1
.
627281
f
,
0
.
219220
f
,
10
.
540824
f
,
-
9
.
136903
f
,
2
.
763750
f
,
-
7
.
30904
f
,
-
5
.
875721
f
,
5
.
303124
f
,
-
8
.
682154
f
,
-
25
.
683384
f
,
1
.
680279
f
,
-
18
.
808388
f
,
7
.
653656
f
,
16
.
939133
f
,
-
17
.
328018
f
,
14
.
629795
f
,
-
54
.
467102
f
,
-
12
.
231035
f
,
-
4
.
089857
f
,
-
9
.
444222
f
,
3
.
056035
f
,
0
.
179257
f
,
-
10
.
041
875
f
,
23
.
090092
f
,
-
23
.
188709
f
,
11
.
727098
f
,
-
65
.
183090
f
,
48
.
671577
f
,
-
15
.
07320
9
f
,
38
.
793171
f
,
-
26
.
03
9536
f
,
6
.
192769
f
,
-
17
.
672247
f
,
/* Rotation around Z-axis Pi/6 */
1
.
01
f
,
3
.
745711
f
,
3
.
01
f
,
2
.
467762
f
,
10
.
307889
f
,
9
.
209813
f
,
7
.
01
f
,
3
.
931864
f
,
0
.
166212
f
,
16
.
01
f
,
18
.
504042
f
,
17
.
405966
f
,
13
.
01
f
,
6
.
128016
f
,
-
2
.
02
9941
f
,
-
10
.
01
f
,
13
.
154292
f
,
24
.
01
f
,
29
.
432245
f
,
28
.
334167
f
,
21
.
01
f
,
9
.
056221
f
,
-
4
.
958143
f
,
-
18
.
01
f
,
-
27
.
236094
f
,
-
4
.
520332
f
,
16
.
814543
f
,
34
.
01
f
,
43
.
092495
f
,
41
.
994423
f
,
31
.
01
f
,
12
.
716471
f
,
-
8
.
618400
f
,
-
28
.
01
f
,
-
40
.
896347
f
,
-
44
.
190571
,};
unsigned
int
i
,
j
,
order
;
D3DXMatrixRotationX
(
&
m
[
0
],
-
D3DX_PI
/
2
.
0
f
);
D3DXMatrixRotationX
(
&
m
[
1
],
D3DX_PI
/
2
.
0
f
);
D3DXMatrixRotationYawPitchRoll
(
&
m
[
2
],
D3DX_PI
/
3
.
0
f
,
D3DX_PI
/
4
.
0
f
,
D3DX_PI
/
5
.
0
f
);
D3DXMatrixRotationZ
(
&
m
[
3
],
D3DX_PI
/
6
.
0
f
);
for
(
i
=
0
;
i
<
49
;
i
++
)
in
[
i
]
=
i
+
1
.
01
f
;
for
(
j
=
0
;
j
<
4
;
j
++
)
{
for
(
order
=
0
;
order
<=
D3DXSH_MAXORDER
;
order
++
)
{
for
(
i
=
0
;
i
<
49
;
i
++
)
out
[
i
]
=
(
i
+
1
.
0
f
)
*
(
i
+
1
.
0
f
);
received_ptr
=
D3DXSHRotate
(
out
,
order
,
&
m
[
j
],
in
);
ok
(
received_ptr
==
out
,
"Order %u, expected %p, received %p
\n
"
,
order
,
out
,
received_ptr
);
for
(
i
=
0
;
i
<
49
;
i
++
)
{
if
(
(
i
>
0
)
&&
(
(
i
>=
order
*
order
)
||
(
order
>
D3DXSH_MAXORDER
)
)
)
expected
=
(
i
+
1
.
0
f
)
*
(
i
+
1
.
0
f
);
else
expected
=
table
[
36
*
j
+
i
];
ok
(
relative_error
(
out
[
i
],
expected
)
<
admitted_error
,
"Order %u index %u, expected %f, received %f
\n
"
,
order
,
i
,
expected
,
out
[
i
]);
}
}
}
}
static
void
test_D3DXSHRotateZ
(
void
)
{
unsigned
int
i
,
j
,
order
,
square
;
...
...
@@ -2740,6 +2806,7 @@ START_TEST(math)
test_D3DXSHEvalDirectionalLight
();
test_D3DXSHMultiply2
();
test_D3DXSHMultiply3
();
test_D3DXSHRotate
();
test_D3DXSHRotateZ
();
test_D3DXSHScale
();
}
include/d3dx9math.h
View file @
1f85d64b
...
...
@@ -383,6 +383,7 @@ FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, CONST D3DXVECTOR3 *dir
HRESULT
WINAPI
D3DXSHEvalDirectionalLight
(
UINT
order
,
CONST
D3DXVECTOR3
*
dir
,
FLOAT
Rintensity
,
FLOAT
Gintensity
,
FLOAT
Bintensity
,
FLOAT
*
rout
,
FLOAT
*
gout
,
FLOAT
*
bout
);
FLOAT
*
WINAPI
D3DXSHMultiply2
(
FLOAT
*
out
,
CONST
FLOAT
*
a
,
CONST
FLOAT
*
b
);
FLOAT
*
WINAPI
D3DXSHMultiply3
(
FLOAT
*
out
,
CONST
FLOAT
*
a
,
CONST
FLOAT
*
b
);
FLOAT
*
WINAPI
D3DXSHRotate
(
FLOAT
*
out
,
UINT
order
,
CONST
D3DXMATRIX
*
matrix
,
CONST
FLOAT
*
in
);
FLOAT
*
WINAPI
D3DXSHRotateZ
(
FLOAT
*
out
,
UINT
order
,
FLOAT
angle
,
CONST
FLOAT
*
in
);
FLOAT
*
WINAPI
D3DXSHScale
(
FLOAT
*
out
,
UINT
order
,
CONST
FLOAT
*
a
,
CONST
FLOAT
scale
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment