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
f1bb04ff
Commit
f1bb04ff
authored
Feb 06, 2009
by
David Adam
Committed by
Alexandre Julliard
Feb 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXComputeBoundingBox.
parent
0ccc431a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
1 deletion
+98
-1
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
mesh.c
dlls/d3dx8/mesh.c
+28
-0
mesh.c
dlls/d3dx8/tests/mesh.c
+68
-0
d3dx8mesh.h
include/d3dx8mesh.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
f1bb04ff
...
...
@@ -93,7 +93,7 @@
@ stub D3DXGeneratePMesh
@ stub D3DXSimplifyMesh
@ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
@ st
ub D3DXComputeBoundingBox
@ st
dcall D3DXComputeBoundingBox(ptr long long ptr ptr)
@ stub D3DXComputeNormals
@ stdcall D3DXCreateBuffer(long ptr)
@ stub D3DXLoadMeshFromX
...
...
dlls/d3dx8/mesh.c
View file @
f1bb04ff
...
...
@@ -97,6 +97,34 @@ done we've got an intersection of the ray with the box.
return
TRUE
;
}
HRESULT
WINAPI
D3DXComputeBoundingBox
(
PVOID
ppointsFVF
,
DWORD
numvertices
,
DWORD
FVF
,
D3DXVECTOR3
*
pmin
,
D3DXVECTOR3
*
pmax
)
{
D3DXVECTOR3
vec
;
unsigned
int
i
;
if
(
!
ppointsFVF
||
!
pmin
||
!
pmax
)
return
D3DERR_INVALIDCALL
;
*
pmin
=
*
(
D3DXVECTOR3
*
)((
char
*
)
ppointsFVF
);
*
pmax
=
*
pmin
;
/* It looks like that D3DXComputeBoundingBox does not take in account the last vertex. */
for
(
i
=
0
;
i
<
numvertices
-
1
;
i
++
)
{
vec
=
*
(
D3DXVECTOR3
*
)((
char
*
)
ppointsFVF
+
D3DXGetFVFVertexSize
(
FVF
)
*
i
);
if
(
vec
.
x
<
pmin
->
x
)
pmin
->
x
=
vec
.
x
;
if
(
vec
.
x
>
pmax
->
x
)
pmax
->
x
=
vec
.
x
;
if
(
vec
.
y
<
pmin
->
y
)
pmin
->
y
=
vec
.
y
;
if
(
vec
.
y
>
pmax
->
y
)
pmax
->
y
=
vec
.
y
;
if
(
vec
.
z
<
pmin
->
z
)
pmin
->
z
=
vec
.
z
;
if
(
vec
.
z
>
pmax
->
z
)
pmax
->
z
=
vec
.
z
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
D3DXComputeBoundingSphere
(
PVOID
ppointsFVF
,
DWORD
numvertices
,
DWORD
FVF
,
D3DXVECTOR3
*
pcenter
,
FLOAT
*
pradius
)
{
D3DXVECTOR3
temp
,
temp1
;
...
...
dlls/d3dx8/tests/mesh.c
View file @
f1bb04ff
...
...
@@ -111,6 +111,73 @@ static void D3DXBoundProbeTest(void)
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
=
1
.
0
f
;
exp_max
.
y
=
1
.
0
f
;
exp_max
.
z
=
1
.
0
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
2
,
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
.
90
f
;
exp_min
.
z
=
-
3
.
80
f
;
exp_max
.
x
=
7
.
43
f
;
exp_max
.
y
=
7
.
90
f
;
exp_max
.
z
=
11
.
9
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
0
],
5
,
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
=
-
1
.
87
f
;
exp_min
.
y
=
-
0
.
90
f
;
exp_min
.
z
=
-
1
.
20
f
;
exp_max
.
x
=
7
.
43
f
;
exp_max
.
y
=
7
.
90
f
;
exp_max
.
z
=
11
.
9
f
;
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
0
],
4
,
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
,
D3DFVF_XYZ
,
&
got_min
,
&
got_max
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
5
,
D3DFVF_XYZ
,
NULL
,
&
got_max
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingBox
(
&
vertex
[
3
],
5
,
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
];
...
...
@@ -322,6 +389,7 @@ static void D3DXIntersectTriTest(void)
START_TEST
(
mesh
)
{
D3DXBoundProbeTest
();
D3DXComputeBoundingBoxTest
();
D3DXComputeBoundingSphereTest
();
D3DXGetFVFVertexSizeTest
();
D3DXIntersectTriTest
();
...
...
include/d3dx8mesh.h
View file @
f1bb04ff
...
...
@@ -31,6 +31,7 @@ UINT WINAPI D3DXGetFVFVertexSize(DWORD);
BOOL
WINAPI
D3DXBoxBoundProbe
(
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
);
BOOL
WINAPI
D3DXSphereBoundProbe
(
CONST
D3DXVECTOR3
*
,
FLOAT
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
);
BOOL
CDECL
D3DXIntersectTri
(
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
CONST
D3DXVECTOR3
*
,
FLOAT
*
,
FLOAT
*
,
FLOAT
*
);
HRESULT
WINAPI
D3DXComputeBoundingBox
(
PVOID
,
DWORD
,
DWORD
,
D3DXVECTOR3
*
,
D3DXVECTOR3
*
);
HRESULT
WINAPI
D3DXComputeBoundingSphere
(
PVOID
,
DWORD
,
DWORD
,
D3DXVECTOR3
*
,
FLOAT
*
);
#ifdef __cplusplus
...
...
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