forked from irajgreenberg/PerunaEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCube.cpp
More file actions
66 lines (46 loc) · 1.26 KB
/
Copy pathCube.cpp
File metadata and controls
66 lines (46 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Cube.cpp
// GLFW_Demo
//
// Created by Ira on 6/3/15.
// Copyright (c) 2015 C3. All rights reserved.
//
#include "Cube.h"
Cube::Cube() {
for (int i = 0; i < 8; ++i){
this->cols.push_back(glm::vec4(.5, .5, .9, 1.0));
}
init();
}
Cube::Cube(glm::vec4 cols[]) {
for (int i = 0; i < 8; ++i){
this->cols.push_back(cols[i]);
}
init();
}
// must include concrete implementations
// of abstract functions (pure virtuals)
void Cube::calcVerts() {
verts.push_back(glm::vec3(-.5, .5, .5));
verts.push_back(glm::vec3(-.5, -.5, .5));
verts.push_back(glm::vec3(.5, -.5, .5));
verts.push_back(glm::vec3(.5, .5, .5));
verts.push_back(glm::vec3(-.5, .5, -.5));
verts.push_back(glm::vec3(.5, .5, -.5));
verts.push_back(glm::vec3(.5, -.5, -.5));
verts.push_back(glm::vec3(-.5, -.5, -.5));
}
void Cube::calcInds() {
inds.push_back(Elem(0, 1, 2));
inds.push_back(Elem(0, 2, 3));
inds.push_back(Elem(0, 3, 4));
inds.push_back(Elem(3, 5, 4));
inds.push_back(Elem(2, 6, 3));
inds.push_back(Elem(6, 5, 3));
inds.push_back(Elem(0, 4, 7));
inds.push_back(Elem(0, 7, 1));
inds.push_back(Elem(7, 2, 1));
inds.push_back(Elem(7, 6, 2));
inds.push_back(Elem(7, 4, 6));
inds.push_back(Elem(6, 4, 5));
}