![]() |
CMSC23740 Common Code Library
Support code for CS23740 programming projects
|
Classes | |
| struct | Obj |
| a geometric object More... | |
Enumerations | |
| enum class | VertexAttrs : uint32_t { ePos = kVAttrPosBit , ePosNorm = kVAttrPosBit | kVAttrNormBit , ePosTex = kVAttrPosBit | kVAttrTCBit , ePosNormTex = kVAttrPosBit | kVAttrNormBit | kVAttrTCBit } |
| specifying the attributes of the generated object More... | |
Functions | |
| bool | hasNormals (VertexAttrs attrs) |
| Does a vertex attribute specification include normals? | |
| bool | hasTextureCoords (VertexAttrs attrs) |
| Does a vertex attribute specification include texture coordinates? | |
| Obj * | cube (VertexAttrs attrs, glm::vec3 center, float width) |
| Obj * | sphere (VertexAttrs attrs, glm::vec3 center, float radius, uint32_t slices, uint32_t stacks) |
| Obj * | cone (VertexAttrs attrs, glm::vec3 pos, glm::vec3 dir, float radius, float height, uint32_t slices, uint32_t stacks) |
Variables | |
| constexpr uint32_t | kVAttrPosBit = (1 << 0) |
| bit mask for the various vertex attributes | |
| constexpr uint32_t | kVAttrNormBit = (1 << 1) |
| normal vector attribute | |
| constexpr uint32_t | kVAttrTCBit = (1 << 2) |
| texture coordinate attribute | |
| constexpr uint32_t | kVAttrTanBit = (1 << 3) |
| tangent vector attribute | |
|
strong |
| Obj * cs237::gobj::cone | ( | VertexAttrs | attrs, |
| glm::vec3 | pos, | ||
| glm::vec3 | dir, | ||
| float | radius, | ||
| float | height, | ||
| uint32_t | slices, | ||
| uint32_t | stacks ) |
creates a cone shaped triange mesh
| attrs | specify the attributes of the cones's vertices |
| pos | the apex of the cone |
| dir | the direction in which the cone is pointing (from the apex to the center of the base) |
| radius | the radius of the cone's base |
| height | the height of the cone (distance from base to apex) |
| slices | the number slices around the sides of the cone; must be at least 6 |
| stacks | the number of segments between the base and the apex of the cone |
Note that the vertices of the mesh lie on the surface of the cone. To produce a mesh that contains the cone, you need to scale the radius by 
| Obj * cs237::gobj::cube | ( | VertexAttrs | attrs, |
| glm::vec3 | center, | ||
| float | width ) |
construct an axis-aligned cube centered at the origin
| attrs | specify the attributes of the sphere's vertices |
| center | the cube's center |
| width | the width of a side |
|
inline |
Does a vertex attribute specification include normals?
|
inline |
Does a vertex attribute specification include texture coordinates?
| Obj * cs237::gobj::sphere | ( | VertexAttrs | attrs, |
| glm::vec3 | center, | ||
| float | radius, | ||
| uint32_t | slices, | ||
| uint32_t | stacks ) |
create a mesh to represent a sphere centered at the origin
| attrs | specify the attributes of the sphere's vertices |
| center | the sphere's center |
| radius | the sphere's radius |
| slices | the number of horizontal triangles around a band; must be at least 5. |
| stacks | the number of horizontal bands around the sphere; must be at least 5. |
Note that the vertices of the mesh lie on the surface of the sphere.
|
constexpr |
normal vector attribute
|
constexpr |
bit mask for the various vertex attributes
vertex position (required)
|
constexpr |
tangent vector attribute
|
constexpr |
texture coordinate attribute