Skip to content

Commit a6e961c

Browse files
author
Thayer J Andrews
committed
CCEffectRefraction - API documentation
1 parent fc4e70c commit a6e961c

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

cocos2d/CCEffectRefraction.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,74 @@
88

99
#import "CCEffect.h"
1010

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+
*/
1116
@interface CCEffectRefraction : CCEffect
1217

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+
*/
1326
@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+
*/
1432
@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+
*/
1537
@property (nonatomic) CCSpriteFrame *normalMap;
1638

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+
*/
1752
-(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+
*/
1863
-(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+
*/
1979
+(id)effectWithRefraction:(float)refraction environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMap;
2080

2181
@end

0 commit comments

Comments
 (0)