GSoC/GCI Archive
Google Code-in 2012 Copyleft Games Group

PySoy: Box Rounded Edges

completed by: Samuel Kim

mentors: Amaury Medeiros, Arc Riley, Tony Young, David Czech, Mayank Singh

Currently soy.bodies.Box has a radius property which reduces the size (but not position) of the faces such that additional faces representing rounded edges and corners can connect them, but these rounded edge verticies and faces are not currently implemented.

When (and only when) radius > 0.0, add new faces and verticies to each side. Use these diagrams as a guide:

[IMAGE http://gci.copyleftgames.org/img/rounded-box.png] [IMAGE http://gci.copyleftgames.org/img/rounded-box2.png]

In the second diagram, verticies need to be created everywhere lines cross, and this diagram represents each of the 6 sides. The outermost corners merge at the blue circles on the first diagram. Note that you do not need to modify the "square" part of the faces (innermost 4 triangles), there is a separate GCI task to subdivide these based on size for better specular lighting.

Texture coordinates (including for flat faces) do need to change such that they'll be evenly distributed across the entire side. That is, the edge of the flat face needs to start texcoords at (pi*radius/4) and end at 1-(pi*radius/4) with the texcoords over the rounded edges further dividing the circumference such that the seams between the sides have texcoords 0.0 and 1.0.

While working on this task you should join and remain in #PySoy on Freenode to get help, feedback, and guidance from mentors and other developers. Code updates which may affect your work are also announced here as they happen. This is especially important for this task as other GCI tasks may be worked on to modify the same function.

When you've done, commit your work and post the resulting changeset url to this task.