|
10 | 10 |
|
11 | 11 | @interface CCEffectReflection : CCEffect
|
12 | 12 |
|
| 13 | +/// ----------------------------------------------------------------------- |
| 14 | +/// @name Accessing Effect Attributes |
| 15 | +/// ----------------------------------------------------------------------- |
| 16 | + |
| 17 | +/** The environment that will be refracted by the affected node. Typically this is a sprite |
| 18 | + * that is not visible in the scene as it is conceptually "behind the viewer" and only visible |
| 19 | + * where reflected by the affected node. |
| 20 | + */ |
13 | 21 | @property (nonatomic) CCSprite *environment;
|
| 22 | + |
| 23 | +/** The normal map that encodes the normal vectors of the affected node. Each pixel in the normal |
| 24 | + * map is a 3 component vector that is perpendicular to the surface of the sprite at that point. |
| 25 | + */ |
14 | 26 | @property (nonatomic) CCSpriteFrame *normalMap;
|
| 27 | + |
| 28 | +/** The bias term in the fresnel reflectance equation: |
| 29 | + * reflectance = max(0.0, fresnelBias + (1 - fresnelBias) * pow((1 - nDotV), fresnelPower)) |
| 30 | + * This value is in the range [0..1] and it controls the constant (view angle independent) contribution |
| 31 | + * to the reflectance equation. |
| 32 | + */ |
15 | 33 | @property (nonatomic) float fresnelBias;
|
| 34 | + |
| 35 | +/** The power term in the fresnel reflectance equation: |
| 36 | + * reflectance = max(0.0, fresnelBias + (1 - fresnelBias) * pow((1 - nDotV), fresnelPower)) |
| 37 | + * This value is in the range [0..inf] and it controls the view angle dependent contribution |
| 38 | + * to the reflectance equation. |
| 39 | + */ |
16 | 40 | @property (nonatomic) float fresnelPower;
|
17 | 41 |
|
| 42 | + |
| 43 | +/// ----------------------------------------------------------------------- |
| 44 | +/// @name Initializing a CCEffectReflection object |
| 45 | +/// ----------------------------------------------------------------------- |
| 46 | + |
| 47 | +/** |
| 48 | + * Initializes a CCEffectReflection object with the following default parameters: |
| 49 | + * fresnelBias : 1.0 |
| 50 | + * fresnelPower : 0.0 |
| 51 | + * environment : nil |
| 52 | + * normalMap : nil |
| 53 | + * |
| 54 | + * @return The CCEffectReflection object. |
| 55 | + */ |
18 | 56 | -(id)init;
|
| 57 | + |
| 58 | +/** |
| 59 | + * Initializes a CCEffectReflection object with the specified environment and normal map and the following default parameters: |
| 60 | + * fresnelBias : 1.0 |
| 61 | + * fresnelPower : 0.0 |
| 62 | + * |
| 63 | + * @param environment The environment image that will be reflected by the affected node. |
| 64 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 65 | + * |
| 66 | + * @return The CCEffectReflection object. |
| 67 | + */ |
19 | 68 | -(id)initWithEnvironment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
| 69 | + |
| 70 | +/** |
| 71 | + * Initializes a CCEffectReflection object with the specified parameters. |
| 72 | + * |
| 73 | + * @param bias The bias term in the fresnel reflectance equation. |
| 74 | + * @param power The power term in the fresnel reflectance equation. |
| 75 | + * @param environment The environment image that will be reflected by the affected node. |
| 76 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 77 | + * |
| 78 | + * @return The CCEffectReflection object. |
| 79 | + */ |
20 | 80 | -(id)initWithFresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
21 | 81 |
|
| 82 | + |
| 83 | +/// ----------------------------------------------------------------------- |
| 84 | +/// @name Creating a CCEffectReflection object |
| 85 | +/// ----------------------------------------------------------------------- |
| 86 | + |
| 87 | +/** |
| 88 | + * Creates a CCEffectReflection object with the specified environment and normal map and the following default parameters: |
| 89 | + * fresnelBias : 1.0 |
| 90 | + * fresnelPower : 0.0 |
| 91 | + * |
| 92 | + * @param environment The environment image that will be reflected by the affected node. |
| 93 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 94 | + * |
| 95 | + * @return The CCEffectReflection object. |
| 96 | + */ |
22 | 97 | +(id)effectWithEnvironment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
| 98 | + |
| 99 | +/** |
| 100 | + * Creates a CCEffectReflection object with the specified parameters. |
| 101 | + * |
| 102 | + * @param bias The bias term in the fresnel reflectance equation. |
| 103 | + * @param power The power term in the fresnel reflectance equation. |
| 104 | + * @param environment The environment image that will be reflected by the affected node. |
| 105 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 106 | + * |
| 107 | + * @return The CCEffectReflection object. |
| 108 | + */ |
23 | 109 | +(id)effectWithFresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
24 | 110 |
|
25 | 111 | @end
|
0 commit comments