[Bug 22918] Ship Simulator 2008 demo crashes on startup (needs D3DXCreateSphere, D3DXCreateCylinder, and D3DXCreateTeapot)

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Jul 16 14:35:37 CDT 2010


http://bugs.winehq.org/show_bug.cgi?id=22918





--- Comment #14 from Misha Koshelev <misha680 at gmail.com>  2010-07-16 14:35:36 ---
Thank you for your comments. I have updated per all comments:
http://github.com/misha680/wine/commit/e90ead51ca630485eb95204fb9e605b47585f8a9

except I do not quite understand:
Also, note that you can easily define a helper function to
generate a ring of vertices with a certain radius, z position and z normal.

Or rather, in the new code, the inner loop looks like this:

    /* side - iterate over stacks (z axis) and slices (x/y axes around circle)
*/
    for (stack=0;stack<=stacks;stack++)
    {
        theta = M_PI / 2;
        for (slice=0;slice<slices;slice++)
        {
            vertex_data[vertex].position.x = radius*cos(theta);
            vertex_data[vertex].position.y = radius*sin(theta);
            vertex_data[vertex].position.z = z;
            vertex_data[vertex].normal.x = vertex_data[vertex].position.x;
            vertex_data[vertex].normal.y = vertex_data[vertex].position.y;
            vertex_data[vertex].normal.z = radius * delta_radius / length;
           
D3DXVec3Normalize(&vertex_data[vertex].normal,&vertex_data[vertex].normal);
            vertex++;
            theta += theta_step;
        }
        if (stack<stacks)
        {
            z += z_step;
            radius -= radius_step;
        }
    }

However, the cap calculations are dfferent wrt normals:

    /* top cap */
    theta = M_PI / 2;
    for (slice=0;slice<slices;slice++)
    {
        vertex_data[vertex].position.x = radius*cos(theta);
        vertex_data[vertex].position.y = radius*sin(theta);
        vertex_data[vertex].position.z = z;
        vertex_data[vertex].normal.x = 0.0f;
        vertex_data[vertex].normal.y = 0.0f;
        vertex_data[vertex].normal.z = -1.0f;
        vertex++;
        theta += theta_step;
    }

Thus, it seems that if I made a helper function, it would only be useful in the
main loop and not the cap calculations... or am I missing something?

Thank you
Misha

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list