src/gl/axesprogram.cpp

changeset 74
6b51e7b7c459
parent 70
f21b800b02a4
child 102
9f435f66bd0c
child 118
8e1c9f18ae15
equal deleted inserted replaced
73:97df974b5ed5 74:6b51e7b7c459
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include "axesprogram.h" 19 #include "axesprogram.h"
20 20
21 // Based on https://stackoverflow.com/q/30842755
22 const char vertexShaderSource[] = R"( 21 const char vertexShaderSource[] = R"(
23 #version 330 core 22 #version 330 core
24 23
25 layout (location = 0) in vec3 in_position; 24 layout (location = 0) in vec3 in_position;
26 layout (location = 1) in vec3 in_color; 25 layout (location = 1) in vec3 in_color;
55 glm::vec3 position; 54 glm::vec3 position;
56 glm::vec3 color; 55 glm::vec3 color;
57 }; 56 };
58 } 57 }
59 58
60 static AxesVertex data[] = 59 static const AxesVertex data[] =
61 { 60 {
62 AxesVertex{{-10000, 0, 0}, {1, 0, 0}},
63 AxesVertex{{10000, 0, 0}, {1, 0, 0}}, 61 AxesVertex{{10000, 0, 0}, {1, 0, 0}},
64 AxesVertex{{0, -10000, 0}, {0, 1, 0}}, 62 AxesVertex{{0, 0, 0}, {1, 0, 0}},
63 AxesVertex{{-10000, 0, 0}, {0.5, 0, 0}},
64 AxesVertex{{0, 0, 0}, {0.5, 0, 0}},
65 AxesVertex{{0, 10000, 0}, {0, 1, 0}}, 65 AxesVertex{{0, 10000, 0}, {0, 1, 0}},
66 AxesVertex{{0, 0, -10000}, {0, 0, 1}}, 66 AxesVertex{{0, 0, 0}, {0, 1, 0}},
67 AxesVertex{{0, -10000, 0}, {0, 0.5, 0}},
68 AxesVertex{{0, 0, 0}, {0, 0.5, 0}},
67 AxesVertex{{0, 0, 10000}, {0, 0, 1}}, 69 AxesVertex{{0, 0, 10000}, {0, 0, 1}},
70 AxesVertex{{0, 0, 0}, {0, 0, 1}},
71 AxesVertex{{0, 0, -10000}, {0, 0, 0.5}},
72 AxesVertex{{0, 0, 0}, {0, 0, 0.5}},
68 }; 73 };
69 74
70 const char* AxesProgram::vertexShaderSource() const 75 const char* AxesProgram::vertexShaderSource() const
71 { 76 {
72 return ::vertexShaderSource; 77 return ::vertexShaderSource;

mercurial