-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuilding.cpp
More file actions
38 lines (32 loc) · 818 Bytes
/
building.cpp
File metadata and controls
38 lines (32 loc) · 818 Bytes
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
//
// building.cpp
// City
//
// Created by Dibash Chhetri on 11/11/12.
// Copyright (c) 2012 Dibash Chhetri. All rights reserved.
//
#include "building.h"
Building::Building(const BuildingType& type)
: m_type(type)
{}
void Building::render()const{
switch (m_type)
{
case DEFAULT_UNIT:
_renderDefaultBuilding();
break;
}
}
Vector3f& Building::position(){
return m_position;
}
const Vector3f& Building::position()const{
return m_position;
}
void Building::_renderDefaultBuilding()const{
glTranslatef(m_position.x,m_position.y,m_position.z);
glTranslatef(0.5f,0.5f,-0.5f); //translate so its bottom surface starts at (0,0,0)
glutSolidCube(1.0f);
glTranslatef(-0.5f,-0.5f,0.5f);
glTranslatef(-m_position.x, -m_position.y, -m_position.z);
}