GSoC/GCI Archive
Google Code-in 2014 BRL-CAD

Implement a UV-mapping callback for extruded sketches (EXTRUDE)

completed by: Michael Huang

mentors: Harmanpreet, Dishank

BRL-CAD provides more than two dozen types of geometry ''primitives'' such as ellipsoids, boxes, and cones. Every primitive is described by a collection of callback functions, for example rt_ell_bbox() returns the bounding box dimensions for an ellipsoid. One of those functions describes a UV mapping of the object's surface, which is used for things like texture and bump mapping. An example of this is rt_ell_uv() in the src/librt/primitives/ell/ell.c source file for an ellipsoid. Several of our more complex primitive types (such as BoT, NMG, and BREP/NURBS) do not presently implement a UV-mapping function leading to unexpected runtime behavior.

References:

  • http://en.wikipedia.org/wiki/UV_mapping
  • src/librt/primitives/[PRIMITIVE]/[PRIMITIVE].c, read the rt_*_uv() function

Code:

  • src/librt/primitives/extrude/extrude.c (implement the uv-mapping callback here)
  • src/librt/primitives/table.c (add a reference to your function here)
  • include/rtgeom.h

This task involves implementing a UV-mapping callback for any of the primitives that do not already have a functional UV-callback defined. Note that this is an advanced task that might take you more than a couple hours if you don't have solid coding skills, but it's ultimately just a few lines of code. See other primitives that already implement a UV-mapping callback for reference.