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
0ccc431a
Commit
0ccc431a
authored
Feb 05, 2009
by
David Adam
Committed by
Alexandre Julliard
Feb 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXComputeBoundingSphere.
parent
1d3889fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
1 deletion
+90
-1
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
mesh.c
dlls/d3dx8/mesh.c
+31
-0
mesh.c
dlls/d3dx8/tests/mesh.c
+57
-0
d3dx8mesh.h
include/d3dx8mesh.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
0ccc431a
...
...
@@ -92,7 +92,7 @@
@ stub D3DXValidMesh
@ stub D3DXGeneratePMesh
@ stub D3DXSimplifyMesh
@ st
ub D3DXComputeBoundingSphere
@ st
dcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
@ stub D3DXComputeBoundingBox
@ stub D3DXComputeNormals
@ stdcall D3DXCreateBuffer(long ptr)
...
...
dlls/d3dx8/mesh.c
View file @
0ccc431a
...
...
@@ -97,6 +97,37 @@ done we've got an intersection of the ray with the box.
return
TRUE
;
}
HRESULT
WINAPI
D3DXComputeBoundingSphere
(
PVOID
ppointsFVF
,
DWORD
numvertices
,
DWORD
FVF
,
D3DXVECTOR3
*
pcenter
,
FLOAT
*
pradius
)
{
D3DXVECTOR3
temp
,
temp1
;
FLOAT
d
;
unsigned
int
i
;
if
(
!
ppointsFVF
||
!
pcenter
||
!
pradius
)
return
D3DERR_INVALIDCALL
;
temp
.
x
=
0
.
0
f
;
temp
.
y
=
0
.
0
f
;
temp
.
z
=
0
.
0
f
;
temp1
=
temp
;
d
=
0
.
0
f
;
*
pradius
=
0
.
0
f
;
for
(
i
=
0
;
i
<
numvertices
;
i
++
)
{
D3DXVec3Add
(
&
temp1
,
&
temp
,
(
D3DXVECTOR3
*
)((
char
*
)
ppointsFVF
+
D3DXGetFVFVertexSize
(
FVF
)
*
i
));
temp
=
temp1
;
}
D3DXVec3Scale
(
pcenter
,
&
temp
,
1
.
0
f
/
((
FLOAT
)
numvertices
));
for
(
i
=
0
;
i
<
numvertices
;
i
++
)
{
d
=
D3DXVec3Length
(
D3DXVec3Subtract
(
&
temp
,
(
D3DXVECTOR3
*
)((
char
*
)
ppointsFVF
+
D3DXGetFVFVertexSize
(
FVF
)
*
i
),
pcenter
));
if
(
d
>
*
pradius
)
*
pradius
=
d
;
}
return
D3D_OK
;
}
static
UINT
Get_TexCoord_Size_From_FVF
(
DWORD
FVF
,
int
tex_num
)
{
return
(((((
FVF
)
>>
(
16
+
(
2
*
(
tex_num
))))
+
1
)
&
0x03
)
+
1
);
...
...
dlls/d3dx8/tests/mesh.c
View file @
0ccc431a
...
...
@@ -32,6 +32,11 @@ static BOOL compare(FLOAT u, FLOAT v)
return
(
fabs
(
u
-
v
)
<
admitted_error
);
}
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
;
...
...
@@ -106,6 +111,57 @@ static void D3DXBoundProbeTest(void)
ok
(
result
==
FALSE
,
"expected FALSE, received TRUE
\n
"
);
}
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
,
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
,
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
,
D3DFVF_XYZ
,
&
got_cen
,
&
got_rad
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
3
],
5
,
D3DFVF_XYZ
,
NULL
,
&
got_rad
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
/*________________________*/
hr
=
D3DXComputeBoundingSphere
(
&
vertex
[
3
],
5
,
D3DFVF_XYZ
,
&
got_cen
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %#x
\n
"
,
hr
);
}
static
void
D3DXGetFVFVertexSizeTest
(
void
)
{
UINT
got
;
...
...
@@ -266,6 +322,7 @@ static void D3DXIntersectTriTest(void)
START_TEST
(
mesh
)
{
D3DXBoundProbeTest
();
D3DXComputeBoundingSphereTest
();
D3DXGetFVFVertexSizeTest
();
D3DXIntersectTriTest
();
}
include/d3dx8mesh.h
View file @
0ccc431a
...
...
@@ -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
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