Skip to content

Commit d399c22

Browse files
author
Thayer J Andrews
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 06d8520 + 9c93263 commit d399c22

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,7 @@
25872587
MACOSX_DEPLOYMENT_TARGET = "$(inherited)";
25882588
OTHER_LDFLAGS = "";
25892589
PRODUCT_NAME = "$(TARGET_NAME)";
2590-
SDKROOT = sbpbeta;
2590+
SDKROOT = sbandroid;
25912591
};
25922592
name = Debug;
25932593
};
@@ -2611,7 +2611,7 @@
26112611
MACOSX_DEPLOYMENT_TARGET = "$(inherited)";
26122612
OTHER_LDFLAGS = "";
26132613
PRODUCT_NAME = "$(TARGET_NAME)";
2614-
SDKROOT = sbpbeta;
2614+
SDKROOT = sbandroid;
26152615
};
26162616
name = Release;
26172617
};
@@ -2783,7 +2783,7 @@
27832783
ONLY_ACTIVE_ARCH = YES;
27842784
OTHER_LDFLAGS = "";
27852785
PRODUCT_NAME = cocos2dAndroid;
2786-
SDKROOT = sbpbeta;
2786+
SDKROOT = sbandroid;
27872787
SKIP_INSTALL = YES;
27882788
};
27892789
name = Debug;
@@ -2828,7 +2828,7 @@
28282828
);
28292829
OTHER_LDFLAGS = "";
28302830
PRODUCT_NAME = cocos2dAndroid;
2831-
SDKROOT = sbpbeta;
2831+
SDKROOT = sbandroid;
28322832
SKIP_INSTALL = YES;
28332833
ZERO_LINK = NO;
28342834
};

cocos2d-ui-tests/tests/CCEffectsTest.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ -(void)setupBlurEffectNodeTest
693693
effectNode.positionType = CCPositionTypeNormalized;
694694
effectNode.position = ccp(0.1, 0.5);
695695
[effectNode addChild:sampleSprite];
696-
CCEffectBlur* effect = [CCEffectBlur effectWithBlurRadius:1.0];
696+
CCEffectBlur* effect = [CCEffectBlur effectWithBlurRadius:4.0];
697697
effectNode.effect = effect;
698698

699699
[self.contentNode addChild:effectNode];
@@ -707,12 +707,11 @@ -(void)setupBlurEffectNodeTest
707707
effectNode2.positionType = CCPositionTypeNormalized;
708708
effectNode2.position = ccp(0.21, 0.5);
709709
[effectNode2 addChild:sampleSprite2];
710-
CCEffectBlur* effect2 = [CCEffectBlur effectWithBlurRadius:7.0];
710+
CCEffectBlur* effect2 = [CCEffectBlur effectWithBlurRadius:10.0];
711711
effectNode2.effect = effect2;
712712

713713
[self.contentNode addChild:effectNode2];
714714

715-
// Tilt shift
716715
CCSprite *sampleSprite3 = [CCSprite spriteWithImageNamed:@"Images/sample_hollow_circle.png"];
717716
sampleSprite3.position = ccp(0.5, 0.5);
718717
sampleSprite3.positionType = CCPositionTypeNormalized;
@@ -728,7 +727,6 @@ -(void)setupBlurEffectNodeTest
728727

729728
[self.contentNode addChild:effectNode3];
730729

731-
// Tilt shift reversed
732730
CCSprite *sampleSprite4 = [CCSprite spriteWithImageNamed:@"Images/sample_hollow_circle.png"];
733731
sampleSprite4.position = ccp(0.5, 0.5);
734732
sampleSprite4.positionType = CCPositionTypeNormalized;
@@ -737,7 +735,7 @@ -(void)setupBlurEffectNodeTest
737735
effectNode4.positionType = CCPositionTypeNormalized;
738736
effectNode4.position = ccp(0.6, 0.5);
739737
[effectNode4 addChild:sampleSprite4];
740-
CCEffectBlur* effect4 = [CCEffectBlur effectWithBlurRadius:7.0];
738+
CCEffectBlur* effect4 = [CCEffectBlur effectWithBlurRadius:12.0];
741739
effectNode4.effect = effect4;
742740

743741
[self.contentNode addChild:effectNode4];

cocos2d-ui/CCBReader/CCBReader.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,9 @@ -(void)readJoint
11821182
[self readPropertyForNode:(CCNode*)properties parent:nil isExtraProp:NO];
11831183
}
11841184

1185+
// TODO: This is a hack because things are happening in the wrong order, needs refactoring!
1186+
[self postDeserialization];
1187+
11851188
CCNode * nodeBodyA = properties[@"bodyA"];
11861189
CCNode * nodeBodyB = properties[@"bodyB"];
11871190

cocos2d/CCEffectBloom.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ -(void)buildFragmentFunctions
136136
{
137137
self.fragmentFunctions = [[NSMutableArray alloc] init];
138138

139-
GLfloat *standardGaussianWeights = calloc(_trueBlurRadius + 1, sizeof(GLfloat));
139+
GLfloat *standardGaussianWeights = calloc(_trueBlurRadius + 2, sizeof(GLfloat));
140140
GLfloat sumOfWeights = 0.0;
141-
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 1; currentGaussianWeightIndex++)
141+
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 2; currentGaussianWeightIndex++)
142142
{
143143
standardGaussianWeights[currentGaussianWeightIndex] = (1.0 / sqrt(2.0 * M_PI * pow(_sigma, 2.0))) * exp(-pow(currentGaussianWeightIndex, 2.0) / (2.0 * pow(_sigma, 2.0)));
144144

@@ -153,14 +153,14 @@ -(void)buildFragmentFunctions
153153
}
154154

