17#ifndef _CS237_GOBJECTS_HPP_
18#define _CS237_GOBJECTS_HPP_
21#error "cs237/gobjects.hpp should not be included directly"
56 return ((
static_cast<uint32_t
>(attrs) &
kVAttrTCBit) != 0);
80 Obj (std::string_view s)
86 Obj (std::string_view s, uint32_t nv, uint32_t ni)
94 if (this->verts !=
nullptr) {
delete [] this->
verts; }
95 if (this->norms !=
nullptr) {
delete [] this->
norms; }
96 if (this->txtCoords !=
nullptr) {
delete [] this->
txtCoords; }
97 if (this->indices !=
nullptr) {
delete [] this->
indices; }
bool hasNormals(VertexAttrs attrs)
Does a vertex attribute specification include normals?
Definition gobjects.hpp:48
constexpr uint32_t kVAttrNormBit
normal vector attribute
Definition gobjects.hpp:33
VertexAttrs
specifying the attributes of the generated object
Definition gobjects.hpp:40
@ ePosNormTex
all attributes
@ ePosTex
position+texture coord
@ ePosNorm
position+normal
constexpr uint32_t kVAttrPosBit
bit mask for the various vertex attributes
Definition gobjects.hpp:32
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)
bool hasTextureCoords(VertexAttrs attrs)
Does a vertex attribute specification include texture coordinates?
Definition gobjects.hpp:54
constexpr uint32_t kVAttrTCBit
texture coordinate attribute
Definition gobjects.hpp:34
constexpr uint32_t kVAttrTanBit
tangent vector attribute
Definition gobjects.hpp:35
a geometric object
Definition gobjects.hpp:60
glm::vec3 * verts
array of nVerts vertex coordinates
Definition gobjects.hpp:64
Obj()
Definition gobjects.hpp:70
glm::vec3 * norms
array of nVerts normal vectors (or nullptr)
Definition gobjects.hpp:65
Obj(std::string_view s, uint32_t nv, uint32_t ni)
Definition gobjects.hpp:86
uint32_t nIndices
the number of indices (3 * number of triangles)
Definition gobjects.hpp:63
glm::vec2 * txtCoords
array of nVerts texture coordinates (or nullptr)
Definition gobjects.hpp:66
uint32_t * indices
Definition gobjects.hpp:67
std::string name
object name ("cube", etc.)
Definition gobjects.hpp:61
~Obj()
Definition gobjects.hpp:92
Obj(std::string_view s)
Definition gobjects.hpp:80
uint32_t nVerts
the number of vertices in this group.
Definition gobjects.hpp:62