Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GLProgram: random used as a flag. Just to make code tidier

  • Loading branch information...
commit 3f9ed3ee58de1f74633ab810e2a75b3a53d93450 1 parent 610f845
@ricardoquesada ricardoquesada authored
View
2  CHANGELOG
@@ -36,7 +36,7 @@ version 2.1-rc0 28-Jan-2013
. [FIX] Actions, Animations, Camera, Director, Menu, Node, Particles, Parallax, Sprite, SpriteBatch, Texture, TextureAtlas, Transitions: All ivars use _ as prefix, not as suffix
. [FIX] CocosDenshion: Tests moved to tests directory. Merged CocosDenshion and CocosDenshionExtras directories
. [FIX] Configuration: Can be initialized before an OpenGL context is created (issue #1450)
-. [FIX] Director: replaced length with lenght
+. [FIX] Director: replaced lenght with length
Fixed 2 memory leaks in createStatsLabel
Frees DrawingPrimitives resources (issue #1456)
The 1st dt after startAnimation will be 0 (issue #1435)
View
1  cocos2d/CCGLProgram.h
@@ -101,6 +101,7 @@ struct _hashUniformEntry;
unsigned int usesTime:1;
unsigned int usesMVP:1;
unsigned int usesMV:1;
+ unsigned int usesRandom:1;
} _flags;
}
View
11 cocos2d/CCGLProgram.m
@@ -206,6 +206,10 @@ -(void) updateUniforms
_uniforms[kCCUniformSinTime] = glGetUniformLocation(_program, kCCUniformSinTime_s);
_uniforms[kCCUniformCosTime] = glGetUniformLocation(_program, kCCUniformCosTime_s);
+ _uniforms[kCCUniformRandom01] = glGetUniformLocation(_program, kCCUniformRandom01_s);
+
+ _uniforms[kCCUniformSampler] = glGetUniformLocation(_program, kCCUniformSampler_s);
+
_flags.usesMVP = _uniforms[kCCUniformMVPMatrix] != -1;
_flags.usesMV = (_uniforms[kCCUniformMVMatrix] != -1 && _uniforms[kCCUniformPMatrix] != -1 );
_flags.usesTime = (
@@ -213,10 +217,8 @@ -(void) updateUniforms
_uniforms[kCCUniformSinTime] != -1 ||
_uniforms[kCCUniformCosTime] != -1
);
+ _flags.usesRandom = _uniforms[kCCUniformRandom01] != -1;
- _uniforms[kCCUniformRandom01] = glGetUniformLocation(_program, kCCUniformRandom01_s);
-
- _uniforms[kCCUniformSampler] = glGetUniformLocation(_program, kCCUniformSampler_s);
[self use];
@@ -453,9 +455,8 @@ -(void) setUniformsForBuiltins
[self setUniformLocation:_uniforms[kCCUniformCosTime] withF1:cosf(time/8.0) f2:cosf(time/4.0) f3:cosf(time/2.0) f4:cosf(time)];
}
- if(_uniforms[kCCUniformRandom01] != -1){
+ if(_flags.usesRandom)
[self setUniformLocation:_uniforms[kCCUniformRandom01] withF1:CCRANDOM_0_1() f2:CCRANDOM_0_1() f3:CCRANDOM_0_1() f4:CCRANDOM_0_1()];
- }
}
-(void)setUniformForModelViewProjectionMatrix;
View
8 tests/JSTests/AppController.mm
@@ -37,11 +37,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// Create an CCGLView with a RGB8 color buffer, and a depth buffer of 24-bits
CCGLView *glView = [CCGLView viewWithFrame:[window_ bounds]
pixelFormat:kEAGLColorFormatRGBA8
- depthFormat:0 //GL_DEPTH_COMPONENT24_OES
+ depthFormat:GL_DEPTH_COMPONENT24_OES
preserveBackbuffer:YES
sharegroup:nil
multiSampling:NO
- numberOfSamples:4];
+ numberOfSamples:0];
director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
@@ -62,8 +62,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[director_ setDelegate:self];
// 2D projection
-// [director_ setProjection:kCCDirectorProjection2D];
- [director_ setProjection:kCCDirectorProjection3D];
+ [director_ setProjection:kCCDirectorProjection2D];
+// [director_ setProjection:kCCDirectorProjection3D];
// Enables High Res mode (Retina Display) for CocosDragon
2  tests/cocos2d-js-tests
@@ -1 +1 @@
-Subproject commit 24bc8b236ea1d796e9b965e264f3055b7a1beced
+Subproject commit a069d2c446b6034d761e949115aca75da0659a84
Please sign in to comment.
Something went wrong with that request. Please try again.