2014-11-03 6:35 GMT+01:00 Sebastian Lackner sebastian@fds-team.de:
Based on a patch by David Adam.
For bug 13632.
dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 + 3 files changed, 92 insertions(+), 1 deletion(-)
Hi Sebastian,
I have a few nitpicks:
+ TRACE("(%p, %f, %u, %p, %p)\n", device, length, sides, mesh, adjacency);
Generally you want that to be something like:
TRACE("device %p, length %f, sides %u, mesh %p, adjacency %p.\n", device, length, sides, mesh, adjacency);
+ if (!device || length < 0.0f || sides == 0 || !mesh)
Probably "!sides" is more in the usual Wine d3d* style. Also, no need to use brackets for single-line branches.
+ if (FAILED(hr = D3DXCreateMeshFVF(sides, sides + 1, D3DXMESH_MANAGED, + D3DFVF_XYZ | D3DFVF_NORMAL,device, &polygon)))
Line continuation should be indented by 8 blanks. Also, missing whitespace after a comma.
+ scale = 0.5f * length / sin(D3DX_PI / sides);
You probably want to use sinf() here. Same below.
+ for (i = 0; i < sides; i++)
Not important, but the current wined3d style wants "++i" here.
+ for (i = 0; i < sides; i++) + { + adjacency_buf[i][0] = i - 1; + adjacency_buf[i][1] = -1; + adjacency_buf[i][2] = i + 1; + }
Really a detail, but adjacency_buf and i are both defined as unsigned int, so either defining them as plain, signed int or using ~0 instead of -1 would be nicer.
I haven't seen the test yet but in some other D3DX9 functions the "out" pointers are set to NULL on error. If this function has the same behavior you should probably add a "*mesh = NULL;" in the first few lines of the function.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2014-11-03 18:44, schrieb Matteo Bruni:
Really a detail, but adjacency_buf and i are both defined as unsigned int, so either defining them as plain, signed int or using ~0 instead of -1 would be nicer.
Nitpicking the nitpick: ~0U.
Stefan Dösinger stefandoesinger@gmail.com wrote:
Am 2014-11-03 18:44, schrieb Matteo Bruni:
Really a detail, but adjacency_buf and i are both defined as unsigned int, so either defining them as plain, signed int or using ~0 instead of -1 would be nicer.
Nitpicking the nitpick: ~0U.
Do you guys (Matteo and Stefan) understand that you are essentially ban an otherwise perfectly fine patch from inclusion? No wonder why almost nobody else is touching the d3d code, and Sebastian (a real one, very smart and qualified developer) next time will think twise before touching it either. And considering dwindling and sparse commits last several months I don't think you really want that.