cocos3d
2.0.0
|
#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.
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.
|
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.
|
readnonatomicstrong |
Returns the surface to which the environment will be rendered.