CCEffectReflection Class Reference
| Inherits from | CCEffect : NSObject |
| Declared in | CCEffectReflection.h |
Overview
CCEffectReflection uses reflection to simulate the appearance of a shiny object contained within an environment. Reflection is controlled with two fresnel reflectance values, the normal map, and a reflection environment sprite.
Tasks
Accessing Effect Attributes
-
environmentproperty -
normalMapproperty -
shininessproperty -
fresnelBiasproperty -
fresnelPowerproperty
Initializing a CCEffectReflection object
-
– init -
– initWithShininess:environment: -
– initWithShininess:environment:normalMap: -
– initWithShininess:fresnelBias:fresnelPower:environment: -
– initWithShininess:fresnelBias:fresnelPower:environment:normalMap:
Creating a CCEffectReflection object
Properties
environment
The environment that will be reflected by the affected node. Typically this is a sprite that is not visible in the scene as it is conceptually “behind the viewer” and only visible where reflected by the affected node.
@property (nonatomic, strong) CCSprite *environmentDeclared In
CCEffectReflection.hfresnelBias
The bias term in the fresnel reflectance equation: reflectance = max(0.0, fresnelBias + (1 - fresnelBias) * pow((1 - nDotV), fresnelPower)) This value is in the range [0..1] and it controls the constant (view angle independent) contribution to the reflectance equation.
@property (nonatomic) float fresnelBiasDeclared In
CCEffectReflection.hfresnelPower
The power term in the fresnel reflectance equation: reflectance = max(0.0, fresnelBias + (1 - fresnelBias) * pow((1 - nDotV), fresnelPower)) This value is in the range [0..inf] and it controls the view angle dependent contribution to the reflectance equation.
@property (nonatomic) float fresnelPowerDeclared In
CCEffectReflection.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
CCEffectReflection.hshininess
The overall shininess of the attached sprite. This value is in the range [0..1] and it controls how much of the reflected environment contributes to the final color of the affected pixels.
@property (nonatomic) float shininessDeclared In
CCEffectReflection.hClass Methods
effectWithShininess:environment:
Creates a CCEffectReflection object with the specified environment and the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0, normalMap = nil
+ (id)effectWithShininess:(float)shininess environment:(CCSprite *)environmentParameters
- shininess
The overall shininess of the effect.
- environment
The environment image that will be reflected by the affected node.
Return Value
The CCEffectReflection object.
Declared In
CCEffectReflection.heffectWithShininess:environment:normalMap:
Creates a CCEffectReflection object with the specified environment and normal map and the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0
+ (id)effectWithShininess:(float)shininess environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- shininess
The overall shininess of the effect.
- environment
The environment image that will be reflected 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 CCEffectReflection object.
Declared In
CCEffectReflection.heffectWithShininess:fresnelBias:fresnelPower:environment:
Creates a CCEffectReflection object with the specified parameters and nil normal map.
+ (id)effectWithShininess:(float)shininess fresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environmentParameters
- shininess
The overall shininess of the effect.
- bias
The bias term in the fresnel reflectance equation.
- power
The power term in the fresnel reflectance equation.
- environment
The environment image that will be reflected by the affected node.
Return Value
The CCEffectReflection object.
Declared In
CCEffectReflection.heffectWithShininess:fresnelBias:fresnelPower:environment:normalMap:
Creates a CCEffectReflection object with the specified parameters.
+ (id)effectWithShininess:(float)shininess fresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- shininess
The overall shininess of the effect.
- bias
The bias term in the fresnel reflectance equation.
- power
The power term in the fresnel reflectance equation.
- environment
The environment image that will be reflected 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 CCEffectReflection object.
Declared In
CCEffectReflection.hInstance Methods
init
Initializes a CCEffectReflection object with the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0, environment = nil, normalMap = nil
- (id)initReturn Value
The CCEffectReflection object.
Declared In
CCEffectReflection.hinitWithShininess:environment:
Initializes a CCEffectReflection object with the specified environment and normal map and the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0, normalMap = nil
- (id)initWithShininess:(float)shininess environment:(CCSprite *)environmentParameters
- shininess
The overall shininess of the effect.
- environment
The environment image that will be reflected by the affected node.
Return Value
The CCEffectReflection object.
Declared In
CCEffectReflection.hinitWithShininess:environment:normalMap:
Initializes a CCEffectReflection object with the specified environment and normal map and the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0
- (id)initWithShininess:(float)shininess environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- shininess
The overall shininess of the effect.
- environment
The environment image that will be reflected 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 CCEffectReflection object.
Declared In
CCEffectReflection.hinitWithShininess:fresnelBias:fresnelPower:environment:
Initializes a CCEffectReflection object with the specified parameters and a nil normal map.
- (id)initWithShininess:(float)shininess fresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environmentParameters
- shininess
The overall shininess of the effect.
- bias
The bias term in the fresnel reflectance equation.
- power
The power term in the fresnel reflectance equation.
- environment
The environment image that will be reflected by the affected node.
Return Value
The CCEffectReflection object.
Declared In
CCEffectReflection.hinitWithShininess:fresnelBias:fresnelPower:environment:normalMap:
Initializes a CCEffectReflection object with the specified parameters.
- (id)initWithShininess:(float)shininess fresnelBias:(float)bias fresnelPower:(float)power environment:(CCSprite *)environment normalMap:(CCSpriteFrame *)normalMapParameters
- shininess
The overall shininess of the effect.
- bias
The bias term in the fresnel reflectance equation.
- power
The power term in the fresnel reflectance equation.
- environment
The environment image that will be reflected 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 CCEffectReflection object.
Declared In
CCEffectReflection.h