#import <CC3RenderSurfaces.h>
Properties | |
GLfloat | numberOfFacesPerSnapshot |
CC3GLFramebuffer * | renderSurface |
A texture that supports an environment map created by rendering the scene from the node's perspective in all six axis directions.
You can use this texture in any model object, wherever you use any cube-map texture. The generateSnapshotOfScene:fromGlobalLocation: method is used to capture the scene images to this texture. You can trigger this as often as you need, to keep the image current with the scene contents.
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.
- (instancetype) initCubeWithColorPixelFormat: | (GLenum) | colorFormat | |
andColorPixelType: | (GLenum) | colorType | |
andDepthAttachment: | (id< CC3FramebufferAttachment >) | __deprecated | |
- (instancetype) initCubeWithDepthAttachment: | (id< CC3FramebufferAttachment >) | __deprecated |
- (instancetype) initCubeWithSideLength: | (GLuint) | sideLength |
Initializes this instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by a new depth buffer with the standard GL_DEPTH_COMPONENT16 depth format.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The internal depth buffer is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth buffer for all such environment textures. In this case, consider using the initCubeWithSideLength:WithDepthAttachment: method instead.
- (instancetype) initCubeWithSideLength: | (GLuint) | sideLength | |
withColorPixelFormat: | (GLenum) | colorFormat | |
withColorPixelType: | (GLenum) | colorType | |
withDepthAttachment: | (id< CC3FramebufferAttachment >) | depthAttachment | |
Initializes this instance with the specified side length, with the specified pixel format and type, and backed by the specified depth attachment.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthAttachment argument must not be nil.
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.
The depth attachment is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth attachment for all such environment textures.
- (instancetype) initCubeWithSideLength: | (GLuint) | sideLength | |
withDepthAttachment: | (id< CC3FramebufferAttachment >) | depthAttachment | |
Initializes this instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by the specified depth attachment.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthAttachment argument must not be nil.
The depth attachment is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth attachment for all such environment textures.
- (instancetype) initCubeWithSideLength: | (GLuint) | sideLength | |
withDepthFormat: | (GLenum) | depthFormat | |
Initializes this instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by a new depth buffer of the specified depth format.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthFormat argument may be one of the following values:
The internal depth buffer is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth buffer for all such environment textures. In this case, consider using the initCubeWithSideLength:WithDepthAttachment: method instead.
+ (instancetype) textureCubeWithColorPixelFormat: | (GLenum) | colorFormat | |
andColorPixelType: | (GLenum) | colorType | |
andDepthAttachment: | (id< CC3FramebufferAttachment >) | __deprecated | |
+ (instancetype) textureCubeWithDepthAttachment: | (id< CC3FramebufferAttachment >) | __deprecated |
+ (instancetype) textureCubeWithSideLength: | (GLuint) | sideLength |
Allocates and initializes an autoreleased instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by a new depth buffer with the standard GL_DEPTH_COMPONENT16 depth format.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The internal depth buffer is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth buffer for all such environment textures. In this case, consider using the textureCubeWithSideLength:WithDepthAttachment: method instead.
+ (instancetype) textureCubeWithSideLength: | (GLuint) | sideLength | |
withColorPixelFormat: | (GLenum) | colorFormat | |
withColorPixelType: | (GLenum) | colorType | |
withDepthAttachment: | (id< CC3FramebufferAttachment >) | depthAttachment | |
Allocates and initializes an autoreleased instance with the specified side length, with the specified pixel format and type, and backed by the specified depth attachment.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthAttachment argument must not be nil.
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.
The depth attachment is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth attachment for all such environment textures.
+ (instancetype) textureCubeWithSideLength: | (GLuint) | sideLength | |
withDepthAttachment: | (id< CC3FramebufferAttachment >) | depthAttachment | |
Allocates and initializes an autoreleased instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by the specified depth attachment.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthAttachment argument must not be nil.
The depth attachment is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth attachment for all such environment textures.
+ (instancetype) textureCubeWithSideLength: | (GLuint) | sideLength | |
withDepthFormat: | (GLenum) | depthFormat | |
Allocates and initializes an autoreleased instance with the specified side length, with the standard GL_RGBA/GL_UNSIGNED_BYTE pixelFormat/pixelType, and backed by a new depth buffer of the specified depth format.
The sideLength argument indicates the length, in pixels, of each side of the texture.
The depthFormat argument may be one of the following values:
The internal depth buffer is used only during the rendering of the environment to this texture. If you are creating many environmental textures of the same size, for different objects, you can save memory by using the same depth buffer for all such environment textures. In this case, consider using the textureCubeWithSideLength:WithDepthAttachment: method instead.
|
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.
|
readnonatomicretain |
Returns the surface to which the environment will be rendered.