CCEffectRefraction Class Reference
| Inherits from | CCEffect : NSObject |
| Declared in | CCEffectRefraction.h |
Overview
CCEffectRefraction uses refraction to simulate the appearance of a transparent object contained within an environment. Refraction is controlled with a single refraction strength value, the normal map, and a refraction environment sprite.
Tasks
Accessing Effect Attributes
-
refractionproperty -
environmentproperty -
normalMapproperty
Initializing a CCEffectRefraction object
Properties
environment
The environment that will be refracted by the affected node. Typically this is a sprite that serves as the background for the affected node so it appears that the viewer is seeing the refracted environment through the refracting node.
@property (nonatomic, strong) CCSprite *environmentDeclared In
CCEffectRefraction.hnormalMap
The normal map that encodes the normal vectors of the affected node. Each pixel in the normal map is a 3 component vector that is perpendicular to the surface of the sprite at that point.
@property (nonatomic, strong) CCSpriteFrame *normalMapDeclared In
CCEffectRefraction.hrefraction
The refraction strength value. This value is in the range [-1..1] with -1 resulting in maximum minification of the refracted image, 0 resulting in no refraction, and 1 resulting in maximum magnification of the refracted image.
@property (nonatomic) float refractionDeclared In
CCEffectRefraction.hClass Methods
effectWithRefraction:environment:
Creates a CCEffectRefraction object with the supplied parameters and a nil normal map.
+ (id)effectWithRefraction:(float)refraction environment:(CCSprite *)environmentParameters
- refraction
The refraction strength.
- environment
The environment image that will be refracted by the affected node.
Return Value
The CCEffectRefraction object.
Declared In
CCEffectRefraction.heffectWithRefraction:environment:normalMap:
Creates a CCEffectRefraction object with the supplied parameters.
+ (id)effectWithRefraction:(float)refraction environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- refraction
The refraction strength.
- environment
The environment image that will be refracted by the affected node.
- normalMap
The normal map of the affected node. This can also be specified as a property of the affected sprite.
Return Value
The CCEffectRefraction object.
Declared In
CCEffectRefraction.hInstance Methods
init
Initializes a CCEffectRefraction object with the following default parameters: refraction = 1.0, environment = nil, normalMap = nil
- (id)initReturn Value
The CCEffectRefraction object.
Declared In
CCEffectRefraction.hinitWithRefraction:environment:
Initializes a CCEffectRefraction object with the supplied parameters and a nil normal map.
- (id)initWithRefraction:(float)refraction environment:(CCSprite *)environmentParameters
- refraction
The refraction strength.
- environment
The environment image that will be refracted by the affected node.
Return Value
The CCEffectRefraction object.
Declared In
CCEffectRefraction.hinitWithRefraction:environment:normalMap:
Initializes a CCEffectRefraction object with the supplied parameters.
- (id)initWithRefraction:(float)refraction environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- refraction
The refraction strength.
- environment
The environment image that will be refracted by the affected node.
- normalMap
The normal map of the affected node. This can also be specified as a property of the affected sprite.
Return Value
The CCEffectRefraction object.
Declared In
CCEffectRefraction.h