|
8 | 8 |
|
9 | 9 | #import "CCEffect.h"
|
10 | 10 |
|
| 11 | +/** |
| 12 | + * CCEffectRefraction uses refraction to simulate the appearance of a transparent object contained within an |
| 13 | + * environment. Refraction is controlled with a single refraction strength value, the normal map, and a refraction |
| 14 | + * environment sprite. |
| 15 | + */ |
11 | 16 | @interface CCEffectRefraction : CCEffect
|
12 | 17 |
|
| 18 | +/// ----------------------------------------------------------------------- |
| 19 | +/// @name Accessing Effect Attributes |
| 20 | +/// ----------------------------------------------------------------------- |
| 21 | + |
| 22 | +/** The refraction strength value. This value is in the range [-1..1] with -1 |
| 23 | + * resulting in maximum minification of the refracted image, 0 resulting in no |
| 24 | + * refraction, and 1 resulting in maximum magnification of the refracted image. |
| 25 | + */ |
13 | 26 | @property (nonatomic) float refraction;
|
| 27 | + |
| 28 | +/** The environment that will be refracted by the affected node. Typically this is a |
| 29 | + * sprite that serves as the background for the affected node so it appears that the viewer |
| 30 | + * is seeing the refracted environment through the refracting node. |
| 31 | + */ |
14 | 32 | @property (nonatomic) CCSprite *environment;
|
| 33 | + |
| 34 | +/** The normal map that encodes the normal vectors of the affected node. Each pixel in the normal |
| 35 | + * map is a 3 component vector that is perpendicular to the surface of the sprite at that point. |
| 36 | + */ |
15 | 37 | @property (nonatomic) CCSpriteFrame *normalMap;
|
16 | 38 |
|
| 39 | + |
| 40 | +/// ----------------------------------------------------------------------- |
| 41 | +/// @name Initializing a CCEffectRefraction object |
| 42 | +/// ----------------------------------------------------------------------- |
| 43 | + |
| 44 | +/** |
| 45 | + * Initializes a CCEffectRefraction object with the following default parameters: |
| 46 | + * refraction : 1.0 |
| 47 | + * environment : nil |
| 48 | + * normalMap : nil |
| 49 | + * |
| 50 | + * @return The CCEffectRefraction object. |
| 51 | + */ |
17 | 52 | -(id)init;
|
| 53 | + |
| 54 | +/** |
| 55 | + * Initializes a CCEffectRefraction object with the supplied parameters. |
| 56 | + * |
| 57 | + * @param refraction The refraction strength. |
| 58 | + * @param environment The environment image that will be refracted by the affected node. |
| 59 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 60 | + * |
| 61 | + * @return The CCEffectRefraction object. |
| 62 | + */ |
18 | 63 | -(id)initWithRefraction:(float)refraction environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
| 64 | + |
| 65 | + |
| 66 | +/// ----------------------------------------------------------------------- |
| 67 | +/// @name Initializing a CCEffectRefraction object |
| 68 | +/// ----------------------------------------------------------------------- |
| 69 | + |
| 70 | +/** |
| 71 | + * Creates a CCEffectRefraction object with the supplied parameters. |
| 72 | + * |
| 73 | + * @param refraction The refraction strength. |
| 74 | + * @param environment The environment image that will be refracted by the affected node. |
| 75 | + * @param normalMap The normal map of the affected node. This can also be specified as a property of the affected sprite. |
| 76 | + * |
| 77 | + * @return The CCEffectRefraction object. |
| 78 | + */ |
19 | 79 | +(id)effectWithRefraction:(float)refraction environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
|
20 | 80 |
|
21 | 81 | @end
|
0 commit comments