Compare commits

..

No commits in common. "94898b4d9d3d6a05d534a7fb33a16893b81d3d03" and "166c5c5ff8cefea8310001ce92b0d6561d664224" have entirely different histories.

5 changed files with 49 additions and 484 deletions

View file

@ -1,24 +1,11 @@
#version 330 core #version 330 core
uniform vec3 scale; out vec4 FragColor;
in vec3 vPos; uniform vec3 color;
out vec4 fColor; // Main
void main() { void main() {
// float thickness = 0.2; FragColor = vec4(color, 1);
// vec3 distanceFromEdge = abs(scale * vPos) - scale / 2;
// vec3 vec = distanceFromEdge + vec3(thickness / 2);
// vec3 signs = max(sign(vec), 0);
// float negatives = signs.x + signs.y + signs.z;
// if (negatives >= 2)
// fColor = vec4(0.204, 0.584, 0.922, 1);
// else
// fColor = vec4(0);
fColor = vec4(0.204, 0.584, 0.922, 1);
} }

View file

@ -1,21 +1,15 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal; layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
out vec3 vPos; out vec3 vPos;
out vec3 vNormal;
uniform mat4 model; uniform mat4 model;
uniform mat4 view; uniform mat4 view;
uniform mat4 projection; uniform mat4 projection;
uniform vec3 scale;
void main() void main()
{ {
float thickness = 0.4; gl_Position = projection * view * model * vec4(aPos, 1.0);
vec3 distFromEdge = sign(aPos) * 0.5 - aPos;
vec3 tVec = (scale * sign(aPos) * 0.5 - distFromEdge * thickness) / scale;
gl_Position = projection * view * model * vec4(tVec, 1);
vPos = aPos;
} }

View file

