@@ -24,58 +24,102 @@ -(void)setupPaddingEffectTest
24
24
{
25
25
self.subTitle = @" Effect Padding Test" ;
26
26
27
- CCSprite *original = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
28
- original.positionType = CCPositionTypeNormalized;
29
- original.position = ccp (0.75 , 0.75 );
30
-
31
- [self .contentNode addChild: original];
32
-
33
- CCLabelTTF *title1 = [CCLabelTTF labelWithString: @" Original Sprite" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
34
- title1.color = [CCColor whiteColor ];
35
- title1.positionType = CCPositionTypeNormalized;
36
- title1.position = ccp (0 .25f , 0 .75f );
37
- title1.horizontalAlignment = CCTextAlignmentCenter;
38
-
39
- [self .contentNode addChild: title1];
40
-
41
-
42
- \
43
- CCSprite *affected = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
44
- affected.positionType = CCPositionTypeNormalized;
45
- affected.position = ccp (0.75 , 0.5 );
46
-
47
- CCEffectColorChannelOffset *offset1 = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
48
- affected.effect = offset1;
49
-
50
- [self .contentNode addChild: affected];
51
-
52
- CCLabelTTF *title2 = [CCLabelTTF labelWithString: @" Color channel offset (no padding)" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
53
- title2.color = [CCColor whiteColor ];
54
- title2.positionType = CCPositionTypeNormalized;
55
- title2.position = ccp (0 .25f , 0 .5f );
56
- title2.horizontalAlignment = CCTextAlignmentCenter;
57
-
58
- [self .contentNode addChild: title2];
59
-
60
-
27
+ {
28
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
29
+ sprite.positionType = CCPositionTypeNormalized;
30
+ sprite.position = ccp (0 .75f , 0 .8f );
31
+
32
+ [self .contentNode addChild: sprite];
33
+
34
+ CCLabelTTF *title = [CCLabelTTF labelWithString: @" Original Sprite" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
35
+ title.color = [CCColor whiteColor ];
36
+ title.positionType = CCPositionTypeNormalized;
37
+ title.position = ccp (0 .25f , 0 .8f );
38
+ title.horizontalAlignment = CCTextAlignmentCenter;
39
+
40
+ [self .contentNode addChild: title];
41
+ }
61
42
62
- CCSprite *padded = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
63
- padded.positionType = CCPositionTypeNormalized;
64
- padded.position = ccp (0.75 , 0.25 );
65
-
66
- CCEffectColorChannelOffset *offset2 = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
67
- offset2.padding = CGSizeMake (5 .0f , 5 .0f );
68
- padded.effect = offset2;
43
+ {
44
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
45
+ sprite.positionType = CCPositionTypeNormalized;
46
+ sprite.position = ccp (0 .75f , 0 .65f );
47
+
48
+ CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
49
+ sprite.effect = offset;
50
+
51
+ [self .contentNode addChild: sprite];
52
+
53
+ CCLabelTTF *title = [CCLabelTTF labelWithString: @" Color channel offset without padding" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
54
+ title.color = [CCColor whiteColor ];
55
+ title.positionType = CCPositionTypeNormalized;
56
+ title.position = ccp (0 .25f , 0 .65f );
57
+ title.horizontalAlignment = CCTextAlignmentCenter;
58
+
59
+ [self .contentNode addChild: title];
60
+ }
69
61
70
- [self .contentNode addChild: padded];
62
+ {
63
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
64
+ sprite.positionType = CCPositionTypeNormalized;
65
+ sprite.position = ccp (0 .75f , 0 .5f );
66
+
67
+ CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
68
+ offset.padding = CGSizeMake (5 .0f , 5 .0f );
69
+ sprite.effect = offset;
70
+
71
+ [self .contentNode addChild: sprite];
72
+
73
+ CCLabelTTF *title = [CCLabelTTF labelWithString: @" Color channel offset with padding" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
74
+ title.color = [CCColor whiteColor ];
75
+ title.positionType = CCPositionTypeNormalized;
76
+ title.position = ccp (0 .25f , 0 .5f );
77
+ title.horizontalAlignment = CCTextAlignmentCenter;
78
+
79
+ [self .contentNode addChild: title];
80
+ }
71
81
72
- CCLabelTTF *title3 = [CCLabelTTF labelWithString: @" Color channel offset (with padding)" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
73
- title3.color = [CCColor whiteColor ];
74
- title3.positionType = CCPositionTypeNormalized;
75
- title3.position = ccp (0 .25f , 0 .25f );
76
- title3.horizontalAlignment = CCTextAlignmentCenter;
82
+ {
83
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
84
+ sprite.positionType = CCPositionTypeNormalized;
85
+ sprite.position = ccp (0 .75f , 0 .35f );
86
+
87
+ CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
88
+ offset.padding = CGSizeMake (5 .0f , 5 .0f );
89
+ CCEffectHue *hue = [CCEffectHue effectWithHue: 60 .0f ];
90
+ sprite.effect = [CCEffectStack effectWithArray: @[offset, hue]];
91
+
92
+ [self .contentNode addChild: sprite];
93
+
94
+ CCLabelTTF *title = [CCLabelTTF labelWithString: @" Padded effect stack (offset then hue)" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
95
+ title.color = [CCColor whiteColor ];
96
+ title.positionType = CCPositionTypeNormalized;
97
+ title.position = ccp (0 .25f , 0 .35f );
98
+ title.horizontalAlignment = CCTextAlignmentCenter;
99
+
100
+ [self .contentNode addChild: title];
101
+ }
77
102
78
- [self .contentNode addChild: title3];
103
+ {
104
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/particles.png" ];
105
+ sprite.positionType = CCPositionTypeNormalized;
106
+ sprite.position = ccp (0 .75f , 0 .2f );
107
+
108
+ CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset: GLKVector2Make (5 .0f , 0 .0f ) greenOffset: GLKVector2Make (-4 .0f , 4 .0f ) blueOffset: GLKVector2Make (-4 .0f , -4 .0f )];
109
+ offset.padding = CGSizeMake (5 .0f , 5 .0f );
110
+ CCEffectHue *hue = [CCEffectHue effectWithHue: 60 .0f ];
111
+ sprite.effect = [CCEffectStack effectWithArray: @[hue, offset]];
112
+
113
+ [self .contentNode addChild: sprite];
114
+
115
+ CCLabelTTF *title = [CCLabelTTF labelWithString: @" Padded efect stack (hue then offset)" fontName: @" HelveticaNeue-Light" fontSize: 14 * [CCDirector sharedDirector ].UIScaleFactor];
116
+ title.color = [CCColor whiteColor ];
117
+ title.positionType = CCPositionTypeNormalized;
118
+ title.position = ccp (0 .25f , 0 .2f );
119
+ title.horizontalAlignment = CCTextAlignmentCenter;
120
+
121
+ [self .contentNode addChild: title];
122
+ }
79
123
}
80
124
81
125
-(void )setupColorChannelOffsetTest
@@ -548,13 +592,14 @@ -(void)setupBloomEffectTest
548
592
const int steps = 5 ;
549
593
for (int i = 0 ; i < steps; i++)
550
594
{
551
- CCSprite *sampleSprite3 = [CCSprite spriteWithImageNamed: @" Images/grossini_dance_08 .png" ];
595
+ CCSprite *sampleSprite3 = [CCSprite spriteWithImageNamed: @" Images/f1 .png" ];
552
596
sampleSprite3.anchorPoint = ccp (0.5 , 0.5 );
553
597
sampleSprite3.position = ccp (0 .1f + i * (0 .8f / (steps - 1 )), 0 .2f );
554
598
sampleSprite3.positionType = CCPositionTypeNormalized;
555
599
556
600
// Blend glow maps test
557
601
CCEffectBloom* glowEffect3 = [CCEffectBloom effectWithBlurRadius: 8 intensity: 1 .0f luminanceThreshold: 1 .0f - ((float )i/(float )(steps-1 ))];
602
+ glowEffect3.padding = CGSizeMake (10 .0f , 10 .0f );
558
603
sampleSprite3.effect = glowEffect3;
559
604
560
605
[self .contentNode addChild: sampleSprite3];
0 commit comments