v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3SurfaceSection Class Reference

#import <CC3RenderSurfaces.h>

Inheritance diagram for CC3SurfaceSection:
Inheritance graph
[legend]

Instance Methods

(void) - activate
 
(void) - clearColorAndDepthContent
 
(void) - clearColorContent
 
(void) - clearDepthContent
 
(void) - clearStencilContent
 
(CGImageRef) - createCGImage
 
(CGImageRef) - createCGImageFrom:
 
(instancetype) - initOnSurface:
 
(void) - readColorContentFrom:into:
 
(void) - replaceColorPixels:withContent:
 
- Instance Methods inherited from CC3Identifiable
(void) - __deprecated
 
(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

(instancetype) + surfaceOnSurface:
 
- Class Methods inherited from CC3Identifiable
(GLint) + instanceCount
 
(void) + resetTagAllocation
 

Properties

id< CC3RenderSurfacebaseSurface
 
id< CC3RenderSurfaceAttachmentcolorAttachment
 
id< CC3RenderSurfaceAttachmentdepthAttachment
 
BOOL isFullCoverage
 
BOOL isOnScreen
 
CC3IntPoint origin
 
CC3IntSize size
 
id< CC3RenderSurfaceAttachmentstencilAttachment
 
CC3Viewport viewport
 
- Properties inherited from CC3Identifiable
NSObject *sharedUserData __deprecated
 
NSString * name
 
NSString * nameSuffix
 
GLint podIndex
 
BOOL shouldIncludeInDeepCopy
 
GLuint tag
 
NSObject * userData
 
- Properties inherited from <CC3Cacheable>
NSString * name
 
- Properties inherited from <CC3RenderSurface>
id< CC3RenderSurfaceAttachmentcolorAttachment
 
id< CC3RenderSurfaceAttachmentdepthAttachment
 
BOOL isFullCoverage
 
BOOL isOnScreen
 
CC3IntSize size
 
id< CC3RenderSurfaceAttachmentstencilAttachment
 
CC3Viewport viewport
 

Detailed Description

CC3SurfaceSection is a surface that is a section of another underlying base surface.

As a surface, the surface section uses the attachments of the base surface, and all rendering activities performed on the surface section will be passed along to the base surface.

The size of the surface section can be set to a value different from the size of the base surface, and rendering to the surface section will be restricted to this size on the base surface. In addition, a surface section supports a origin property. The combination of the origin and size properties constrains all rendering activity to a rectangle somewhere on the base surface, as described by the viewport property of the surface section.

Method Documentation

- (void) activate

Activates this surface in the GL engine.

If the isFullCoverage property returns NO, this method applies a scissor function to the GL engine, so that subsequent GL activity while this surface is active will be constrained to the viewport of this surface.

Reimplemented from <CC3RenderSurface>.

- (void) clearColorAndDepthContent

Clears the color and depth content of the base surface, within the bounds of the viewport of this instance.

Reimplemented from <CC3RenderSurface>.

- (void) clearColorContent

Clears the color content of the base surface, within the bounds of the viewport of this instance.

Reimplemented from <CC3RenderSurface>.

- (void) clearDepthContent

Clears the depth content of the base surface, within the bounds of the viewport of this instance.

Reimplemented from <CC3RenderSurface>.

- (void) clearStencilContent

Clears the stencil content of the base surface, within the bounds of the viewport of this instance.

Reimplemented from <CC3RenderSurface>.

- (CGImageRef) createCGImage

Returns a newly created CGImageRef from the contents of this surface.

The size of the returned image will be the same as the size of this surface.

You are responsible for releasing the returned image by calling the CGImageRelease function.

Reimplemented from <CC3RenderSurface>.

- (CGImageRef) createCGImageFrom: (CC3Viewport rect

Returns a newly created CGImageRef from the contents of this surface that are contained within the specified rectangle.

The size of the returned image will be the same as the size of the rectangle.

The rectangle is first offset by the origin of this surface section.

You are responsible for releasing the returned image by calling the CGImageRelease function.

Reimplemented from <CC3RenderSurface>.

- (instancetype) initOnSurface: (id< CC3RenderSurface >)  baseSurface

Initializes this instance as a section of the specified surface.

The initial size of this instance will be set to that of the specified surface.

- (void) readColorContentFrom: (CC3Viewport rect
into: (ccColor4B *)  colorArray 

Reads the content of the range of pixels defined by the specified rectangle from the color attachment of the base surface, into the specified array, which must be large enough to accommodate the number of pixels covered by the specified rectangle.

The rectangle is first offset by the origin of this surface section.

Content is written to the specified array left to right across each row, starting at the row at the bottom of the image, and ending at the row at the top of the image. The pixel content is packed tightly into the specified array, with no gaps left at the end of each row. The last pixel of one row is immediately followed by the first pixel of the next row.

This surface does not have to be the active surface to invoke this method. If this surface is not the active surface, it will temporarily be made active, and when pixel reading has finished, the currently active surface will be restored. This allows color to be read from one surface while rendering to another surface.

Not all surfaces have readable color content. In particular, content cannot be read from some system framebuffers.

This method should be used with care, since it involves making a synchronous call to query the state of the GL engine. This method will not return until the GL engine has executed all previous drawing commands in the pipeline. Excessive use of this method will reduce GL throughput and performance.

Reimplemented from <CC3RenderSurface>.

- (void) replaceColorPixels: (CC3Viewport rect
withContent: (ccColor4B *)  colorArray 

If the colorAttachment of the base surface supports pixel replacement, replaces a portion of the content of the color attachment by writing the specified array of pixels into the specified rectangular area within the attachment, The specified content replaces the pixel data within the specified rectangle.

The specified content array must be large enough to contain content for the number of pixels in the specified rectangle.

The rectangle is first offset by the origin of this surface section.

Not all color attachments support pixel replacement. In particular, pixel replacement is available only for color attachments whose content is provided by an underlying texture. If the color attachment does not support pixel replacement, this method will do nothing.

Content is read from the specified array left to right across each row of pixels within the specified image rectangle, starting at the row at the bottom of the rectangle, and ending at the row at the top of the rectangle.

Within the specified array, the pixel content should be packed tightly, with no gaps left at the end of each row. The last pixel of one row should immediately be followed by the first pixel of the next row.

The pixels in the specified array are in standard 32-bit RGBA. If the format of the underlying storage does not match this format, the specified array will be converted to the format of the underlying storage before being inserted. Be aware that this conversion will reduce the performance of this method. For maximum performance, match the format of the underlying storage to the 32-bit RGBA format of the specified array. However, keep in mind that the 32-bit RGBA format consumes more memory than most other formats, so if performance is of lesser concern, you may choose to minimize the memory requirements of this texture by choosing a more memory efficient storage format.

Reimplemented from <CC3RenderSurface>.

+ (instancetype) surfaceOnSurface: (id< CC3RenderSurface >)  baseSurface

Allocates and initializes an instance as a section of the specified surface.

The initial size of the returned instance will be set to that of the specified surface.

Property Documentation

- (id<CC3RenderSurface>) baseSurface
readwritenonatomicretain

The base surface of which this surface is a part.

Activating this surface activates the base surface, and all rendering occurs on the base surface, within the viewport defined by the viewport of this surface.

If the size property of this surface has not been set when this property is set, the size property of this instance will be set to that of the base surface. However, once set, the size property is not changed if this property is changed. This allows the base surface to be changed, while retaining a defined viewport through the size and origin properties.

- (id<CC3RenderSurfaceAttachment>) colorAttachment
readwritenonatomicretain

The surface attachment to which color data is rendered.

Returns the value of the same property on the baseSurface. Setting the value of this property has no effect.

- (id<CC3RenderSurfaceAttachment>) depthAttachment
readwritenonatomicretain

The surface attachment to which depth data is rendered.

Returns the value of the same property on the baseSurface. Setting the value of this property has no effect.

- (BOOL) isFullCoverage
readnonatomicassign

Returns whether this surface section covers the entire base surface.

Returns YES if the same property on the base surface returns YES, the origin property is zero, and the size property of this section is equal to the size property of the base surface.

- (BOOL) isOnScreen
readwritenonatomicassign

Returns whether this surface is an on-screen surface.

Returns the value of the same property on the baseSurface. Setting the value of this property has no effect.

- (CC3IntPoint) origin
readwritenonatomicassign

The origin of this surface section, relative to the base surface.

Changing the value of this property changes the value returned by the viewport property, which causes rendering to occur only within the section of the base surface defined by the viewport property.

The initial value of this property is zero.

- (CC3IntSize) size
readwritenonatomicassign

The size of this surface in pixels.

Changing the value of this property does not affect the size of any attachments. Instead, changing the value of this property changes the value returned by the viewport property, which causes rendering to occur only within the section of the base surface defined by the viewport property.

The initial value of this property is the size of the base surface at the time the baseSurface property is set for the first time.

- (id<CC3RenderSurfaceAttachment>) stencilAttachment
readwritenonatomicretain

The surface attachment to which stencil data is rendered.

Returns the value of the same property on the baseSurface. Setting the value of this property has no effect.

- (CC3Viewport) viewport
readnonatomicassign

Returns a viewport whose origin is at the point specified by the origin property, and whose width and height match the size property.

Initially, this property will return a viewport that covers the entire baseSurface. Changing the origin and size properties of this instance will change the value returned by this property.


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