cocos3d  2.0.0
Instance Methods | Class Methods | Properties | List of all members
CC3EnvironmentMapTexture Class Reference

#import <CC3RenderSurfaces.h>

Inheritance diagram for CC3EnvironmentMapTexture:
Inheritance graph
[legend]

Instance Methods

(void) - generateSnapshotOfScene:fromGlobalLocation:
 
(id) - initCubeWithColorPixelFormat:andColorPixelType:andDepthAttachment:
 
(id) - initCubeWithDepthAttachment:
 
- Instance Methods inherited from CC3TextureCube
(void) - loadCubeFace:fromCGImage:
 
(BOOL) - loadCubeFace:fromFile:
 
(BOOL) - loadFromFilePattern:
 
(BOOL) - loadFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(void) - replacePixels:inCubeFace:withContent:
 
- Instance Methods inherited from CC3Texture
(NSString *) - constructorDescription
 
(CCTexture2D *) - DEPRECATED_ATTRIBUTE
 
(void) - drawWithVisitor:
 
(void) - generateMipmap
 
(id) - initCubeFromFilePattern:
 
(id) - initCubeFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(id) - initCubeWithPixelFormat:andPixelType:
 
(id) - initCubeWithSize:andPixelFormat:andPixelType:
 
(id) - initFromFile:
 
(id) - initWithCGImage:
 
(id) - initWithPixelFormat:andPixelType:
 
(id) - initWithSize:andPixelFormat:andPixelType:
 
(void) - remove
 
(void) - replacePixels:inTarget:withContent:
 
(void) - resizeTo:
 
- Instance Methods inherited from CC3Identifiable
(id) - copy
 
(id) - copyAsClass:
 
(void) - copyUserDataFrom:
 
(id) - copyWithName:
 
(id) - copyWithName:asClass:
 
(id) - copyWithZone:withName:
 
(id) - copyWithZone:withName:asClass:
 
(BOOL) - deriveNameFrom:
 
(BOOL) - deriveNameFrom:usingSuffix:
 
(NSString *) - fullDescription
 
(id) - init
 
(id) - initAtIndex:fromPODResource:
 
(void) - initUserData
 
(id) - initWithName:
 
(id) - initWithTag:
 
(id) - initWithTag:withName:
 
(GLuint) - nextTag
 
(void) - populateFrom:
 

Class Methods

(id) + textureCubeWithColorPixelFormat:andColorPixelType:andDepthAttachment:
 
(id) + textureCubeWithDepthAttachment:
 
- Class Methods inherited from CC3TextureCube
(BOOL) + defaultShouldFlipHorizontallyOnLoad
 
(BOOL) + defaultShouldFlipVerticallyOnLoad
 
(void) + setDefaultShouldFlipHorizontallyOnLoad:
 
(void) + setDefaultShouldFlipVerticallyOnLoad:
 
- Class Methods inherited from CC3Texture
(void) + addTexture:
 
(NSString *) + cachedTexturesDescription
 
(ccTexParams) + defaultTextureParameters
 
(CC3Texture *) + getTextureNamed:
 
(BOOL) + isPreloading
 
(void) + removeAllTextures
 
(void) + removeTexture:
 
(void) + removeTextureNamed:
 
(void) + setDefaultTextureParameters:
 
(void) + setIsPreloading:
 
(void) + setShouldCacheAssociatedCCTexture2Ds:
 
(void) + setShouldGenerateMipmaps:
 
(BOOL) + shouldCacheAssociatedCCTexture2Ds
 
(BOOL) + shouldGenerateMipmaps
 
(id) + textureCubeFromFilePattern:
 
(id) + textureCubeFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(id) + textureCubeWithPixelFormat:andPixelType:
 
(id) + textureCubeWithSize:andPixelFormat:andPixelType:
 
(id) + textureFromFile:
 
(NSString *) + textureNameFromFilePath:
 
(id) + textureWithCGImage:
 
(id) + textureWithPixelFormat:andPixelType:
 
(id) + textureWithSize:andPixelFormat:andPixelType:
 
- Class Methods inherited from CC3Identifiable
(GLint) + instanceCount
 
(void) + resetTagAllocation
 

Properties

GLfloat numberOfFacesPerSnapshot
 
CC3GLFramebufferrenderSurface
 

Detailed Description

A texture that supports an environment map created by rendering the scene from the node's perspective in all six axis directions.

Method Documentation

- (void) generateSnapshotOfScene: (CC3Scene *)  scene
fromGlobalLocation: (CC3Vector location 

Generates up to six faces of this cube-map, by creating a view of the specified scene, from the specified global location, once for each face of this cube-mapped texture.

The scene's drawSceneContentForEnvironmentMapWithVisitor: method is invoked to render the scene as an environment map, using the visitor in the scene's envMapDrawingVisitor property.

Typcally, you invoke this method on each frame rendering loop, and use the numberOfFacesPerSnapshot property to control how often the texture is updated.

- (id) initCubeWithColorPixelFormat: (GLenum)  colorFormat
andColorPixelType: (GLenum)  colorType
andDepthAttachment: (id< CC3FramebufferAttachment >)  depthAttachment 

Initializes this instance with a rendering surface constructed from a new cube-map texture with the specified pixel format and type, and the specified depth attachment, which must not be nil and must have a square size.

The cube-map texture will have the same size as the specified depth attachment.

Be aware that the possible combinations of color and depth pixel formats is quite limited with cube-mapped framebuffer attachments. If you have trouble finding a suitable combination, you can use the initWithDepthAttachment: method, which invokes this method with GL_RGBA as the colorFormat and GL_UNSIGNED_BYTE as the colorType.

- (id) initCubeWithDepthAttachment: (id< CC3FramebufferAttachment >)  depthAttachment

Initializes this instance with a rendering surface constructed from a new cube-map texture with the economical 16-bit GL_RGB/GL_UNSIGNED_SHORT_5_6_5 pixelFormat/pixelType, and the specified depth attachment, which must not be nil and must have a square size.

The cube-map texture will have the same size as the specified depth attachment.

+ (id) textureCubeWithColorPixelFormat: (GLenum)  colorFormat
andColorPixelType: (GLenum)  colorType
andDepthAttachment: (id< CC3FramebufferAttachment >)  depthAttachment 

Allocates and initializes an autoreleased instance with a rendering surface constructed from a new cube-map texture with the specified pixel format and type, and the specified depth attachment, which must not be nil and must have a square size.

The cube-map texture will have the same size as the specified depth attachment.

Be aware that the possible combinations of color and depth pixel formats is quite limited with cube-mapped framebuffer attachments. If you have trouble finding a suitable combination, you can use the textureWithDepthAttachment: method, which invokes this method with GL_RGBA as the colorFormat and GL_UNSIGNED_BYTE as the colorType.

+ (id) textureCubeWithDepthAttachment: (id< CC3FramebufferAttachment >)  depthAttachment

Allocates and initializes an autoreleased instance with a rendering surface constructed from a new cube-map texture with whose pixelFormat and pixelType properties are set to GL_RGBA and GL_UNSIGNED_BYTE, respectively, and the specified depth attachment, which must not be nil and must have a square size.

The cube-map texture will have the same size as the specified depth attachment.

Property Documentation

- (GLfloat) numberOfFacesPerSnapshot
readwritenonatomicassign

Indicates the number of faces of the cube-map that will be generated on each invocation of the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method.

Generating each face in the cube-map requires rendering the scene from the perspective of a camera facing towards that face, and generating a full cube-map requires six separate scene renderings. Depending on the complexity of the scene, this can be quite costly.

However, in most situations, an environment map does not require high-fideility, and the workload can be spread over time by not generating all of the cube-map faces on every snapshot.

You can use this property to control the number of cube-map faces that will be generated each time a snapshot is taken using the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method.

The maximum value of this property is 6, indicating that all six faces should be generated each time the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method is invoked. Setting this property to a smaller value will cause fewer faces to be generated on each snapshot, thereby spreading the workload out over time. On each invocation, a different set of faces will be generated, in a cycle, ensuring that each face will be generated at some point.

As an example, setting this value to 2 will cause only 2 of the 6 faces of the cube-map to be generated each time the generateSnapshotOfScene:fromGlobalLocation:withVisitor: is invoked. Therefore, it would take 3 snapshot invocations to generate all 6 sides of the cube-map.

You can even set this property to a fractional value less than one to spread the updating of the faces out even further. For example, if the value of this property is set to 0.25, the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method will only generate one face of this cube-map texture every fourth time it is invoked. On the other three invocations, the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method will do nothing. Therefore, with the value of this property set to 0.25, it would take 24 snapshot invocations to generate all 6 sides of this cube-map.

The initial value of this property is 1, indicating that one face of the cube-map will be generated on each invocation of the generateSnapshotOfScene:fromGlobalLocation:withVisitor: method. With this value, it will take six invocations to generate all six sides of the cube-map.

- (CC3GLFramebuffer*) renderSurface
readnonatomicstrong

Returns the surface to which the environment will be rendered.


The documentation for this class was generated from the following file: