@@ -35,9 +35,14 @@ -(id)init
35
35
}
36
36
37
37
-(id )initWithEnvironment : (CCSprite *)environment normalMap : (CCSpriteFrame *)normalMap
38
+ {
39
+ return [self initWithFresnelBias: 1 .0f fresnelPower: 0 .0f environment: environment normalMap: normalMap];
40
+ }
41
+
42
+ -(id )initWithFresnelBias : (float )bias fresnelPower : (float )power environment : (CCSprite *)environment normalMap : (CCSpriteFrame *)normalMap
38
43
{
39
44
NSArray *uniforms = @[
40
- [CCEffectUniform uniform: @" float" name: @" u_fresnelBias" value: [NSNumber numberWithFloat: 0 .0f ]],
45
+ [CCEffectUniform uniform: @" float" name: @" u_fresnelBias" value: [NSNumber numberWithFloat: 1 .0f ]],
41
46
[CCEffectUniform uniform: @" float" name: @" u_fresnelPower" value: [NSNumber numberWithFloat: 0 .0f ]],
42
47
[CCEffectUniform uniform: @" sampler2D" name: @" u_envMap" value: (NSValue *)[CCTexture none ]],
43
48
[CCEffectUniform uniform: @" vec2" name: @" u_tangent" value: [NSValue valueWithGLKVector2: GLKVector2Make (1 .0f , 0 .0f )]],
@@ -49,6 +54,8 @@ -(id)initWithEnvironment:(CCSprite *)environment normalMap:(CCSpriteFrame *)norm
49
54
{
50
55
_environment = environment;
51
56
_normalMap = normalMap;
57
+ _fresnelBias = bias;
58
+ _fresnelPower = power;
52
59
53
60
self.debugName = @" CCEffectReflection" ;
54
61
}
@@ -60,6 +67,11 @@ +(id)effectWithEnvironment:(CCSprite *)environment normalMap:(CCSpriteFrame *)no
60
67
return [[self alloc ] initWithEnvironment: environment normalMap: normalMap];
61
68
}
62
69
70
+ +(id )effectWithFresnelBias : (float )bias fresnelPower : (float )power environment : (CCSprite *)environment normalMap : (CCSpriteFrame *)normalMap
71
+ {
72
+ return [[self alloc ] initWithFresnelBias: bias fresnelPower: power environment: environment normalMap: normalMap];
73
+ }
74
+
63
75
-(void )buildFragmentFunctions
64
76
{
65
77
self.fragmentFunctions = [[NSMutableArray alloc ] init ];
0 commit comments