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
cc3ec2da
Commit
cc3ec2da
authored
Feb 27, 2014
by
Gediminas Jakutis
Committed by
Alexandre Julliard
Mar 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXCreateBox().
parent
955ce003
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
15 deletions
+105
-15
mesh.c
dlls/d3dx9_36/mesh.c
+98
-8
mesh.c
dlls/d3dx9_36/tests/mesh.c
+7
-7
No files found.
dlls/d3dx9_36/mesh.c
View file @
cc3ec2da
...
...
@@ -4525,20 +4525,110 @@ cleanup:
return
hr
;
}
HRESULT
WINAPI
D3DXCreateBox
(
struct
IDirect3DDevice9
*
device
,
float
width
,
float
height
,
float
depth
,
struct
ID3DXMesh
**
mesh
,
struct
ID3DXBuffer
**
adjacency
)
{
FIXME
(
"(%p, %f, %f, %f, %p, %p): stub
\n
"
,
device
,
width
,
height
,
depth
,
mesh
,
adjacency
);
return
E_NOTIMPL
;
}
struct
vertex
{
D3DXVECTOR3
position
;
D3DXVECTOR3
normal
;
};
HRESULT
WINAPI
D3DXCreateBox
(
struct
IDirect3DDevice9
*
device
,
float
width
,
float
height
,
float
depth
,
struct
ID3DXMesh
**
mesh
,
struct
ID3DXBuffer
**
adjacency
)
{
HRESULT
hr
;
ID3DXMesh
*
box
;
struct
vertex
*
vertices
;
WORD
(
*
faces
)[
3
];
DWORD
*
adjacency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
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
}
};
static
const
DWORD
adjacency_table
[]
=
{
6
,
9
,
1
,
2
,
10
,
0
,
1
,
9
,
3
,
4
,
10
,
2
,
3
,
8
,
5
,
7
,
11
,
4
,
0
,
11
,
7
,
5
,
8
,
6
,
7
,
4
,
9
,
2
,
0
,
8
,
1
,
3
,
11
,
5
,
6
,
10
};
TRACE
(
"device %p, width %f, height %f, depth %f, mesh %p, adjacency %p
\n
"
,
device
,
width
,
height
,
depth
,
mesh
,
adjacency
);
if
(
!
device
||
width
<
0
.
0
f
||
height
<
0
.
0
f
||
depth
<
0
.
0
f
||
!
mesh
)
{
return
D3DERR_INVALIDCALL
;
}
if
(
FAILED
(
hr
=
D3DXCreateMeshFVF
(
12
,
24
,
D3DXMESH_MANAGED
,
D3DFVF_XYZ
|
D3DFVF_NORMAL
,
device
,
&
box
)))
{
return
hr
;
}
if
(
FAILED
(
hr
=
box
->
lpVtbl
->
LockVertexBuffer
(
box
,
0
,
(
void
**
)
&
vertices
)))
{
box
->
lpVtbl
->
Release
(
box
);
return
hr
;
}
if
(
FAILED
(
hr
=
box
->
lpVtbl
->
LockIndexBuffer
(
box
,
0
,
(
void
**
)
&
faces
)))
{
box
->
lpVtbl
->
UnlockVertexBuffer
(
box
);
box
->
lpVtbl
->
Release
(
box
);
return
hr
;
}
width
/=
2
.
0
f
;
height
/=
2
.
0
f
;
depth
/=
2
.
0
f
;
for
(
i
=
0
;
i
<
24
;
i
++
)
{
vertices
[
i
].
position
.
x
=
width
*
unit_box
[
i
].
x
;
vertices
[
i
].
position
.
y
=
height
*
unit_box
[
i
].
y
;
vertices
[
i
].
position
.
z
=
depth
*
unit_box
[
i
].
z
;
vertices
[
i
].
normal
.
x
=
normals
[
i
/
4
].
x
;
vertices
[
i
].
normal
.
y
=
normals
[
i
/
4
].
y
;
vertices
[
i
].
normal
.
z
=
normals
[
i
/
4
].
z
;
}
face
=
0
;
for
(
i
=
0
;
i
<
12
;
i
++
)
{
faces
[
i
][
0
]
=
face
++
;
faces
[
i
][
1
]
=
face
++
;
faces
[
i
][
2
]
=
(
i
%
2
)
?
face
-
4
:
face
;
}
box
->
lpVtbl
->
UnlockIndexBuffer
(
box
);
box
->
lpVtbl
->
UnlockVertexBuffer
(
box
);
if
(
adjacency
)
{
if
(
FAILED
(
hr
=
D3DXCreateBuffer
(
sizeof
(
adjacency_table
),
adjacency
)))
{
box
->
lpVtbl
->
Release
(
box
);
return
hr
;
}
adjacency_buf
=
ID3DXBuffer_GetBufferPointer
(
*
adjacency
);
memcpy
(
adjacency_buf
,
adjacency_table
,
sizeof
(
adjacency_table
));
}
*
mesh
=
box
;
return
D3D_OK
;
}
typedef
WORD
face
[
3
];
struct
sincos_table
...
...
dlls/d3dx9_36/tests/mesh.c
View file @
cc3ec2da
...
...
@@ -2482,23 +2482,23 @@ static void D3DXCreateBoxTest(void)
}
hr
=
D3DXCreateBox
(
device
,
2
.
0
f
,
20
.
0
f
,
4
.
9
f
,
NULL
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
hr
=
D3DXCreateBox
(
NULL
,
22
.
0
f
,
20
.
0
f
,
4
.
9
f
,
&
box
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
hr
=
D3DXCreateBox
(
device
,
-
2
.
0
f
,
20
.
0
f
,
4
.
9
f
,
&
box
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
hr
=
D3DXCreateBox
(
device
,
22
.
0
f
,
-
20
.
0
f
,
4
.
9
f
,
&
box
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
hr
=
D3DXCreateBox
(
device
,
22
.
0
f
,
20
.
0
f
,
-
4
.
9
f
,
&
box
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, received %#x
\n
"
,
hr
);
ppBuffer
=
NULL
;
hr
=
D3DXCreateBox
(
device
,
10
.
9
f
,
20
.
0
f
,
4
.
9
f
,
&
box
,
&
ppBuffer
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, received %#x
\n
"
,
hr
);
ok
(
hr
==
D3D_OK
,
"Expected D3D_OK, received %#x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
...
...
@@ -2508,7 +2508,7 @@ static void D3DXCreateBoxTest(void)
buffer
=
ID3DXBuffer_GetBufferPointer
(
ppBuffer
);
for
(
i
=
0
;
i
<
36
;
i
++
)
todo_wine
ok
(
adjacency
[
i
]
==
buffer
[
i
],
"expected adjacency %d: %#x, received %#x
\n
"
,
i
,
adjacency
[
i
],
buffer
[
i
]);
ok
(
adjacency
[
i
]
==
buffer
[
i
],
"expected adjacency %d: %#x, received %#x
\n
"
,
i
,
adjacency
[
i
],
buffer
[
i
]);
box
->
lpVtbl
->
Release
(
box
);
...
...
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