Skip to content
Browse files

Added #ifdef's and a macro to enable the 'next' view texture usage

  • Loading branch information...
1 parent 6546b3d commit 957747791b0f081117afb203589226465c946006 Edward Patel committed Feb 28, 2010
Showing with 21 additions and 2 deletions.
  1. +5 −2 DemoProject/Classes/MainViewController.m
  2. +5 −0 src/DemoTransition.h
  3. +11 −0 src/DemoTransition.m
View
7 DemoProject/Classes/MainViewController.m
@@ -58,15 +58,18 @@ - (IBAction)showInfo {
initWithWindow:self.view
delegate:transition] autorelease];
- // Get texture for the "to" view
+#ifdef ENABLE_PHASE_IN
+
+ // Get texture for the "next" view
[glview prepareTextureTo:controller.view];
- // If you are using an "IN" animation for the "to" view set appropriate
+ // If you are using an "IN" animation for the "next" view set appropriate
// clear color (ie no alpha)
[glview setClearColorRed:0.3
green:0.3
blue:0.3
alpha:1.0];
+#endif
[glview startTransition];
View
5 src/DemoTransition.h
@@ -29,13 +29,18 @@
// falls down off the screen.
//
+// Enable this macro to enable the usage of a transition to bring in the new view
+// #define ENABLE_PHASE_IN
+
@interface DemoTransition : NSObject<EPGLTransitionViewDelegate> {
// 4x6 part, 4 vertex 2 coords
GLfloat vertices[4][6][4][2];
GLfloat texcoords[4][6][4][2];
float yOut[4][6];
float dyOut[4][6];
+#ifdef ENABLE_PHASE_IN
float yIn[4][6];
+#endif
}
@end
View
11 src/DemoTransition.m
@@ -65,10 +65,12 @@ - (void)setupTransition
texcoords[i][j][3][1] = ty;
yOut[i][j] = 0;
dyOut[i][j] = 0;
+#ifdef ENABLE_PHASE_IN
if (j)
yIn[i][j] = yIn[i][j-1]+3.0/6.0+(rand()%200)/500.0;
else
yIn[i][j] = 3.0+3.0/6.0+(rand()%200)/500.0;
+#endif
}
}
@@ -102,8 +104,13 @@ - (BOOL)drawTransitionFrameWithTextureFrom:(GLuint)textureFromView
dyOut[i][j] *= 1.1;
moved++;
}
+#ifdef ENABLE_PHASE_IN
if (yOut[i][j] < 0.5)
allAreGone = NO;
+#else
+ if (yOut[i][j] < 3.0)
+ allAreGone = NO;
+#endif
}
if (moved<4) {
if (rand()%100 > 50) {
@@ -119,6 +126,8 @@ - (BOOL)drawTransitionFrameWithTextureFrom:(GLuint)textureFromView
}
}
+#ifdef ENABLE_PHASE_IN
+
glBindTexture(GL_TEXTURE_2D, textureToView);
if (allAreGone) {
@@ -137,6 +146,8 @@ - (BOOL)drawTransitionFrameWithTextureFrom:(GLuint)textureFromView
}
}
}
+
+#endif
return !allAreGone;
}

0 comments on commit 9577477

Please sign in to comment.
Something went wrong with that request. Please try again.