Commit 2aab6428 authored by Alexandre Julliard's avatar Alexandre Julliard

d3drm: Use nameless unions/structs.

parent a42f5f19
......@@ -21,8 +21,6 @@
#ifndef __D3DRM_PRIVATE_INCLUDED__
#define __D3DRM_PRIVATE_INCLUDED__
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include <assert.h>
#include <math.h>
......
......@@ -158,7 +158,7 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT;
surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
surface_desc.u2.dwZBufferBitDepth = 16;
surface_desc.dwZBufferBitDepth = 16;
surface_desc.dwWidth = desc.dwWidth;
surface_desc.dwHeight = desc.dwHeight;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &ds, NULL);
......
......@@ -132,19 +132,19 @@ static void d3drm_matrix_set_rotation(struct d3drm_matrix *matrix, D3DVECTOR *ax
cos_theta = cosf(theta);
vers_theta = 1.0f - cos_theta;
matrix->_11 = vers_theta * axis->u1.x * axis->u1.x + cos_theta;
matrix->_21 = vers_theta * axis->u1.x * axis->u2.y - sin_theta * axis->u3.z;
matrix->_31 = vers_theta * axis->u1.x * axis->u3.z + sin_theta * axis->u2.y;
matrix->_11 = vers_theta * axis->x * axis->x + cos_theta;
matrix->_21 = vers_theta * axis->x * axis->y - sin_theta * axis->z;
matrix->_31 = vers_theta * axis->x * axis->z + sin_theta * axis->y;
matrix->_41 = 0.0f;
matrix->_12 = vers_theta * axis->u2.y * axis->u1.x + sin_theta * axis->u3.z;
matrix->_22 = vers_theta * axis->u2.y * axis->u2.y + cos_theta;
matrix->_32 = vers_theta * axis->u2.y * axis->u3.z - sin_theta * axis->u1.x;
matrix->_12 = vers_theta * axis->y * axis->x + sin_theta * axis->z;
matrix->_22 = vers_theta * axis->y * axis->y + cos_theta;
matrix->_32 = vers_theta * axis->y * axis->z - sin_theta * axis->x;
matrix->_42 = 0.0f;
matrix->_13 = vers_theta * axis->u3.z * axis->u1.x - sin_theta * axis->u2.y;
matrix->_23 = vers_theta * axis->u3.z * axis->u2.y + sin_theta * axis->u1.x;
matrix->_33 = vers_theta * axis->u3.z * axis->u3.z + cos_theta;
matrix->_13 = vers_theta * axis->z * axis->x - sin_theta * axis->y;
matrix->_23 = vers_theta * axis->z * axis->y + sin_theta * axis->x;
matrix->_33 = vers_theta * axis->z * axis->z + cos_theta;
matrix->_43 = 0.0f;
matrix->_14 = 0.0f;
......@@ -157,9 +157,9 @@ static void d3drm_vector_transform_affine(D3DVECTOR *dst, const D3DVECTOR *v, co
{
D3DVECTOR tmp;
tmp.u1.x = v->u1.x * m->_11 + v->u2.y * m->_21 + v->u3.z * m->_31 + m->_41;
tmp.u2.y = v->u1.x * m->_12 + v->u2.y * m->_22 + v->u3.z * m->_32 + m->_42;
tmp.u3.z = v->u1.x * m->_13 + v->u2.y * m->_23 + v->u3.z * m->_33 + m->_43;
tmp.x = v->x * m->_11 + v->y * m->_21 + v->z * m->_31 + m->_41;
tmp.y = v->x * m->_12 + v->y * m->_22 + v->z * m->_32 + m->_42;
tmp.z = v->x * m->_13 + v->y * m->_23 + v->z * m->_33 + m->_43;
*dst = tmp;
}
......@@ -1194,9 +1194,9 @@ static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface,
TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta);
axis.u1.x = x;
axis.u2.y = y;
axis.u3.z = z;
axis.x = x;
axis.y = y;
axis.z = z;
switch (type)
{
......@@ -3535,13 +3535,13 @@ static HRESULT WINAPI d3drm_animation2_AddKey(IDirect3DRMAnimation2 *iface, D3DR
switch (key->dwKeyType)
{
case D3DRMANIMATION_POSITIONKEY:
keys->keys[index].u.position = key->u.dvPositionKey;
keys->keys[index].u.position = key->dvPositionKey;
break;
case D3DRMANIMATION_SCALEKEY:
keys->keys[index].u.scale = key->u.dvScaleKey;
keys->keys[index].u.scale = key->dvScaleKey;
break;
case D3DRMANIMATION_ROTATEKEY:
keys->keys[index].u.rotate = key->u.dqRotateKey;
keys->keys[index].u.rotate = key->dqRotateKey;
break;
}
++keys->count;
......@@ -3559,7 +3559,7 @@ static HRESULT WINAPI d3drm_animation2_AddRotateKey(IDirect3DRMAnimation2 *iface
key.dwKeyType = D3DRMANIMATION_ROTATEKEY;
key.dvTime = time;
key.dwID = 0;
key.u.dqRotateKey = *q;
key.dqRotateKey = *q;
return d3drm_animation2_AddKey(iface, &key);
}
......@@ -3584,9 +3584,9 @@ static HRESULT WINAPI d3drm_animation2_AddPositionKey(IDirect3DRMAnimation2 *ifa
key.dwKeyType = D3DRMANIMATION_POSITIONKEY;
key.dvTime = time;
key.dwID = 0;
key.u.dvPositionKey.u1.x = x;
key.u.dvPositionKey.u2.y = y;
key.u.dvPositionKey.u3.z = z;
key.dvPositionKey.x = x;
key.dvPositionKey.y = y;
key.dvPositionKey.z = z;
return d3drm_animation2_AddKey(iface, &key);
}
......@@ -3612,9 +3612,9 @@ static HRESULT WINAPI d3drm_animation2_AddScaleKey(IDirect3DRMAnimation2 *iface,
key.dwKeyType = D3DRMANIMATION_SCALEKEY;
key.dvTime = time;
key.dwID = 0;
key.u.dvScaleKey.u1.x = x;
key.u.dvScaleKey.u2.y = y;
key.u.dvScaleKey.u3.z = z;
key.dvScaleKey.x = x;
key.dvScaleKey.y = y;
key.dvScaleKey.z = z;
return d3drm_animation2_AddKey(iface, &key);
}
......@@ -3783,7 +3783,7 @@ static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3D
keys[i].dwKeyType = D3DRMANIMATION_ROTATEKEY;
keys[i].dvTime = key[i].time;
keys[i].dwID = 0; /* FIXME */
keys[i].u.dqRotateKey = key[i].u.rotate;
keys[i].dqRotateKey = key[i].u.rotate;
}
keys += count;
}
......@@ -3800,7 +3800,7 @@ static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3D
keys[i].dwKeyType = D3DRMANIMATION_POSITIONKEY;
keys[i].dvTime = key[i].time;
keys[i].dwID = 0; /* FIXME */
keys[i].u.dvPositionKey = key[i].u.position;
keys[i].dvPositionKey = key[i].u.position;
}
keys += count;
}
......@@ -3817,7 +3817,7 @@ static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3D
keys[i].dwKeyType = D3DRMANIMATION_SCALEKEY;
keys[i].dvTime = key[i].time;
keys[i].dwID = 0; /* FIXME */
keys[i].u.dvScaleKey = key[i].u.scale;
keys[i].dvScaleKey = key[i].u.scale;
}
keys += count;
}
......
......@@ -66,9 +66,9 @@ D3DRMQUATERNION * WINAPI D3DRMQuaternionMultiply(D3DRMQUATERNION *q, D3DRMQUATER
D3DRMVectorCrossProduct(&cross_product, &a->v, &b->v);
temp.s = a->s * b->s - D3DRMVectorDotProduct(&a->v, &b->v);
temp.v.u1.x = a->s * b->v.u1.x + b->s * a->v.u1.x + cross_product.u1.x;
temp.v.u2.y = a->s * b->v.u2.y + b->s * a->v.u2.y + cross_product.u2.y;
temp.v.u3.z = a->s * b->v.u3.z + b->s * a->v.u3.z + cross_product.u3.z;
temp.v.x = a->s * b->v.x + b->s * a->v.x + cross_product.x;
temp.v.y = a->s * b->v.y + b->s * a->v.y + cross_product.y;
temp.v.z = a->s * b->v.z + b->s * a->v.z + cross_product.z;
*q = temp;
return q;
......@@ -79,9 +79,9 @@ void WINAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, D3DRMQUATERNION *q)
{
D3DVALUE w,x,y,z;
w = q->s;
x = q->v.u1.x;
y = q->v.u2.y;
z = q->v.u3.z;
x = q->v.x;
y = q->v.y;
z = q->v.z;
m[0][0] = 1.0-2.0*(y*y+z*z);
m[1][1] = 1.0-2.0*(x*x+z*z);
m[2][2] = 1.0-2.0*(x*x+y*y);
......@@ -142,9 +142,9 @@ D3DVECTOR * WINAPI D3DRMVectorAdd(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVECTOR temp;
temp.u1.x=s1->u1.x + s2->u1.x;
temp.u2.y=s1->u2.y + s2->u2.y;
temp.u3.z=s1->u3.z + s2->u3.z;
temp.x=s1->x + s2->x;
temp.y=s1->y + s2->y;
temp.z=s1->z + s2->z;
*d = temp;
return d;
......@@ -155,9 +155,9 @@ D3DVECTOR * WINAPI D3DRMVectorSubtract(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s
{
D3DVECTOR temp;
temp.u1.x=s1->u1.x - s2->u1.x;
temp.u2.y=s1->u2.y - s2->u2.y;
temp.u3.z=s1->u3.z - s2->u3.z;
temp.x=s1->x - s2->x;
temp.y=s1->y - s2->y;
temp.z=s1->z - s2->z;
*d = temp;
return d;
......@@ -168,9 +168,9 @@ D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTO
{
D3DVECTOR temp;
temp.u1.x=s1->u2.y * s2->u3.z - s1->u3.z * s2->u2.y;
temp.u2.y=s1->u3.z * s2->u1.x - s1->u1.x * s2->u3.z;
temp.u3.z=s1->u1.x * s2->u2.y - s1->u2.y * s2->u1.x;
temp.x=s1->y * s2->z - s1->z * s2->y;
temp.y=s1->z * s2->x - s1->x * s2->z;
temp.z=s1->x * s2->y - s1->y * s2->x;
*d = temp;
return d;
......@@ -180,7 +180,7 @@ D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTO
D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVALUE dot_product;
dot_product=s1->u1.x * s2->u1.x + s1->u2.y * s2->u2.y + s1->u3.z * s2->u3.z;
dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z;
return dot_product;
}
......@@ -188,7 +188,7 @@ D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *s1, D3DVECTOR *s2)
D3DVALUE WINAPI D3DRMVectorModulus(D3DVECTOR *v)
{
D3DVALUE result;
result=sqrt(v->u1.x * v->u1.x + v->u2.y * v->u2.y + v->u3.z * v->u3.z);
result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z);
return result;
}
......@@ -202,9 +202,9 @@ D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *u)
}
else
{
u->u1.x=1.0;
u->u2.y=0.0;
u->u3.z=0.0;
u->x=1.0;
u->y=0.0;
u->z=0.0;
}
return u;
}
......@@ -212,9 +212,9 @@ D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *u)
/* Returns a random unit vector */
D3DVECTOR * WINAPI D3DRMVectorRandom(D3DVECTOR *d)
{
d->u1.x = rand();
d->u2.y = rand();
d->u3.z = rand();
d->x = rand();
d->y = rand();
d->z = rand();
D3DRMVectorNormalize(d);
return d;
}
......@@ -254,9 +254,9 @@ D3DVECTOR * WINAPI D3DRMVectorScale(D3DVECTOR *d, D3DVECTOR *s, D3DVALUE factor)
{
D3DVECTOR temp;
temp.u1.x=factor * s->u1.x;
temp.u2.y=factor * s->u2.y;
temp.u3.z=factor * s->u3.z;
temp.x=factor * s->x;
temp.y=factor * s->y;
temp.z=factor * s->z;
*d = temp;
return d;
......
......@@ -1385,9 +1385,9 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
}
else
{
face_normal.u1.x = 0.0f;
face_normal.u2.y = 0.0f;
face_normal.u3.z = 0.0f;
face_normal.x = 0.0f;
face_normal.y = 0.0f;
face_normal.z = 0.0f;
}
}
......@@ -1588,9 +1588,9 @@ static HRESULT WINAPI d3drm_mesh_builder3_Scale(IDirect3DRMMeshBuilder3 *iface,
for (i = 0; i < mesh_builder->nb_vertices; ++i)
{
mesh_builder->vertices[i].u1.x *= sx;
mesh_builder->vertices[i].u2.y *= sy;
mesh_builder->vertices[i].u3.z *= sz;
mesh_builder->vertices[i].x *= sx;
mesh_builder->vertices[i].y *= sy;
mesh_builder->vertices[i].z *= sz;
}
/* Normals are not affected by Scale */
......@@ -1862,9 +1862,9 @@ static int WINAPI d3drm_mesh_builder3_AddVertex(IDirect3DRMMeshBuilder3 *iface,
mesh_builder->nb_vertices + 1, sizeof(*mesh_builder->vertices)))
return 0;
mesh_builder->vertices[mesh_builder->nb_vertices].u1.x = x;
mesh_builder->vertices[mesh_builder->nb_vertices].u2.y = y;
mesh_builder->vertices[mesh_builder->nb_vertices].u3.z = z;
mesh_builder->vertices[mesh_builder->nb_vertices].x = x;
mesh_builder->vertices[mesh_builder->nb_vertices].y = y;
mesh_builder->vertices[mesh_builder->nb_vertices].z = z;
return mesh_builder->nb_vertices++;
}
......@@ -1880,9 +1880,9 @@ static int WINAPI d3drm_mesh_builder3_AddNormal(IDirect3DRMMeshBuilder3 *iface,
mesh_builder->nb_normals + 1, sizeof(*mesh_builder->normals)))
return 0;
mesh_builder->normals[mesh_builder->nb_normals].u1.x = x;
mesh_builder->normals[mesh_builder->nb_normals].u2.y = y;
mesh_builder->normals[mesh_builder->nb_normals].u3.z = z;
mesh_builder->normals[mesh_builder->nb_normals].x = x;
mesh_builder->normals[mesh_builder->nb_normals].y = y;
mesh_builder->normals[mesh_builder->nb_normals].z = z;
return mesh_builder->nb_normals++;
}
......
......@@ -34,10 +34,10 @@ static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport2(IDirect3DRMV
static inline void d3drm_normalize_d3d_color(D3DCOLORVALUE *color_value, D3DCOLOR color)
{
color_value->u1.r = RGBA_GETRED(color) / 255.0f;
color_value->u2.g = RGBA_GETGREEN(color) / 255.0f;
color_value->u3.b = RGBA_GETBLUE(color) / 255.0f;
color_value->u4.a = RGBA_GETALPHA(color) / 255.0f;
color_value->r = RGBA_GETRED(color) / 255.0f;
color_value->g = RGBA_GETGREEN(color) / 255.0f;
color_value->b = RGBA_GETBLUE(color) / 255.0f;
color_value->a = RGBA_GETALPHA(color) / 255.0f;
}
static HRESULT d3drm_update_background_material(struct d3drm_viewport *viewport)
......@@ -54,7 +54,7 @@ static HRESULT d3drm_update_background_material(struct d3drm_viewport *viewport)
memset(&mat, 0, sizeof(mat));
mat.dwSize = sizeof(mat);
d3drm_normalize_d3d_color(&mat.u.diffuse, color);
d3drm_normalize_d3d_color(&mat.diffuse, color);
return IDirect3DMaterial_SetMaterial(viewport->material, &mat);
}
......@@ -434,9 +434,9 @@ static HRESULT WINAPI d3drm_viewport2_Clear(IDirect3DRMViewport2 *iface, DWORD f
TRACE("iface %p, flags %#lx.\n", iface, flags);
clear_rect.u1.x1 = clear_rect.u2.y1 = 0;
clear_rect.u3.x2 = viewport->device->width;
clear_rect.u4.y2 = viewport->device->height;
clear_rect.x1 = clear_rect.y1 = 0;
clear_rect.x2 = viewport->device->width;
clear_rect.y2 = viewport->device->height;
if (flags & D3DRMCLEAR_TARGET)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment