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

#import <CC3Texture.h>

Inheritance diagram for CC3TextureCube:
Inheritance graph
[legend]

Instance Methods

(void) - loadCubeFace:fromCGImage:
 
(BOOL) - loadCubeFace:fromFile:
 
(BOOL) - loadFromFilePattern:
 
(BOOL) - loadFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(void) - replacePixels:inCubeFace:withContent:
 
- Instance Methods inherited from CC3Texture
(CCTexture *) - __deprecated
 
(NSString *) - constructorDescription
 
(void) - drawWithVisitor:
 
(void) - generateMipmap
 
(id) - initCubeColoredForAxes
 
(id) - initCubeFromFilePattern:
 
(id) - initCubeFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(id) - initCubeWithPixelFormat:andPixelType:
 
(id) - initCubeWithPixelFormat:withPixelType:
 
(id) - initCubeWithSideLength:withPixelFormat:withPixelType:
 
(id) - initCubeWithSize:andPixelFormat:andPixelType:
 
(id) - initFromFile:
 
(id) - initWithCCTexture:
 
(id) - initWithCGImage:
 
(id) - initWithPixelFormat:andPixelType:
 
(id) - initWithPixelFormat:withPixelType:
 
(id) - initWithSize:andPixelFormat:andPixelType:
 
(id) - initWithSize:withColor:
 
(id) - initWithSize:withPixelFormat:withPixelType:
 
