Each instanc of CC3Texture wraps a cocos2d CCTexture2D instance, and manages applying that texture to the GL engine.
#import <CC3Texture.h>
Public Member Functions | |
(void) | - draw |
(id) | - initFromFile: |
(id) | - initWithName:fromFile: |
(id) | - initWithTag:fromFile: |
(id) | - initWithTag:withName:fromFile: |
(void) | - unbind |
Static Public Member Functions | |
(id) | + textureFromFile: |
(id) | + textureWithName:fromFile: |
(id) | + textureWithTag:fromFile: |
(id) | + textureWithTag:withName:fromFile: |
(void) | + unbind |
Properties | |
ccTex2F | mapSize |
CCTexture2D * | texture |
GLenum | textureChannel |
ccTexParams | textureParameters |
- (void) draw |
If the texture property is not nil, binds this texture to the GL engine, in the texture channel indicated by the textureChannel property.
If the texture property is nil, invokes the unbind method to disable texture handling in the GL engine.
- (id) initFromFile: | (NSString *) | aFileName |
Initializes this unnamed instance with an automatically generated unique tag value.
The tag value will be generated automatically via the method nextTag. The texture file with the specified fileName will be loaded into the texture property.
- (id) initWithName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFileName | |
Initializes this instance with the specified name and an automatically generated unique tag value.
The tag value will be generated automatically via the method nextTag. The texture file with the specified fileName will be loaded into the texture property.
- (id) initWithTag: | (GLuint) | aTag | |
fromFile: | (NSString *) | aFileName | |
Initializes this unnamed instance with the specified tag.
The texture file with the specified fileName will be loaded into the texture property.
- (id) initWithTag: | (GLuint) | aTag | |
withName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFileName | |
Initializes this instance with the specified tag and name.
The texture file with the specified fileName will be loaded into the texture property.
- (BOOL) loadTextureFile: | (NSString *) | aFileName |
Loads the specified texture file into the texture property, and returns whether the loading was successful.
+ (id) textureFromFile: | (NSString *) | aFileName |
Allocates and initializes an autoreleased unnamed instance with an automatically generated unique tag value.
The tag value is generated using a call to nextTag. The texture file with the specified fileName will be loaded into the texture property.
+ (id) textureWithName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFileName | |
Allocates and initializes an autoreleased instance with the specified name and an automatically generated unique tag value.
The tag value is generated using a call to nextTag. The texture file with the specified fileName will be loaded into the texture property.
+ (id) textureWithTag: | (GLuint) | aTag | |
fromFile: | (NSString *) | aFileName | |
Allocates and initializes an unnamed autoreleased instance with the specified tag.
The texture file with the specified fileName will be loaded into the texture property.
+ (id) textureWithTag: | (GLuint) | aTag | |
withName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFileName | |
Allocates and initializes an autoreleased instance with the specified tag and name.
The texture file with the specified fileName will be loaded into the texture property.
- (void) unbind |
Convenience method that simple delegates to the unbind class method.
+ (void) unbind |
Unbinds all textures from the GL engine by disabling texture handling in the GL engine.
- (ccTex2F) mapSize [read, assign] |
Returns the proportional size of the usable image in the contained CCTexture2D, relative to its physical size.
The physical size of most textures is some power-of-two (POT), whereas the usable image size is the actual portion of it that contains the image. The value returned by this method contains two fractional floats (u & v), each between zero and one, representing the proportional size of the usable image
As an example, an image whose dimensions are actually 320 x 480 pixels will result in a texture that is 512 x 512 pixels, and the mapSize returned by this method will be {0.625, 0.9375}, calculated from {320/512, 480/512}.
- (CCTexture2D *) texture [read, write, retain] |
The 2D texture being managed by this instance.
- (GLenum) textureChannel [read, write, assign] |
The index of the texture channel used to draw this texture to the GL engine.
More than one texture channel may be used when textures are to be overlaid on each other.
This value should be set to a number between zero and the maximum number of texture channels. The initial value of this property is zero.
The maximum number of texture channels available is determined by the platform. That number can be retrieved from [CC3OpenGLES11Engine engine].platform.maxTextureChannels.value. All platforms support at least two texture channels.
- (ccTexParams) textureParameters [read, write, assign] |
An set of texture parameters used to optimize the display of the contained texture in the GL engine.
The initial value of these parameters are: