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
c4368874
Commit
c4368874
authored
May 10, 2012
by
Christian Costa
Committed by
Alexandre Julliard
May 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Retrieve mesh name at loading time. Implement GetName and SetName.
parent
edf61623
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
12 deletions
+84
-12
meshbuilder.c
dlls/d3drm/meshbuilder.c
+62
-12
d3drm.c
dlls/d3drm/tests/d3drm.c
+22
-0
No files found.
dlls/d3drm/meshbuilder.c
View file @
c4368874
...
@@ -48,6 +48,7 @@ typedef struct {
...
@@ -48,6 +48,7 @@ typedef struct {
IDirect3DRMMeshBuilder2
IDirect3DRMMeshBuilder2_iface
;
IDirect3DRMMeshBuilder2
IDirect3DRMMeshBuilder2_iface
;
IDirect3DRMMeshBuilder3
IDirect3DRMMeshBuilder3_iface
;
IDirect3DRMMeshBuilder3
IDirect3DRMMeshBuilder3_iface
;
LONG
ref
;
LONG
ref
;
char
*
name
;
DWORD
nb_vertices
;
DWORD
nb_vertices
;
D3DVECTOR
*
pVertices
;
D3DVECTOR
*
pVertices
;
DWORD
nb_normals
;
DWORD
nb_normals
;
...
@@ -344,6 +345,7 @@ static ULONG WINAPI IDirect3DRMMeshBuilder2Impl_Release(IDirect3DRMMeshBuilder2*
...
@@ -344,6 +345,7 @@ static ULONG WINAPI IDirect3DRMMeshBuilder2Impl_Release(IDirect3DRMMeshBuilder2*
if
(
!
ref
)
if
(
!
ref
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVertices
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pVertices
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pNormals
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pNormals
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pFaceData
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pFaceData
);
...
@@ -408,23 +410,23 @@ static DWORD WINAPI IDirect3DRMMeshBuilder2Impl_GetAppData(IDirect3DRMMeshBuilde
...
@@ -408,23 +410,23 @@ static DWORD WINAPI IDirect3DRMMeshBuilder2Impl_GetAppData(IDirect3DRMMeshBuilde
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_SetName
(
IDirect3DRMMeshBuilder2
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_SetName
(
IDirect3DRMMeshBuilder2
*
iface
,
LPCSTR
pN
ame
)
LPCSTR
n
ame
)
{
{
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder2
(
iface
);
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder2
(
iface
);
FIXME
(
"(%p)->(%s): stub
\n
"
,
This
,
pName
);
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_a
(
name
)
);
return
E_NOTIMPL
;
return
IDirect3DRMMeshBuilder3_SetName
(
&
This
->
IDirect3DRMMeshBuilder3_iface
,
name
)
;
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_GetName
(
IDirect3DRMMeshBuilder2
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_GetName
(
IDirect3DRMMeshBuilder2
*
iface
,
LPDWORD
lpdwSize
,
LPSTR
lpN
ame
)
LPDWORD
size
,
LPSTR
n
ame
)
{
{
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder2
(
iface
);
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder2
(
iface
);
FIXME
(
"(%p)->(%p,%p): stub
\n
"
,
This
,
lpdwSize
,
lpN
ame
);
TRACE
(
"(%p)->(%p,%p)
\n
"
,
This
,
size
,
n
ame
);
return
E_NOTIMPL
;
return
IDirect3DRMMeshBuilder3_GetName
(
&
This
->
IDirect3DRMMeshBuilder3_iface
,
size
,
name
)
;
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_GetClassName
(
IDirect3DRMMeshBuilder2
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder2Impl_GetClassName
(
IDirect3DRMMeshBuilder2
*
iface
,
...
@@ -1002,23 +1004,48 @@ static DWORD WINAPI IDirect3DRMMeshBuilder3Impl_GetAppData(IDirect3DRMMeshBuilde
...
@@ -1002,23 +1004,48 @@ static DWORD WINAPI IDirect3DRMMeshBuilder3Impl_GetAppData(IDirect3DRMMeshBuilde
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_SetName
(
IDirect3DRMMeshBuilder3
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_SetName
(
IDirect3DRMMeshBuilder3
*
iface
,
LPCSTR
pN
ame
)
LPCSTR
n
ame
)
{
{
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder3
(
iface
);
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder3
(
iface
);
char
*
string
=
NULL
;
FIXME
(
"(%p)->(%s): stub
\n
"
,
This
,
pName
);
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_a
(
name
)
);
return
E_NOTIMPL
;
if
(
name
)
{
string
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
);
if
(
!
string
)
return
E_OUTOFMEMORY
;
strcpy
(
string
,
name
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
This
->
name
=
string
;
return
D3DRM_OK
;
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_GetName
(
IDirect3DRMMeshBuilder3
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_GetName
(
IDirect3DRMMeshBuilder3
*
iface
,
LPDWORD
lpdwSize
,
LPSTR
lpN
ame
)
LPDWORD
size
,
LPSTR
n
ame
)
{
{
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder3
(
iface
);
IDirect3DRMMeshBuilderImpl
*
This
=
impl_from_IDirect3DRMMeshBuilder3
(
iface
);
FIXME
(
"(%p)->(%p,%p): stub
\n
"
,
This
,
lpdwSize
,
lpN
ame
);
TRACE
(
"(%p)->(%p,%p)
\n
"
,
This
,
size
,
n
ame
);
return
E_NOTIMPL
;
if
(
!
size
)
return
E_POINTER
;
if
(
!
This
->
name
)
{
*
size
=
0
;
return
D3DRM_OK
;
}
if
(
*
size
<
(
strlen
(
This
->
name
)
+
1
))
return
E_INVALIDARG
;
strcpy
(
name
,
This
->
name
);
*
size
=
strlen
(
This
->
name
)
+
1
;
return
D3DRM_OK
;
}
}
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_GetClassName
(
IDirect3DRMMeshBuilder3
*
iface
,
static
HRESULT
WINAPI
IDirect3DRMMeshBuilder3Impl_GetClassName
(
IDirect3DRMMeshBuilder3
*
iface
,
...
@@ -1052,6 +1079,29 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
...
@@ -1052,6 +1079,29 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pData
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pData
);
/* Remove previous name */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
This
->
name
=
NULL
;
hr
=
IDirectXFileData_GetName
(
pData
,
NULL
,
&
size
);
if
(
hr
!=
DXFILE_OK
)
return
hr
;
if
(
size
)
{
This
->
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
This
->
name
)
return
E_OUTOFMEMORY
;
hr
=
IDirectXFileData_GetName
(
pData
,
This
->
name
,
&
size
);
if
(
hr
!=
DXFILE_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
name
);
This
->
name
=
NULL
;
return
hr
;
}
}
TRACE
(
"Mesh name is '%s'
\n
"
,
This
->
name
?
This
->
name
:
""
);
hr
=
IDirectXFileData_GetData
(
pData
,
NULL
,
&
size
,
(
void
**
)
&
ptr
);
hr
=
IDirectXFileData_GetData
(
pData
,
NULL
,
&
size
,
(
void
**
)
&
ptr
);
if
(
hr
!=
DXFILE_OK
)
if
(
hr
!=
DXFILE_OK
)
goto
end
;
goto
end
;
...
...
dlls/d3drm/tests/d3drm.c
View file @
c4368874
...
@@ -179,6 +179,8 @@ static void test_MeshBuilder(void)
...
@@ -179,6 +179,8 @@ static void test_MeshBuilder(void)
D3DVECTOR
v
[
3
];
D3DVECTOR
v
[
3
];
D3DVECTOR
n
[
3
];
D3DVECTOR
n
[
3
];
DWORD
f
[
8
];
DWORD
f
[
8
];
char
name
[
10
];
DWORD
size
;
hr
=
pDirect3DRMCreate
(
&
pD3DRM
);
hr
=
pDirect3DRMCreate
(
&
pD3DRM
);
ok
(
hr
==
D3DRM_OK
,
"Cannot get IDirect3DRM interface (hr = %x)
\n
"
,
hr
);
ok
(
hr
==
D3DRM_OK
,
"Cannot get IDirect3DRM interface (hr = %x)
\n
"
,
hr
);
...
@@ -201,6 +203,26 @@ static void test_MeshBuilder(void)
...
@@ -201,6 +203,26 @@ static void test_MeshBuilder(void)
hr
=
IDirect3DRMMeshBuilder_Load
(
pMeshBuilder
,
&
info
,
NULL
,
D3DRMLOAD_FROMMEMORY
,
NULL
,
NULL
);
hr
=
IDirect3DRMMeshBuilder_Load
(
pMeshBuilder
,
&
info
,
NULL
,
D3DRMLOAD_FROMMEMORY
,
NULL
,
NULL
);
ok
(
hr
==
D3DRM_OK
,
"Cannot load mesh data (hr = %x)
\n
"
,
hr
);
ok
(
hr
==
D3DRM_OK
,
"Cannot load mesh data (hr = %x)
\n
"
,
hr
);
size
=
sizeof
(
name
);
hr
=
IDirect3DRMMeshBuilder_GetName
(
pMeshBuilder
,
&
size
,
name
);
ok
(
hr
==
D3DRM_OK
,
"IDirect3DRMMeshBuilder_GetName returned hr = %x
\n
"
,
hr
);
ok
(
!
strcmp
(
name
,
"Object"
),
"Retreived name '%s' instead of 'Object'
\n
"
,
name
);
size
=
strlen
(
"Object"
);
/* No space for null character */
hr
=
IDirect3DRMMeshBuilder_GetName
(
pMeshBuilder
,
&
size
,
name
);
ok
(
hr
==
E_INVALIDARG
,
"IDirect3DRMMeshBuilder_GetName returned hr = %x
\n
"
,
hr
);
hr
=
IDirect3DRMMeshBuilder_SetName
(
pMeshBuilder
,
NULL
);
ok
(
hr
==
D3DRM_OK
,
"IDirect3DRMMeshBuilder_SetName returned hr = %x
\n
"
,
hr
);
size
=
sizeof
(
name
);
hr
=
IDirect3DRMMeshBuilder_GetName
(
pMeshBuilder
,
&
size
,
name
);
ok
(
hr
==
D3DRM_OK
,
"IDirect3DRMMeshBuilder_GetName returned hr = %x
\n
"
,
hr
);
ok
(
size
==
0
,
"Size should be 0 instead of %u
\n
"
,
size
);
hr
=
IDirect3DRMMeshBuilder_SetName
(
pMeshBuilder
,
""
);
ok
(
hr
==
D3DRM_OK
,
"IDirect3DRMMeshBuilder_SetName returned hr = %x
\n
"
,
hr
);
size
=
sizeof
(
name
);
hr
=
IDirect3DRMMeshBuilder_GetName
(
pMeshBuilder
,
&
size
,
name
);
ok
(
hr
==
D3DRM_OK
,
"IDirect3DRMMeshBuilder_GetName returned hr = %x
\n
"
,
hr
);
ok
(
!
strcmp
(
name
,
""
),
"Retreived name '%s' instead of ''
\n
"
,
name
);
val
=
IDirect3DRMMeshBuilder_GetVertexCount
(
pMeshBuilder
);
val
=
IDirect3DRMMeshBuilder_GetVertexCount
(
pMeshBuilder
);
ok
(
val
==
4
,
"Wrong number of vertices %d (must be 4)
\n
"
,
val
);
ok
(
val
==
4
,
"Wrong number of vertices %d (must be 4)
\n
"
,
val
);
...
...
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