d3dx9_36: Implement D3DXSHRotate
kgbricola at web.de
Mon Sep 3 05:02:49 CDT 2012
I had another look and like to give some suggestion.
On 02.09.2012 22:28, Nozomi Kodama wrote:
+ sinb = sqrt( 1.0f - matrix->u.m * matrix->u.m );
I'd prefer to declare the variables as locally as possible.
+ D3DXSHRotateZ(temp5, order, alpha, temp4);
+ memcpy(out, temp5, sizeof(float) * order * order);
+ return out;
You probably may avoid the memcpy. What do you think about something like:
return D3DXSHRotateZ(out, order, alpha, temp4);
+ FLOAT alpha, beta, gamma, sinb, temp1, temp2, temp3,
Do we really need that much temps? I think one is enough, but
definitively 2 (I think you are able to use out as one "temp"). If you
don't like the usage of out, you may use temp2 instead, but I think it
could be avoided.
D3DXSHRotateZ(out, order, gamma, in);
RotateX(temp, order, 1, out);
D3DXSHRotateZ(out, order, beta, temp);
RotateX(temp, order, 0, out);
D3DXSHRotateZ(out, order, alpha, temp);
+static FLOAT* RotateX(FLOAT *out, UINT order, UINT pm, FLOAT *in)
The return value is never used. Probably you may return void or you'd
like to stack the function calls above a bit and reuse the returned
pointer. You also may use "BOOL pm" since it uses only 0 and 1 or you
may pass the "FLOAT a" directly to the function. Whatever pm stands for...
More information about the wine-devel