Ver código fonte

Use mix now in shader examples, also replaced a bunch of tabs with spaces to make it consistent

naelstrof 7 anos atrás
pai
commit
fa10482ead

+ 1
- 1
CMakeLists.txt Ver arquivo

@@ -69,7 +69,7 @@ include_directories(${X11_INCLUDE_DIR}
69 69
                     ${OPENGL_INCLUDE_DIR})
70 70
 
71 71
 target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
72
-				      ${CMAKE_THREAD_LIBS_INIT} 
72
+                                      ${CMAKE_THREAD_LIBS_INIT} 
73 73
                                       ${GLM_LIBRARIES}
74 74
                                       ${OPENGL_LIBRARIES}
75 75
                                       ${GLX_LIBRARY}

+ 2
- 1
shaderexamples/boxzoom.frag Ver arquivo

@@ -43,7 +43,8 @@ void main()
43 43
         // The desktop texture is upside-down due to X11
44 44
         vec2 zoomedUVFlipped = vec2( zoomedUV.x, -zoomedUV.y );
45 45
         // Then change the color to the desktop color to draw, then add on our rectangle on top.
46
-        color = texture2D( desktop, zoomedUVFlipped ) + texture2D( texture, zoomedUV );
46
+        vec4 rectColor = texture2D( texture, zoomedUV );
47
+        color = mix( texture2D( desktop, zoomedUVFlipped ), rectColor, rectColor.a );
47 48
       }
48 49
     // Then check if we're in our border size.
49 50
     } else if( uvCoord.x <= mpos.x+boxOffset.x+boxSize.x+borderSize.x &&

+ 1
- 1
shaderexamples/crosshair.frag Ver arquivo

@@ -34,7 +34,7 @@ void main()
34 34
             vec2 upsideDown = c/magnifyNerf*t*t+b;
35 35
 
36 36
             vec4 textureColor = texture2D( texture, upsideDown );
37
-            color = texture2D( desktop, vec2(upsideDown.x, -upsideDown.y) )*(1-textureColor.a) + textureColor;
37
+            color = mix( texture2D( desktop, vec2(upsideDown.x, -upsideDown.y) ), textureColor, textureColor.a );
38 38
         }
39 39
     } else if ( dr < circleSize+borderSize ) {
40 40
         color = borderColor;

+ 1
- 1
src/framebuffer.cpp Ver arquivo

@@ -105,7 +105,7 @@ void slop::Framebuffer::draw(glm::vec2 mouse, float time, glm::vec4 color){
105 105
     glActiveTexture(GL_TEXTURE0);
106 106
     glBindTexture( GL_TEXTURE_2D, image );
107 107
     if ( shader->hasParameter( "desktop" ) ) {
108
-		shader->setParameter( "desktop", 1 );
108
+        shader->setParameter( "desktop", 1 );
109 109
         glActiveTexture(GL_TEXTURE0 + 1);
110 110
         glBindTexture( GL_TEXTURE_2D, desktopImage );
111 111
     }

+ 5
- 5
src/mouse.cpp Ver arquivo

@@ -66,27 +66,27 @@ slop::Mouse::Mouse(X11* x11, int nodecorations, Window ignoreWindow ) {
66 66
 }
67 67
 
68 68
 slop::Mouse::~Mouse() {
69
-	XUngrabPointer( x11->display, CurrentTime );
69
+    XUngrabPointer( x11->display, CurrentTime );
70 70
 }
71 71
 
72 72
 void slop::Mouse::update() {
73 73
     XEvent event;
74 74
     while ( XCheckTypedEvent( x11->display, ButtonPress, &event ) ) {
75 75
 		setButton( event.xbutton.button, 1 );
76
-	}
76
+    }
77 77
     bool findNewWindow = false;
78 78
     while ( XCheckTypedEvent( x11->display, MotionNotify, &event ) ) {
79 79
         findNewWindow = true;
80
-	}
80
+    }
81 81
     if ( findNewWindow ) {
82 82
         hoverWindow = findWindow(x11->root);
83 83
     }
84 84
     while ( XCheckTypedEvent( x11->display, ButtonRelease, &event ) ) {
85 85
 		setButton( event.xbutton.button, 0 );
86
-	}
86
+    }
87 87
     while ( XCheckTypedEvent( x11->display, EnterNotify, &event ) ) {
88 88
         hoverWindow = event.xcrossing.window;
89
-	}
89
+    }
90 90
 }
91 91
 
92 92
 Window slop::Mouse::findWindow( Window foo ) {

+ 2
- 2
src/mouse.hpp Ver arquivo

@@ -40,8 +40,8 @@ private:
40 40
     int nodecorations;
41 41
     Window ignoreWindow;
42 42
 public:
43
-	Window hoverWindow;
44
-	void update();
43
+    Window hoverWindow;
44
+    void update();
45 45
     Mouse( X11* x11, int nodecorations, Window ignoreWindow );
46 46
     ~Mouse();
47 47
     void setCursor( int cursor );

+ 14
- 14
src/slopstates.cpp Ver arquivo

@@ -115,20 +115,20 @@ void slop::SlopStartDrag::update( SlopMemory& memory, double dt ) {
115 115
     }
116 116
     if ( keyboard ) {
117 117
         int arrows[2];
118
-        arrows[0] = keyboard->getKey(XK_Down)-keyboard->getKey(XK_Up);		
119
-        arrows[1] = keyboard->getKey(XK_Right)-keyboard->getKey(XK_Left);		
120
-        if ( arrows[0] || arrows[1] ) {		
121
-            if ( repeatTimer == 0 || repeatTimer > .4 ) {		
122
-                startPoint.y += arrows[0]*multiplier;		
123
-                startPoint.x += arrows[1]*multiplier;		
124
-            }		
125
-            if ( repeatTimer > 1 ) {		
126
-                multiplier += dt*2;		
127
-            }		
128
-            repeatTimer += dt;		
129
-        } else {		
130
-            repeatTimer = 0;		
131
-            multiplier = 1;		
118
+        arrows[0] = keyboard->getKey(XK_Down)-keyboard->getKey(XK_Up);
119
+        arrows[1] = keyboard->getKey(XK_Right)-keyboard->getKey(XK_Left);
120
+        if ( arrows[0] || arrows[1] ) {
121
+            if ( repeatTimer == 0 || repeatTimer > .4 ) {
122
+                startPoint.y += arrows[0]*multiplier;
123
+                startPoint.x += arrows[1]*multiplier;
124
+            }
125
+            if ( repeatTimer > 1 ) {
126
+                multiplier += dt*2;
127
+            }
128
+            repeatTimer += dt;
129
+        } else {
130
+            repeatTimer = 0;
131
+            multiplier = 1;
132 132
         }
133 133
     }
134 134
 }

+ 1
- 1
src/xshaperectangle.cpp Ver arquivo

@@ -55,7 +55,7 @@ void slop::XShapeRectangle::createWindow() {
55 55
     if ( createdWindow ) {
56 56
         return;
57 57
     }
58
-	XMapWindow( x11->display, window );
58
+    XMapWindow( x11->display, window );
59 59
     createdWindow = true;
60 60
 }
61 61