summaryrefslogtreecommitdiffstats
path: root/dev/snowman/snowman.cc
blob: 0b6ab5ec700bf703659308fb4df01ff6df517329 (plain) (blame)
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
/** CSci-4611 In-Class Example */

#include "snowman.h"

#include <iostream>
#include <sstream>



Snowman::Snowman() : GraphicsApp(1024,768, "Do You Want to Build a Snowman?") {
}


Snowman::~Snowman() {
}


void Snowman::UpdateSimulation(double dt)  {
}


void Snowman::InitOpenGL() {
    // Set up the camera in a good position to see the entire scene
    proj_matrix_ = Matrix4::Perspective(60.0f, aspect_ratio(), 0.01f, 100.0f);
    view_matrix_ = Matrix4::LookAt(Point3(0,2,10), Point3(0,0,0), Vector3(0,1,0));
    glClearColor(0.2f, 0.6f, 1.0f, 1.0f);
}


void Snowman::DrawUsingOpenGL() {
    Matrix4 identity;
    
    // draws a set of axes at the world origin, since we are passing the identity
    // matrix for the "model" matrix.
    quick_shapes_.DrawAxes(identity, view_matrix_, proj_matrix_);
    

    Matrix4 S_ground = Matrix4::Scale(Vector3(40.0f, 0.2f, 40.0f));
    Matrix4 T_ground = Matrix4::Translation(Vector3(0.0f, -0.2f, 0.0f));
    Matrix4 ground_combo = T_ground * S_ground;
    quick_shapes_.DrawCube(ground_combo, view_matrix_, proj_matrix_, Color(0.8f, 0.8f, 0.8f));

}