155155
// Next, normalize these weights to prevent the clipping of the Gaussian curve at the end of the discrete samples from reducing luminance
156-
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 1; currentGaussianWeightIndex++)
156+
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 2; currentGaussianWeightIndex++)
157157
{
158158
standardGaussianWeights[currentGaussianWeightIndex] = standardGaussianWeights[currentGaussianWeightIndex] / sumOfWeights;
159159
}
160160

161161
// From these weights we calculate the offsets to read interpolated values from
162-
NSUInteger numberOfOptimizedOffsets = MIN(_blurRadius / 2 + (_blurRadius % 2), BLUR_OPTIMIZED_RADIUS_MAX);
163-
NSUInteger trueNumberOfOptimizedOffsets = _trueBlurRadius / 2 + (_trueBlurRadius % 2);
162+
NSUInteger numberOfOptimizedOffsets = _numberOfOptimizedOffsets;
163+
NSUInteger trueNumberOfOptimizedOffsets = _trueBlurRadius / 2;
164164

165165
NSMutableString *shaderString = [[NSMutableString alloc] init];
166166

@@ -183,7 +183,7 @@ -(void)buildFragmentFunctions
183183
[shaderString appendString:@"inBounds = step(0.0, min(compare.x, compare.y));"];
184184
[shaderString appendFormat:@"srcPixel = texture2D(cc_PreviousPassTexture, v_blurCoordinates[0]);\n"];
185185
[shaderString appendString:@"luminanceCheck = step(u_luminanceThreshold, dot(srcPixel.rgb, luminanceWeighting));\n"];
186-
[shaderString appendFormat:@"src += inBounds * luminanceCheck * srcPixel * %f;\n", standardGaussianWeights[0]];
186+
[shaderString appendFormat:@"src += inBounds * luminanceCheck * srcPixel * %f;\n", (_trueBlurRadius == 0) ? 1.0 : standardGaussianWeights[0]];
187187

188188
for (NSUInteger currentBlurCoordinateIndex = 0; currentBlurCoordinateIndex < numberOfOptimizedOffsets; currentBlurCoordinateIndex++)
189189
{

cocos2d/CCEffectBlur.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/// @name Accessing Effect Attributes
2121
/// -----------------------------------------------------------------------
2222

23-
/** The size of the blur. This value is in the range [0..6].
23+
/** The size of the blur. This value is in the range [0..n].
2424
*/
2525
@property (nonatomic, assign) NSUInteger blurRadius;
2626

cocos2d/CCEffectBlur.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ -(void)buildFragmentFunctions
118118
{
119119
self.fragmentFunctions = [[NSMutableArray alloc] init];
120120

121-
GLfloat *standardGaussianWeights = calloc(_trueBlurRadius + 1, sizeof(GLfloat));
121+
GLfloat *standardGaussianWeights = calloc(_trueBlurRadius + 2, sizeof(GLfloat));
122122
GLfloat sumOfWeights = 0.0;
123-
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 1; currentGaussianWeightIndex++)
123+
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 2; currentGaussianWeightIndex++)
124124
{
125125
standardGaussianWeights[currentGaussianWeightIndex] = (1.0 / sqrt(2.0 * M_PI * pow(_sigma, 2.0))) * exp(-pow(currentGaussianWeightIndex, 2.0) / (2.0 * pow(_sigma, 2.0)));
126126

@@ -135,14 +135,14 @@ -(void)buildFragmentFunctions
135135
}
136136

137137
// Next, normalize these weights to prevent the clipping of the Gaussian curve at the end of the discrete samples from reducing luminance
138-
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 1; currentGaussianWeightIndex++)
138+
for (NSUInteger currentGaussianWeightIndex = 0; currentGaussianWeightIndex < _trueBlurRadius + 2; currentGaussianWeightIndex++)
139139
{
140140
standardGaussianWeights[currentGaussianWeightIndex] = standardGaussianWeights[currentGaussianWeightIndex] / sumOfWeights;
141141
}
142142

143143
// From these weights we calculate the offsets to read interpolated values from
144-
NSUInteger numberOfOptimizedOffsets = MIN(_blurRadius / 2 + (_blurRadius % 2), BLUR_OPTIMIZED_RADIUS_MAX);
145-
NSUInteger trueNumberOfOptimizedOffsets = _trueBlurRadius / 2 + (_trueBlurRadius % 2);
144+
NSUInteger numberOfOptimizedOffsets = _numberOfOptimizedOffsets;
145+
NSUInteger trueNumberOfOptimizedOffsets = _trueBlurRadius / 2;
146146

147147
NSMutableString *shaderString = [[NSMutableString alloc] init];
148148

@@ -157,7 +157,7 @@ -(void)buildFragmentFunctions
157157
// Inner texture loop
158158
[shaderString appendString:@"compare = cc_FragTexCoord1Extents - abs(v_blurCoordinates[0] - cc_FragTexCoord1Center);"];
159159
[shaderString appendString:@"inBounds = step(0.0, min(compare.x, compare.y));"];
160-
[shaderString appendFormat:@"sum += texture2D(cc_PreviousPassTexture, v_blurCoordinates[0]) * inBounds * %f;\n", standardGaussianWeights[0]];
160+
[shaderString appendFormat:@"sum += texture2D(cc_PreviousPassTexture, v_blurCoordinates[0]) * inBounds * %f;\n", (_trueBlurRadius == 0) ? 1.0 : standardGaussianWeights[0]];
161161

162162
for (NSUInteger currentBlurCoordinateIndex = 0; currentBlurCoordinateIndex < numberOfOptimizedOffsets; currentBlurCoordinateIndex++)
163163
{

0 commit comments

Comments
 (0)