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
5bb6e4ab
Commit
5bb6e4ab
authored
Aug 19, 2008
by
David Adam
Committed by
Alexandre Julliard
Aug 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXBoxBoundProbe.
parent
517462cf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
4 deletions
+120
-4
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
mesh.c
dlls/d3dx8/mesh.c
+70
-0
mesh.c
dlls/d3dx8/tests/mesh.c
+48
-3
d3dx8mesh.h
include/d3dx8mesh.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
5bb6e4ab
...
...
@@ -109,7 +109,7 @@
@ stub D3DXWeldVertices
@ stub D3DXIntersect
@ stdcall D3DXSphereBoundProbe(ptr long ptr ptr)
@ st
ub D3DXBoxBoundProbe
@ st
dcall D3DXBoxBoundProbe(ptr ptr ptr ptr)
@ stub D3DXCreatePolygon
@ stub D3DXCreateBox
@ stub D3DXCreateCylinder
...
...
dlls/d3dx8/mesh.c
View file @
5bb6e4ab
...
...
@@ -24,6 +24,76 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
BOOL
WINAPI
D3DXBoxBoundProbe
(
CONST
D3DXVECTOR3
*
pmin
,
CONST
D3DXVECTOR3
*
pmax
,
CONST
D3DXVECTOR3
*
prayposition
,
CONST
D3DXVECTOR3
*
praydirection
)
/* Algorithm taken from the article: An Efficient and Robust Ray-Box Intersection Algoritm
Amy Williams University of Utah
Steve Barrus University of Utah
R. Keith Morley University of Utah
Peter Shirley University of Utah
International Conference on Computer Graphics and Interactive Techniques archive
ACM SIGGRAPH 2005 Courses
Los Angeles, California
This algorithm is free of patents or of copyrights, as confirmed by Peter Shirley himself.
Algorithm: Consider the box as the intersection of three slabs. Clip the ray
against each slab, if there's anything left of the ray after we're
done we've got an intersection of the ray with the box.
*/
{
FLOAT
div
,
tmin
,
tmax
,
tymin
,
tymax
,
tzmin
,
tzmax
;
div
=
1
.
0
f
/
praydirection
->
x
;
if
(
div
>=
0
.
0
f
)
{
tmin
=
(
pmin
->
x
-
prayposition
->
x
)
*
div
;
tmax
=
(
pmax
->
x
-
prayposition
->
x
)
*
div
;
}
else
{
tmin
=
(
pmax
->
x
-
prayposition
->
x
)
*
div
;
tmax
=
(
pmin
->
x
-
prayposition
->
x
)
*
div
;
}
if
(
tmax
<
0
.
0
f
)
return
FALSE
;
div
=
1
.
0
f
/
praydirection
->
y
;
if
(
div
>=
0
.
0
f
)
{
tymin
=
(
pmin
->
y
-
prayposition
->
y
)
*
div
;
tymax
=
(
pmax
->
y
-
prayposition
->
y
)
*
div
;
}
else
{
tymin
=
(
pmax
->
y
-
prayposition
->
y
)
*
div
;
tymax
=
(
pmin
->
y
-
prayposition
->
y
)
*
div
;
}
if
(
(
tymax
<
0
.
0
f
)
||
(
tmin
>
tymax
)
||
(
tymin
>
tmax
)
)
return
FALSE
;
if
(
tymin
>
tmin
)
tmin
=
tymin
;
if
(
tymax
<
tmax
)
tmax
=
tymax
;
div
=
1
.
0
f
/
praydirection
->
z
;
if
(
div
>=
0
.
0
f
)
{
tzmin
=
(
pmin
->
z
-
prayposition
->
z
)
*
div
;
tzmax
=
(
pmax
->
z
-
prayposition
->
z
)
*
div
;
}
else
{
tzmin
=
(
pmax
->
z
-
prayposition
->
z
)
*
div
;
tzmax
=
(
pmin
->
z
-
prayposition
->
z
)
*
div
;
}
if
(
(
tzmax
<
0
.
0
f
)
||
(
tmin
>
tzmax
)
||
(
tzmin
>
tmax
)
)
return
FALSE
;
return
TRUE
;
}
BOOL
WINAPI
D3DXSphereBoundProbe
(
CONST
D3DXVECTOR3
*
pcenter
,
FLOAT
radius
,
CONST
D3DXVECTOR3
*
prayposition
,
CONST
D3DXVECTOR3
*
praydirection
)
{
D3DXVECTOR3
difference
;
...
...
dlls/d3dx8/tests/mesh.c
View file @
5bb6e4ab
...
...
@@ -22,12 +22,57 @@
static
void
D3DXBoundProbeTest
(
void
)
{
/*____________Test the Sphere case________________________*/
BOOL
result
;
D3DXVECTOR3
center
,
raydirection
,
rayposition
;
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
;
...
...
include/d3dx8mesh.h
View file @
5bb6e4ab
...
...
@@ -28,6 +28,7 @@ extern "C" {
HRESULT
WINAPI
D3DXCreateBuffer
(
DWORD
,
LPD3DXBUFFER
*
);
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
*
);
#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