41#define PROVIDE_MATERIALS 0x1
42#define PROVIDE_SKININFO 0x2
43#define PROVIDE_ADJACENCY 0x4
101 iface->lpVtbl->AddRef(iface);
116 TRACE(
"%p increasing refcount to %lu.\n",
mesh, refcount);
126 TRACE(
"%p decreasing refcount to %lu.\n",
mesh, refcount);
132 if (
mesh->vertex_declaration)
151 TRACE(
"iface %p, attrib_id %lu.\n", iface, attrib_id);
153 if (!
This->vertex_declaration)
155 WARN(
"Can't draw a mesh with an invalid vertex declaration.\n");
159 vertex_size = iface->lpVtbl->GetNumBytesPerVertex(iface);
170 for (face_start = face_end; face_start <
This->numfaces; face_start++)
172 if (
This->attrib_buffer[face_start] == attrib_id)
175 if (face_start >=
This->numfaces)
177 for (face_end = face_start + 1; face_end <
This->numfaces; face_end++)
179 if (
This->attrib_buffer[face_end] != attrib_id)
184 0, 0,
This->numvertices, face_start * 3, face_end - face_start);
195 TRACE(
"iface %p.\n", iface);
197 return mesh->numfaces;
204 TRACE(
"iface %p.\n", iface);
206 return mesh->numvertices;
213 TRACE(
"iface %p.\n", iface);
241 TRACE(
"iface %p.\n", iface);
243 return mesh->vertex_declaration_size;
250 TRACE(
"iface %p.\n", iface);
252 return mesh->options;
275 TRACE(
"iface %p, options %#lx, fvf %#lx, device %p, clone_mesh %p.\n",
464 FIXME(
"Conversion from D3DDECLTYPE_FLOAT4 to %d not implemented.\n", type_dst);
478 D3DXVECTOR4 src_float4 = {*src_ptr, 0.0f, 0.0f, 1.0f};
485 D3DXVECTOR4 src_float4 = {src_ptr->
x, src_ptr->
y, 0.0f, 1.0f};
492 D3DXVECTOR4 src_float4 = {src_ptr->
x, src_ptr->
y, src_ptr->
z, 1.0f};
499 D3DXVECTOR4 src_float4 = {src_ptr->
x, src_ptr->
y, src_ptr->
z, src_ptr->
w};
524 D3DXVECTOR4 src_float4 = {src_ptr[0], src_ptr[1], 0.0f, 1.0f};
531 D3DXVECTOR4 src_float4 = {src_ptr[0], src_ptr[1], src_ptr[2], src_ptr[3]};
583 FIXME(
"Conversion of D3DDECLTYPE %d to %d not implemented.\n", type_src, type_dst);
612 UINT num_vertices = mesh_src->lpVtbl->GetNumVertices(mesh_src);
613 UINT dst_vertex_size = mesh_dst->lpVtbl->GetNumBytesPerVertex(mesh_dst);
614 UINT src_vertex_size = mesh_src->lpVtbl->GetNumBytesPerVertex(mesh_src);
616 hr = mesh_src->lpVtbl->GetDeclaration(mesh_src, orig_declaration);
618 hr = mesh_dst->lpVtbl->GetDeclaration(mesh_dst,
declaration);
623 hr = mesh_dst->lpVtbl->LockVertexBuffer(mesh_dst, 0, (
void**)&vb_dst);
627 memset(vb_dst, 0, num_vertices * dst_vertex_size);
629 for (
i = 0; orig_declaration[
i].
Stream != 0xff;
i++)
636 for (
j = 0;
j < num_vertices;
j++)
639 UINT idx_src = src_vertex_size *
j + orig_declaration[
i].
Offset;
643 memcpy(&vb_dst[idx_dst], &vb_src[idx_src], type_size);
652 if (vb_dst) mesh_dst->lpVtbl->UnlockVertexBuffer(mesh_dst);
653 if (vb_src) mesh_src->lpVtbl->UnlockVertexBuffer(mesh_src);
660 UINT size1 = 0, size2 = 0;
663 while (declaration1[size1].
Stream != 0xff) size1++;
664 while (declaration2[size2].
Stream != 0xff) size2++;
671 if (
memcmp(declaration1, declaration2, size1*
sizeof(*declaration1)) == 0)
682 ID3DXMesh *clone_mesh;
684 void *data_in, *data_out;
687 BOOL same_declaration;
689 TRACE(
"iface %p, options %#lx, declaration %p, device %p, clone_mesh_out %p.\n",
695 hr = iface->lpVtbl->GetDeclaration(iface, orig_declaration);
703 vertex_size = clone_mesh->lpVtbl->GetNumBytesPerVertex(clone_mesh);
707 if (!same_declaration) {
715 }
else if (same_declaration) {
718 hr = clone_mesh->lpVtbl->LockVertexBuffer(clone_mesh, 0, &data_out);
720 iface->lpVtbl->UnlockVertexBuffer(iface);
723 memcpy(data_out, data_in,
This->numvertices * vertex_size);
724 clone_mesh->lpVtbl->UnlockVertexBuffer(clone_mesh);
725 iface->lpVtbl->UnlockVertexBuffer(iface);
733 hr = clone_mesh->lpVtbl->LockIndexBuffer(clone_mesh, 0, &data_out);
735 iface->lpVtbl->UnlockIndexBuffer(iface);
741 for (
i = 0;
i <
This->numfaces * 3;
i++)
744 for (
i = 0;
i <
This->numfaces * 3;
i++)
750 clone_mesh->lpVtbl->UnlockIndexBuffer(clone_mesh);
751 iface->lpVtbl->UnlockIndexBuffer(iface);
755 if (
This->attrib_table_size)
766 *clone_mesh_out = clone_mesh;
770 IUnknown_Release(clone_mesh);
817 TRACE(
"iface %p.\n", iface);
835 TRACE(
"iface %p.\n", iface);
847 TRACE(
"iface %p, attrib_table %p, attrib_table_size %p.\n",
896 for (
i = 0;
i < 3 * num_faces;
i++)
903 for (edge = 0; edge < 3; edge++)
929 if (edge_face_ptr->
v2 == vertex1)
930 return edge_face_ptr->
face;
938 DWORD *id_point_reps;
941 id_point_reps =
malloc(num_vertices *
sizeof(*id_point_reps));
945 for (
i = 0;
i < num_vertices;
i++)
947 id_point_reps[
i] =
i;
950 return id_point_reps;
957 DWORD num_faces = iface->lpVtbl->GetNumFaces(iface);
958 DWORD num_vertices = iface->lpVtbl->GetNumVertices(iface);
969 TRACE(
"iface %p, point_reps %p, adjacency %p.\n", iface, point_reps, adjacency);
982 point_reps_ptr = id_point_reps;
986 point_reps_ptr = point_reps;
992 if (indices_are_16_bit)
996 WORD *ib_16bit = ib_ptr;
1003 for (
i = 0;
i < 3 * num_faces;
i++)
1005 ib[
i] = ib_16bit[
i];
1019 for (edge = 0; edge < 3; edge++)
1023 DWORD new_v1 = point_reps_ptr[
v1];
1024 DWORD new_v2 = point_reps_ptr[
v2];
1028 adjacency[3*
face + edge] = adj_face;
1034 free(id_point_reps);
1035 if (indices_are_16_bit)
free(ib);
1038 if(ib_ptr) iface->lpVtbl->UnlockIndexBuffer(iface);
1057 unsigned int face_base = 3 * face_idx;
1058 unsigned int edge, opp_edge;
1060 for (edge = 0; edge < 3; ++edge)
1062 unsigned int adj_face = adjacency[face_base + edge];
1063 unsigned int adj_face_base;
1066 if (adj_face == ~0
u)
1071 WARN(
"Index out of bounds. Got %u, expected less than %u.\n", adj_face,
face_count);
1074 adj_face_base = 3 * adj_face;
1077 for (opp_edge = 0; opp_edge < 3; ++opp_edge)
1079 unsigned int opp_edge_index = adj_face_base + opp_edge;
1081 if (adjacency[opp_edge_index] == face_idx)
1086 for (
i = 0;
i < 2; ++
i)
1088 unsigned int from = face_base + (edge + (1 -
i)) % 3;
1089 unsigned int to = adj_face_base + (opp_edge +
i) % 3;
1092 if (new_indices[to] > new_indices[
from])
1094 new_indices[to] = new_indices[
from];
1110 unsigned int face,
i;
1113 TRACE(
"iface %p, adjacency %p, point_reps %p.\n", iface, adjacency, point_reps);
1117 WARN(
"NULL adjacency.\n");
1123 WARN(
"NULL point_reps.\n");
1128 if (!
mesh->numfaces)
1130 ERR(
"Number of faces was zero.\n");
1155 for (
i = 0;
i < 3 *
mesh->numfaces; ++
i)
1157 new_indices[
i] = indices_16bit[
i];
1163 for (
i = 0;
i <
mesh->numvertices; ++
i)
1187 iface->lpVtbl->UnlockIndexBuffer(iface);
1192 iface->lpVtbl->UnlockIndexBuffer(iface);
1227 const FLOAT epsilon_sq = epsilon * epsilon;
1230 TRACE(
"iface %p, epsilon %.8e, adjacency %p.\n", iface, epsilon, adjacency);
1235 buffer_size =
This->numfaces * 3 *
sizeof(*shared_indices) +
This->numvertices *
sizeof(*sorted_vertices);
1239 if (!shared_indices)
1250 DWORD *dword_indices = (
DWORD*)(sorted_vertices +
This->numvertices);
1252 for (
i = 0;
i <
This->numfaces * 3;
i++)
1253 *dword_indices++ = *word_indices++;
1256 vertex_size = iface->lpVtbl->GetNumBytesPerVertex(iface);
1257 for (
i = 0;
i <
This->numvertices;
i++) {
1263 for (
i = 0;
i <
This->numfaces * 3;
i++) {
1271 for (
i = 0;
i <
This->numvertices;
i++) {
1276 while (shared_index_a != -1) {
1278 DWORD shared_index_b = shared_indices[shared_index_a];
1282 while (shared_index_b != -1) {
1284 DWORD base_a = (shared_index_a / 3) * 3;
1285 DWORD base_b = (shared_index_b / 3) * 3;
1289 for (
k = 0;
k < 3;
k++) {
1290 if (adjacency[base_b +
k] == shared_index_a / 3) {
1296 for (
k = 1;
k <= 2;
k++) {
1297 DWORD vertex_index_a = base_a + (shared_index_a +
k) % 3;
1298 DWORD vertex_index_b = base_b + (shared_index_b + (3 -
k)) % 3;
1300 if (!adjacent && epsilon >= 0.0f) {
1304 D3DXVec3Subtract(&delta,
1307 length_sq = D3DXVec3LengthSq(&delta);
1308 adjacent = epsilon == 0.0f ? length_sq == 0.0f : length_sq < epsilon_sq;
1311 DWORD adj_a = base_a + 2 - (vertex_index_a + shared_index_a + 1) % 3;
1312 DWORD adj_b = base_b + 2 - (vertex_index_b + shared_index_b + 1) % 3;
1313 if (adjacency[adj_a] == -1 && adjacency[adj_b] == -1) {
1314 adjacency[adj_a] = base_b / 3;
1315 adjacency[adj_b] = base_a / 3;
1322 shared_index_b = shared_indices[shared_index_b];
1324 while (++j < This->numvertices) {
1328 if (sorted_vertex_b->
key - sorted_vertex_a->
key > epsilon * 3.0f) {
1330 j =
This->numvertices;
1335 if (
fabsf(vertex_a->
x - vertex_b->
x) <= epsilon &&
1336 fabsf(vertex_a->
y - vertex_b->
y) <= epsilon &&
1337 fabsf(vertex_a->
z - vertex_b->
z) <= epsilon)
1342 if (
j >=
This->numvertices)
1354 if (
indices) iface->lpVtbl->UnlockIndexBuffer(iface);
1355 if (vertices) iface->lpVtbl->UnlockVertexBuffer(iface);
1356 free(shared_indices);
1371 WARN(
"Invalid declaration. Can't use NULL declaration.\n");
1379 WARN(
"Invalid declaration. New vertex size does not match the original vertex size.\n");
1388 WARN(
"Invalid declaration. New declaration contains non-zero Stream value.\n");
1393 This->num_elem =
i + 1;
1396 if (
This->vertex_declaration)
1409 &
This->vertex_declaration);
1412 WARN(
"Using invalid declaration. Calls to DrawSubset will fail.\n");
1430 mesh->attrib_table_size = 0;
1445 TRACE(
"iface %p.\n", iface);
1463 ID3DXMesh *optimized_mesh;
1465 TRACE(
"iface %p, flags %#lx, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, opt_mesh %p.\n",
1466 iface,
flags, adjacency_in, adjacency_out, face_remap, vertex_remap, opt_mesh);
1477 hr = optimized_mesh->lpVtbl->OptimizeInplace(optimized_mesh,
flags, adjacency_in, adjacency_out, face_remap, vertex_remap);
1479 *opt_mesh = optimized_mesh;
1481 IUnknown_Release(optimized_mesh);
1491 DWORD *vertex_remap_ptr;
1492 DWORD num_used_vertices;
1499 for (
i = 0;
i <
This->numfaces * 3;
i++)
1503 num_used_vertices = 0;
1504 for (
i = 0;
i <
This->numvertices;
i++) {
1505 if (vertex_remap_ptr[
i])
1506 vertex_remap_ptr[
i] = num_used_vertices++;
1508 vertex_remap_ptr[
i] = -1;
1511 for (
i = 0;
i <
This->numfaces * 3;
i++)
1515 num_used_vertices = 0;
1516 for (
i = 0;
i <
This->numvertices;
i++) {
1517 if (vertex_remap_ptr[
i] != -1)
1518 vertex_remap_ptr[num_used_vertices++] =
i;
1520 for (
i = num_used_vertices;
i <
This->numvertices;
i++)
1521 vertex_remap_ptr[
i] = -1;
1523 *new_num_vertices = num_used_vertices;
1548 DWORD min_vertex, max_vertex;
1553 min_vertex = (
DWORD)-1;
1566 min_vertex = (
DWORD)-1;
1569 for (
j = 0;
j < 3;
j++) {
1587 int delta = *ptr_a - *ptr_b;
1592 delta = ptr_a - ptr_b;
1600 DWORD **sorted_attrib_ptr_buffer =
NULL;
1603 sorted_attrib_ptr_buffer =
malloc(
This->numfaces *
sizeof(*sorted_attrib_ptr_buffer));
1604 if (!sorted_attrib_ptr_buffer)
1607 *face_remap =
malloc(
This->numfaces *
sizeof(**face_remap));
1610 free(sorted_attrib_ptr_buffer);
1614 for (
i = 0;
i <
This->numfaces;
i++)
1618 for (
i = 0;
i <
This->numfaces;
i++)
1621 (*face_remap)[old_face] =
i;
1625 *sorted_attrib_buffer = (
DWORD*)sorted_attrib_ptr_buffer;
1626 for (
i = 0;
i <
This->numfaces;
i++)
1634 if (
index == 0xffffffff)
1636 return face_remap[
index];
1649 DWORD new_num_vertices = 0;
1650 DWORD new_num_alloc_vertices = 0;
1655 TRACE(
"iface %p, flags %#lx, adjacency_in %p, adjacency_out %p, face_remap_out %p, vertex_remap_out %p.\n",
1656 iface,
flags, adjacency_in, adjacency_out, face_remap_out, vertex_remap_out);
1668 FIXME(
"D3DXMESHOPT_VERTEXCACHE not implemented.\n");
1670 FIXME(
"D3DXMESHOPT_STRIPREORDER not implemented.\n");
1674 hr = iface->lpVtbl->LockIndexBuffer(iface, 0, &
indices);
1683 for (
i = 0;
i <
This->numfaces * 3;
i++)
1684 dword_indices[
i] = *word_indices++;
1689 new_num_alloc_vertices =
This->numvertices;
1694 FIXME(
"D3DXMESHOPT_ATTRSORT vertex reordering not implemented.\n");
1708 DWORD vertex_size = iface->lpVtbl->GetNumBytesPerVertex(iface);
1709 BYTE *orig_vertices;
1728 for (
i = 0;
i < new_num_vertices;
i++)
1729 memcpy(new_vertices +
i * vertex_size, orig_vertices + vertex_remap_ptr[
i] * vertex_size, vertex_size);
1733 }
else if (vertex_remap_out) {
1734 DWORD *vertex_remap_ptr;
1739 for (
i = 0;
i <
This->numvertices;
i++)
1740 *vertex_remap_ptr++ =
i;
1759 for (
i = 0;
i <
This->numfaces;
i++)
1763 for (
i = 0;
i <
This->numfaces;
i++) {
1764 DWORD new_pos = face_remap[
i] * 3;
1766 word_indices[new_pos++] = dword_indices[old_pos++];
1767 word_indices[new_pos++] = dword_indices[old_pos++];
1768 word_indices[new_pos] = dword_indices[old_pos];
1783 for (
i = 0;
i <
This->numfaces * 3;
i++)
1784 *word_indices++ = dword_indices[
i];
1788 if (adjacency_out) {
1790 for (
i = 0;
i <
This->numfaces;
i++) {
1792 DWORD new_pos = face_remap[
i] * 3;
1794 adjacency_out[new_pos++] =
adjacency_remap(face_remap, adjacency_in[old_pos++]);
1795 adjacency_out[new_pos++] =
adjacency_remap(face_remap, adjacency_in[old_pos++]);
1796 adjacency_out[new_pos] =
adjacency_remap(face_remap, adjacency_in[old_pos]);
1799 memcpy(adjacency_out, adjacency_in,
This->numfaces * 3 *
sizeof(*adjacency_out));
1802 if (face_remap_out) {
1804 for (
i = 0;
i <
This->numfaces;
i++)
1805 face_remap_out[face_remap[
i]] =
i;
1807 for (
i = 0;
i <
This->numfaces;
i++)
1808 face_remap_out[
i] =
i;
1811 if (vertex_remap_out)
1812 *vertex_remap_out = vertex_remap;
1813 vertex_remap =
NULL;
1819 This->numvertices = new_num_vertices;
1824 free(sorted_attrib_buffer);
1826 free(dword_indices);
1829 if (
attrib_buffer) iface->lpVtbl->UnlockAttributeBuffer(iface);
1830 if (
indices) iface->lpVtbl->UnlockIndexBuffer(iface);
1854 mesh->attrib_table = new_table;
1912 FLOAT div, tmin, tmax, tymin, tymax, tzmin, tzmax;
1914 div = 1.0f / praydirection->
x;
1917 tmin = ( pmin->
x - prayposition->
x ) *
div;
1918 tmax = ( pmax->
x - prayposition->
x ) *
div;
1922 tmin = ( pmax->
x - prayposition->
x ) *
div;
1923 tmax = ( pmin->
x - prayposition->
x ) *
div;
1926 if ( tmax < 0.0f )
return FALSE;
1928 div = 1.0f / praydirection->
y;
1931 tymin = ( pmin->
y - prayposition->
y ) *
div;
1932 tymax = ( pmax->
y - prayposition->
y ) *
div;
1936 tymin = ( pmax->
y - prayposition->
y ) *
div;
1937 tymax = ( pmin->
y - prayposition->
y ) *
div;
1940 if ( ( tymax < 0.0f ) || ( tmin > tymax ) || ( tymin > tmax ) )
return FALSE;
1942 if ( tymin > tmin ) tmin = tymin;
1943 if ( tymax < tmax ) tmax = tymax;
1945 div = 1.0f / praydirection->
z;
1948 tzmin = ( pmin->
z - prayposition->
z ) *
div;
1949 tzmax = ( pmax->
z - prayposition->
z ) *
div;
1953 tzmin = ( pmax->
z - prayposition->
z ) *
div;
1954 tzmax = ( pmin->
z - prayposition->
z ) *
div;
1957 if ( (tzmax < 0.0f ) || ( tmin > tzmax ) || ( tzmin > tmax ) )
return FALSE;
1970 *pmin = *pfirstposition;
1973 for(
i=0;
i<numvertices;
i++)
1975 vec = *( (
const D3DXVECTOR3*)((
const char*)pfirstposition + dwstride *
i) );
1983 if (
vec.z < pmin->
z ) pmin->
z =
vec.z;
1984 if (
vec.z > pmax->
z ) pmax->
z =
vec.z;
2004 for(
i=0;
i<numvertices;
i++)
2007 D3DXVec3Scale(pcenter, &
temp, 1.0f / numvertices);
2009 for(
i=0;
i<numvertices;
i++)
2011 d = D3DXVec3Length(D3DXVec3Subtract(&
temp, (
const D3DXVECTOR3*)((
const char*)pfirstposition + dwstride *
i), pcenter));
2012 if (
d > *pradius ) *pradius =
d;
2039 unsigned int idx = 0;
2052 if (has_blend_idx) --blend_count;
2055 || (has_blend && blend_count > 4))
2065 switch (blend_count)
2082 ERR(
"Invalid blend count %lu.\n", blend_count);
2105 for (
i = 0;
i < tex_count; ++
i)
2107 switch ((fvf >> (16 + 2 *
i)) & 0x03)
2284 return (((((FVF) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1);
2310 for (
i = 0;
i < numTextures;
i++)
2326 TRACE(
"decl %p, stream_idx %lu.\n", decl, stream_idx);
2328 if (!decl)
return 0;
2334 if (
element->Stream != stream_idx)
continue;
2338 FIXME(
"Unhandled element type %#x, size will be incorrect.\n",
element->Type);
2356 TRACE(
"decl %p\n", decl);
2371 TRACE(
"p0 %p, p1 %p, p2 %p, praypos %p, praydir %p, pu %p, pv %p, pdist %p.\n",
2372 p0, p1, p2, praypos, praydir, pu, pv, pdist);
2374 m.m[0][0] = p1->
x - p0->
x;
2375 m.m[1][0] = p2->
x - p0->
x;
2376 m.m[2][0] = -praydir->
x;
2378 m.m[0][1] = p1->
y - p0->
y;
2379 m.m[1][1] = p2->
y - p0->
y;
2380 m.m[2][1] = -praydir->
y;
2382 m.m[0][2] = p1->
z - p0->
z;
2383 m.m[1][2] = p2->
z - p0->
z;
2384 m.m[2][2] = -praydir->
z;
2391 vec.
x = praypos->
x - p0->
x;
2392 vec.
y = praypos->
y - p0->
y;
2393 vec.z = praypos->
z - p0->
z;
2401 if (pu) *pu =
vec.
x;
2402 if (pv) *pv =
vec.
y;
2403 if (pdist) *pdist =
fabsf(
vec.z );
2417 D3DXVec3Subtract(&difference, ray_position, center);
2418 c = D3DXVec3LengthSq(&difference) - radius * radius;
2421 a = D3DXVec3LengthSq(ray_direction);
2422 b = D3DXVec3Dot(&difference, ray_direction);
2425 return d >= 0.0f && (
b <= 0.0f ||
d >
b *
b);
2436 IDirect3DVertexDeclaration9 *vertex_declaration;
2437 UINT vertex_declaration_size;
2440 IDirect3DIndexBuffer9 *index_buffer;
2441 DWORD *attrib_buffer;
2443 DWORD index_usage = 0;
2446 DWORD vertex_usage = 0;
2450 TRACE(
"numfaces %lu, numvertices %lu, options %#lx, declaration %p, device %p, mesh %p.\n",
2516 WARN(
"Failed to create vertex declaration, hr %#lx.\n",
hr);
2524 WARN(
"Failed to create vertex buffer, hr %#lx.\n",
hr);
2533 WARN(
"Failed to create index buffer, hr %#lx.\n",
hr);
2540 object =
calloc(1,
sizeof(*
object));
2569 *
mesh = &
object->ID3DXMesh_iface;
2583 TRACE(
"face_count %lu, vertex_count %lu, options %#lx, fvf %#lx, device %p, mesh %p.\n",
2634 free(*filename_out);
2635 *filename_out =
NULL;
2637 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void**)&
data);
2641 if (data_size <
sizeof(filename_in))
2643 WARN(
"Truncated data (%Iu bytes).\n", data_size);
2644 filedata->lpVtbl->Unlock(filedata);
2647 filename_in = *(
char **)
data;
2649 if (!(*filename_out =
strdup(filename_in))) {
2650 filedata->lpVtbl->Unlock(filedata);
2654 filedata->lpVtbl->Unlock(filedata);
2665 ID3DXFileData *
child;
2668 material->pTextureFilename =
NULL;
2670 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void**)&
data);
2693 if (data_size !=
sizeof(
float) * 11)
2695 WARN(
"Incorrect data size (%Id bytes).\n", data_size);
2696 filedata->lpVtbl->Unlock(filedata);
2714 filedata->lpVtbl->Unlock(filedata);
2716 hr = filedata->lpVtbl->GetChildren(filedata, &nb_children);
2720 for (
i = 0;
i < nb_children;
i++)
2722 hr = filedata->lpVtbl->GetChild(filedata,
i, &
child);
2734 IUnknown_Release(
child);
2739 IUnknown_Release(
child);
2747 for (
i = 0;
i <
mesh->num_materials; ++
i)
2748 free(
mesh->materials[
i].pTextureFilename);
2751 mesh->num_materials = 0;
2759 unsigned int material_count;
2773 hr = filedata->lpVtbl->Lock(filedata, &data_size, &
data);
2789 WARN(
"Truncated data (%Id bytes).\n", data_size);
2792 material_count = *in_ptr++;
2793 if (!material_count) {
2798 if (data_size < 2 *
sizeof(
uint32_t))
2800 WARN(
"Truncated data (%Id bytes).\n", data_size);
2803 if (*in_ptr++ !=
mesh->num_poly_faces)
2805 WARN(
"Number of material face indices (%u) doesn't match number of faces (%u).\n",
2806 *(in_ptr - 1),
mesh->num_poly_faces);
2811 WARN(
"Truncated data (%Id bytes).\n", data_size);
2814 for (
i = 0;
i <
mesh->num_poly_faces; ++
i)
2816 if (*in_ptr++ >= material_count)
2818 WARN(
"Face %u: reference to undefined material %u (only %u materials).\n",
2819 i, *(in_ptr - 1), material_count);
2824 mesh->materials =
malloc(material_count *
sizeof(*
mesh->materials));
2825 mesh->material_indices =
malloc(
mesh->num_poly_faces *
sizeof(*
mesh->material_indices));
2826 if (!
mesh->materials || !
mesh->material_indices) {
2832 hr = filedata->lpVtbl->GetChildren(filedata, &nb_children);
2836 for (
i = 0;
i < nb_children;
i++)
2838 hr = filedata->lpVtbl->GetChild(filedata,
i, &
child);
2847 if (
mesh->num_materials >= material_count)
2849 WARN(
"%u materials defined, only %u declared.\n",
mesh->num_materials, material_count);
2858 IUnknown_Release(
child);
2861 if (material_count !=
mesh->num_materials)
2863 WARN(
"Only %u of %u materials defined.\n", material_count,
mesh->num_materials);
2869 IUnknown_Release(
child);
2870 filedata->lpVtbl->Unlock(filedata);
2883 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data);
2900 WARN(
"Truncated data (%Id bytes).\n", data_size);
2905 WARN(
"Number of texture coordinates (%u) doesn't match number of vertices (%u).\n",
2910 if (data_size <
sizeof(
uint32_t) +
mesh->num_vertices *
sizeof(*
mesh->tex_coords))
2912 WARN(
"Truncated data (%Id bytes).\n", data_size);
2917 if (!
mesh->tex_coords) {
2928 filedata->lpVtbl->Unlock(filedata);
2934 unsigned int color_count,
i;
2942 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data);
2959 WARN(
"Truncated data (%Id bytes).\n", data_size);
2962 color_count = *
data;
2966 WARN(
"Truncated data (%Id bytes).\n", data_size);
2971 if (!
mesh->vertex_colors) {
2976 for (
i = 0;
i <
mesh->num_vertices;
i++)
2978 for (
i = 0;
i < color_count; ++
i)
2986 WARN(
"Vertex color %u references undefined vertex %u (only %u vertices).\n",
3007 filedata->lpVtbl->Unlock(filedata);
3013 unsigned int num_face_indices =
mesh->num_poly_faces * 2 +
mesh->num_tri_faces;
3014 DWORD *index_out_ptr;
3021 mesh->num_normals = 0;
3026 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data);
3048 if (data_size <
sizeof(
uint32_t) * 2)
3050 WARN(
"Truncated data (%Id bytes).\n", data_size);
3056 num_face_indices *
sizeof(
uint32_t))
3058 WARN(
"Truncated data (%Id bytes).\n", data_size);
3063 mesh->normal_indices =
malloc(num_face_indices *
sizeof(*
mesh->normal_indices));
3064 if (!
mesh->normals || !
mesh->normal_indices) {
3071 for (
i = 0;
i <
mesh->num_normals;
i++)
3076 WARN(
"Number of face normals (%u) doesn't match number of faces (%u).\n",
3081 index_out_ptr =
mesh->normal_indices;
3082 for (
i = 0;
i <
mesh->num_poly_faces;
i++)
3089 WARN(
"Face %u: number of normals (%u) doesn't match number of vertices (%u).\n",
3099 if (normal_index >=
mesh->num_normals)
3101 WARN(
"Face %u, normal index %u: reference to undefined normal %u (only %u normals).\n",
3102 i,
j, normal_index,
mesh->num_normals);
3105 *index_out_ptr++ = normal_index;
3113 filedata->lpVtbl->Unlock(filedata);
3130 WARN(
"Skin mesh header already encountered\n");
3134 if (
FAILED(
hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data)))
3137 if (data_size <
sizeof(
WORD) * 3)
3139 WARN(
"Truncated data (%Id bytes).\n", data_size);
3140 filedata->lpVtbl->Unlock(filedata);
3155 unsigned int influence_count;
3168 WARN(
"Skin weights found but skin mesh header not encountered yet.\n");
3172 if (
FAILED(
hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data)))
3178 data +=
sizeof(
char *);
3183 if (data_size < (
sizeof(
char *) +
sizeof(
uint32_t) + influence_count * (
sizeof(
uint32_t) +
sizeof(
float))
3184 + 16 *
sizeof(
float)))
3186 WARN(
"Truncated data (%Id bytes).\n", data_size);
3187 filedata->lpVtbl->Unlock(filedata);
3236 DWORD *index_out_ptr;
3255 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data);
3261 if (data_size <
sizeof(
uint32_t) * 2)
3263 WARN(
"Truncated data (%Id bytes).\n", data_size);
3269 WARN(
"Truncated data (%Id bytes).\n", data_size);
3280 unsigned int poly_vertices_count;
3285 WARN(
"Truncated data (%Id bytes).\n", data_size);
3288 poly_vertices_count = *(
uint32_t *)in_ptr;
3290 if (data_size - (in_ptr -
data) < poly_vertices_count *
sizeof(
uint32_t))
3292 WARN(
"Truncated data (%Id bytes).\n", data_size);
3295 if (poly_vertices_count < 3)
3297 WARN(
"Face %u has only %u vertices.\n",
i, poly_vertices_count);
3300 for (
j = 0;
j < poly_vertices_count;
j++)
3304 WARN(
"Face %u, index %u: undefined vertex %u (only %u vertices).\n",
3338 *index_out_ptr++ = *(
uint32_t *)in_ptr;
3343 hr = filedata->lpVtbl->GetChildren(filedata, &child_count);
3347 for (
i = 0;
i < child_count;
i++)
3349 hr = filedata->lpVtbl->GetChild(filedata,
i, &
child);
3361 IUnknown_Release(
child);
3367 WARN(
"Mismatch between skin weights info count %u and bones count %u from skin mesh header.\n",
3384 IUnknown_Release(
child);
3385 filedata->lpVtbl->Unlock(filedata);
3396 static const struct {
3397 const char *param_name;
3401 } material_effects[] = {
3402#define EFFECT_TABLE_ENTRY(str, field) \
3403 {str, sizeof(str), sizeof(material_ptr->MatD3D.field), offsetof(D3DXMATERIAL, MatD3D.field)}
3409#undef EFFECT_TABLE_ENTRY
3411 static const char texture_paramname[] =
"Texture0@Name";
3435 for (
i = 0;
i < num_materials;
i++) {
3436 if (material_ptr[
i].pTextureFilename) {
3446 out_ptr = (
BYTE*)(effect_ptr + num_materials);
3448 for (
i = 0;
i < num_materials;
i++)
3454 effect_ptr->
NumDefaults = material_ptr->pTextureFilename ? 6 : 5;
3459 defaults->pParamName = (
char *)out_ptr;
3463 defaults->NumBytes = material_effects[
j].num_bytes;
3469 if (material_ptr->pTextureFilename)
3471 defaults->pParamName = (
char *)out_ptr;
3489 struct ID3DXBuffer **effects_out,
DWORD *num_materials_out,
struct ID3DXSkinInfo **skin_info_out,
3490 struct ID3DXMesh **mesh_out)
3493 DWORD *index_in_ptr;
3495 DWORD total_vertices;
3496 ID3DXMesh *d3dxmesh =
NULL;
3500 struct vertex_duplication {
3503 } *duplications =
NULL;
3505 void *vertices =
NULL;
3508 DWORD provide_flags = 0;
3510 TRACE(
"filedata %p, options %#lx, device %p, adjacency_out %p, materials_out %p, "
3511 "effects_out %p, num_materials_out %p, skin_info_out %p, mesh_out %p.\n",
3513 effects_out, num_materials_out, skin_info_out, mesh_out);
3517 if (num_materials_out || materials_out || effects_out)
3528 *adjacency_out =
NULL;
3530 *materials_out =
NULL;
3532 *effects_out =
NULL;
3543 if (!duplications) {
3547 for (
i = 0;
i < total_vertices;
i++)
3549 duplications[
i].normal_index = -1;
3552 for (
i = 0;
i < num_face_indices;
i++) {
3555 struct vertex_duplication *dup_ptr = &duplications[
vertex_index];
3557 if (dup_ptr->normal_index == -1) {
3558 dup_ptr->normal_index = normal_index;
3561 struct list *dup_list = &dup_ptr->entry;
3564 if (new_normal->
x == cur_normal->
x &&
3565 new_normal->
y == cur_normal->
y &&
3566 new_normal->
z == cur_normal->
z)
3570 }
else if (!
list_next(dup_list, &dup_ptr->entry)) {
3571 dup_ptr = &duplications[total_vertices++];
3572 dup_ptr->normal_index = normal_index;
3578 struct vertex_duplication,
entry);
3588 hr = d3dxmesh->lpVtbl->LockVertexBuffer(d3dxmesh, 0, &vertices);
3596 if (duplications[
i].normal_index == -1)
3604 out_ptr +=
sizeof(
DWORD);
3615 struct vertex_duplication *dup_ptr;
3618 int j = dup_ptr - duplications;
3619 BYTE *dest_vertex = (
BYTE*)vertices +
j * vertex_size;
3621 memcpy(dest_vertex, out_ptr, vertex_size);
3625 out_ptr += vertex_size;
3628 d3dxmesh->lpVtbl->UnlockVertexBuffer(d3dxmesh);
3630 hr = d3dxmesh->lpVtbl->LockIndexBuffer(d3dxmesh, 0, &
indices);
3634#define FILL_INDEX_BUFFER(indices_var) \
3635 for (i = 0; i < mesh_data.num_poly_faces; i++) \
3637 DWORD count = mesh_data.num_tri_per_face[i]; \
3638 WORD first_index = *index_in_ptr++; \
3640 *indices_var++ = first_index; \
3641 *indices_var++ = *index_in_ptr; \
3643 *indices_var++ = *index_in_ptr; \
3654#undef FILL_INDEX_BUFFER
3655 d3dxmesh->lpVtbl->UnlockIndexBuffer(d3dxmesh);
3659 hr = d3dxmesh->lpVtbl->LockAttributeBuffer(d3dxmesh, 0, &attrib_buffer);
3667 d3dxmesh->lpVtbl->UnlockAttributeBuffer(d3dxmesh);
3669 hr = d3dxmesh->lpVtbl->OptimizeInplace(d3dxmesh,
3677 char *strings_out_ptr;
3692 if (materials_ptr[
i].pTextureFilename) {
3694 materials_ptr[
i].pTextureFilename = strings_out_ptr;
3704 if (!materials_out) {
3710 if (adjacency_out) {
3717 *mesh_out = d3dxmesh;
3718 if (adjacency_out) *adjacency_out = adjacency;
3720 if (materials_out) *materials_out = materials;
3721 if (effects_out) *effects_out = effects;
3727 if (d3dxmesh) IUnknown_Release(d3dxmesh);
3732 if (skin_info_out) *skin_info_out =
NULL;
3747 struct ID3DXAllocateHierarchy *
alloc_hier,
struct ID3DXLoadUserData *load_user_data,
3748 D3DXFRAME **frame_hierarchy,
struct ID3DXAnimationController **anim_controller)
3754 TRACE(
"filename %s, options %#lx, device %p, alloc_hier %p, "
3755 "load_user_data %p, frame_hierarchy %p, anim_controller %p.\n",
3757 load_user_data, frame_hierarchy, anim_controller);
3768 alloc_hier, load_user_data, frame_hierarchy, anim_controller);
3775 struct ID3DXAllocateHierarchy *
alloc_hier,
struct ID3DXLoadUserData *load_user_data,
3776 D3DXFRAME **frame_hierarchy,
struct ID3DXAnimationController **anim_controller)
3782 TRACE(
"filename %s, options %#lx, device %p, alloc_hier %p, "
3783 "load_user_data %p, frame_hierarchy %p, anim_controller %p.\n",
3785 load_user_data, frame_hierarchy, anim_controller);
3795 alloc_hier, load_user_data, frame_hierarchy, anim_controller);
3807 hr = filedata->lpVtbl->GetName(filedata,
NULL, &name_len);
3815 hr = filedata->lpVtbl->GetName(filedata, *
name, &name_len);
3826 struct ID3DXLoadUserData *load_user_data)
3832 ID3DXSkinInfo *skin_info =
NULL;
3834 DWORD num_materials = 0;
3845 &adjacency, &materials, &effects, &num_materials,
3863 hr = filedata->lpVtbl->GetChildren(filedata, &child_count);
3867 for (
i = 0;
i < child_count;
i++)
3869 if (
FAILED(
hr = filedata->lpVtbl->GetChild(filedata,
i, &
child)))
3878 IUnknown_Release(
child);
3887 if (skin_info) IUnknown_Release(skin_info);
3907 hr = filedata->lpVtbl->Lock(filedata, &data_size, (
const void **)&
data);
3913 WARN(
"Incorrect data size (%Id bytes).\n", data_size);
3914 filedata->lpVtbl->Unlock(filedata);
3920 filedata->lpVtbl->Unlock(filedata);
3925 struct ID3DXAllocateHierarchy *
alloc_hier,
D3DXFRAME **frame_out,
struct ID3DXLoadUserData *load_user_data)
3929 ID3DXFileData *
child;
3948 hr = filedata->lpVtbl->GetChildren(filedata, &nb_children);
3952 for (
i = 0;
i < nb_children;
i++)
3954 hr = filedata->lpVtbl->GetChild(filedata,
i, &
child);
3971 }
else if (load_user_data) {
3973 hr = load_user_data->lpVtbl->LoadFrameChildData(load_user_data, frame,
child);
3978 IUnknown_Release(
child);
3983 IUnknown_Release(
child);
3989 struct ID3DXLoadUserData *load_user_data,
D3DXFRAME **frame_hierarchy,
3990 struct ID3DXAnimationController **anim_controller)
3993 ID3DXFile *d3dxfile =
NULL;
3994 ID3DXFileEnumObject *enumobj =
NULL;
3995 ID3DXFileData *filedata =
NULL;
4002 TRACE(
"memory %p, memory_size %lu, options %#lx, device %p, alloc_hier %p, load_user_data %p, "
4003 "frame_hierarchy %p, anim_controller %p.\n",
memory, memory_size,
options,
4016 source.dSize = memory_size;
4020 hr = enumobj->lpVtbl->GetChildren(enumobj, &nb_children);
4024 for (
i = 0;
i < nb_children;
i++)
4026 hr = enumobj->lpVtbl->GetChild(enumobj,
i, &filedata);
4030 hr = filedata->lpVtbl->GetType(filedata, &
guid);
4039 D3DXMatrixIdentity(&(*next_frame)->TransformationMatrix);
4047 }
else if (load_user_data) {
4049 hr = load_user_data->lpVtbl->LoadTopLevelData(load_user_data, filedata);
4055 filedata->lpVtbl->Release(filedata);
4072 *frame_hierarchy = root_frame;
4075 *frame_hierarchy = first_frame;
4079 if (anim_controller)
4081 *anim_controller =
NULL;
4082 FIXME(
"Animation controller creation not implemented.\n");
4087 if (filedata) filedata->lpVtbl->Release(filedata);
4088 if (enumobj) enumobj->lpVtbl->Release(enumobj);
4089 if (d3dxfile) d3dxfile->lpVtbl->Release(d3dxfile);
4094 ID3DXMesh **mesh_out,
DWORD *adjacency_out,
ID3DXBuffer **errors_and_warnings)
4096 FIXME(
"(%u, %p, %p, %p, %p, %p)\n", clean_type, mesh_in, adjacency_in, mesh_out, adjacency_out, errors_and_warnings);
4120 current_frame = frame;
4145 DWORD *num_materials,
struct ID3DXMesh **
mesh)
4151 TRACE(
"filename %s, options %#lx, device %p, adjacency %p, materials %p, "
4152 "effect_instances %p, num_materials %p, mesh %p.\n",
4154 effect_instances, num_materials,
mesh);
4165 effect_instances, num_materials,
mesh);
4173 DWORD *num_materials,
struct ID3DXMesh **
mesh)
4179 TRACE(
"filename %s, options %#lx, device %p, adjacency %p, materials %p, "
4180 "effect_instances %p, num_materials %p, mesh %p.\n",
4182 effect_instances, num_materials,
mesh);
4192 materials, effect_instances, num_materials,
mesh);
4208 TRACE(
"module %p, name %s, type %s, options %#lx, device %p, adjacency %p, "
4209 "materials %p, effect_instances %p, num_materials %p, mesh %p.\n",
4211 materials, effect_instances, num_materials,
mesh);
4220 materials, effect_instances, num_materials,
mesh);
4239 ID3DXFileData *
child;
4243 hr = filedata->lpVtbl->GetChildren(filedata, &nb_children);
4247 for (
i = 0;
i < nb_children;
i++)
4249 hr = filedata->lpVtbl->GetChild(filedata,
i, &
child);
4288 IUnknown_Release(
child);
4293 IUnknown_Release(
child);
4299 struct ID3DXBuffer **effects_out,
DWORD *num_materials_out,
struct ID3DXMesh **mesh_out)
4302 ID3DXFile *d3dxfile =
NULL;
4303 ID3DXFileEnumObject *enumobj =
NULL;
4304 ID3DXFileData *filedata =
NULL;
4312 DWORD num_faces, num_vertices;
4314 DWORD provide_flags = 0;
4316 ID3DXMesh *concat_mesh =
NULL;
4319 void *concat_indices =
NULL;
4321 DWORD concat_vertex_size;
4325 TRACE(
"memory %p, memory_size %lu, options %#lx, device %p, adjacency_out %p, materials_out %p, "
4326 "effects_out %p, num_materials_out %p, mesh_out %p.\n",
memory, memory_size,
options,
4327 device, adjacency_out, materials_out, effects_out, num_materials_out, mesh_out);
4339 source.dSize = memory_size;
4347 hr = enumobj->lpVtbl->GetChildren(enumobj, &nb_children);
4351 for (
i = 0;
i < nb_children;
i++)
4353 hr = enumobj->lpVtbl->GetChild(enumobj,
i, &filedata);
4357 hr = filedata->lpVtbl->GetType(filedata, &
guid);
4360 container_ptr =
calloc(1,
sizeof(*container_ptr));
4361 if (!container_ptr) {
4370 if (container_ptr->
mesh)
4373 D3DXMatrixIdentity(&container_ptr->
transform);
4377 free(container_ptr);
4384 filedata->lpVtbl->
Release(filedata);
4390 enumobj->lpVtbl->
Release(enumobj);
4392 d3dxfile->lpVtbl->Release(d3dxfile);
4406 ID3DXMesh *
mesh = container_ptr->
mesh;
4408 num_faces +=
mesh->lpVtbl->GetNumFaces(
mesh);
4409 num_vertices +=
mesh->lpVtbl->GetNumVertices(
mesh);
4416 hr = concat_mesh->lpVtbl->GetDeclaration(concat_mesh, concat_decl);
4421 hr = concat_mesh->lpVtbl->LockVertexBuffer(concat_mesh, 0, (
void**)&concat_vertices);
4427 ID3DXMesh *
mesh = container_ptr->
mesh;
4428 DWORD num_mesh_vertices =
mesh->lpVtbl->GetNumVertices(
mesh);
4429 DWORD mesh_vertex_size;
4430 const BYTE *mesh_vertices;
4433 hr =
mesh->lpVtbl->GetDeclaration(
mesh, mesh_decl);
4441 for (
i = 0;
i < num_mesh_vertices;
i++) {
4448 for (
j = 1; concat_decl[
j].
Stream != 0xff;
j++)
4451 concat_decl[
j].UsageIndex == mesh_decl[
k].UsageIndex)
4459 mesh_vertices + mesh_decl[
k].
Offset,
4465 mesh_vertices += mesh_vertex_size;
4466 concat_vertices += concat_vertex_size;
4469 mesh->lpVtbl->UnlockVertexBuffer(
mesh);
4472 concat_mesh->lpVtbl->UnlockVertexBuffer(concat_mesh);
4473 concat_vertices =
NULL;
4475 hr = concat_mesh->lpVtbl->LockIndexBuffer(concat_mesh, 0, &concat_indices);
4481 ID3DXMesh *
mesh = container_ptr->
mesh;
4482 const void *mesh_indices;
4492 for (
i = 0;
i < num_mesh_faces * 3;
i++)
4493 *
dest++ = index_offset + *
src++;
4494 concat_indices =
dest;
4497 const WORD *
src = mesh_indices;
4498 for (
i = 0;
i < num_mesh_faces * 3;
i++)
4499 *
dest++ = index_offset + *
src++;
4500 concat_indices =
dest;
4502 mesh->lpVtbl->UnlockIndexBuffer(
mesh);
4504 index_offset += num_mesh_faces * 3;
4507 concat_mesh->lpVtbl->UnlockIndexBuffer(concat_mesh);
4508 concat_indices =
NULL;
4514 hr = concat_mesh->lpVtbl->LockAttributeBuffer(concat_mesh, 0, &concat_attrib_buffer);
4519 ID3DXMesh *
mesh = container_ptr->
mesh;
4525 concat_mesh->lpVtbl->UnlockAttributeBuffer(concat_mesh);
4530 *concat_attrib_buffer++ =
offset + *mesh_attrib_buffer++;
4532 mesh->lpVtbl->UnlockAttributeBuffer(
mesh);
4535 concat_mesh->lpVtbl->UnlockAttributeBuffer(concat_mesh);
4538 if (materials_out || effects_out) {
4555 char *strings_out_ptr;
4564 if (in_ptr->pTextureFilename)
4584 if (in_ptr->pTextureFilename) {
4585 out_ptr->pTextureFilename = strings_out_ptr;
4586 strcpy(out_ptr->pTextureFilename, in_ptr->pTextureFilename);
4587 strings_out_ptr +=
strlen(in_ptr->pTextureFilename) + 1;
4601 if (!materials_out) {
4607 if (adjacency_out) {
4627 *out_ptr++ =
offset + *in_ptr++;
4634 *mesh_out = concat_mesh;
4635 if (adjacency_out) *adjacency_out =
adjacency;
4636 if (materials_out) *materials_out =
materials;
4637 if (effects_out) *effects_out =
effects;
4642 if (concat_indices) concat_mesh->lpVtbl->UnlockIndexBuffer(concat_mesh);
4643 if (concat_vertices) concat_mesh->lpVtbl->UnlockVertexBuffer(concat_mesh);
4644 if (filedata) filedata->lpVtbl->
Release(filedata);
4645 if (enumobj) enumobj->lpVtbl->Release(enumobj);
4646 if (d3dxfile) d3dxfile->lpVtbl->Release(d3dxfile);
4648 if (concat_mesh) IUnknown_Release(concat_mesh);
4655 if (container_ptr->
mesh) IUnknown_Release(container_ptr->
mesh);
4659 free(container_ptr);
4677 DWORD (*adjacency_buf)[3];
4681 TRACE(
"device %p, length %f, sides %u, mesh %p, adjacency %p.\n",
4693 if (
FAILED(
hr = polygon->lpVtbl->LockVertexBuffer(polygon, 0, (
void **)&vertices)))
4695 polygon->lpVtbl->
Release(polygon);
4699 if (
FAILED(
hr = polygon->lpVtbl->LockIndexBuffer(polygon, 0, (
void **)&faces)))
4701 polygon->lpVtbl->UnlockVertexBuffer(polygon);
4702 polygon->lpVtbl->
Release(polygon);
4717 for (
i = 0;
i < sides; ++
i)
4727 faces[
i][1] =
i + 1;
4728 faces[
i][2] =
i + 2;
4731 faces[sides - 1][2] = 1;
4733 polygon->lpVtbl->UnlockVertexBuffer(polygon);
4734 polygon->lpVtbl->UnlockIndexBuffer(polygon);
4740 polygon->lpVtbl->
Release(polygon);
4745 for (
i = 0;
i < sides; ++
i)
4747 adjacency_buf[
i][0] =
i - 1;
4748 adjacency_buf[
i][1] = ~0
U;
4749 adjacency_buf[
i][2] =
i + 1;
4751 adjacency_buf[0][0] = sides - 1;
4752 adjacency_buf[sides - 1][2] = 0;
4767 DWORD *adjacency_buf;
4768 unsigned int i,
face;
4771 {-0.5f, -0.5f, -0.5f}, {-0.5f, -0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, -0.5f},
4772 {-0.5f, 0.5f, -0.5f}, {-0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, -0.5f},
4773 { 0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, -0.5f},
4774 {-0.5f, -0.5f, 0.5f}, {-0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, 0.5f},
4775 {-0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f},
4776 {-0.5f, -0.5f, -0.5f}, {-0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f}
4780 {-1.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f}, { 1.0f, 0.0f, 0.0f},
4781 { 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}, { 0.0f, 0.0f, -1.0f}
4783 static const DWORD adjacency_table[] =
4785 6, 9, 1, 2, 10, 0, 1, 9, 3, 4, 10, 2,
4786 3, 8, 5, 7, 11, 4, 0, 11, 7, 5, 8, 6,
4787 7, 4, 9, 2, 0, 8, 1, 3, 11, 5, 6, 10
4790 TRACE(
"device %p, width %f, height %f, depth %f, mesh %p, adjacency %p\n",
4803 if (
FAILED(
hr =
box->lpVtbl->LockVertexBuffer(
box, 0, (
void **)&vertices)))
4805 box->lpVtbl->Release(
box);
4809 if (
FAILED(
hr =
box->lpVtbl->LockIndexBuffer(
box, 0, (
void **)&faces)))
4811 box->lpVtbl->UnlockVertexBuffer(
box);
4812 box->lpVtbl->Release(
box);
4816 for (
i = 0;
i < 24;
i++)
4827 for (
i = 0;
i < 12;
i++)
4829 faces[
i][0] =
face++;
4830 faces[
i][1] =
face++;
4834 box->lpVtbl->UnlockIndexBuffer(
box);
4835 box->lpVtbl->UnlockVertexBuffer(
box);
4841 box->lpVtbl->Release(
box);
4846 memcpy(adjacency_buf, adjacency_table,
sizeof(adjacency_table));
4886 angle = angle_start;
4887 for (
i = 0;
i <
n;
i++)
4891 angle += angle_step;
4905 DWORD number_of_vertices, number_of_faces;
4910 float phi_step, phi_start;
4912 float theta_step, theta, sin_theta, cos_theta;
4915 TRACE(
"(%p, %f, %u, %u, %p, %p)\n",
device, radius, slices, stacks,
mesh, adjacency);
4917 if (!
device || radius < 0.0f || slices < 2 || stacks < 2 || !
mesh)
4922 number_of_vertices = 2 + slices * (stacks-1);
4923 number_of_faces = 2 * slices + (stacks - 2) * (2 * slices);
4932 if (
FAILED(
hr = sphere->lpVtbl->LockVertexBuffer(sphere, 0, (
void **)&vertices)))
4934 sphere->lpVtbl->
Release(sphere);
4938 if (
FAILED(
hr = sphere->lpVtbl->LockIndexBuffer(sphere, 0, (
void **)&faces)))
4940 sphere->lpVtbl->UnlockVertexBuffer(sphere);
4941 sphere->lpVtbl->
Release(sphere);
4946 phi_step = -2.0f *
D3DX_PI / slices;
4951 sphere->lpVtbl->UnlockIndexBuffer(sphere);
4952 sphere->lpVtbl->UnlockVertexBuffer(sphere);
4953 sphere->lpVtbl->Release(sphere);
4958 theta_step =
D3DX_PI / stacks;
4974 sin_theta =
sinf(theta);
4975 cos_theta =
cosf(theta);
5013 theta += theta_step;
5057 sphere->lpVtbl->UnlockIndexBuffer(sphere);
5058 sphere->lpVtbl->UnlockVertexBuffer(sphere);
5065 sphere->lpVtbl->Release(sphere);
5069 if (
FAILED(
hr = sphere->lpVtbl->GenerateAdjacency(sphere, 0.0f, (*adjacency)->lpVtbl->GetBufferPointer(*adjacency))))
5071 (*adjacency)->lpVtbl->
Release(*adjacency);
5072 sphere->lpVtbl->Release(sphere);
5085 DWORD number_of_vertices, number_of_faces;
5090 float theta_step, theta_start;
5092 float delta_radius, radius, radius_step;
5093 float z, z_step, z_normal;
5096 TRACE(
"(%p, %f, %f, %f, %u, %u, %p, %p)\n",
device, radius1, radius2,
length, slices, stacks,
mesh, adjacency);
5098 if (
device ==
NULL || radius1 < 0.0f || radius2 < 0.0f ||
length < 0.0f || slices < 2 || stacks < 1 ||
mesh ==
NULL)
5103 number_of_vertices = 2 + (slices * (3 + stacks));
5104 number_of_faces = 2 * slices + stacks * (2 * slices);
5127 theta_step = -2.0f *
D3DX_PI / slices;
5141 delta_radius = radius1 - radius2;
5143 radius_step = delta_radius / stacks;
5146 z_step =
length / stacks;
5147 z_normal = delta_radius /
length;
5148 if (
isnan(z_normal))
5179 faces[
face++][2] = 1;
5216 if (
stack < stacks + 1)
5219 radius -= radius_step;
5235 faces[
face][1] = number_of_vertices - 1;
5248 faces[
face][1] = number_of_vertices - 1;
5263 if (
FAILED(
hr =
cylinder->lpVtbl->GenerateAdjacency(
cylinder, 0.0f, (*adjacency)->lpVtbl->GetBufferPointer(*adjacency))))
5265 (*adjacency)->lpVtbl->
Release(*adjacency);
5279 FIXME(
"device %p, mesh %p, adjacency %p semi-stub.\n",
device,
mesh, adjacency);
5291 TRACE(
"device %p, hdc %p, text %s, deviation %.8e, extrusion %.8e, mesh %p, adjacency %p, glyphmetrics %p.\n",
5302 mesh, adjacency, glyphmetrics);
5309 float innerradius,
float outerradius,
UINT sides,
UINT rings,
struct ID3DXMesh **
mesh,
ID3DXBuffer **adjacency)
5315 float phi, phi_step, sin_phi, cos_phi;
5316 float theta, theta_step, sin_theta, cos_theta;
5317 unsigned int i,
j, numvert, numfaces;
5319 TRACE(
"device %p, innerradius %.8e, outerradius %.8e, sides %u, rings %u, mesh %p, adjacency %p.\n",
5320 device, innerradius, outerradius, sides, rings,
mesh, adjacency);
5322 numvert = sides * rings;
5323 numfaces = numvert * 2;
5325 if (!
device || innerradius < 0.0f || outerradius < 0.0f || sides < 3 || rings < 3 || !
mesh)
5327 WARN(
"Invalid arguments.\n");
5334 if (
FAILED(
hr = torus->lpVtbl->LockVertexBuffer(torus, 0, (
void **)&vertices)))
5336 torus->lpVtbl->
Release(torus);
5340 if (
FAILED(
hr = torus->lpVtbl->LockIndexBuffer(torus, 0, (
void **)&faces)))
5342 torus->lpVtbl->UnlockVertexBuffer(torus);
5343 torus->lpVtbl->
Release(torus);
5347 phi_step =
D3DX_PI / sides * 2.0f;
5348 theta_step =
D3DX_PI / rings * -2.0f;
5352 for (
i = 0;
i < rings; ++
i)
5356 sin_theta =
sinf(theta);
5357 cos_theta =
cosf(theta);
5359 for (
j = 0;
j < sides; ++
j)
5361 sin_phi =
sinf(phi);
5362 cos_phi =
cosf(phi);
5364 vertices[
i * sides +
j].
position.
x = (innerradius * cos_phi + outerradius) * cos_theta;
5365 vertices[
i * sides +
j].
position.
y = (innerradius * cos_phi + outerradius) * sin_theta;
5366 vertices[
i * sides +
j].
position.
z = innerradius * sin_phi;
5367 vertices[
i * sides +
j].
normal.
x = cos_phi * cos_theta;
5368 vertices[
i * sides +
j].
normal.
y = cos_phi * sin_theta;
5369 vertices[
i * sides +
j].
normal.
z = sin_phi;
5374 theta += theta_step;
5377 for (
i = 0;
i < numfaces - sides * 2; ++
i)
5379 faces[
i][0] =
i % 2 ?
i / 2 + sides :
i / 2;
5380 faces[
i][1] = (
i / 2 + 1) % sides ?
i / 2 + 1 :
i / 2 + 1 - sides;
5381 faces[
i][2] = (
i + 1) % (sides * 2) ? (
i + 1) / 2 + sides : (
i + 1) / 2;
5384 for (
j = 0;
i < numfaces; ++
i, ++
j)
5386 faces[
i][0] =
i % 2 ?
j / 2 :
i / 2;
5387 faces[
i][1] = (
i / 2 + 1) % sides ?
i / 2 + 1 :
i / 2 + 1 - sides;
5388 faces[
i][2] =
i == numfaces - 1 ? 0 : (
j + 1) / 2;
5391 torus->lpVtbl->UnlockIndexBuffer(torus);
5392 torus->lpVtbl->UnlockVertexBuffer(torus);
5398 torus->lpVtbl->
Release(torus);
5402 if (
FAILED(
hr = torus->lpVtbl->GenerateAdjacency(torus, 0.0f, (*adjacency)->lpVtbl->GetBufferPointer(*adjacency))))
5404 (*adjacency)->lpVtbl->
Release(*adjacency);
5405 torus->lpVtbl->Release(torus);
5504 new_buffer =
realloc(
array->items, new_capacity * itemsize);
5507 array->items = new_buffer;
5508 array->capacity = new_capacity;
5581 float max_deviation_sq)
5586 D3DXVec2Scale(&split1, D3DXVec2Add(&split1, p1, p2), 0.5f);
5587 D3DXVec2Scale(&split2, D3DXVec2Add(&split2, p2, p3), 0.5f);
5588 D3DXVec2Scale(&middle, D3DXVec2Add(&middle, &split1, &split2), 0.5f);
5590 deviation_sq = D3DXVec2LengthSq(D3DXVec2Subtract(&
vec, &middle, p2));
5591 if (deviation_sq < max_deviation_sq) {
5612 return D3DXVec2Dot(dir1, dir2) > cos_theta;
5672 float max_deviation_sq,
unsigned int emsquare,
5697 FIXME(
"Unknown header type %lu.\n",
header->dwType);
5703 unsigned int j2 = 0;
5723 D3DXVec2Scale(&bezier_end, D3DXVec2Add(&bezier_end, &pt_flt[j2], &pt_flt[j2+1]), 0.5f);
5727 bezier_start = bezier_end;
5739 pt->pos = pt_flt[j2];
5745 for (j2 = 0; j2 < curve->
cpfx; j2++)
5747 pt->pos = pt_flt[j2];
5762 if (
pt->pos.x == lastpt->
pos.
x &&
pt->pos.y == lastpt->
pos.
y) {
5828 D3DXVec2Subtract(&line_vec, line_pt2, line_pt1);
5829 line_pt_dx =
point->
x - line_pt1->
x;
5830 line_y = line_pt1->
y + (line_vec.
y * line_pt_dx) / line_vec.
x;
5831 return point->
y - line_y;
5862 if (
t->last_on_top) {
5870 if (
t->last_on_top != to_top &&
t->vertex_stack.count > 1) {
5872 WORD last_pt =
t->vertex_stack.items[0];
5874 for (
i = 1;
i <
t->vertex_stack.count;
i++)
5878 (*face)[0] = vtx_idx;
5879 (*face)[
f1] = last_pt;
5880 (*face)[
f2] = last_pt =
t->vertex_stack.items[
i];
5882 t->vertex_stack.items[0] = last_pt;
5883 t->vertex_stack.count = 1;
5884 }
else if (
t->vertex_stack.count > 1) {
5885 int i =
t->vertex_stack.count - 1;
5887 WORD top_idx =
t->vertex_stack.items[
i--];
5892 WORD prev_idx =
t->vertex_stack.items[
i--];
5895 if (prev_pt->
x != top_pt->
x &&
5902 (*face)[0] = vtx_idx;
5903 (*face)[
f1] = prev_idx;
5904 (*face)[
f2] = top_idx;
5908 t->vertex_stack.count--;
5911 t->last_on_top = to_top;
5915 if (
hr ==
S_OK &&
t->merging) {
5918 t2 = to_top ?
t - 1 :
t + 1;
5933 int i =
t->last_on_top == on_top ?
t->vertex_stack.count - 1 : 0;
5950 const D3DXVECTOR2 *p2 = &idx2->outline->items[idx2->vertex].pos;
5951 float diff = p1->
x - p2->
x;
5954 diff = p1->
y - p2->
y;
5956 return diff == 0.0f ? 0 : (diff > 0.0f ? -1 : 1);
5964 int nb_vertices = 0;
5973 nb_vertices += glyph->
outlines.items[
i].count;
6014 ccw = D3DXVec2CCW(&
v1, &
v2);
6023 if (!glyph->
faces.items)
6027 for (
i = 0;
i < glyph->
faces.count;
i++)
6029 glyph->
faces.items[
i][0] = 0;
6030 glyph->
faces.items[
i][1] =
i + 1;
6031 glyph->
faces.items[
i][2] =
i + 2;
6048 if (!glyph->
faces.items)
6053 for (sweep_idx = 0; sweep_idx < glyph->
ordered_vertices.count; sweep_idx++)
6065 WORD top_idx, bottom_idx;
6067 if (
t->merging &&
t->last_on_top)
6071 if (sweep_vtx == top_next)
6073 if (
t->merging &&
t->last_on_top)
6078 if (
t + 1 < &triangulations->
items[triangulations->
count] &&
6089 on_top_outline =
TRUE;
6092 if (
t->merging && !
t->last_on_top)
6096 if (sweep_vtx == bottom_next)
6098 if (
t->merging && !
t->last_on_top)
6100 if (on_top_outline) {
6109 if (
t > triangulations->
items &&
6126 if (
t->last_on_top) {
6127 top_idx =
t->vertex_stack.items[
t->vertex_stack.count - 1];
6128 bottom_idx =
t->vertex_stack.items[0];
6130 top_idx =
t->vertex_stack.items[0];
6131 bottom_idx =
t->vertex_stack.items[
t->vertex_stack.count - 1];
6136 top_next, sweep_vtx) > 0)
6140 bottom_next, sweep_vtx) < 0)
6143 }
else if (
t->merging) {
6158 if (
t->last_on_top) {
6197 DWORD nb_vertices, nb_faces;
6198 DWORD nb_front_faces, nb_corners, nb_outline_points;
6206 const MAT2 identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
6207 void *raw_outline =
NULL;
6213 struct vertex *vertex_ptr;
6215 float max_deviation_sq;
6223 TRACE(
"(%p, %p, %s, %f, %f, %p, %p, %p)\n",
device,
hdc,
6224 debugstr_w(
text), deviation, extrusion, mesh_ptr, adjacency, glyphmetrics);
6226 if (!
device || !
hdc || !
text || !*
text || deviation < 0.0f || extrusion < 0.0f || !mesh_ptr)
6231 FIXME(
"Case of adjacency != NULL not implemented.\n");
6241 if (deviation == 0.0f)
6243 max_deviation_sq = deviation * deviation;
6255 for (
i = 0;
i < textlen;
i++)
6268 glyphs =
calloc(textlen,
sizeof(*glyphs));
6270 if (!glyphs || !raw_outline) {
6276 for (
i = 0;
i < textlen;
i++)
6288 triangulations.
glyph = &glyphs[
i];
6291 if (triangulations.
count) {
6292 ERR(
"%d incomplete triangulations of glyph (%u).\n", triangulations.
count,
text[
i]);
6293 triangulations.
count = 0;
6310 nb_outline_points = 0;
6312 for (
i = 0;
i < textlen;
i++)
6316 nb_front_faces += glyphs[
i].
faces.count;
6328 nb_vertices = (nb_outline_points + nb_corners) * 2 + nb_outline_points * 2;
6329 nb_faces = nb_outline_points * 2 + nb_front_faces * 2;
6337 if (
FAILED(
hr =
mesh->lpVtbl->LockVertexBuffer(
mesh, 0, (
void **)&vertices)))
6344 vertex_ptr = vertices;
6346 if (extrusion == 0.0f) {
6353 for (
i = 0;
i < textlen;
i++)
6357 struct vertex *back_vertices;
6363 struct vertex *outline_vertices = vertex_ptr;
6373 WORD vtx_idx = vertex_ptr - vertices;
6377 D3DXVec2Subtract(&
vec, &
pt->pos, &prevpt->
pos);
6378 else if (
pt->corner)
6379 D3DXVec2Subtract(&
vec, &nextpt->
pos, &
pt->pos);
6381 D3DXVec2Subtract(&
vec, &nextpt->
pos, &prevpt->
pos);
6390 *vertex_ptr++ = vtx;
6393 *vertex_ptr++ = vtx;
6399 *vertex_ptr++ = vtx;
6401 *vertex_ptr++ = vtx;
6403 (*face_ptr)[0] = vtx_idx;
6404 (*face_ptr)[1] = vtx_idx + 2;
6405 (*face_ptr)[2] = vtx_idx + 1;
6408 (*face_ptr)[0] = vtx_idx;
6409 (*face_ptr)[1] = vtx_idx + 3;
6410 (*face_ptr)[2] = vtx_idx + 2;
6416 D3DXVec2Subtract(&
vec, nextpt2, &nextpt->
pos);
6418 D3DXVec2Subtract(&
vec, &nextpt->
pos, &
pt->pos);
6425 *vertex_ptr++ = vtx;
6427 *vertex_ptr++ = vtx;
6430 (*face_ptr)[0] = vtx_idx;
6431 (*face_ptr)[1] = vtx_idx + 3;
6432 (*face_ptr)[2] = vtx_idx + 1;
6435 (*face_ptr)[0] = vtx_idx;
6436 (*face_ptr)[1] = vtx_idx + 2;
6437 (*face_ptr)[2] = vtx_idx + 3;
6445 *vertex_ptr++ = *outline_vertices++;
6446 *vertex_ptr++ = *outline_vertices++;
6451 back_faces = face_ptr;
6452 back_vertices = vertex_ptr;
6464 count = back_vertices - vertices;
6465 for (
j = 0;
j < glyphs[
i].
faces.count;
j++)
6468 (*face_ptr)[0] = (*f)[0] +
count;
6469 (*face_ptr)[1] = (*f)[1] +
count;
6470 (*face_ptr)[2] = (*f)[2] +
count;
6475 j =
count = vertex_ptr - back_vertices;
6483 vertex_ptr->
normal.
z = extrusion == 0.0f ? 1.0f : -1.0f;
6487 j = face_ptr - back_faces;
6490 (*face_ptr)[0] = (*back_faces)[0] +
count;
6491 (*face_ptr)[1] = (*back_faces)[
f1] +
count;
6492 (*face_ptr)[2] = (*back_faces)[
f2] +
count;
6502 if (faces)
mesh->lpVtbl->UnlockIndexBuffer(
mesh);
6503 if (vertices)
mesh->lpVtbl->UnlockVertexBuffer(
mesh);
6507 for (
i = 0;
i < textlen;
i++)
6511 free(glyphs[
i].outlines.items[
j].items);
6512 free(glyphs[
i].outlines.items);
6513 free(glyphs[
i].faces.items);
6514 free(glyphs[
i].ordered_vertices.items);
6518 if (triangulations.
items) {
6520 for (
i = 0;
i < triangulations.
count;
i++)
6521 free(triangulations.
items[
i].vertex_stack.items);
6533 FIXME(
"mesh %p, adjacency %p, errors_and_warnings %p stub.\n",
mesh, adjacency, errors_and_warnings);
6559 FLOAT max_abs_diff =
max(diff_x, diff_y);
6561 if (max_abs_diff <= epsilon)
6578 FLOAT max_abs_diff =
max(diff_x, diff_y);
6579 max_abs_diff =
max(diff_z, max_abs_diff);
6581 if (max_abs_diff <= epsilon)
6599 FLOAT max_abs_diff =
max(diff_x, diff_y);
6600 max_abs_diff =
max(diff_z, max_abs_diff);
6601 max_abs_diff =
max(diff_w, max_abs_diff);
6603 if (max_abs_diff <= epsilon)
6617 BYTE truncated_epsilon = (
BYTE)epsilon;
6622 BYTE max_diff =
max(diff_x, diff_y);
6623 max_diff =
max(diff_z, max_diff);
6624 max_diff =
max(diff_w, max_diff);
6626 if (max_diff <= truncated_epsilon)
6653 SHORT max_abs_diff =
max(diff_x, diff_y);
6655 if (max_abs_diff <= truncated_epsilon)
6679 SHORT max_abs_diff =
max(diff_x, diff_y);
6680 max_abs_diff =
max(diff_z, max_abs_diff);
6681 max_abs_diff =
max(diff_w, max_abs_diff);
6683 if (max_abs_diff <= truncated_epsilon)
6707 if (max_diff <= scaled_epsilon)
6727 max_diff =
max(diff_z, max_diff);
6728 max_diff =
max(diff_w, max_diff);
6730 if (max_diff <= scaled_epsilon)
6753 v.y = (
d & 0xffc00) >> 10;
6754 v.z = (
d & 0x3ff00000) >> 20;
6755 v.w = (
d & 0xc0000000) >> 30;
6766 UINT truncated_epsilon = (
UINT)epsilon;
6771 UINT max_diff =
max(diff_x, diff_y);
6772 max_diff =
max(diff_z, max_diff);
6773 max_diff =
max(diff_w, max_diff);
6775 if (max_diff <= truncated_epsilon)
6798 v.y = (
d & 0xffc00) >> 10;
6799 v.z = (
d & 0x3ff00000) >> 20;
6800 v.w = (
d & 0xc0000000) >> 30;
6807 const UINT MAX_DEC3N = 511;
6812 INT scaled_epsilon = (
INT)(epsilon * MAX_DEC3N);
6817 INT max_abs_diff =
max(diff_x, diff_y);
6818 max_abs_diff =
max(diff_z, max_abs_diff);
6819 max_abs_diff =
max(diff_w, max_abs_diff);
6821 if (max_abs_diff <= scaled_epsilon)
6847 max_abs_diff =
max(diff_x, diff_y);
6849 if (max_abs_diff <= epsilon)
6880 max_abs_diff =
max(diff_x, diff_y);
6881 max_abs_diff =
max(diff_z, max_abs_diff);
6882 max_abs_diff =
max(diff_w, max_abs_diff);
6884 if (max_abs_diff <= epsilon)
6956 if (!fixme_once_unused++)
6957 FIXME(
"D3DDECLTYPE_UNUSED welding not implemented.\n");
6961 if (!fixme_once_unknown++)
6962 FIXME(
"Welding of unknown declaration type %d is not implemented.\n",
type);
6971 FLOAT epsilon = 0.0f;
6973 static BOOL fixme_once_blendindices =
FALSE;
6974 static BOOL fixme_once_positiont =
FALSE;
6980 switch (decl_ptr->
Usage)
6992 epsilon = epsilons->
PSize;
6997 if (usage_index > 7)
6999 epsilon = epsilons->
Texcoords[usage_index];
7020 if (!fixme_once_blendindices++)
7021 FIXME(
"D3DDECLUSAGE_BLENDINDICES welding not implemented.\n");
7024 if (!fixme_once_positiont++)
7025 FIXME(
"D3DDECLUSAGE_POSITIONT welding not implemented.\n");
7028 if (!fixme_once_fog++)
7029 FIXME(
"D3DDECLUSAGE_FOG welding not implemented.\n");
7032 if (!fixme_once_depth++)
7033 FIXME(
"D3DDECLUSAGE_DEPTH welding not implemented.\n");
7036 if (!fixme_once_sample++)
7037 FIXME(
"D3DDECLUSAGE_SAMPLE welding not implemented.\n");
7040 if (!fixme_once_unknown++)
7041 FIXME(
"Unknown usage %x\n", decl_ptr->
Usage);
7052 if (indices_are_32bit)
7068 if (indices_are_32bit)
7108 const DWORD *adjacency_ptr;
7110 const FLOAT DEFAULT_EPSILON = 1.0e-6f;
7115 DWORD optimize_flags;
7121 TRACE(
"mesh %p, flags %#lx, epsilons %p, adjacency %p, adjacency_out %p, face_remap_out %p, "
7122 "vertex_remap_out %p.\n",
7123 mesh,
flags, epsilons, adjacency, adjacency_out, face_remap_out, vertex_remap_out);
7127 WARN(
"No flags are undefined. Using D3DXWELDEPSILONS_WELDPARTIALMATCHES instead.\n");
7133 adjacency_ptr = adjacency;
7137 adjacency_generated =
malloc(3 *
This->numfaces *
sizeof(*adjacency_generated));
7138 if (!adjacency_generated)
7140 ERR(
"Couldn't allocate memory for adjacency_generated.\n");
7144 hr =
mesh->lpVtbl->GenerateAdjacency(
mesh, DEFAULT_EPSILON, adjacency_generated);
7147 ERR(
"Couldn't generate adjacency.\n");
7150 adjacency_ptr = adjacency_generated;
7154 point_reps =
malloc(
This->numvertices *
sizeof(*point_reps));
7158 ERR(
"Couldn't allocate memory for point_reps.\n");
7161 hr =
mesh->lpVtbl->ConvertAdjacencyToPointReps(
mesh, adjacency_ptr, point_reps);
7164 ERR(
"ConvertAdjacencyToPointReps failed.\n");
7171 ERR(
"Couldn't lock index buffer.\n");
7178 ERR(
"Couldn't lock attribute buffer.\n");
7181 vertex_face_map =
malloc(
This->numvertices *
sizeof(*vertex_face_map));
7182 if (!vertex_face_map)
7185 ERR(
"Couldn't allocate memory for vertex_face_map.\n");
7189 for (
i = 0;
i <
This->numfaces;
i++)
7192 for (
j = 0;
j < 3;
j++)
7195 vertex_face_map[
index] =
i;
7201 hr =
mesh->lpVtbl->LockVertexBuffer(
mesh, 0, (
void**)&vertices);
7204 ERR(
"Couldn't lock vertex buffer.\n");
7214 for (
i = 0;
i < 3 *
This->numfaces;
i++)
7217 DWORD vertex_size =
mesh->lpVtbl->GetNumBytesPerVertex(
mesh);
7218 DWORD num_vertex_components;
7223 for (decl_ptr =
This->cached_declaration, num_vertex_components = 0; decl_ptr->
Stream != 0xFF; decl_ptr++, num_vertex_components++)
7240 all_match = (num_vertex_components ==
matches);
7244 DWORD from_face = vertex_face_map[point_reps[
index]];
7250 mesh->lpVtbl->UnlockVertexBuffer(
mesh);
7255 for (
i = 0;
i < 3 *
This->numfaces;
i++)
7259 DWORD from_face = vertex_face_map[point_reps[
index]];
7265 mesh->lpVtbl->UnlockAttributeBuffer(
mesh);
7267 mesh->lpVtbl->UnlockIndexBuffer(
mesh);
7272 hr =
mesh->lpVtbl->OptimizeInplace(
mesh, optimize_flags, adjacency_ptr, adjacency_out, face_remap_out, vertex_remap_out);
7275 ERR(
"Couldn't compact mesh.\n");
7281 free(adjacency_generated);
7283 free(vertex_face_map);
7286 if (vertices)
mesh->lpVtbl->UnlockVertexBuffer(
mesh);
7312 UINT num_vertices,
BOOL indices_are_32bit,
DWORD *face_remap)
7315 UINT j = num_faces - 1;
7316 UINT limit_16_bit = 2 << 15;
7319 FIXME(
"indices %p, num_faces %u, num_vertices %u, indices_are_32bit %#x, face_remap %p semi-stub. "
7320 "Face order will not be optimal.\n",
7321 indices, num_faces, num_vertices, indices_are_32bit, face_remap);
7323 if (!indices_are_32bit && num_faces >= limit_16_bit)
7325 WARN(
"Number of faces must be less than %d when using 16-bit indices.\n",
7333 WARN(
"Face remap pointer is NULL.\n");
7345 for (
i = 0;
i < num_faces;
i++)
7347 face_remap[
i] =
j--;
7357 BOOL indices_are_32bit,
DWORD *vertex_remap)
7361 FIXME(
"indices %p, face_count %u, vertex_count %u, indices_are_32bit %#x, vertex_remap %p semi-stub.\n",
7368 vertex_remap[
i] =
i;
7399 ERR(
"Cannot read vec3\n");
7410 DWORD u_partial_out_semantic,
DWORD u_partial_out_index,
DWORD v_partial_out_semantic,
7412 const DWORD *adjacency,
float partial_edge_threshold,
float singular_point_threshold,
7413 float normal_edge_threshold, ID3DXMesh **mesh_out,
ID3DXBuffer **vertex_mapping)
7420 BOOL indices_are_32bit;
7421 DWORD i,
j, num_faces, num_vertices, vertex_stride;
7426 TRACE(
"mesh %p, texture_in_semantic %lu, texture_in_index %lu, u_partial_out_semantic %lu, "
7427 "u_partial_out_index %lu, v_partial_out_semantic %lu, v_partial_out_index %lu, "
7428 "normal_out_semantic %lu, normal_out_index %lu, options %#lx, adjacency %p, "
7429 "partial_edge_threshold %.8e, singular_point_threshold %.8e, normal_edge_threshold %.8e, "
7430 "mesh_out %p, vertex_mapping %p.\n",
7431 mesh, texture_in_semantic, texture_in_index, u_partial_out_semantic, u_partial_out_index,
7432 v_partial_out_semantic, v_partial_out_index, normal_out_semantic, normal_out_index,
7433 options, adjacency, partial_edge_threshold, singular_point_threshold,
7434 normal_edge_threshold, mesh_out, vertex_mapping);
7438 WARN(
"mesh is NULL\n");
7444 WARN(
"D3DXTANGENT_WEIGHT_BY_AREA and D3DXTANGENT_WEIGHT_EQUAL are mutally exclusive\n");
7450 FIXME(
"tangent vectors computation is not supported\n");
7456 FIXME(
"binormal vectors computation is not supported\n");
7469 FIXME(
"only normals computation is supported\n");
7475 FIXME(
"only D3DXTANGENT_GENERATE_IN_PLACE is supported\n");
7490 if (!position_declaration || !normal_declaration)
7503 WARN(
"unsupported normals type %u\n", normal_declaration->Type);
7507 num_faces =
mesh->lpVtbl->GetNumFaces(
mesh);
7508 num_vertices =
mesh->lpVtbl->GetNumVertices(
mesh);
7509 vertex_stride =
mesh->lpVtbl->GetNumBytesPerVertex(
mesh);
7512 point_reps =
malloc(num_vertices *
sizeof(*point_reps));
7521 if (
FAILED(
hr =
mesh->lpVtbl->ConvertAdjacencyToPointReps(
mesh, adjacency, point_reps)))
7526 for (
i = 0;
i < num_vertices;
i++)
7533 if (
FAILED(
hr =
mesh->lpVtbl->LockVertexBuffer(
mesh, 0, (
void **)&vertices)))
7536 for (
i = 0;
i < num_vertices;
i++)
7538 static const D3DXVECTOR4 default_vector = {0.0f, 0.0f, 0.0f, 1.0f};
7539 void *
normal = vertices + normal_declaration->Offset +
i * vertex_stride;
7544 for (
i = 0;
i < num_faces;
i++)
7546 float denominator,
weights[3];
7548 const DWORD face_indices[3] =
7558 D3DXVec3Cross(&
cross, D3DXVec3Subtract(&
a, &
v0, &
v1), D3DXVec3Subtract(&
b, &
v0, &
v2));
7560 switch (weighting_method)
7570 denominator = D3DXVec3Length(&
a) * D3DXVec3Length(&
b);
7576 D3DXVec3Subtract(&
a, &
v1, &
v0);
7577 D3DXVec3Subtract(&
b, &
v1, &
v2);
7578 denominator = D3DXVec3Length(&
a) * D3DXVec3Length(&
b);
7584 D3DXVec3Subtract(&
a, &
v2, &
v0);
7585 D3DXVec3Subtract(&
b, &
v2, &
v1);
7586 denominator = D3DXVec3Length(&
a) * D3DXVec3Length(&
b);
7597 for (
j = 0;
j < 3;
j++)
7600 DWORD rep_index = point_reps[face_indices[
j]];
7604 D3DXVec3Add(rep_normal, rep_normal, &
normal);
7608 for (
i = 0;
i < num_vertices;
i++)
7610 DWORD rep_index = point_reps[
i];
7624 mesh->lpVtbl->UnlockVertexBuffer(
mesh);
7627 mesh->lpVtbl->UnlockIndexBuffer(
mesh);
7639 TRACE(
"mesh %p, adjacency %p\n",
mesh, adjacency);
7643 ERR(
"Invalid virtual table\n");
7650 adjacency, -1.01f, -0.01f, -1.01f,
NULL,
NULL);
7659 FIXME(
"mesh %p, ray_pos %p, ray_dir %p, hit %p, face_index %p, u %p, v %p, distance %p, all_hits %p, "
7660 "count_of_hits %p stub!\n",
mesh, ray_pos, ray_dir, hit, face_index,
u,
v,
distance, all_hits, count_of_hits);
7666 BOOL quadratic_normals, ID3DXMesh **mesh_out,
ID3DXBuffer **adjacency_out)
7668 FIXME(
"mesh %p, adjacency_in %p, num_segs %f, quadratic_normals %d, mesh_out %p, adjacency_out %p stub.\n",
7669 mesh, adjacency_in, num_segs, quadratic_normals, mesh_out, adjacency_out);
7677 FIXME(
"mesh_in %p, attribute_id %lu, ib_flags %#lx, index_buffer %p, index_count %p stub.\n",
7678 mesh_in, attribute_id, ib_flags,
index_buffer, index_count);
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
#define D3DERR_INVALIDCALL
#define D3DFVF_TEXCOUNT_SHIFT
#define D3DFVF_LASTBETA_UBYTE4
#define D3DUSAGE_NPATCHES
#define D3DDP_MAXTEXCOORD
#define D3DUSAGE_DONOTCLIP
#define D3DCOLOR_ARGB(a, r, g, b)
#define D3DFVF_TEXTUREFORMAT4
#define D3DFVF_TEXTUREFORMAT3
#define D3DFVF_TEXCOUNT_MASK
#define D3DUSAGE_WRITEONLY
#define D3DFVF_TEXCOORDSIZE4(CoordIndex)
#define D3DFVF_TEXCOORDSIZE3(CoordIndex)
#define D3DFVF_TEXTUREFORMAT1
#define D3DFVF_TEXTUREFORMAT2
#define D3DFVF_TEXCOORDSIZE2(CoordIndex)
#define D3DFVF_TEXCOORDSIZE1(CoordIndex)
enum _D3DFORMAT D3DFORMAT
#define D3DUSAGE_SOFTWAREPROCESSING
#define D3DUSAGE_RTPATCHES
#define D3DFVF_POSITION_MASK
#define IDirect3DIndexBuffer9_Unlock(p)
#define IDirect3DVertexBuffer9_Unlock(p)
#define IDirect3DDevice9_CreateIndexBuffer(p, a, b, c, d, e, f)
#define IDirect3DDevice9_SetIndices(p, a)
#define IDirect3DDevice9_DrawIndexedPrimitive(p, a, b, c, d, e, f)
#define IDirect3DDevice9_CreateVertexDeclaration(p, a, b)
#define IDirect3DVertexBuffer9_Release(p)
#define IDirect3DIndexBuffer9_AddRef(p)
#define IDirect3DVertexBuffer9_Lock(p, a, b, c, d)
#define IDirect3DVertexBuffer9_GetDesc(p, a)
#define IDirect3DVertexDeclaration9_Release(p)
#define IDirect3DVertexBuffer9_AddRef(p)
#define IDirect3DDevice9_SetStreamSource(p, a, b, c, d)
#define IDirect3DDevice9_Release(p)
#define IDirect3DIndexBuffer9_Lock(p, a, b, c, d)
#define IDirect3DDevice9_CreateVertexBuffer(p, a, b, c, d, e, f)
#define IDirect3DIndexBuffer9_Release(p)
#define IDirect3DDevice9_AddRef(p)
#define IDirect3DDevice9_SetVertexDeclaration(p, a)
@ D3DDECLUSAGE_BLENDWEIGHT
@ D3DDECLUSAGE_BLENDINDICES
@ D3DDECLUSAGE_TESSFACTOR
#define D3DFVF_LASTBETA_D3DCOLOR
enum _D3DDECLTYPE D3DDECLTYPE
enum _D3DDECLUSAGE D3DDECLUSAGE
#define D3DXERR_INVALIDDATA
struct ID3DXBuffer ID3DXBuffer
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length)
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length)
HRESULT WINAPI D3DXCreateBuffer(DWORD size, ID3DXBuffer **buffer)
D3DXVECTOR4 *WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm)
FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, const D3DXFLOAT16 *pin, UINT n)
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
D3DXVECTOR2 *WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv)
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
D3DXFLOAT16 *WINAPI D3DXFloat32To16Array(D3DXFLOAT16 *pout, const FLOAT *pin, UINT n)
static void write_ib(void *index_buffer, BOOL indices_are_32bit, DWORD index, DWORD value)
BOOL WINAPI D3DXIntersectTri(const D3DXVECTOR3 *p0, const D3DXVECTOR3 *p1, const D3DXVECTOR3 *p2, const D3DXVECTOR3 *praypos, const D3DXVECTOR3 *praydir, float *pu, float *pv, float *pdist)
HRESULT WINAPI D3DXCreateBox(struct IDirect3DDevice9 *device, float width, float height, float depth, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency)
static DWORD find_adjacent_face(struct edge_face_map *edge_face_map, DWORD vertex1, DWORD vertex2, DWORD num_faces)
static DWORD WINAPI d3dx9_mesh_GetNumFaces(ID3DXMesh *iface)
static FLOAT scale_clamp_ushortn(FLOAT value)
static DWORD adjacency_remap(DWORD *face_remap, DWORD index)
static HRESULT init_edge_face_map(struct edge_face_map *edge_face_map, const DWORD *index_buffer, const DWORD *point_reps, DWORD num_faces)
static HRESULT parse_skin_weights_info(ID3DXFileData *filedata, struct mesh_data *mesh_data, DWORD flags)
static HRESULT WINAPI d3dx9_mesh_GetDeclaration(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
static FLOAT scale_clamp_shortn(FLOAT value)
static HRESULT load_frame(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXAllocateHierarchy *alloc_hier, D3DXFRAME **frame_out, struct ID3DXLoadUserData *load_user_data)
HRESULT WINAPI D3DXLoadMeshFromXResource(HMODULE module, const char *name, const char *type, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh)
static BOOL is_direction_similar(D3DXVECTOR2 *dir1, D3DXVECTOR2 *dir2, float cos_theta)
static HRESULT WINAPI d3dx9_mesh_DrawSubset(ID3DXMesh *iface, DWORD attrib_id)
static FLOAT scale_clamp_ubyten(FLOAT value)
UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl)
HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length, UINT sides, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency)
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
static HRESULT create_outline(struct glyphinfo *glyph, void *raw_outline, int datasize, float max_deviation_sq, unsigned int emsquare, const struct cos_table *cos_table)
static HRESULT triangulation_add_point(struct triangulation **t_ptr, struct triangulation_array *triangulations, WORD vtx_idx, BOOL to_top)
static HRESULT convert_vertex_buffer(ID3DXMesh *mesh_dst, ID3DXMesh *mesh_src)
static HRESULT WINAPI d3dx9_mesh_CloneMesh(struct ID3DXMesh *iface, DWORD options, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh_out)
static HRESULT triangulate(struct triangulation_array *triangulations)
static HRESULT WINAPI d3dx9_mesh_UnlockVertexBuffer(ID3DXMesh *iface)
static void copy_declaration(D3DVERTEXELEMENT9 *dst, const D3DVERTEXELEMENT9 *src, UINT num_elem)
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
static HRESULT WINAPI d3dx9_mesh_GetVertexBuffer(struct ID3DXMesh *iface, struct IDirect3DVertexBuffer9 **vertex_buffer)
static face * add_face(struct face_array *array)
static HRESULT WINAPI d3dx9_mesh_UpdateSemantics(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
static mesh_parse_func mesh_get_parse_func(const GUID *type)
HRESULT WINAPI D3DXCreateCylinder(struct IDirect3DDevice9 *device, float radius1, float radius2, float length, UINT slices, UINT stacks, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency)
static HRESULT WINAPI d3dx9_mesh_GetIndexBuffer(struct ID3DXMesh *iface, struct IDirect3DIndexBuffer9 **index_buffer)
static D3DXVECTOR2 * convert_fixed_to_float(POINTFX *pt, int count, unsigned int emsquare)
HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *mesh, DWORD texture_in_semantic, DWORD texture_in_index, DWORD u_partial_out_semantic, DWORD u_partial_out_index, DWORD v_partial_out_semantic, DWORD v_partial_out_index, DWORD normal_out_semantic, DWORD normal_out_index, DWORD options, const DWORD *adjacency, float partial_edge_threshold, float singular_point_threshold, float normal_edge_threshold, ID3DXMesh **mesh_out, ID3DXBuffer **vertex_mapping)
static struct point2d * add_points(struct outline *array, int num)
static HRESULT add_bezier_points(struct outline *outline, const D3DXVECTOR2 *p1, const D3DXVECTOR2 *p2, const D3DXVECTOR2 *p3, float max_deviation_sq)
#define EFFECT_TABLE_ENTRY(str, field)
HRESULT WINAPI D3DXLoadMeshHierarchyFromXInMemory(const void *memory, DWORD memory_size, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXAllocateHierarchy *alloc_hier, struct ID3DXLoadUserData *load_user_data, D3DXFRAME **frame_hierarchy, struct ID3DXAnimationController **anim_controller)
static FLOAT get_component_epsilon(const D3DVERTEXELEMENT9 *decl_ptr, const D3DXWELDEPSILONS *epsilons)
static HRESULT parse_normals(ID3DXFileData *filedata, struct mesh_data *mesh, DWORD flags)
static BOOL weld_float2(void *to, void *from, FLOAT epsilon)
static HRESULT WINAPI d3dx9_mesh_SetAttributeTable(ID3DXMesh *iface, const D3DXATTRIBUTERANGE *attrib_table, DWORD attrib_table_size)
static BOOL weld_d3dcolor(void *to, void *from, FLOAT epsilon)
static HRESULT parse_vertex_colors(ID3DXFileData *filedata, struct mesh_data *mesh, DWORD flags)
static void free_sincos_table(struct sincos_table *sincos_table)
static DWORD WINAPI d3dx9_mesh_GetNumVertices(ID3DXMesh *iface)
static UINT Get_TexCoord_Size_From_FVF(DWORD FVF, int tex_num)
static HRESULT propagate_face_vertices(const DWORD *adjacency, DWORD *point_reps, const uint32_t *indices, uint32_t *new_indices, unsigned int face_idx, unsigned int face_count)
static HRESULT parse_material(ID3DXFileData *filedata, D3DXMATERIAL *material)
static void remove_triangulation(struct triangulation_array *array, struct triangulation *item)
static D3DXVECTOR3 read_vec3(BYTE *vertices, const D3DVERTEXELEMENT9 *declaration, DWORD vertex_stride, DWORD index)
static HRESULT WINAPI d3dx9_mesh_ConvertPointRepsToAdjacency(ID3DXMesh *iface, const DWORD *point_reps, DWORD *adjacency)
static BOOL weld_float1(void *to, void *from, FLOAT epsilon)
static HRESULT WINAPI d3dx9_mesh_ConvertAdjacencyToPointReps(ID3DXMesh *iface, const DWORD *adjacency, DWORD *point_reps)
HRESULT WINAPI D3DXCreateTextA(struct IDirect3DDevice9 *device, HDC hdc, const char *text, float deviation, float extrusion, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency, GLYPHMETRICSFLOAT *glyphmetrics)
static void empty_frame_queue(struct list *queue)
HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *declaration, DWORD *fvf)
static BOOL weld_float3(void *to, void *from, FLOAT epsilon)
HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
static struct triangulation * add_triangulation(struct triangulation_array *array)
static BOOL weld_short2(void *to, void *from, FLOAT epsilon)
static BOOL weld_dec3n(void *to, void *from, FLOAT epsilon)
HRESULT WINAPI D3DXComputeBoundingBox(const D3DXVECTOR3 *pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pmin, D3DXVECTOR3 *pmax)
HRESULT WINAPI D3DXCreateTeapot(struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency)
HRESULT WINAPI D3DXCleanMesh(D3DXCLEANTYPE clean_type, ID3DXMesh *mesh_in, const DWORD *adjacency_in, ID3DXMesh **mesh_out, DWORD *adjacency_out, ID3DXBuffer **errors_and_warnings)
static BOOL weld_ubyte4(void *to, void *from, FLOAT epsilon)
static HRESULT WINAPI d3dx9_mesh_OptimizeInplace(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap_out, ID3DXBuffer **vertex_remap_out)
static HRESULT WINAPI d3dx9_mesh_LockAttributeBuffer(ID3DXMesh *iface, DWORD flags, DWORD **data)
HRESULT WINAPI D3DXTessellateNPatches(ID3DXMesh *mesh, const DWORD *adjacency_in, float num_segs, BOOL quadratic_normals, ID3DXMesh **mesh_out, ID3DXBuffer **adjacency_out)
static D3DXVECTOR2 * get_ordered_vertex(struct glyphinfo *glyph, WORD index)
HRESULT WINAPI D3DXIntersect(ID3DXBaseMesh *mesh, const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir, BOOL *hit, DWORD *face_index, float *u, float *v, float *distance, ID3DXBuffer **all_hits, DWORD *count_of_hits)
HRESULT WINAPI D3DXLoadMeshHierarchyFromXW(const WCHAR *filename, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXAllocateHierarchy *alloc_hier, struct ID3DXLoadUserData *load_user_data, D3DXFRAME **frame_hierarchy, struct ID3DXAnimationController **anim_controller)
static HRESULT WINAPI d3dx9_mesh_GenerateAdjacency(ID3DXMesh *iface, float epsilon, DWORD *adjacency)
static BOOL weld_ushort4n(void *to, void *from, FLOAT epsilon)
HRESULT WINAPI D3DXOptimizeFaces(const void *indices, UINT num_faces, UINT num_vertices, BOOL indices_are_32bit, DWORD *face_remap)
#define PROVIDE_MATERIALS
HRESULT WINAPI D3DXComputeBoundingSphere(const D3DXVECTOR3 *pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pcenter, float *pradius)
static HRESULT WINAPI d3dx9_mesh_GetAttributeTable(ID3DXMesh *iface, D3DXATTRIBUTERANGE *attrib_table, DWORD *attrib_table_size)
HRESULT WINAPI D3DXLoadSkinMeshFromXof(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency_out, struct ID3DXBuffer **materials_out, struct ID3DXBuffer **effects_out, DWORD *num_materials_out, struct ID3DXSkinInfo **skin_info_out, struct ID3DXMesh **mesh_out)
static BOOL weld_short2n(void *to, void *from, FLOAT epsilon)
static int __cdecl attrib_entry_compare(const void *a, const void *b)
BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *center, float radius, const D3DXVECTOR3 *ray_position, const D3DXVECTOR3 *ray_direction)
static BOOL queue_frame_node(struct list *queue, D3DXFRAME *frame)
static BOOL weld_float16_2(void *to, void *from, FLOAT epsilon)
static void convert_component(BYTE *dst, BYTE *src, D3DDECLTYPE type_dst, D3DDECLTYPE type_src)
static void append_decl_element(D3DVERTEXELEMENT9 *declaration, UINT *idx, UINT *offset, D3DDECLTYPE type, D3DDECLUSAGE usage, UINT usage_idx)
static HRESULT WINAPI d3dx9_mesh_LockIndexBuffer(ID3DXMesh *iface, DWORD flags, void **data)
static HRESULT WINAPI d3dx9_mesh_GetDevice(struct ID3DXMesh *iface, struct IDirect3DDevice9 **device)
static HRESULT WINAPI d3dx9_mesh_Optimize(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, ID3DXMesh **opt_mesh)
static HRESULT parse_transform_matrix(ID3DXFileData *filedata, D3DXMATRIX *transform)
static INT simple_round(FLOAT value)
static BOOL weld_float4(void *to, void *from, FLOAT epsilon)
static D3DXVECTOR2 * get_indexed_point(struct point2d_index *pt_idx)
static BOOL weld_float16_4(void *to, void *from, FLOAT epsilon)
static BOOL compute_sincos_table(struct sincos_table *sincos_table, float angle_start, float angle_step, int n)
static HRESULT parse_texture_coords(ID3DXFileData *filedata, struct mesh_data *mesh, DWORD flags)
static struct udec3 dword_to_udec3(DWORD d)
static void fill_attribute_table(DWORD *attrib_buffer, DWORD numfaces, void *indices, BOOL is_32bit_indices, D3DXATTRIBUTERANGE *attrib_table)
static HRESULT parse_mesh(ID3DXFileData *filedata, struct mesh_data *mesh_data, DWORD provide_flags)
static HRESULT load_mesh_container(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXAllocateHierarchy *alloc_hier, D3DXMESHCONTAINER **mesh_container, struct ID3DXLoadUserData *load_user_data)
HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, UINT slices, UINT stacks, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency)
D3DXFRAME *WINAPI D3DXFrameFind(const D3DXFRAME *root, const char *name)
static HRESULT parse_material_list(ID3DXFileData *filedata, struct mesh_data *mesh, DWORD flags)
static BOOL weld_component(void *to, void *from, D3DDECLTYPE type, FLOAT epsilon)
HRESULT WINAPI D3DXLoadMeshFromXW(const WCHAR *filename, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh)
static INT get_equivalent_declaration_index(D3DVERTEXELEMENT9 orig_declaration, D3DVERTEXELEMENT9 *declaration)
static struct outline * add_outline(struct outline_array *array)
static BOOL declaration_equals(const D3DVERTEXELEMENT9 *declaration1, const D3DVERTEXELEMENT9 *declaration2)
static ULONG WINAPI d3dx9_mesh_Release(ID3DXMesh *iface)
static BOOL reserve(struct dynamic_array *array, int count, int itemsize)
UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_idx)
static HRESULT compact_mesh(struct d3dx9_mesh *This, DWORD *indices, DWORD *new_num_vertices, ID3DXBuffer **vertex_remap)
static HRESULT WINAPI d3dx9_mesh_LockVertexBuffer(ID3DXMesh *iface, DWORD flags, void **data)
static BOOL weld_ushort2n(void *to, void *from, FLOAT epsilon)
static HRESULT parse_skin_mesh_header(ID3DXFileData *filedata, struct mesh_data *mesh_data, DWORD flags)
static HRESULT filedata_get_name(ID3DXFileData *filedata, char **name)
static DWORD * generate_identity_point_reps(DWORD num_vertices)
static const struct ID3DXMeshVtbl D3DXMesh_Vtbl
HRESULT WINAPI D3DXValidMesh(ID3DXMesh *mesh, const DWORD *adjacency, ID3DXBuffer **errors_and_warnings)
#define FILL_INDEX_BUFFER(indices_var)
HRESULT(* mesh_parse_func)(ID3DXFileData *, struct mesh_data *, DWORD)
HRESULT WINAPI D3DXLoadMeshFromXA(const char *filename, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh)
static BOOL attempt_line_merge(struct outline *outline, int pt_index, const D3DXVECTOR2 *nextpt, BOOL to_curve, const struct cos_table *table)
static ULONG WINAPI d3dx9_mesh_AddRef(ID3DXMesh *iface)
static HRESULT WINAPI d3dx9_mesh_UnlockAttributeBuffer(ID3DXMesh *iface)
HRESULT WINAPI D3DXCreateTorus(struct IDirect3DDevice9 *device, float innerradius, float outerradius, UINT sides, UINT rings, struct ID3DXMesh **mesh, ID3DXBuffer **adjacency)
static DWORD read_ib(void *index_buffer, BOOL indices_are_32bit, DWORD index)
static HRESULT remap_faces_for_attrsort(struct d3dx9_mesh *This, const DWORD *indices, DWORD *attrib_buffer, DWORD **sorted_attrib_buffer, DWORD **face_remap)
static const UINT d3dx_decltype_size[]
#define PROVIDE_ADJACENCY
static struct dec3n dword_to_dec3n(DWORD d)
static D3DXVECTOR3 * vertex_element_vec3(BYTE *vertices, const D3DVERTEXELEMENT9 *declaration, DWORD vertex_stride, DWORD index)
static BOOL weld_ubyte4n(void *to, void *from, FLOAT epsilon)
HRESULT WINAPI D3DXConvertMeshSubsetToSingleStrip(struct ID3DXBaseMesh *mesh_in, DWORD attribute_id, DWORD ib_flags, struct IDirect3DIndexBuffer9 **index_buffer, DWORD *index_count)
HRESULT WINAPI D3DXOptimizeVertices(const void *indices, UINT face_count, UINT vertex_count, BOOL indices_are_32bit, DWORD *vertex_remap)
static DWORD WINAPI d3dx9_mesh_GetFVF(ID3DXMesh *iface)
static HRESULT parse_frame(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, const D3DXMATRIX *parent_transform, struct list *container_list, DWORD provide_flags)
HRESULT WINAPI D3DXCreateTextW(struct IDirect3DDevice9 *device, HDC hdc, const WCHAR *text, float deviation, float extrusion, struct ID3DXMesh **mesh_ptr, struct ID3DXBuffer **adjacency, GLYPHMETRICSFLOAT *glyphmetrics)
static struct d3dx9_mesh * impl_from_ID3DXMesh(ID3DXMesh *iface)
static DWORD count_attributes(const DWORD *attrib_buffer, DWORD numfaces)
HRESULT WINAPI D3DXComputeNormals(struct ID3DXBaseMesh *mesh, const DWORD *adjacency)
HRESULT WINAPI D3DXLoadMeshFromXInMemory(const void *memory, DWORD memory_size, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency_out, struct ID3DXBuffer **materials_out, struct ID3DXBuffer **effects_out, DWORD *num_materials_out, struct ID3DXMesh **mesh_out)
static D3DXVECTOR2 * unit_vec2(D3DXVECTOR2 *dir, const D3DXVECTOR2 *pt1, const D3DXVECTOR2 *pt2)
HRESULT WINAPI D3DXWeldVertices(ID3DXMesh *mesh, DWORD flags, const D3DXWELDEPSILONS *epsilons, const DWORD *adjacency, DWORD *adjacency_out, DWORD *face_remap_out, ID3DXBuffer **vertex_remap_out)
static BOOL weld_short4(void *to, void *from, FLOAT epsilon)
static int __cdecl compare_vertex_keys(const void *a, const void *b)
static HRESULT WINAPI d3dx9_mesh_CloneMeshFVF(struct ID3DXMesh *iface, DWORD options, DWORD fvf, struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh)
static HRESULT add_vertex_index(struct word_array *array, WORD vertex_index)
HRESULT WINAPI D3DXLoadMeshHierarchyFromXA(const char *filename, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXAllocateHierarchy *alloc_hier, struct ID3DXLoadUserData *load_user_data, D3DXFRAME **frame_hierarchy, struct ID3DXAnimationController **anim_controller)
HRESULT WINAPI D3DXCreateMeshFVF(DWORD face_count, DWORD vertex_count, DWORD options, DWORD fvf, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
static D3DXVECTOR2 * triangulation_get_next_point(struct triangulation *t, struct glyphinfo *glyph, BOOL on_top)
static int __cdecl compare_vertex_indices(const void *a, const void *b)
static DWORD WINAPI d3dx9_mesh_GetNumBytesPerVertex(ID3DXMesh *iface)
static BOOL weld_udec3(void *to, void *from, FLOAT epsilon)
HRESULT WINAPI D3DXFrameDestroy(D3DXFRAME *frame, ID3DXAllocateHierarchy *alloc_hier)
static float get_line_to_point_y_distance(D3DXVECTOR2 *line_pt1, D3DXVECTOR2 *line_pt2, D3DXVECTOR2 *point)
static HRESULT WINAPI d3dx9_mesh_UnlockIndexBuffer(ID3DXMesh *iface)
static void convert_float4(BYTE *dst, const D3DXVECTOR4 *src, D3DDECLTYPE type_dst)
static BOOL weld_short4n(void *to, void *from, FLOAT epsilon)
static WORD vertex_index(UINT slices, int slice, int stack)
BOOL WINAPI D3DXBoxBoundProbe(const D3DXVECTOR3 *pmin, const D3DXVECTOR3 *pmax, const D3DXVECTOR3 *prayposition, const D3DXVECTOR3 *praydirection)
static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, ID3DXBuffer **effects)
static HRESULT WINAPI d3dx9_mesh_QueryInterface(ID3DXMesh *iface, REFIID riid, void **out)
static HRESULT parse_texture_filename(ID3DXFileData *filedata, char **filename_out)
static DWORD WINAPI d3dx9_mesh_GetOptions(ID3DXMesh *iface)
static void destroy_materials(struct mesh_data *mesh)
HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
#define MultiByteToWideChar
static void cleanup(void)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP float __cdecl acosf(float)
_ACRTIMP float __cdecl cosf(float)
_ACRTIMP float __cdecl sinf(float)
_ACRTIMP float __cdecl fabsf(float)
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
_ACRTIMP div_t __cdecl div(int, int)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
static char * strdup(const char *buf)
struct tagD3DXMATERIAL D3DXMATERIAL
#define ID3DXBuffer_GetBufferPointer(p)
#define ID3DXBuffer_Release(p)
struct _D3DVECTOR D3DXVECTOR3
#define D3DXToRadian(degree)
@ D3DXTANGENT_WEIGHT_BY_AREA
@ D3DXTANGENT_CALCULATE_NORMALS
@ D3DXTANGENT_WEIGHT_EQUAL
@ D3DXTANGENT_GENERATE_IN_PLACE
struct _D3DXEFFECTDEFAULT D3DXEFFECTDEFAULT
@ D3DXMESHOPT_STRIPREORDER
@ D3DXMESHOPT_IGNOREVERTS
@ D3DXMESHOPT_VERTEXCACHE
@ D3DXWELDEPSILONS_DONOTREMOVEVERTICES
@ D3DXWELDEPSILONS_DONOTSPLIT
@ D3DXWELDEPSILONS_WELDALL
@ D3DXWELDEPSILONS_WELDPARTIALMATCHES
@ D3DXMESH_VB_SOFTWAREPROCESSING
@ D3DXMESH_IB_SOFTWAREPROCESSING
struct _D3DXEFFECTINSTANCE D3DXEFFECTINSTANCE
#define D3DXF_FILELOAD_FROMMEMORY
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei height
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLuint GLuint GLsizei GLenum const GLvoid * indices
GLuint GLenum GLenum transform
GLenum GLenum GLenum GLenum GLenum scale
GLenum GLuint GLint GLenum face
GLboolean GLboolean GLboolean b
GLsizei GLsizei GLfloat distance
GLuint GLsizei GLsizei * length
GLenum GLuint GLsizei bufsize
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat v2
GLsizeiptr const GLvoid GLenum usage
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
#define memcpy(s1, s2, n)
struct task_struct * current
static const WCHAR textW[]
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
static ID3DXAllocateHierarchy alloc_hier
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS]
static char memory[1024 *256]
static const WCHAR filenameW[]
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
static float(__cdecl *square_half_float)(float x
_In_ ULONG _In_ ULONG Offset
static HANDLE ACCESS_MASK ULONG attributes
static void cross(float v1[3], float v2[3], float result[3])
#define IsEqualGUID(rguid1, rguid2)
static unsigned __int64 next
#define D3DRM_XTEMPLATE_BYTES
unsigned char D3DRM_XTEMPLATES[]
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
static struct __wine_debug_functions funcs
HRESULT WINAPI D3DXCreateSkinInfoFVF(DWORD vertex_count, DWORD fvf, DWORD bone_count, ID3DXSkinInfo **skin_info)
wchar_t const *const size_t const buffer_size
LPD3DXEFFECTDEFAULT pDefaults
struct _D3DXFRAME * pFrameSibling
D3DXMATRIX TransformationMatrix
LPD3DXMESHCONTAINER pMeshContainer
struct _D3DXFRAME * pFrameFirstChild
struct _D3DXMESHCONTAINER * pNextMeshContainer
POINTFLOAT gmfptGlyphOrigin
D3DVERTEXELEMENT9 cached_declaration[MAX_FVF_DECL_SIZE]
D3DXATTRIBUTERANGE * attrib_table
LONG attrib_buffer_lock_count
UINT vertex_declaration_size
IDirect3DDevice9 * device
IDirect3DVertexBuffer9 * vertex_buffer
ID3DXMesh ID3DXMesh_iface
IDirect3DIndexBuffer9 * index_buffer
IDirect3DVertexDeclaration9 * vertex_declaration
struct edge_face * entries
struct point2d_index_array ordered_vertices
struct outline_array outlines
unsigned int num_materials
unsigned int skin_weights_info_count
struct ID3DXSkinInfo * skin_info
unsigned int num_vertices
unsigned int num_poly_faces
unsigned int num_tri_faces
unsigned int * num_tri_per_face
struct point2d_index * items
struct triangulation * items
struct word_array vertex_stack
#define CONTAINING_RECORD(address, type, field)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)