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

#import <CC3Texture.h>

Inheritance diagram for CC3Texture2DContent:
Inheritance graph
[legend]

Instance Methods

(void) - deleteImageData
 
(void) - flipHorizontally
 
(void) - flipVertically
 
(id) - initFromCC3Texture:
 
(id) - initFromFile:
 
(id) - initWithCGImage:
 
(id) - initWithSize:andPixelFormat:andPixelType:
 
(void) - resizeTo:
 
(void) - rotateHalfCircle
 

Class Methods

(id) + textureFromCC3Texture:
 

Properties

GLuint bytesPerPixel
 
BOOL hasAlpha
 
const GLvoid * imageData
 
BOOL isUpsideDown
 
GLuint name
 
GLenum pixelGLFormat
 
GLenum pixelGLType
 

Detailed Description

A CCTexture2D subclass used by the CC3Texture class cluster during the loading of a 2D texture, and when extracting a CCTexture2D from the CC3Texture ccTexture2D property.

PVR texture files cannot be loaded using this class.

Method Documentation

- (void) deleteImageData

Deletes the texture content from main memory.

This should be invoked once the texture is bound to the GL engine.

- (void) flipHorizontally

Flips this texture horizontally.

- (void) flipVertically

Flips this texture vertically, to compensate for the opposite orientation of vertical graphical coordinates between OpenGL and iOS & OSX.

The value of the isUpsideDown property is toggled after flipping.

- (id) initFromCC3Texture: (CC3Texture *)  texture

Initializes this instance to represent the same GL texture as the specified CC3Texture.

- (id) initFromFile: (NSString *)  aFilePath

Initializes this instance with content loaded from the specified file.

The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.

Returns nil if the file could not be loaded.

The value of the isUpsideDown is set to YES.

- (id) initWithCGImage: (CGImageRef)  cgImg

Initializes this instance from the content in the specified CGImage.

The value of the isUpsideDown is set to YES.

- (id) initWithSize: (CC3IntSize size
andPixelFormat: (GLenum)  format
andPixelType: (GLenum)  type 

Initializes this instance to define the properties of a texture, without defining any specific content.

This instance can be used to initialize an empty CC3Texture, to which content can be added later.

The value of the isUpsideDown is set to NO.

- (void) resizeTo: (CC3IntSize size

Resizes this texture to the specified dimensions.

This method changes the values of the size, width, height, maxS & maxT properties, but does not make any changes to the texture within the GL engine. This method is invoked during the resizing of a texture that backs a surface.

- (void) rotateHalfCircle

Rotates the image by 180 degrees.

This is equivalent to combined vertical and horizontal flips, but is executed in one pass for efficiency.

The value of the isUpsideDown property is toggled after rotating.

+ (id) textureFromCC3Texture: (CC3Texture *)  texture

Allocates and initializes an instance to represent the same GL texture as the specified CC3Texture.

Property Documentation

- (GLuint) bytesPerPixel
readnonatomicassign

Returns the number of bytes in each pixel of content.

- (BOOL) hasAlpha
readnonatomicassign

Indicates whether this texture has an alpha channel, representing opacity.

The value of this property is derived from the value of the pixelGLFomat property.

- (const GLvoid*) imageData
readnonatomicassign

Returns a pointer to the texture image data.

- (BOOL) isUpsideDown
readnonatomicassign

Indicates whether this texture is upside-down.

The vertical axis of the coordinate system of OpenGL is inverted relative to the CoreGraphics view coordinate system. As a result, any texture content created from a CGImage will be upside down. This includes texture content loaded from a file by an instance of this class.

- (GLuint) name
readwritenonatomicassign

The texture ID used to identify this texture to the GL engine.

This implementation allows this property to be set, in order to permit an instance to be created from a CC3Texture.

- (GLenum) pixelGLFormat
readnonatomicassign

Returns the GL engine pixel format of the texture.

See the pixelFormat property of CC3Texture for the range of possible values.

- (GLenum) pixelGLType
readnonatomicassign

Returns the pixel data type.

Possible values depend on the value of the pixelFormat property. See the pixelType property of CC3Texture for the range of possible values.


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