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
35ada0dc
Commit
35ada0dc
authored
Jul 11, 2009
by
David Adam
Committed by
Alexandre Julliard
Jul 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Merge d3dx8 mesh tests into d3dx9.
parent
40c6cf77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
368 additions
and
0 deletions
+368
-0
mesh.c
dlls/d3dx9_36/tests/mesh.c
+368
-0
No files found.
dlls/d3dx9_36/tests/mesh.c
View file @
35ada0dc
/*
* Copyright 2008 David Adam
* Copyright 2008 Luis Busquets
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
...
...
@@ -19,6 +21,367 @@
#include "wine/test.h"
#include "d3dx9.h"
#define admitted_error 0.0001f
#define compare_vertex_sizes(type, exp) \
got=D3DXGetFVFVertexSize(type); \
ok(got==exp, "Expected: %d, Got: %d\n", exp, got);
static
BOOL
compare
(
FLOAT
u
,
FLOAT
v
)
{
return
(
fabs
(
u
-
v
)
<
admitted_error
);
}
static
BOOL
compare_vec3
(
D3DXVECTOR3
u
,
D3DXVECTOR3
v
)
{
return
(
compare
(
u
.
x
,
v
.
x
)
&&
compare
(
u
.
y
,
v
.
y
)
&&
compare
(
u
.
z
,
v
.
z
)
);
}
static
void
D3DXBoundProbeTest
(
void
)
{
BOOL
result
;
D3DXVECTOR3
bottom_point
,
center
,
top_point
,
raydirection
,
rayposition
;
FLOAT
radius
;
/*____________Test the Box case___________________________*/
bottom_point
.
x
=
-
3
.
0
f
;
bottom_point
.
y
=
-
2
.
0
f
;
bottom_point
.
z
=
-
1
.
0
f
;
top_point
.
x
=
7
.
0
f
;
top_point
.
y
=
8
.
0
f
;
top_point
.
z
=
9
.
0
f
;
raydirection
.
x
=
-
4
.
0
f
;
raydirection
.
y
=
-
5
.
0
f
;
raydirection
.
z
=
-
6
.
0
f
;
rayposition
.
x
=
5
.
0
f
;
rayposition
.
y
=
5
.
0
f
;
rayposition
.
z
=
11
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
TRUE
,
"expected TRUE, received FALSE
\n
"
);
raydirection
.
x
=
4
.
0
f
;
raydirection
.
y
=
5
.
0
f
;
raydirection
.
z
=
6
.
0
f
;
rayposition
.
x
=
5
.
0
f
;
rayposition
.
y
=
5
.
0
f
;
rayposition
.
z
=
11
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
rayposition
.
x
=
-
4
.
0
f
;
rayposition
.
y
=
1
.
0
f
;
rayposition
.
z
=
-
2
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
TRUE
,
"expected TRUE, received FALSE
\n
"
);
bottom_point
.
x
=
1
.
0
f
;
bottom_point
.
y
=
0
.
0
f
;
bottom_point
.
z
=
0
.
0
f
;
top_point
.
x
=
1
.
0
f
;
top_point
.
y
=
0
.
0
f
;
top_point
.
z
=
0
.
0
f
;
rayposition
.
x
=
0
.
0
f
;
rayposition
.
y
=
1
.
0
f
;
rayposition
.
z
=
0
.
0
f
;
raydirection
.
x
=
0
.
0
f
;
raydirection
.
y
=
3
.
0
f
;
raydirection
.
z
=
0
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
bottom_point
.
x
=
1
.
0
f
;
bottom_point
.
y
=
2
.
0
f
;
bottom_point
.
z
=
3
.
0
f
;
top_point
.
x
=
10
.
0
f
;
top_point
.
y
=
15
.
0
f
;
top_point
.
z
=
20
.
0
f
;
raydirection
.
x
=
7
.
0
f
;
raydirection
.
y
=
8
.
0
f
;
raydirection
.
z
=
9
.
0
f
;
rayposition
.
x
=
3
.
0
f
;
rayposition
.
y
=
7
.
0
f
;
rayposition
.
z
=
-
6
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
TRUE
,
"expected TRUE, received FALSE
\n
"
);
bottom_point
.
x
=
0
.
0
f
;
bottom_point
.
y
=
0
.
0
f
;
bottom_point
.
z
=
0
.
0
f
;
top_point
.
x
=
1
.
0
f
;
top_point
.
y
=
1
.
0
f
;
top_point
.
z
=
1
.
0
f
;
raydirection
.
x
=
0
.
0
f
;
raydirection
.
y
=
1
.
0
f
;
raydirection
.
z
=
.
0
f
;
rayposition
.
x
=
-
3
.
0
f
;
rayposition
.
y
=
0
.
0
f
;
rayposition
.
z
=
0
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
raydirection
.
x
=
1
.
0
f
;
raydirection
.
y
=
0
.
0
f
;
raydirection
.
z
=
.
0
f
;
rayposition
.
x
=
-
3
.
0
f
;
rayposition
.
y
=
0
.
0
f
;
rayposition
.
z
=
0
.
0
f
;
result
=
D3DXBoxBoundProbe
(
&
bottom_point
,
&
top_point
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
TRUE
,
"expected TRUE, received FALSE
\n
"
);
/*____________Test the Sphere case________________________*/
radius
=
sqrt
(
77
.
0
f
);
center
.
x
=
1
.
0
f
;
center
.
y
=
2
.
0
f
;
center
.
z
=
3
.
0
f
;
raydirection
.
x
=
2
.
0
f
;
raydirection
.
y
=
-
4
.
0
f
;
raydirection
.
z
=
2
.
0
f
;
rayposition
.
x
=
5
.
0
f
;
rayposition
.
y
=
5
.
0
f
;
rayposition
.
z
=
9
.
0
f
;
result
=
D3DXSphereBoundProbe
(
&
center
,
radius
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
TRUE
,
"expected TRUE, received FALSE
\n
"
);
rayposition
.
x
=
45
.
0
f
;
rayposition
.
y
=
-
75
.
0
f
;
rayposition
.
z
=
49
.
0
f
;
result
=
D3DXSphereBoundProbe
(
&
center
,
radius
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
rayposition
.
x
=
5
.
0
f
;
rayposition
.
y
=
11
.
0
f
;
rayposition
.
z
=
9
.
0
f
;
result
=
D3DXSphereBoundProbe
(
&
center
,
radius
,
&
rayposition
,
&
raydirection
);
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
}
static
void
D3DXComputeBoundingBoxTest
(
void
)
{
D3DXVECTOR3
exp_max
,
exp_min
,
got_max
,
got_min
,
vertex
[
5
];
HRESULT
hr
;
vertex
[
0
].
x
=
1
.
0
f
;
vertex
[
0
].
y
=
1
.
0
f
;
vertex
[
0
].
z
=
1
.
0
f
;
vertex
[
1
].
x
=
1
.
0
f
;
vertex
[
1
].
y
=
1
.
0
f
;
vertex
[
1
].
z
=
1
.
0
f
;
vertex
[
2
].
x
=
1
.
0
f
;
vertex
[
2
].
y
=
1
.
0
f
;
vertex
[
2
].
z
=
1
.
0
f
;
vertex
[
3
].
x
=
1
.
0
f
;
vertex
[
3
].
y
=
1
.
0
f
;
vertex
[
3
].
z
=
1
.
0
f
;
vertex
[
4
].
x
=
9
.
0
f
;
vertex
[
4
].
y
=
9
.
0
f
;
vertex
[
4
].
z
=
9
.
0
f
;
exp_min
.
x
=
1
.
0
f
;
exp_min
.
y
=
1
.
0
f
;
exp_min
.
z
=
1
.
0
f
;
exp_max
.
x
=
9
.
0
f
;
exp_max
.
y
=
9
.
0
f
;
exp_max
.
z
=
9
.
0
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
2
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_min
,
&
got_max
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#x
\n
"
,
hr
);
ok
(
compare_vec3
(
exp_min
,
got_min
),
"Expected min: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_min
.
x
,
exp_min
.
y
,
exp_min
.
z
,
got_min
.
x
,
got_min
.
y
,
got_min
.
z
);
ok
(
compare_vec3
(
exp_max
,
got_max
),
"Expected max: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_max
.
x
,
exp_max
.
y
,
exp_max
.
z
,
got_max
.
x
,
got_max
.
y
,
got_max
.
z
);
/*________________________*/
vertex
[
0
].
x
=
2
.
0
f
;
vertex
[
0
].
y
=
5
.
9
f
;
vertex
[
0
].
z
=
-
1
.
2
f
;
vertex
[
1
].
x
=
-
1
.
87
f
;
vertex
[
1
].
y
=
7
.
9
f
;
vertex
[
1
].
z
=
7
.
4
f
;
vertex
[
2
].
x
=
7
.
43
f
;
vertex
[
2
].
y
=
-
0
.
9
f
;
vertex
[
2
].
z
=
11
.
9
f
;
vertex
[
3
].
x
=
-
6
.
92
f
;
vertex
[
3
].
y
=
6
.
3
f
;
vertex
[
3
].
z
=
-
3
.
8
f
;
vertex
[
4
].
x
=
11
.
4
f
;
vertex
[
4
].
y
=
-
8
.
1
f
;
vertex
[
4
].
z
=
4
.
5
f
;
exp_min
.
x
=
-
6
.
92
f
;
exp_min
.
y
=
-
8
.
1
f
;
exp_min
.
z
=
-
3
.
80
f
;
exp_max
.
x
=
11
.
4
f
;
exp_max
.
y
=
7
.
90
f
;
exp_max
.
z
=
11
.
9
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
0
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_min
,
&
got_max
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#x
\n
"
,
hr
);
ok
(
compare_vec3
(
exp_min
,
got_min
),
"Expected min: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_min
.
x
,
exp_min
.
y
,
exp_min
.
z
,
got_min
.
x
,
got_min
.
y
,
got_min
.
z
);
ok
(
compare_vec3
(
exp_max
,
got_max
),
"Expected max: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_max
.
x
,
exp_max
.
y
,
exp_max
.
z
,
got_max
.
x
,
got_max
.
y
,
got_max
.
z
);
/*________________________*/
vertex
[
0
].
x
=
2
.
0
f
;
vertex
[
0
].
y
=
5
.
9
f
;
vertex
[
0
].
z
=
-
1
.
2
f
;
vertex
[
1
].
x
=
-
1
.
87
f
;
vertex
[
1
].
y
=
7
.
9
f
;
vertex
[
1
].
z
=
7
.
4
f
;
vertex
[
2
].
x
=
7
.
43
f
;
vertex
[
2
].
y
=
-
0
.
9
f
;
vertex
[
2
].
z
=
11
.
9
f
;
vertex
[
3
].
x
=
-
6
.
92
f
;
vertex
[
3
].
y
=
6
.
3
f
;
vertex
[
3
].
z
=
-
3
.
8
f
;
vertex
[
4
].
x
=
11
.
4
f
;
vertex
[
4
].
y
=
-
8
.
1
f
;
vertex
[
4
].
z
=
4
.
5
f
;
exp_min
.
x
=
-
6
.
92
f
;
exp_min
.
y
=
-
0
.
9
f
;
exp_min
.
z
=
-
3
.
8
f
;
exp_max
.
x
=
7
.
43
f
;
exp_max
.
y
=
7
.
90
f
;
exp_max
.
z
=
11
.
9
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
0
],
4
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_min
,
&
got_max
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#x
\n
"
,
hr
);
ok
(
compare_vec3
(
exp_min
,
got_min
),
"Expected min: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_min
.
x
,
exp_min
.
y
,
exp_min
.
z
,
got_min
.
x
,
got_min
.
y
,
got_min
.
z
);
ok
(
compare_vec3
(
exp_max
,
got_max
),
"Expected max: (%f, %f, %f), got: (%f, %f, %f)
\n
"
,
exp_max
.
x
,
exp_max
.
y
,
exp_max
.
z
,
got_max
.
x
,
got_max
.
y
,
got_max
.
z
);
/*________________________*/
hr
=
D3DXComputeBoundingBox
(
NULL
,
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_min
,
&
got_max
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
NULL
,
&
got_max
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_min
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
}
static
void
D3DXComputeBoundingSphereTest
(
void
)
{
D3DXVECTOR3
exp_cen
,
got_cen
,
vertex
[
5
];
FLOAT
exp_rad
,
got_rad
;
HRESULT
hr
;
vertex
[
0
].
x
=
1
.
0
f
;
vertex
[
0
].
y
=
1
.
0
f
;
vertex
[
0
].
z
=
1
.
0
f
;
vertex
[
1
].
x
=
1
.
0
f
;
vertex
[
1
].
y
=
1
.
0
f
;
vertex
[
1
].
z
=
1
.
0
f
;
vertex
[
2
].
x
=
1
.
0
f
;
vertex
[
2
].
y
=
1
.
0
f
;
vertex
[
2
].
z
=
1
.
0
f
;
vertex
[
3
].
x
=
1
.
0
f
;
vertex
[
3
].
y
=
1
.
0
f
;
vertex
[
3
].
z
=
1
.
0
f
;
vertex
[
4
].
x
=
9
.
0
f
;
vertex
[
4
].
y
=
9
.
0
f
;
vertex
[
4
].
z
=
9
.
0
f
;
exp_rad
=
6
.
928203
f
;
exp_cen
.
x
=
5
.
0
;
exp_cen
.
y
=
5
.
0
;
exp_cen
.
z
=
5
.
0
;
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
3
],
2
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_cen
,
&
got_rad
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#x
\n
"
,
hr
);
ok
(
compare
(
exp_rad
,
got_rad
),
"Expected radius: %f, got radius: %f
\n
"
,
exp_rad
,
got_rad
);
ok
(
compare_vec3
(
exp_cen
,
got_cen
),
"Expected center: (%f, %f, %f), got center: (%f, %f, %f)
\n
"
,
exp_cen
.
x
,
exp_cen
.
y
,
exp_cen
.
z
,
got_cen
.
x
,
got_cen
.
y
,
got_cen
.
z
);
/*________________________*/
vertex
[
0
].
x
=
2
.
0
f
;
vertex
[
0
].
y
=
5
.
9
f
;
vertex
[
0
].
z
=
-
1
.
2
f
;
vertex
[
1
].
x
=
-
1
.
87
f
;
vertex
[
1
].
y
=
7
.
9
f
;
vertex
[
1
].
z
=
7
.
4
f
;
vertex
[
2
].
x
=
7
.
43
f
;
vertex
[
2
].
y
=
-
0
.
9
f
;
vertex
[
2
].
z
=
11
.
9
f
;
vertex
[
3
].
x
=
-
6
.
92
f
;
vertex
[
3
].
y
=
6
.
3
f
;
vertex
[
3
].
z
=
-
3
.
8
f
;
vertex
[
4
].
x
=
11
.
4
f
;
vertex
[
4
].
y
=
-
8
.
1
f
;
vertex
[
4
].
z
=
4
.
5
f
;
exp_rad
=
13
.
707883
f
;
exp_cen
.
x
=
2
.
408
f
;
exp_cen
.
y
=
2
.
22
f
;
exp_cen
.
z
=
3
.
76
f
;
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
0
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_cen
,
&
got_rad
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, got %#x
\n
"
,
hr
);
ok
(
compare
(
exp_rad
,
got_rad
),
"Expected radius: %f, got radius: %f
\n
"
,
exp_rad
,
got_rad
);
ok
(
compare_vec3
(
exp_cen
,
got_cen
),
"Expected center: (%f, %f, %f), got center: (%f, %f, %f)
\n
"
,
exp_cen
.
x
,
exp_cen
.
y
,
exp_cen
.
z
,
got_cen
.
x
,
got_cen
.
y
,
got_cen
.
z
);
/*________________________*/
hr
=
D3DXComputeBoundingSphere
(
NULL
,
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_cen
,
&
got_rad
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
3
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
NULL
,
&
got_rad
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
3
],
5
,
D3DXGetFVFVertexSize
(
D3DFVF_XYZ
),
&
got_cen
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
}
static
void
D3DXGetFVFVertexSizeTest
(
void
)
{
UINT
got
;
compare_vertex_sizes
(
D3DFVF_XYZ
,
12
);
compare_vertex_sizes
(
D3DFVF_XYZB3
,
24
);
compare_vertex_sizes
(
D3DFVF_XYZB5
,
32
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_NORMAL
,
24
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
,
16
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE1
(
0
),
16
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX2
|
D3DFVF_TEXCOORDSIZE1
(
0
)
|
D3DFVF_TEXCOORDSIZE1
(
1
),
20
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE2
(
0
),
20
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX2
|
D3DFVF_TEXCOORDSIZE2
(
0
)
|
D3DFVF_TEXCOORDSIZE2
(
1
),
28
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX6
|
D3DFVF_TEXCOORDSIZE2
(
0
)
|
D3DFVF_TEXCOORDSIZE2
(
1
)
|
D3DFVF_TEXCOORDSIZE2
(
2
)
|
D3DFVF_TEXCOORDSIZE2
(
3
)
|
D3DFVF_TEXCOORDSIZE2
(
4
)
|
D3DFVF_TEXCOORDSIZE2
(
5
),
60
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX8
|
D3DFVF_TEXCOORDSIZE2
(
0
)
|
D3DFVF_TEXCOORDSIZE2
(
1
)
|
D3DFVF_TEXCOORDSIZE2
(
2
)
|
D3DFVF_TEXCOORDSIZE2
(
3
)
|
D3DFVF_TEXCOORDSIZE2
(
4
)
|
D3DFVF_TEXCOORDSIZE2
(
5
)
|
D3DFVF_TEXCOORDSIZE2
(
6
)
|
D3DFVF_TEXCOORDSIZE2
(
7
),
76
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE3
(
0
),
24
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX4
|
D3DFVF_TEXCOORDSIZE3
(
0
)
|
D3DFVF_TEXCOORDSIZE3
(
1
)
|
D3DFVF_TEXCOORDSIZE3
(
2
)
|
D3DFVF_TEXCOORDSIZE3
(
3
),
60
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE4
(
0
),
28
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX2
|
D3DFVF_TEXCOORDSIZE4
(
0
)
|
D3DFVF_TEXCOORDSIZE4
(
1
),
44
);
compare_vertex_sizes
(
D3DFVF_XYZ
|
D3DFVF_TEX3
|
D3DFVF_TEXCOORDSIZE4
(
0
)
|
D3DFVF_TEXCOORDSIZE4
(
1
)
|
D3DFVF_TEXCOORDSIZE4
(
2
),
60
);
compare_vertex_sizes
(
D3DFVF_XYZB5
|
D3DFVF_NORMAL
|
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
|
D3DFVF_TEX8
|
D3DFVF_TEXCOORDSIZE4
(
0
)
|
D3DFVF_TEXCOORDSIZE4
(
1
)
|
D3DFVF_TEXCOORDSIZE4
(
2
)
|
D3DFVF_TEXCOORDSIZE4
(
3
)
|
D3DFVF_TEXCOORDSIZE4
(
4
)
|
D3DFVF_TEXCOORDSIZE4
(
5
)
|
D3DFVF_TEXCOORDSIZE4
(
6
)
|
D3DFVF_TEXCOORDSIZE4
(
7
),
180
);
}
static
void
D3DXIntersectTriTest
(
void
)
{
BOOL
exp_res
,
got_res
;
D3DXVECTOR3
position
,
ray
,
vertex
[
3
];
FLOAT
exp_dist
,
got_dist
,
exp_u
,
got_u
,
exp_v
,
got_v
;
vertex
[
0
].
x
=
1
.
0
f
;
vertex
[
0
].
y
=
0
.
0
f
;
vertex
[
0
].
z
=
0
.
0
f
;
vertex
[
1
].
x
=
2
.
0
f
;
vertex
[
1
].
y
=
0
.
0
f
;
vertex
[
1
].
z
=
0
.
0
f
;
vertex
[
2
].
x
=
1
.
0
f
;
vertex
[
2
].
y
=
1
.
0
f
;
vertex
[
2
].
z
=
0
.
0
f
;
position
.
x
=
-
14
.
5
f
;
position
.
y
=
-
23
.
75
f
;
position
.
z
=
-
32
.
0
f
;
ray
.
x
=
2
.
0
f
;
ray
.
y
=
3
.
0
f
;
ray
.
z
=
4
.
0
f
;
exp_res
=
TRUE
;
exp_u
=
0
.
5
f
;
exp_v
=
0
.
25
f
;
exp_dist
=
8
.
0
f
;
got_res
=
D3DXIntersectTri
(
&
vertex
[
0
],
&
vertex
[
1
],
&
vertex
[
2
],
&
position
,
&
ray
,
&
got_u
,
&
got_v
,
&
got_dist
);
ok
(
got_res
==
exp_res
,
"Expected result = %d, got %d
\n
"
,
exp_res
,
got_res
);
ok
(
compare
(
exp_u
,
got_u
),
"Expected u = %f, got %f
\n
"
,
exp_u
,
got_u
);
ok
(
compare
(
exp_v
,
got_v
),
"Expected v = %f, got %f
\n
"
,
exp_v
,
got_v
);
ok
(
compare
(
exp_dist
,
got_dist
),
"Expected distance = %f, got %f
\n
"
,
exp_dist
,
got_dist
);
/*Only positive ray is taken in account*/
vertex
[
0
].
x
=
1
.
0
f
;
vertex
[
0
].
y
=
0
.
0
f
;
vertex
[
0
].
z
=
0
.
0
f
;
vertex
[
1
].
x
=
2
.
0
f
;
vertex
[
1
].
y
=
0
.
0
f
;
vertex
[
1
].
z
=
0
.
0
f
;
vertex
[
2
].
x
=
1
.
0
f
;
vertex
[
2
].
y
=
1
.
0
f
;
vertex
[
2
].
z
=
0
.
0
f
;
position
.
x
=
17
.
5
f
;
position
.
y
=
24
.
25
f
;
position
.
z
=
32
.
0
f
;
ray
.
x
=
2
.
0
f
;
ray
.
y
=
3
.
0
f
;
ray
.
z
=
4
.
0
f
;
exp_res
=
FALSE
;
got_res
=
D3DXIntersectTri
(
&
vertex
[
0
],
&
vertex
[
1
],
&
vertex
[
2
],
&
position
,
&
ray
,
&
got_u
,
&
got_v
,
&
got_dist
);
ok
(
got_res
==
exp_res
,
"Expected result = %d, got %d
\n
"
,
exp_res
,
got_res
);
/*Intersection between ray and triangle in a same plane is considered as empty*/
vertex
[
0
].
x
=
4
.
0
f
;
vertex
[
0
].
y
=
0
.
0
f
;
vertex
[
0
].
z
=
0
.
0
f
;
vertex
[
1
].
x
=
6
.
0
f
;
vertex
[
1
].
y
=
0
.
0
f
;
vertex
[
1
].
z
=
0
.
0
f
;
vertex
[
2
].
x
=
4
.
0
f
;
vertex
[
2
].
y
=
2
.
0
f
;
vertex
[
2
].
z
=
0
.
0
f
;
position
.
x
=
1
.
0
f
;
position
.
y
=
1
.
0
f
;
position
.
z
=
0
.
0
f
;
ray
.
x
=
1
.
0
f
;
ray
.
y
=
0
.
0
f
;
ray
.
z
=
0
.
0
f
;
exp_res
=
FALSE
;
got_res
=
D3DXIntersectTri
(
&
vertex
[
0
],
&
vertex
[
1
],
&
vertex
[
2
],
&
position
,
&
ray
,
&
got_u
,
&
got_v
,
&
got_dist
);
ok
(
got_res
==
exp_res
,
"Expected result = %d, got %d
\n
"
,
exp_res
,
got_res
);
}
static
void
test_get_decl_vertex_size
(
void
)
{
static
const
D3DVERTEXELEMENT9
declaration1
[]
=
...
...
@@ -93,5 +456,10 @@ static void test_get_decl_vertex_size(void)
START_TEST
(
mesh
)
{
D3DXBoundProbeTest
();
D3DXComputeBoundingBoxTest
();
D3DXComputeBoundingSphereTest
();
D3DXGetFVFVertexSizeTest
();
D3DXIntersectTriTest
();
test_get_decl_vertex_size
();
}
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