(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

(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) + setShouldCacheAssociatedCCTextures:
 
(void) + setShouldGenerateMipmaps:
 
(BOOL) + shouldCacheAssociatedCCTextures
 
(BOOL) + shouldGenerateMipmaps
 
(id) + textureCubeColoredForAxes
 
(id) + textureCubeFromFilePattern:
 
(id) + textureCubeFromFilesPosX:negX:posY:negY:posZ:negZ:
 
(id) + textureCubeWithPixelFormat:andPixelType:
 
(id) + textureCubeWithPixelFormat:withPixelType:
 
(id) + textureCubeWithSideLength:withPixelFormat:withPixelType:
 
(id) + textureCubeWithSize:andPixelFormat:andPixelType:
 
(id) + textureFromFile:
 
(NSString *) + textureNameFromFilePath:
 
(id) + textureWithCCTexture:
 
(id) + textureWithCGImage:
 
(id) + textureWithPixelFormat:andPixelType:
 
(id) + textureWithPixelFormat:withPixelType:
 
(id) + textureWithSize:andPixelFormat:andPixelType:
 
(id) + textureWithSize:withColor:
 
(id) + textureWithSize:withPixelFormat:withPixelType:
 
- Class Methods inherited from CC3Identifiable
(GLint) + instanceCount
 
(void) + resetTagAllocation
 

Additional Inherited Members

- Properties inherited from CC3Texture
CCTexture *ccTexture2D __deprecated
 
CCTexture * ccTexture
 
CGSize coverage
 
BOOL hasAlpha
 
BOOL hasMipmap
 
BOOL hasPremultipliedAlpha
 
GLenum horizontalWrappingFunction
 
GLenum initialAttachmentFace
 
BOOL isBumpMap
 
BOOL isPOT
 
BOOL isPOTHeight
 
BOOL isPOTWidth
 
BOOL isTexture2D
 
BOOL isTextureCube
 
BOOL isUpsideDown
 
CC3Vector lightDirection
 
GLenum magnifyingFunction
 
GLenum minifyingFunction
 
GLenum pixelFormat
 
GLenum pixelType
 
GLenum samplerSemantic
 
BOOL shouldFlipHorizontallyOnLoad
 
BOOL shouldFlipVerticallyOnLoad
 
CC3IntSize size
 
CC3Texturetexture
 
GLuint textureID
 
ccTexParams textureParameters
 
GLenum textureTarget
 
CC3TextureUnittextureUnit
 
GLenum verticalWrappingFunction
 

Detailed Description

The representation of a 3D cube-map texture loaded into the GL engine.

This class is used for all cube-map texture types except PVR.

This class is part of a class-cluster under the parent CC3Texture class. Although you can invoke an instance creation method on this class directly, you will more commonly invoke them on the CC3Texture class instead. The creation and initialization methods will ensure that the correct subclass for the texture type, and in some cases, the texture file type, is created and returned. Because of this class-cluster structure, be aware that the class of the instance returned by an instance creation or initialization method may be different than the receiver of that method.

Method Documentation

+ (BOOL) defaultShouldFlipHorizontallyOnLoad

This class-side property determines the initial value of the shouldFlipHorizontallyOnLoad for instances of this class.

The initial value for cube-map textures is YES, indicating that the texture will be flipped horizontally. This is because cube-mapped textures need to be stored in GL memory rotated by 180 degrees (flipped both vertically and horizontally).

Implements CC3Texture.

+ (BOOL) defaultShouldFlipVerticallyOnLoad

This class-side property determines the initial value of the shouldFlipVerticallyOnLoad for instances of this class.

The initial value for cube-map textures is NO, indicating that a cube-map texture that has been loaded in upsdide-down will be left upside-down. This is because cube-mapped textures need to be stored in GL memory rotated by 180 degrees (flipped both vertically and horizontally).

Implements CC3Texture.

- (void) loadCubeFace: (GLenum)  faceTarget
fromCGImage: (CGImageRef)  cgImg 

Loads the specified image into the specified cube face target.

The specified cube face target can be one of the following:

  • GL_TEXTURE_CUBE_MAP_POSITIVE_X
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_X
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Y
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Z
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

In order to complete this cube texture, this method should be invoked once for each of these six face targets.

This method does not automatically generate a mipmap. If you want a mipmap, you should invoke the generateMipmap method once all six faces have been loaded.

- (BOOL) loadCubeFace: (GLenum)  faceTarget
fromFile: (NSString *)  filePath 

Loads the texture file at the specified file path into the specified cube face target, and returns whether the loading was successful.

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.

The specified cube face target can be one of the following:

  • GL_TEXTURE_CUBE_MAP_POSITIVE_X
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_X
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Y
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Z
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

In order to complete this cube texture, this method should be invoked once for each of these six face targets.

If this instance has not been assigned a name, it is set to the unqualified file name from the specified file path.

This method does not automatically generate a mipmap. If you want a mipmap, you should invoke the generateMipmap method once all six faces have been loaded.

- (BOOL) loadFromFilePattern: (NSString *)  aFilePathPattern

Loads the six cube face textures using the specified pattern string as a string format template to derive the names of the six textures, and returns whether all six files were successfully loaded.

If the class-side shouldGenerateMipmaps property is set to YES, a mipmap will be generated for the texture automatically.

If the instance is instantiated via initFromFilePattern: or textureFromFilePattern:, this method is invoked automatically during instance initialization. If the instance is instantiated without using one of those file-loading initializers, this method can be invoked directly to load the files.

This method expects the six required files to have identical paths and names, except that each should contain one of the following character substrings in the same place in each file path: "PosX", "NegX", "PosY", "NegY", "PosZ", "NegZ".

The specified file path pattern should include one standard NSString format marker %@ at the point where one of the substrings in the list above should be substituted.

As an example, the file path pattern MyCubeTex%png would be expanded by this method to load the following six textures:

  • MyCubeTexPosX.png
  • MyCubeTexNegX.png
  • MyCubeTexPosY.png
  • MyCubeTexNegY.png
  • MyCubeTexPosZ.png
  • MyCubeTexNegZ.png

The format marker can occur anywhere in the file name. It does not need to occur at the end as in this example.

The specified file path pattern 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 pattern can simply be the file name pattern.

If this instance has not been assigned a name, it is set to the unqualified file name derived from substituting an empty string into the format marker in the specified file path pattern string.

- (BOOL) loadFromFilesPosX: (NSString *)  posXFilePath
negX: (NSString *)  negXFilePath
posY: (NSString *)  posYFilePath
negY: (NSString *)  negYFilePath
posZ: (NSString *)  posZFilePath
negZ: (NSString *)  negZFilePath 

Loads the six cube face textures at the specified file paths, and returns whether all six files were successfully loaded.

If this instance has not been assigned a name, it is set to the unqualified file name of the specified posXFilePath file path.

If the class-side shouldGenerateMipmaps property is set to YES, a mipmap will be generated for the texture automatically.

If the instance is instantiated via initFromFilesPosX:negX:posY:negY:posZ:negZ: or textureFromFilesPosX:negX:posY:negY:posZ:negZ:, this method is invoked automatically during instance initialization. If the instance is instantiated without using one of those file-loading initializers, this method can be invoked directly to load the files.

Each of the specified file paths 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 corresponding file path can simply be the name of the file.

- (void) replacePixels: (CC3Viewport rect
inCubeFace: (GLenum)  faceTarget
withContent: (ccColor4B *)  colorArray 

Replaces a portion of the content of this texture by writing the specified array of pixels into the specified rectangular area within the specified face of this texture, The specified content replaces the texture 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 specified cube face target can be one of the following:

  • GL_TEXTURE_CUBE_MAP_POSITIVE_X
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_X
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Y
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Z
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

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 pixelFormat and pixelType properties of this texture are not GL_RGBA and GL_UNSIGNED_BYTE, respectively, the pixels in the specified array will be converted to the format and type of this texture before being inserted into the texture. Be aware that this conversion will reduce the performance of this method. For maximum performance, match the format and type of this texture to the 32-bit RGBA format of the specified array, by setting the pixelFormat property to GL_RGBA and the pixelType property to GL_UNSIGNED_BYTE. 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 setting the pixelFormat and pixelType properties to values that consume less memory.

If this texture has mipmaps, they are not automatically updated. Once all desired content has been replaced, invoke the generateMipmap method to regenerate the mipmaps.

+ (void) setDefaultShouldFlipHorizontallyOnLoad: (BOOL)  shouldFlip

This class-side property determines the initial value of the shouldFlipHorizontallyOnLoad for instances of this class.

The initial value for cube-map textures is YES, indicating that the texture will be flipped horizontally. This is because cube-mapped textures need to be stored in GL memory rotated by 180 degrees (flipped both vertically and horizontally).

Implements CC3Texture.

+ (void) setDefaultShouldFlipVerticallyOnLoad: (BOOL)  shouldFlip

This class-side property determines the initial value of the shouldFlipVerticallyOnLoad for instances of this class.

The initial value for cube-map textures is NO, indicating that a cube-map texture that has been loaded in upsdide-down will be left upside-down. This is because cube-mapped textures need to be stored in GL memory rotated by 180 degrees (flipped both vertically and horizontally).

Implements CC3Texture.


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