-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFog.cpp
More file actions
57 lines (48 loc) · 997 Bytes
/
Fog.cpp
File metadata and controls
57 lines (48 loc) · 997 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Fog.cpp
// Project
//
// Created by Inês on 10/8/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include "Fog.h"
namespace CastleBlast {
Fog::Fog() : cg::Entity("FOG") {}
Fog::~Fog() {}
void Fog::init() {}
void Fog::setLevel(int level)
{
switch(level) {
case 1:
_fogColor[0] = 0.53;
_fogColor[1] = 0.81;
_fogColor[2] = 0.98;
_fogColor[3] = 1.0;
_start = 100.f;
_end = 500.f;
_density = 0.1;
break;
case 2:
_fogColor[0] = 0.0;
_fogColor[1] = 0.0;
_fogColor[2] = 0.0;
_fogColor[3] = 1.0;
_start = 200.f;
_end = 500.f;
_density = 1;
break;
}
}
void Fog::draw()
{
glEnable (GL_DEPTH_TEST);
glEnable (GL_FOG); //enable the fog
glFogi (GL_FOG_MODE, GL_LINEAR);
glFogfv (GL_FOG_COLOR, _fogColor);
glFogf (GL_FOG_DENSITY, _density);
glFogf(GL_FOG_START, _start);
glFogf(GL_FOG_END, _end);
glHint (GL_FOG_HINT, GL_NICEST);
}
void Fog::update(unsigned long elapsed_millis) {}
}