@@ -492,6 +492,56 @@ -(void)setupHueEffectTest
492
492
}
493
493
}
494
494
495
+ -(void )setupStackTest
496
+ {
497
+ self.subTitle = @" Effect Performance Test" ;
498
+
499
+ CCSprite *reflectEnvironment = [CCSprite spriteWithImageNamed: @" Images/MountainPanorama.jpg" ];
500
+ reflectEnvironment.positionType = CCPositionTypeNormalized;
501
+ reflectEnvironment.position = ccp (0 .5f , 0 .5f );
502
+ reflectEnvironment.visible = NO ;
503
+ [self .contentNode addChild: reflectEnvironment];
504
+
505
+ CCSprite *refractEnvironment = [CCSprite spriteWithImageNamed: @" Images/StoneWall.jpg" ];
506
+ refractEnvironment.positionType = CCPositionTypeNormalized;
507
+ refractEnvironment.position = ccp (0 .5f , 0 .5f );
508
+ refractEnvironment.scale = 0.5 ;
509
+ [self .contentNode addChild: refractEnvironment];
510
+
511
+ NSArray *effects = @[
512
+ [CCEffectGaussianBlur effectWithPixelBlurRadius: 7.0 ],
513
+ [CCEffectBloom effectWithPixelBlurRadius: 8 intensity: 1 .0f luminanceThreshold: 0 .0f ],
514
+ [CCEffectBrightness effectWithBrightness: 0 .25f ],
515
+ [CCEffectContrast effectWithContrast: 1 .0f ],
516
+ [CCEffectPixellate effectWithBlockSize: 8 .0f ],
517
+ [CCEffectSaturation effectWithSaturation: -1 .0f ],
518
+ [CCEffectHue effectWithHue: 90 .0f ],
519
+ [CCEffectGlass effectWithRefraction: 0 .5f refractionEnvironment: refractEnvironment reflectionEnvironment: reflectEnvironment normalMap: nil ],
520
+ [CCEffectRefraction effectWithRefraction: 0 .5f environment: refractEnvironment normalMap: nil ],
521
+ [CCEffectReflection effectWithEnvironment: reflectEnvironment normalMap: nil ],
522
+ ];
523
+
524
+
525
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/ShinyBallColor.png" ];
526
+ sprite.positionType = CCPositionTypeNormalized;
527
+ sprite.position = ccp (0 .1f , 0 .9f );
528
+ sprite.scale = 0 .5f ;
529
+
530
+ sprite.effect = [[CCEffectStack alloc ] initWithEffects: @[effects[4 ]]];
531
+ sprite.normalMapSpriteFrame = [CCSpriteFrame frameWithImageNamed: @" Images/ShinyBallNormals.png" ];
532
+ sprite.colorRGBA = [CCColor colorWithRed: 0 .75f green: 0 .75f blue: 0 .75f alpha: 0 .75f ];
533
+
534
+ [self .contentNode addChild: sprite];
535
+
536
+ [sprite runAction: [CCActionRepeatForever actionWithAction: [CCActionSequence actions:
537
+ [CCActionMoveTo actionWithDuration: 8.0 position: ccp (0 .9f , 0 .9f )],
538
+ [CCActionMoveTo actionWithDuration: 8.0 position: ccp (0 .9f , 0 .1f )],
539
+ [CCActionMoveTo actionWithDuration: 8.0 position: ccp (0 .1f , 0 .1f )],
540
+ [CCActionMoveTo actionWithDuration: 8.0 position: ccp (0 .1f , 0 .9f )],
541
+ nil
542
+ ]]];
543
+ }
544
+
495
545
-(void )setupPerformanceTest
496
546
{
497
547
self.subTitle = @" Effect Performance Test" ;
0 commit comments