# 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

- `environment` property
- `normalMap` property
- `shininess` property
- `fresnelBias` property
- `fresnelPower` property

### Initializing a CCEffectReflection object

- `– init`
- `– initWithShininess:environment:`
- `– initWithShininess:environment:normalMap:`
- `– initWithShininess:fresnelBias:fresnelPower:environment:`
- `– initWithShininess:fresnelBias:fresnelPower:environment:normalMap:`

### Creating a CCEffectReflection object

- `+ effectWithShininess:environment:`
- `+ effectWithShininess:environment:normalMap:`
- `+ effectWithShininess:fresnelBias:fresnelPower:environment:`
- `+ effectWithShininess:fresnelBias:fresnelPower:environment:normalMap:`

## 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 *environment`

#### Declared In

`CCEffectReflection.h`

### fresnelBias

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 fresnelBias`

#### Declared In

`CCEffectReflection.h`

### fresnelPower

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 fresnelPower`

#### Declared In

`CCEffectReflection.h`

### normalMap

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 *normalMap`

#### Declared In

`CCEffectReflection.h`

### shininess

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 shininess`

#### Declared In

`CCEffectReflection.h`

## Class 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 *)environment`

#### Parameters

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.h`

### effectWithShininess: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 *)normalMap`

#### Parameters

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.h`

### effectWithShininess: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 *)environment`

#### Parameters

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.h`

### effectWithShininess: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 *)normalMap`

#### Parameters

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`

## Instance Methods

### init

Initializes a CCEffectReflection object with the following default parameters: fresnelBias = 1.0, fresnelPower = 0.0, environment = nil, normalMap = nil

`- (id)init`

#### Return Value

The CCEffectReflection object.

#### Declared In

`CCEffectReflection.h`

### initWithShininess: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 *)environment`

#### Parameters

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.h`

### initWithShininess: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 *)normalMap`

#### Parameters

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.h`

### initWithShininess: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 *)environment`

#### Parameters

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.h`

### initWithShininess: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 *)normalMap`

#### Parameters

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`