-
Notifications
You must be signed in to change notification settings - Fork 0
/
vxLighting.cpp
45 lines (35 loc) · 1.09 KB
/
vxLighting.cpp
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
/**
*
* file vxLighting.cpp
* \brief Automated lighting setup.
* This source file is a part of VoxelBrain software.
*
* (c) Nanyang Technological University
*
* Author: Konstantin Levinski
*
*/
#include "vxProjection.h"
void DrawLighting(){
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
float specular[] = {0.6,0.6,0.6,1};
glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
float diffuse[] = {0.6,0.6,0.6,1};
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
GLfloat high_shininess[] = { 50.0 };
glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
//Light position
V3f lp(GetProjection()->Z()); lp *= 1;
lp += GetProjection()->X()*0.8;
lp += GetProjection()->Y()*0.8;
lp *= 250;
float position[] = {lp.x, lp.y, lp.z, 1};
glLightfv(GL_LIGHT0, GL_POSITION, position);
};
// End of vxLighting.cpp