Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
cb131bf0
Commit
cb131bf0
authored
Oct 21, 2012
by
Christian Costa
Committed by
Alexandre Julliard
Oct 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Fix normals computation and add according tests.
parent
466c244d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
meshbuilder.c
dlls/d3drm/meshbuilder.c
+1
-1
d3drm.c
dlls/d3drm/tests/d3drm.c
+22
-1
No files found.
dlls/d3drm/meshbuilder.c
View file @
cb131bf0
...
...
@@ -1419,7 +1419,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData)
D3DVECTOR
a
,
b
;
D3DRMVectorSubtract
(
&
a
,
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
2
]],
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
1
]]);
D3DRMVectorSubtract
(
&
a
,
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
1
]],
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
0
]]);
D3DRMVectorSubtract
(
&
b
,
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
0
]],
&
This
->
pVertices
[
faces_vertex_idx_ptr
[
1
]]);
D3DRMVectorCrossProduct
(
&
face_normal
,
&
a
,
&
b
);
D3DRMVectorNormalize
(
&
face_normal
);
}
...
...
dlls/d3drm/tests/d3drm.c
View file @
cb131bf0
...
...
@@ -64,6 +64,11 @@ static int get_refcount(IUnknown *object)
return
IUnknown_Release
(
object
);
}
static
BOOL
match_float
(
float
a
,
float
b
)
{
return
(
a
-
b
)
<
0
.
000001
f
;
}
static
D3DRMMATRIX4D
identity
=
{
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
...
...
@@ -186,7 +191,7 @@ static void test_MeshBuilder(void)
DWORD
val1
,
val2
,
val3
;
D3DVALUE
valu
,
valv
;
D3DVECTOR
v
[
3
];
D3DVECTOR
n
[
3
];
D3DVECTOR
n
[
4
];
DWORD
f
[
8
];
char
name
[
10
];
DWORD
size
;
...
...
@@ -259,6 +264,22 @@ static void test_MeshBuilder(void)
ok
(
val2
==
4
,
"Wrong number of normals %d (must be 4)
\n
"
,
val2
);
ok
(
val3
==
22
,
"Wrong number of face data bytes %d (must be 22)
\n
"
,
val3
);
/* Check that Load method generated default normals */
hr
=
IDirect3DRMMeshBuilder_GetVertices
(
pMeshBuilder
,
NULL
,
NULL
,
&
val2
,
n
,
NULL
,
NULL
);
ok
(
hr
==
D3DRM_OK
,
"Cannot get vertices information (hr = %x)
\n
"
,
hr
);
ok
(
match_float
(
U1
(
n
[
0
]).
x
,
0
.
577350
f
),
"Wrong component n[0].x = %f (expected %f)
\n
"
,
U1
(
n
[
0
]).
x
,
0
.
577350
f
);
ok
(
match_float
(
U2
(
n
[
0
]).
y
,
0
.
577350
f
),
"Wrong component n[0].y = %f (expected %f)
\n
"
,
U2
(
n
[
0
]).
y
,
0
.
577350
f
);
ok
(
match_float
(
U3
(
n
[
0
]).
z
,
0
.
577350
f
),
"Wrong component n[0].z = %f (expected %f)
\n
"
,
U3
(
n
[
0
]).
z
,
0
.
577350
f
);
ok
(
match_float
(
U1
(
n
[
1
]).
x
,
-
0
.
229416
f
),
"Wrong component n[1].x = %f (expected %f)
\n
"
,
U1
(
n
[
1
]).
x
,
-
0
.
229416
f
);
ok
(
match_float
(
U2
(
n
[
1
]).
y
,
0
.
688247
f
),
"Wrong component n[1].y = %f (expected %f)
\n
"
,
U2
(
n
[
1
]).
y
,
0
.
688247
f
);
ok
(
match_float
(
U3
(
n
[
1
]).
z
,
0
.
688247
f
),
"Wrong component n[1].z = %f (expected %f)
\n
"
,
U3
(
n
[
1
]).
z
,
0
.
688247
f
);
ok
(
match_float
(
U1
(
n
[
2
]).
x
,
-
0
.
229416
f
),
"Wrong component n[2].x = %f (expected %f)
\n
"
,
U1
(
n
[
2
]).
x
,
-
0
.
229416
f
);
ok
(
match_float
(
U2
(
n
[
2
]).
y
,
0
.
688247
f
),
"Wrong component n[2].y = %f (expected %f)
\n
"
,
U2
(
n
[
2
]).
y
,
0
.
688247
f
);
ok
(
match_float
(
U3
(
n
[
2
]).
z
,
0
.
688247
f
),
"Wrong component n[2].z = %f (expected %f)
\n
"
,
U3
(
n
[
2
]).
z
,
0
.
688247
f
);
ok
(
match_float
(
U1
(
n
[
3
]).
x
,
-
0
.
577350
f
),
"Wrong component n[3].x = %f (expected %f)
\n
"
,
U1
(
n
[
3
]).
x
,
-
0
.
577350
f
);
ok
(
match_float
(
U2
(
n
[
3
]).
y
,
0
.
577350
f
),
"Wrong component n[3].y = %f (expected %f)
\n
"
,
U2
(
n
[
3
]).
y
,
0
.
577350
f
);
ok
(
match_float
(
U3
(
n
[
3
]).
z
,
0
.
577350
f
),
"Wrong component n[3].z = %f (expected %f)
\n
"
,
U3
(
n
[
3
]).
z
,
0
.
577350
f
);
/* Check that Load method generated default texture coordinates (0.0f, 0.0f) for each vertex */
valu
=
1
.
23
f
;
valv
=
3
.
21
f
;
...
...
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