From: Matt Keeter Date: Thu, 13 Mar 2014 13:17:51 +0000 (-0700) Subject: Big reorganization X-Git-Tag: v0.9.0~22 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=44fb4197cad551d54d61d339374b0f60da435117;p=fstl Big reorganization --- diff --git a/gl/gl.qrc b/gl/gl.qrc new file mode 100644 index 0000000..38d525c --- /dev/null +++ b/gl/gl.qrc @@ -0,0 +1,8 @@ + + + mesh.frag + mesh.vert + quad.frag + quad.vert + + diff --git a/gl/mesh.frag b/gl/mesh.frag new file mode 100644 index 0000000..5949025 --- /dev/null +++ b/gl/mesh.frag @@ -0,0 +1,15 @@ +#version 120 + +varying vec3 ec_pos; + +void main() { + vec3 base3 = vec3(0.99, 0.96, 0.89); + vec3 base2 = vec3(0.92, 0.91, 0.83); + vec3 base00 = vec3(0.40, 0.48, 0.51); + vec3 ec_normal = normalize(cross(dFdx(ec_pos), dFdy(ec_pos))); + float a = dot(ec_normal, vec3(0.0, 0.0, 1.0)); + float b = dot(ec_normal, vec3(-0.57, -0.57, 0.57)); + + gl_FragColor = vec4((a*base2 + (1-a)*base00)*0.5 + + (b*base3 + (1-b)*base00)*0.5, 1.0); +} diff --git a/gl/mesh.vert b/gl/mesh.vert new file mode 100644 index 0000000..e60e76b --- /dev/null +++ b/gl/mesh.vert @@ -0,0 +1,13 @@ +#version 120 +attribute vec3 vertex_position; + +uniform mat4 transform_matrix; +uniform mat4 view_matrix; + +varying vec3 ec_pos; + +void main() { + gl_Position = view_matrix*transform_matrix* + vec4(vertex_position, 1.0); + ec_pos = gl_Position.xyz; +} diff --git a/gl/quad.frag b/gl/quad.frag new file mode 100644 index 0000000..1c02e1b --- /dev/null +++ b/gl/quad.frag @@ -0,0 +1,7 @@ +#version 120 + +varying vec3 frag_color; + +void main() { + gl_FragColor = vec4(frag_color, 1.0); +} diff --git a/gl/quad.vert b/gl/quad.vert new file mode 100644 index 0000000..6698297 --- /dev/null +++ b/gl/quad.vert @@ -0,0 +1,10 @@ +#version 120 +attribute vec2 vertex_position; +attribute vec3 vertex_color; + +varying vec3 frag_color; + +void main() { + gl_Position = vec4(vertex_position, 0.9, 1.0); + frag_color = vertex_color; +} diff --git a/qt/fstl.pro b/qt/fstl.pro new file mode 100644 index 0000000..74cab3b --- /dev/null +++ b/qt/fstl.pro @@ -0,0 +1,31 @@ +QT += core gui opengl widgets + +TARGET = fstl +TEMPLATE = app + +SOURCES += \ + ../src/main.cpp\ + ../src/canvas.cpp \ + ../src/mesh.cpp \ + ../src/glmesh.cpp \ + ../src/loader.cpp \ + ../src/window.cpp \ + ../src/backdrop.cpp + +HEADERS += \ + ../src/canvas.h \ + ../src/mesh.h \ + ../src/glmesh.h \ + ../src/loader.h \ + ../src/window.h \ + ../src/backdrop.h + +CONFIG += c++11 + +RESOURCES += \ + qt.qrc \ + ../gl/gl.qrc + +QMAKE_INFO_PLIST = ../misc/Info.plist + +ICON = ../misc/fstl.icns diff --git a/qt/qt.qrc b/qt/qt.qrc new file mode 100644 index 0000000..883ac14 --- /dev/null +++ b/qt/qt.qrc @@ -0,0 +1,5 @@ + + + style.qss + + diff --git a/qt/style.qss b/qt/style.qss new file mode 100644 index 0000000..36eeee4 --- /dev/null +++ b/qt/style.qss @@ -0,0 +1,19 @@ +QWidget { + background-color: #fdf6e3; + color: #839496; +} + +QPushButton { + background-color: #eee8d5; + border-top-width: 5px; + border-bottom-width: 5px; + border-left-width: 30px; + border-right-width: 30px; + border-style: flat; + margin: 0px; + color: #839496; +} + +QPushButton:pressed { + background-color: #ddd7d4; +} diff --git a/src/fstl.pro b/src/fstl.pro deleted file mode 100644 index 8729f8c..0000000 --- a/src/fstl.pro +++ /dev/null @@ -1,30 +0,0 @@ -QT += core gui opengl widgets - -TARGET = fstl -TEMPLATE = app - -SOURCES += \ - main.cpp\ - canvas.cpp \ - mesh.cpp \ - glmesh.cpp \ - loader.cpp \ - window.cpp \ - backdrop.cpp - -HEADERS += \ - canvas.h \ - mesh.h \ - glmesh.h \ - loader.h \ - window.h \ - backdrop.h - -CONFIG += c++11 - -RESOURCES += \ - resources.qrc - -QMAKE_INFO_PLIST = ../misc/Info.plist - -ICON = ../misc/fstl.icns diff --git a/src/gl/mesh.frag b/src/gl/mesh.frag deleted file mode 100644 index 5949025..0000000 --- a/src/gl/mesh.frag +++ /dev/null @@ -1,15 +0,0 @@ -#version 120 - -varying vec3 ec_pos; - -void main() { - vec3 base3 = vec3(0.99, 0.96, 0.89); - vec3 base2 = vec3(0.92, 0.91, 0.83); - vec3 base00 = vec3(0.40, 0.48, 0.51); - vec3 ec_normal = normalize(cross(dFdx(ec_pos), dFdy(ec_pos))); - float a = dot(ec_normal, vec3(0.0, 0.0, 1.0)); - float b = dot(ec_normal, vec3(-0.57, -0.57, 0.57)); - - gl_FragColor = vec4((a*base2 + (1-a)*base00)*0.5 + - (b*base3 + (1-b)*base00)*0.5, 1.0); -} diff --git a/src/gl/mesh.vert b/src/gl/mesh.vert deleted file mode 100644 index e60e76b..0000000 --- a/src/gl/mesh.vert +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 -attribute vec3 vertex_position; - -uniform mat4 transform_matrix; -uniform mat4 view_matrix; - -varying vec3 ec_pos; - -void main() { - gl_Position = view_matrix*transform_matrix* - vec4(vertex_position, 1.0); - ec_pos = gl_Position.xyz; -} diff --git a/src/gl/quad.frag b/src/gl/quad.frag deleted file mode 100644 index 1c02e1b..0000000 --- a/src/gl/quad.frag +++ /dev/null @@ -1,7 +0,0 @@ -#version 120 - -varying vec3 frag_color; - -void main() { - gl_FragColor = vec4(frag_color, 1.0); -} diff --git a/src/gl/quad.vert b/src/gl/quad.vert deleted file mode 100644 index 6698297..0000000 --- a/src/gl/quad.vert +++ /dev/null @@ -1,10 +0,0 @@ -#version 120 -attribute vec2 vertex_position; -attribute vec3 vertex_color; - -varying vec3 frag_color; - -void main() { - gl_Position = vec4(vertex_position, 0.9, 1.0); - frag_color = vertex_color; -} diff --git a/src/resources.qrc b/src/resources.qrc deleted file mode 100644 index a88f834..0000000 --- a/src/resources.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - gl/mesh.frag - gl/mesh.vert - gl/quad.frag - gl/quad.vert - style.qss - - diff --git a/src/style.qss b/src/style.qss deleted file mode 100644 index 36eeee4..0000000 --- a/src/style.qss +++ /dev/null @@ -1,19 +0,0 @@ -QWidget { - background-color: #fdf6e3; - color: #839496; -} - -QPushButton { - background-color: #eee8d5; - border-top-width: 5px; - border-bottom-width: 5px; - border-left-width: 30px; - border-right-width: 30px; - border-style: flat; - margin: 0px; - color: #839496; -} - -QPushButton:pressed { - background-color: #ddd7d4; -} diff --git a/src/window.cpp b/src/window.cpp index 13d3583..f3a7438 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -11,7 +11,7 @@ Window::Window(QWidget *parent) : { setWindowTitle("fstl"); - QFile styleFile( ":/style.qss" ); + QFile styleFile( ":/qt/style.qss" ); styleFile.open( QFile::ReadOnly ); setStyleSheet(styleFile.readAll());