d3dx9_36 [patch 2/2]: Add tests for D3DXCreateBox

Matteo Bruni matteo.mystral at gmail.com
Thu Mar 31 07:41:55 CDT 2011


2011/3/31 David Adam <david.adam.cnrs at gmail.com>:
>
> +      /* Check the width */
> +        v1 = *((D3DXVECTOR3*)(data+19*num_bytes_per_vertex));
> +        v2 = *((D3DXVECTOR3*)(data+18*num_bytes_per_vertex));
> +        length = D3DXVec3Length(D3DXVec3Subtract(&v2,&v1,&v2));
> +        ok(fabs(length-10.0f)<admitted_error, "Width expected= 10.0, received %f\n", length);

This is not really different from the previous version: you are still
making assumptions about the vertex ordering (in this specific case,
you're assuming that vertices 18 and 19 have different X coordinate
but the same Y and Z coordinate values).

What I was proposing was something like this:

for (i = 0; i < num_vertices; i++)
{
    float *vertex_data = data + i * num_bytes_per_vertex;
    if (vertex_data[0] < xmin) xmin = vertex_data[0];
    if (vertex_data[0] > xmax) xmax = vertex_data[0];
    if (vertex_data[1] < ymin) ymin = vertex_data[1];
    if (vertex_data[1] > ymax) ymax = vertex_data[1];
    if (vertex_data[2] < zmin) zmin = vertex_data[2];
    if (vertex_data[2] > zmax) zmax = vertex_data[2];
}

and then proceed to check whether the minimum and maximum values you
got match the expected ones. This code snippet can certainly be
improved, it is only to show you what I meant.

Also, again, please try to fix the whitespaces...



More information about the wine-devel mailing list