#import <CC3Texture.h>
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 |
CC3Texture * | texture |
GLuint | textureID |
ccTexParams | textureParameters |
GLenum | textureTarget |
CC3TextureUnit * | textureUnit |
GLenum | verticalWrappingFunction |
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.
+ (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:
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:
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:
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:
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.