@ -1151,454 +1151,14 @@ static float ARROW_VERTICES[] = {
}; };
static float OUTLINE_VERTICES[] = {
// positions // normals // texture coords
-0.5, 0.5, -0.25, -1.0, -0.0, -0.0, 0.625, 0.1875,
-0.5, 0.25, -0.5, -1.0, -0.0, -0.0, 0.5625, 0.25,
-0.5, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.1875,
0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.4375,
0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.5,
0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.4375,
0.5, 0.5, 0.25, 1.0, -0.0, -0.0, 0.625, 0.6875,
0.5, 0.25, 0.5, 1.0, -0.0, -0.0, 0.5625, 0.75,
0.5, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.6875,
-0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.9375,
-0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 1.0,
-0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.9375,
0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.375, 0.6875,
0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.3125, 0.75,
0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.3125, 0.6875,
-0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.875, 0.6875,
-0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.8125, 0.75,
-0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.8125, 0.6875,
-0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.8125, 0.6875,
0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.6875, 0.75,
0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.6875, 0.6875,
-0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.1875, 0.6875,
-0.5, -0.5, 0.5, -0.0, -1.0, -0.0, 0.125, 0.75,
-0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.125, 0.6875,
0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.8125,
-0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.9375,
0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.8125,
-0.5, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.25,
-0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.3125,
-0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.25,
0.5, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.75,
0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.8125,
0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.75,
0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.6875, 0.6875,
0.5, 0.5, 0.5, -0.0, 1.0, -0.0, 0.625, 0.75,
0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.625, 0.6875,
0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.3125, 0.6875,
-0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.1875, 0.75,
-0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.1875, 0.6875,
-0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.3125,
0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.4375,
-0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.3125,
0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.3125, 0.5,
-0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.1875, 0.5625,
-0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.1875, 0.5,
0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.6875, 0.5,
0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.625, 0.5625,
0.5, 0.5, -0.5, -0.0, 1.0, -0.0, 0.625, 0.5,
-0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.1875, 0.5,
-0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.125, 0.5625,
-0.5, -0.5, -0.5, -0.0, -1.0, -0.0, 0.125, 0.5,
-0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.8125, 0.5,
0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.6875, 0.5625,
0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.6875, 0.5,
-0.5, 0.5, -0.5, -0.0, 1.0, -0.0, 0.875, 0.5,
-0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.8125, 0.5625,
-0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.8125, 0.5,
0.5, -0.5, -0.5, -0.0, -1.0, -0.0, 0.375, 0.5,
0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.3125, 0.5625,
0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.3125, 0.5,
0.5, 0.5, -0.5, 1.0, -0.0, -0.0, 0.625, 0.5,
0.5, 0.25, -0.25, 1.0, -0.0, -0.0, 0.5625, 0.5625,
0.5, 0.25, -0.5, 1.0, -0.0, -0.0, 0.5625, 0.5,
-0.5, 0.5, 0.25, -1.0, -0.0, -0.0, 0.625, 0.0625,
-0.5, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.1875,
-0.5, 0.25, 0.25, -1.0, -0.0, -0.0, 0.5625, 0.0625,
-0.5, 0.5, 0.5, -1.0, -0.0, -0.0, 0.625, 0.0,
-0.5, 0.25, 0.25, -1.0, -0.0, -0.0, 0.5625, 0.0625,
-0.5, 0.25, 0.5, -1.0, -0.0, -0.0, 0.5625, 0.0,
-0.25, -0.5, 0.25, -0.0, -0.0, -1.0, 0.1875, 0.6875,
0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.3125, 0.6875,
0.25, -0.5, 0.25, -0.0, -0.0, -1.0, 0.3125, 0.6875,
0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.6875, 0.5625,
0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.625, 0.6875,
0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.625, 0.5625,
-0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.1875, 0.5625,
-0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.125, 0.6875,
-0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.125, 0.5625,
-0.25, 0.5, 0.25, 1.0, -0.0, -0.0, 0.8125, 0.6875,
-0.25, 0.25, -0.25, 1.0, -0.0, -0.0, 0.8125, 0.5625,
-0.25, 0.5, -0.25, 1.0, -0.0, -0.0, 0.8125, 0.5625,
-0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.875, 0.5625,
-0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.8125, 0.6875,
-0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.8125, 0.5625,
0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.375, 0.5625,
0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.3125, 0.6875,
0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.3125, 0.5625,
0.5, 0.5, -0.25, 1.0, -0.0, -0.0, 0.625, 0.5625,
0.5, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.6875,
0.5, 0.25, -0.25, 1.0, -0.0, -0.0, 0.5625, 0.5625,
0.5, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.5625,
0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.5625,
0.5, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.5625,
-0.5, 0.25, 0.5, -1.0, -0.0, -0.0, 0.5625, 0.0,
-0.5, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.0625,
-0.5, -0.25, 0.5, -1.0, -0.0, -0.0, 0.4375, 0.0,
-0.5, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.0625,
-0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.0625,
-0.5, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.0625,
0.5, 0.25, -0.5, 1.0, -0.0, -0.0, 0.5625, 0.5,
0.5, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.5625,
0.5, -0.25, -0.5, 1.0, -0.0, -0.0, 0.4375, 0.5,
0.25, -0.25, -0.5, -1.0, -0.0, -0.0, 0.4375, 0.4375,
0.25, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.4375,
0.25, 0.25, -0.5, -1.0, -0.0, -0.0, 0.5625, 0.4375,
0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.75,
0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.8125,
0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.75,
-0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.25,
-0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.3125,
-0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.25,
0.25, 0.25, 0.5, -1.0, -0.0, -0.0, 0.5625, 0.8125,
0.25, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.8125,
0.25, -0.25, 0.5, -1.0, -0.0, -0.0, 0.4375, 0.8125,
-0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.9375,
-0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 1.0,
-0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.9375,
0.5, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.6875,
0.5, -0.25, 0.5, 1.0, -0.0, -0.0, 0.4375, 0.75,
0.5, -0.25, 0.25, 1.0, -0.0, -0.0, 0.4375, 0.6875,
0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.4375,
0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.5,
0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.4375,
-0.5, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.1875,
-0.5, -0.25, -0.5, -1.0, -0.0, -0.0, 0.4375, 0.25,
-0.5, -0.25, -0.25, -1.0, -0.0, -0.0, 0.4375, 0.1875,
-0.5, -0.25, -0.25, -1.0, -0.0, -0.0, 0.4375, 0.1875,
-0.5, -0.5, -0.5, -1.0, -0.0, -0.0, 0.375, 0.25,
-0.5, -0.5, -0.25, -1.0, -0.0, -0.0, 0.375, 0.1875,
0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.4375,
0.5, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.5,
0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.4375,
0.5, -0.25, 0.25, 1.0, -0.0, -0.0, 0.4375, 0.6875,
0.5, -0.5, 0.5, 1.0, -0.0, -0.0, 0.375, 0.75,
0.5, -0.5, 0.25, 1.0, -0.0, -0.0, 0.375, 0.6875,
-0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.9375,
-0.5, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 1.0,
-0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.9375,
0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.8125,
-0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.9375,
0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.8125,
-0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.25,
-0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.3125,
-0.5, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.25,
0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.75,
0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.8125,
0.5, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.75,
-0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.3125,
0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.4375,
-0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.3125,
0.5, -0.25, -0.5, 1.0, -0.0, -0.0, 0.4375, 0.5,
0.5, -0.5, -0.25, 1.0, -0.0, -0.0, 0.375, 0.5625,
0.5, -0.5, -0.5, 1.0, -0.0, -0.0, 0.375, 0.5,
-0.5, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.0625,
-0.5, -0.5, -0.25, -1.0, -0.0, -0.0, 0.375, 0.1875,
-0.5, -0.5, 0.25, -1.0, -0.0, -0.0, 0.375, 0.0625,
-0.5, -0.25, 0.5, -1.0, -0.0, -0.0, 0.4375, 0.0,
-0.5, -0.5, 0.25, -1.0, -0.0, -0.0, 0.375, 0.0625,
-0.5, -0.5, 0.5, -1.0, -0.0, -0.0, 0.375, 0.0,
0.5, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.5625,
0.5, -0.5, 0.25, 1.0, -0.0, -0.0, 0.375, 0.6875,
0.5, -0.5, -0.25, 1.0, -0.0, -0.0, 0.375, 0.5625,
0.25, -0.25, 0.5, -0.0, 1.0, -0.0, 0.4375, 0.8125,
-0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.9375,
-0.25, -0.25, 0.5, -0.0, 1.0, -0.0, 0.4375, 0.9375,
-0.25, -0.25, 0.5, 1.0, -0.0, -0.0, 0.4375, 0.9375,
-0.25, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.9375,
-0.25, 0.25, 0.5, 1.0, -0.0, -0.0, 0.5625, 0.9375,
-0.25, 0.25, 0.5, -0.0, -1.0, -0.0, 0.5625, 0.9375,
0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.8125,
0.25, 0.25, 0.5, -0.0, -1.0, -0.0, 0.5625, 0.8125,
0.5, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.5625,
0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.6875,
0.5, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.6875,
0.5, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.6875,
0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.5625,
0.5, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.5625,
0.5, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.6875,
0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.6875,
0.5, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.6875,
-0.25, 0.25, -0.5, 1.0, -0.0, -0.0, 0.5625, 0.3125,
-0.25, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.3125,
-0.25, -0.25, -0.5, 1.0, -0.0, -0.0, 0.4375, 0.3125,
0.25, 0.25, -0.5, -0.0, -1.0, -0.0, 0.5625, 0.4375,
-0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.3125,
-0.25, 0.25, -0.5, -0.0, -1.0, -0.0, 0.5625, 0.3125,
-0.25, -0.25, -0.5, -0.0, 1.0, -0.0, 0.4375, 0.3125,
0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.4375,
0.25, -0.25, -0.5, -0.0, 1.0, -0.0, 0.4375, 0.4375,
0.25, 0.5, 0.25, -0.0, -0.0, -1.0, 0.6875, 0.6875,
-0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.8125, 0.6875,
-0.25, 0.5, 0.25, -0.0, -0.0, -1.0, 0.8125, 0.6875,
-0.25, 0.5, -0.25, -0.0, -0.0, 1.0, 0.8125, 0.5625,
0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.6875, 0.5625,
0.25, 0.5, -0.25, -0.0, -0.0, 1.0, 0.6875, 0.5625,
0.25, 0.5, -0.25, -1.0, -0.0, -0.0, 0.6875, 0.5625,
0.25, 0.25, 0.25, -1.0, -0.0, -0.0, 0.6875, 0.6875,
0.25, 0.5, 0.25, -1.0, -0.0, -0.0, 0.6875, 0.6875,
0.25, -0.5, 0.25, -1.0, -0.0, -0.0, 0.3125, 0.6875,
0.25, -0.25, -0.25, -1.0, -0.0, -0.0, 0.3125, 0.5625,
0.25, -0.5, -0.25, -1.0, -0.0, -0.0, 0.3125, 0.5625,
0.25, -0.5, -0.25, -0.0, -0.0, 1.0, 0.3125, 0.5625,
-0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.1875, 0.5625,
-0.25, -0.5, -0.25, -0.0, -0.0, 1.0, 0.1875, 0.5625,
-0.25, -0.5, -0.25, 1.0, -0.0, -0.0, 0.1875, 0.5625,
-0.25, -0.25, 0.25, 1.0, -0.0, -0.0, 0.1875, 0.6875,
-0.25, -0.5, 0.25, 1.0, -0.0, -0.0, 0.1875, 0.6875,
-0.5, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.1875,
-0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.0625,
-0.5, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.0625,
-0.5, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.0625,
-0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.1875,
-0.5, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.1875,
-0.5, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.1875,
-0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.1875,
-0.5, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.1875,
-0.5, 0.5, -0.25, -1.0, -0.0, -0.0, 0.625, 0.1875,
-0.5, 0.5, -0.5, -1.0, -0.0, -0.0, 0.625, 0.25,
-0.5, 0.25, -0.5, -1.0, -0.0, -0.0, 0.5625, 0.25,
0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.4375,
0.5, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.5,
0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.5,
0.5, 0.5, 0.25, 1.0, -0.0, -0.0, 0.625, 0.6875,
0.5, 0.5, 0.5, 1.0, -0.0, -0.0, 0.625, 0.75,
0.5, 0.25, 0.5, 1.0, -0.0, -0.0, 0.5625, 0.75,
-0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.9375,
-0.5, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 1.0,
-0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 1.0,
0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.375, 0.6875,
0.5, -0.5, 0.5, -0.0, -1.0, -0.0, 0.375, 0.75,
0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.3125, 0.75,
-0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.875, 0.6875,
-0.5, 0.5, 0.5, -0.0, 1.0, -0.0, 0.875, 0.75,
-0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.8125, 0.75,
-0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.8125, 0.6875,
-0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.8125, 0.75,
0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.6875, 0.75,
-0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.1875, 0.6875,
-0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.1875, 0.75,
-0.5, -0.5, 0.5, -0.0, -1.0, -0.0, 0.125, 0.75,
0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.8125,
-0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.9375,
-0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.9375,
-0.5, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.25,
-0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.3125,
-0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.3125,
0.5, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.75,
0.25, 0.5, 0.5, -0.0, -0.0, 1.0, 0.625, 0.8125,
0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.8125,
0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.6875, 0.6875,
0.25, 0.5, 0.5, -0.0, 1.0, -0.0, 0.6875, 0.75,
0.5, 0.5, 0.5, -0.0, 1.0, -0.0, 0.625, 0.75,
0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.3125, 0.6875,
0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.3125, 0.75,
-0.25, -0.5, 0.5, -0.0, -1.0, -0.0, 0.1875, 0.75,
-0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.3125,
0.25, 0.5, -0.5, -0.0, -0.0, -1.0, 0.625, 0.4375,
0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.4375,
0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.3125, 0.5,
0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.3125, 0.5625,
-0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.1875, 0.5625,
0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.6875, 0.5,
0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.6875, 0.5625,
0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.625, 0.5625,
-0.25, -0.5, -0.5, -0.0, -1.0, -0.0, 0.1875, 0.5,
-0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.1875, 0.5625,
-0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.125, 0.5625,
-0.25, 0.5, -0.5, -0.0, 1.0, -0.0, 0.8125, 0.5,
-0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.8125, 0.5625,
0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.6875, 0.5625,
-0.5, 0.5, -0.5, -0.0, 1.0, -0.0, 0.875, 0.5,
-0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.875, 0.5625,
-0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.8125, 0.5625,
0.5, -0.5, -0.5, -0.0, -1.0, -0.0, 0.375, 0.5,
0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.375, 0.5625,
0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.3125, 0.5625,
0.5, 0.5, -0.5, 1.0, -0.0, -0.0, 0.625, 0.5,
0.5, 0.5, -0.25, 1.0, -0.0, -0.0, 0.625, 0.5625,
0.5, 0.25, -0.25, 1.0, -0.0, -0.0, 0.5625, 0.5625,
-0.5, 0.5, 0.25, -1.0, -0.0, -0.0, 0.625, 0.0625,
-0.5, 0.5, -0.25, -1.0, -0.0, -0.0, 0.625, 0.1875,
-0.5, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.1875,
-0.5, 0.5, 0.5, -1.0, -0.0, -0.0, 0.625, 0.0,
-0.5, 0.5, 0.25, -1.0, -0.0, -0.0, 0.625, 0.0625,
-0.5, 0.25, 0.25, -1.0, -0.0, -0.0, 0.5625, 0.0625,
-0.25, -0.5, 0.25, -0.0, -0.0, -1.0, 0.1875, 0.6875,
-0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.1875, 0.6875,
0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.3125, 0.6875,
0.25, 0.5, -0.25, -0.0, 1.0, -0.0, 0.6875, 0.5625,
0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.6875, 0.6875,
0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.625, 0.6875,
-0.25, -0.5, -0.25, -0.0, -1.0, -0.0, 0.1875, 0.5625,
-0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.1875, 0.6875,
-0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.125, 0.6875,
-0.25, 0.5, 0.25, 1.0, -0.0, -0.0, 0.8125, 0.6875,
-0.25, 0.25, 0.25, 1.0, -0.0, -0.0, 0.8125, 0.6875,
-0.25, 0.25, -0.25, 1.0, -0.0, -0.0, 0.8125, 0.5625,
-0.5, 0.5, -0.25, -0.0, 1.0, -0.0, 0.875, 0.5625,
-0.5, 0.5, 0.25, -0.0, 1.0, -0.0, 0.875, 0.6875,
-0.25, 0.5, 0.25, -0.0, 1.0, -0.0, 0.8125, 0.6875,
0.5, -0.5, -0.25, -0.0, -1.0, -0.0, 0.375, 0.5625,
0.5, -0.5, 0.25, -0.0, -1.0, -0.0, 0.375, 0.6875,
0.25, -0.5, 0.25, -0.0, -1.0, -0.0, 0.3125, 0.6875,
0.5, 0.5, -0.25, 1.0, -0.0, -0.0, 0.625, 0.5625,
0.5, 0.5, 0.25, 1.0, -0.0, -0.0, 0.625, 0.6875,
0.5, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.6875,
0.5, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.5625,
0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.5625,
0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.5625,
-0.5, 0.25, 0.5, -1.0, -0.0, -0.0, 0.5625, 0.0,
-0.5, 0.25, 0.25, -1.0, -0.0, -0.0, 0.5625, 0.0625,
-0.5, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.0625,
-0.5, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.0625,
-0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.0625,
-0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.0625,
0.5, 0.25, -0.5, 1.0, -0.0, -0.0, 0.5625, 0.5,
0.5, 0.25, -0.25, 1.0, -0.0, -0.0, 0.5625, 0.5625,
0.5, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.5625,
0.25, -0.25, -0.5, -1.0, -0.0, -0.0, 0.4375, 0.4375,
0.25, -0.25, -0.25, -1.0, -0.0, -0.0, 0.4375, 0.4375,
0.25, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.4375,
0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.75,
0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.8125,
0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.8125,
-0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.25,
-0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.3125,
-0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.3125,
0.25, 0.25, 0.5, -1.0, -0.0, -0.0, 0.5625, 0.8125,
0.25, 0.25, 0.25, -1.0, -0.0, -0.0, 0.5625, 0.8125,
0.25, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.8125,
-0.25, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 0.9375,
-0.5, 0.25, 0.5, -0.0, -0.0, 1.0, 0.5625, 1.0,
-0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 1.0,
0.5, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.6875,
0.5, 0.25, 0.5, 1.0, -0.0, -0.0, 0.5625, 0.75,
0.5, -0.25, 0.5, 1.0, -0.0, -0.0, 0.4375, 0.75,
0.25, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.4375,
0.5, 0.25, -0.5, -0.0, -0.0, -1.0, 0.5625, 0.5,
0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.5,
-0.5, 0.25, -0.25, -1.0, -0.0, -0.0, 0.5625, 0.1875,
-0.5, 0.25, -0.5, -1.0, -0.0, -0.0, 0.5625, 0.25,
-0.5, -0.25, -0.5, -1.0, -0.0, -0.0, 0.4375, 0.25,
-0.5, -0.25, -0.25, -1.0, -0.0, -0.0, 0.4375, 0.1875,
-0.5, -0.25, -0.5, -1.0, -0.0, -0.0, 0.4375, 0.25,
-0.5, -0.5, -0.5, -1.0, -0.0, -0.0, 0.375, 0.25,
0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.4375,
0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.5,
0.5, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.5,
0.5, -0.25, 0.25, 1.0, -0.0, -0.0, 0.4375, 0.6875,
0.5, -0.25, 0.5, 1.0, -0.0, -0.0, 0.4375, 0.75,
0.5, -0.5, 0.5, 1.0, -0.0, -0.0, 0.375, 0.75,
-0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.9375,
-0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 1.0,
-0.5, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 1.0,
0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.8125,
-0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.9375,
-0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.9375,
-0.5, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.25,
-0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.3125,
-0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.3125,
0.5, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.75,
0.25, -0.25, 0.5, -0.0, -0.0, 1.0, 0.4375, 0.8125,
0.25, -0.5, 0.5, -0.0, -0.0, 1.0, 0.375, 0.8125,
-0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.3125,
0.25, -0.25, -0.5, -0.0, -0.0, -1.0, 0.4375, 0.4375,
0.25, -0.5, -0.5, -0.0, -0.0, -1.0, 0.375, 0.4375,
0.5, -0.25, -0.5, 1.0, -0.0, -0.0, 0.4375, 0.5,
0.5, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.5625,
0.5, -0.5, -0.25, 1.0, -0.0, -0.0, 0.375, 0.5625,
-0.5, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.0625,
-0.5, -0.25, -0.25, -1.0, -0.0, -0.0, 0.4375, 0.1875,
-0.5, -0.5, -0.25, -1.0, -0.0, -0.0, 0.375, 0.1875,
-0.5, -0.25, 0.5, -1.0, -0.0, -0.0, 0.4375, 0.0,
-0.5, -0.25, 0.25, -1.0, -0.0, -0.0, 0.4375, 0.0625,
-0.5, -0.5, 0.25, -1.0, -0.0, -0.0, 0.375, 0.0625,
0.5, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.5625,
0.5, -0.25, 0.25, 1.0, -0.0, -0.0, 0.4375, 0.6875,
0.5, -0.5, 0.25, 1.0, -0.0, -0.0, 0.375, 0.6875,
0.25, -0.25, 0.5, -0.0, 1.0, -0.0, 0.4375, 0.8125,
0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.8125,
-0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.9375,
-0.25, -0.25, 0.5, 1.0, -0.0, -0.0, 0.4375, 0.9375,
-0.25, -0.25, 0.25, 1.0, -0.0, -0.0, 0.4375, 0.9375,
-0.25, 0.25, 0.25, 1.0, -0.0, -0.0, 0.5625, 0.9375,
-0.25, 0.25, 0.5, -0.0, -1.0, -0.0, 0.5625, 0.9375,
-0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.9375,
0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.8125,
0.5, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.5625,
0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.5625,
0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.6875,
0.5, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.6875,
0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.6875,
0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.5625,
0.5, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.6875,
0.25, -0.25, 0.25, -0.0, -0.0, -1.0, 0.4375, 0.6875,
0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.5625, 0.6875,
-0.25, 0.25, -0.5, 1.0, -0.0, -0.0, 0.5625, 0.3125,
-0.25, 0.25, -0.25, 1.0, -0.0, -0.0, 0.5625, 0.3125,
-0.25, -0.25, -0.25, 1.0, -0.0, -0.0, 0.4375, 0.3125,
0.25, 0.25, -0.5, -0.0, -1.0, -0.0, 0.5625, 0.4375,
0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.4375,
-0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.3125,
-0.25, -0.25, -0.5, -0.0, 1.0, -0.0, 0.4375, 0.3125,
-0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.3125,
0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.4375,
0.25, 0.5, 0.25, -0.0, -0.0, -1.0, 0.6875, 0.6875,
0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.6875, 0.6875,
-0.25, 0.25, 0.25, -0.0, -0.0, -1.0, 0.8125, 0.6875,
-0.25, 0.5, -0.25, -0.0, -0.0, 1.0, 0.8125, 0.5625,
-0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.8125, 0.5625,
0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.6875, 0.5625,
0.25, 0.5, -0.25, -1.0, -0.0, -0.0, 0.6875, 0.5625,
0.25, 0.25, -0.25, -1.0, -0.0, -0.0, 0.6875, 0.5625,
0.25, 0.25, 0.25, -1.0, -0.0, -0.0, 0.6875, 0.6875,
0.25, -0.5, 0.25, -1.0, -0.0, -0.0, 0.3125, 0.6875,
0.25, -0.25, 0.25, -1.0, -0.0, -0.0, 0.3125, 0.6875,
0.25, -0.25, -0.25, -1.0, -0.0, -0.0, 0.3125, 0.5625,
0.25, -0.5, -0.25, -0.0, -0.0, 1.0, 0.3125, 0.5625,
0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.3125, 0.5625,
-0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.1875, 0.5625,
-0.25, -0.5, -0.25, 1.0, -0.0, -0.0, 0.1875, 0.5625,
-0.25, -0.25, -0.25, 1.0, -0.0, -0.0, 0.1875, 0.5625,
-0.25, -0.25, 0.25, 1.0, -0.0, -0.0, 0.1875, 0.6875,
-0.5, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.1875,
-0.25, 0.25, -0.25, -0.0, -1.0, -0.0, 0.5625, 0.1875,
-0.25, 0.25, 0.25, -0.0, -1.0, -0.0, 0.5625, 0.0625,
-0.5, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.0625,
-0.25, -0.25, 0.25, -0.0, 1.0, -0.0, 0.4375, 0.0625,
-0.25, -0.25, -0.25, -0.0, 1.0, -0.0, 0.4375, 0.1875,
-0.5, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.1875,
-0.25, -0.25, -0.25, -0.0, -0.0, 1.0, 0.4375, 0.1875,
-0.25, 0.25, -0.25, -0.0, -0.0, 1.0, 0.5625, 0.1875,
};
Mesh* CUBE_MESH; Mesh* CUBE_MESH;
Mesh* SPHERE_MESH; Mesh* SPHERE_MESH;
Mesh* ARROW_MESH; Mesh* ARROW_MESH;
Mesh* OUTLINE_MESH;
void initMeshes() { void initMeshes() {
CUBE_MESH = new Mesh(sizeof(CUBE_VERTICES) / sizeof(float) / 8, CUBE_VERTICES); CUBE_MESH = new Mesh(sizeof(CUBE_VERTICES) / sizeof(float) / 8, CUBE_VERTICES);
SPHERE_MESH = new Mesh(sizeof(SPHERE_VERTICES) / sizeof(float) / 8, SPHERE_VERTICES); SPHERE_MESH = new Mesh(sizeof(SPHERE_VERTICES) / sizeof(float) / 8, SPHERE_VERTICES);
ARROW_MESH = new Mesh(sizeof(ARROW_VERTICES) / sizeof(float) / 8, ARROW_VERTICES); ARROW_MESH = new Mesh(sizeof(ARROW_VERTICES) / sizeof(float) / 8, ARROW_VERTICES);
OUTLINE_MESH = new Mesh(sizeof(OUTLINE_VERTICES) / sizeof(float) / 8, OUTLINE_VERTICES);
} }
/* Python generator: /* Python generator:

View file

@ -4,6 +4,5 @@
extern Mesh* CUBE_MESH; extern Mesh* CUBE_MESH;
extern Mesh* SPHERE_MESH; extern Mesh* SPHERE_MESH;
extern Mesh* ARROW_MESH; extern Mesh* ARROW_MESH;
extern Mesh* OUTLINE_MESH;
void initMeshes(); void initMeshes();

View file

@ -187,7 +187,6 @@ void renderParts() {
void renderSkyBox() { void renderSkyBox() {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
glCullFace(GL_FRONT); glCullFace(GL_FRONT);
glFrontFace(GL_CW);
skyboxShader->use(); skyboxShader->use();
@ -355,43 +354,69 @@ void renderWireframe() {
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} }
void renderOutlines() { void renderOutline() {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glCullFace(GL_BACK); glCullFace(GL_BACK);
glFrontFace(GL_CCW); glFrontFace(GL_CW);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glLineWidth(10.f);
// Use shader // Use shader
outlineShader->use(); wireframeShader->use();
// view/projection transformations // view/projection transformations
glm::mat4 projection = glm::perspective(glm::radians(45.f), (float)viewportWidth / (float)viewportHeight, 0.1f, 1000.0f); glm::mat4 projection = glm::perspective(glm::radians(45.f), (float)viewportWidth / (float)viewportHeight, 0.1f, 1000.0f);
glm::mat4 view = camera.getLookAt(); glm::mat4 view = camera.getLookAt();
outlineShader->set("projection", projection); wireframeShader->set("projection", projection);
outlineShader->set("view", view); wireframeShader->set("view", view);
// Pass in the camera position // Pass in the camera position
outlineShader->set("viewPos", camera.cameraPos); wireframeShader->set("viewPos", camera.cameraPos);
// outlineShader->set("color", glm::vec3(1.f, 0.f, 0.f)); wireframeShader->set("transparency", 0.5f);
wireframeShader->set("color", glm::vec3(0.204, 0.584, 0.922));
// Sort by nearest // Sort by nearest
for (auto it = gWorkspace()->GetDescendantsStart(); it != gWorkspace()->GetDescendantsEnd(); it++) { for (InstanceRef inst : gWorkspace()->GetChildren()) {
InstanceRef inst = *it; if (inst->GetClass()->className != "Part") continue;
if (inst->GetClass() != &Part::TYPE) continue;
std::shared_ptr<Part> part = std::dynamic_pointer_cast<Part>(inst); std::shared_ptr<Part> part = std::dynamic_pointer_cast<Part>(inst);
if (!part->selected) continue; if (!part->selected) continue;
glm::mat4 model = part->cframe; glm::mat4 model = part->cframe;
model = glm::scale(model, (glm::vec3)part->size + glm::vec3(0.2)); model = glm::scale(model, (glm::vec3)part->size / glm::vec3(2) + glm::vec3(0.001));
outlineShader->set("model", model); wireframeShader->set("model", model);
outlineShader->set("scale", part->size + glm::vec3(0.1)); glm::mat3 normalMatrix = glm::mat3(glm::transpose(glm::inverse(model)));
wireframeShader->set("normalMatrix", normalMatrix);
OUTLINE_MESH->bind(); // CUBE_MESH->bind();
glDrawArrays(GL_TRIANGLES, 0, OUTLINE_MESH->vertexCount); // glDrawArrays(GL_TRIANGLES, 0, CUBE_MESH->vertexCount);
glBegin(GL_LINES);
// Upper face
glVertex3f(-1., 1., -1.); glVertex3f(1., 1., -1.);
glVertex3f(-1., 1., 1.); glVertex3f(1., 1., 1.);
glVertex3f(-1., 1., -1.); glVertex3f(-1., 1., 1.);
glVertex3f(1., 1., -1.); glVertex3f(1., 1., 1.);
// Lower face
glVertex3f(-1., -1., -1.); glVertex3f(1., -1., -1.);
glVertex3f(-1., -1., 1.); glVertex3f(1., -1., 1.);
glVertex3f(-1., -1., -1.); glVertex3f(-1., -1., 1.);
glVertex3f(1., -1., -1.); glVertex3f(1., -1., 1.);
// Connecting vertical lines
glVertex3f(-1., -1., -1.); glVertex3f(-1., 1., -1.);
glVertex3f(1., -1., -1.); glVertex3f(1., 1., -1.);
glVertex3f(-1., -1., 1.); glVertex3f(-1., 1., 1.);
glVertex3f(1., -1., 1.); glVertex3f(1., 1., 1.);
glEnd();
} }
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} }
void render(GLFWwindow* window) { void render(GLFWwindow* window) {
@ -401,7 +426,7 @@ void render(GLFWwindow* window) {
renderSkyBox(); renderSkyBox();
renderHandles(); renderHandles();
renderParts(); renderParts();
renderOutlines(); renderOutline();
if (wireframeRendering) if (wireframeRendering)
renderWireframe(); renderWireframe();
// TODO: Make this a debug flag // TODO: Make this a debug flag