Cheetah Software  1.0
Graphics3D.cpp File Reference

Visualizer window for simulator. More...

#include "Graphics3D.h"
#include "Utilities/utilities.h"
#include <GL/glut.h>
#include <unistd.h>
#include <iostream>
+ Include dependency graph for Graphics3D.cpp:

Go to the source code of this file.

Variables

static constexpr auto clearColor = windows2000
 
static constexpr char vertexShaderSourceColorArray []
 
static constexpr char vertexShaderSourceSolidColor []
 
static constexpr char fragmentShaderSource []
 

Detailed Description

Visualizer window for simulator.

This class displays a window for 3D graphics. It also implements scroll/pan/zoom.

Definition in file Graphics3D.cpp.

Variable Documentation

constexpr auto clearColor = windows2000
static

Definition at line 16 of file Graphics3D.cpp.

constexpr char fragmentShaderSource[]
static
Initial value:
= R"(
varying lowp vec4 col;
varying vec3 pos_world;
varying vec3 normal;
void main() {
vec3 light_pos = vec3(0,0,4);
float light_dist = length(light_pos - pos_world);
vec3 light_color = vec3(1,1,1);
vec3 mat_ambient = vec3(.1,.1,.1);
vec3 mat_spec = vec3(.3,.3,.3);
vec3 n = normalize(normal);
vec3 l = normalize(light_pos);
float angle_thing = clamp( dot(-n,l), 0., 1.);
gl_FragColor = col + vec4(mat_ambient*light_color*40.*angle_thing/(light_dist*light_dist),0);
}
)"

Definition at line 57 of file Graphics3D.cpp.

constexpr char vertexShaderSourceColorArray[]
static
Initial value:
= R"(
// inputs:
attribute highp vec3 posAttr; // position
attribute lowp vec3 colAttr; // color
attribute highp vec3 normAttr; // normal
uniform highp mat4 matrix; // transformation
// outputs:
varying lowp vec4 col; // color
varying vec3 normal; // normal
varying vec3 pos_world; // position
void main() {
col = vec4(colAttr,1);
gl_Position = matrix * vec4(posAttr,1);
normal = (matrix * vec4(normAttr,0)).xyz;
pos_world = posAttr;
}
)"

Definition at line 19 of file Graphics3D.cpp.

constexpr char vertexShaderSourceSolidColor[]
static
Initial value:
= R"(
// inputs:
attribute highp vec3 posAttr; // position
uniform lowp vec4 colUniform; // color
attribute lowp vec3 colAttr; // color
attribute highp vec3 normAttr; // normal
uniform highp mat4 matrix; // transformation
// outputs:
varying lowp vec4 col; // color
varying vec3 normal; // normal
varying vec3 pos_world; // position
void main() {
col = colUniform;
gl_Position = matrix * vec4(posAttr,1);
normal = (matrix * vec4(normAttr,0)).xyz;
pos_world = posAttr;
}
)"

Definition at line 38 of file Graphics3D.cpp.