summary refs log tree commit diff stats
path: root/libs/cocos2d/CCTexturePVR.h
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
committerStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
commit9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch)
tree5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/CCTexturePVR.h
downloadcartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCTexturePVR.h')
-rwxr-xr-xlibs/cocos2d/CCTexturePVR.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/libs/cocos2d/CCTexturePVR.h b/libs/cocos2d/CCTexturePVR.h new file mode 100755 index 0000000..66f8286 --- /dev/null +++ b/libs/cocos2d/CCTexturePVR.h
@@ -0,0 +1,127 @@
1/*
2
3File: PVRTexture.h
4Abstract: The PVRTexture class is responsible for loading .pvr files.
5
6Version: 1.0
7
8Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
9("Apple") in consideration of your agreement to the following terms, and your
10use, installation, modification or redistribution of this Apple software
11constitutes acceptance of these terms. If you do not agree with these terms,
12please do not use, install, modify or redistribute this Apple software.
13
14In consideration of your agreement to abide by the following terms, and subject
15to these terms, Apple grants you a personal, non-exclusive license, under
16Apple's copyrights in this original Apple software (the "Apple Software"), to
17use, reproduce, modify and redistribute the Apple Software, with or without
18modifications, in source and/or binary forms; provided that if you redistribute
19the Apple Software in its entirety and without modifications, you must retain
20this notice and the following text and disclaimers in all such redistributions
21of the Apple Software.
22Neither the name, trademarks, service marks or logos of Apple Inc. may be used
23to endorse or promote products derived from the Apple Software without specific
24prior written permission from Apple. Except as expressly stated in this notice,
25no other rights or licenses, express or implied, are granted by Apple herein,
26including but not limited to any patent rights that may be infringed by your
27derivative works or by other works in which the Apple Software may be
28incorporated.
29
30The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
31WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
32WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
34COMBINATION WITH YOUR PRODUCTS.
35
36IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
37CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
40DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
41CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
42APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44Copyright (C) 2008 Apple Inc. All Rights Reserved.
45
46*/
47
48#import <Foundation/Foundation.h>
49
50#import "Platforms/CCGL.h"
51#import "CCTexture2D.h"
52
53
54#pragma mark -
55#pragma mark CCTexturePVR
56
57struct CCPVRMipmap {
58 unsigned char *address;
59 unsigned int len;
60};
61
62enum {
63 CC_PVRMIPMAP_MAX = 16,
64};
65
66/** CCTexturePVR
67
68 Object that loads PVR images.
69
70 Supported PVR formats:
71 - RGBA8888
72 - BGRA8888
73 - RGBA4444
74 - RGBA5551
75 - RGB565
76 - A8
77 - I8
78 - AI88
79 - PVRTC 4BPP
80 - PVRTC 2BPP
81
82 Limitations:
83 Pre-generated mipmaps, such as PVR textures with mipmap levels embedded in file,
84 are only supported if all individual sprites are of _square_ size.
85 To use mipmaps with non-square textures, instead call CCTexture2D#generateMipmap on the sheet texture itself
86 (and to save space, save the PVR sprite sheet without mip maps included).
87 */
88@interface CCTexturePVR : NSObject
89{
90 struct CCPVRMipmap mipmaps_[CC_PVRMIPMAP_MAX]; // pointer to mipmap images
91 int numberOfMipmaps_; // number of mipmap used
92
93 unsigned int tableFormatIndex_;
94 uint32_t width_, height_;
95 GLuint name_;
96 BOOL hasAlpha_;
97
98 // cocos2d integration
99 BOOL retainName_;
100 CCTexture2DPixelFormat format_;
101}
102
103/** initializes a CCTexturePVR with a path */
104- (id)initWithContentsOfFile:(NSString *)path;
105/** initializes a CCTexturePVR with an URL */
106- (id)initWithContentsOfURL:(NSURL *)url;
107/** creates and initializes a CCTexturePVR with a path */
108+ (id)pvrTextureWithContentsOfFile:(NSString *)path;
109/** creates and initializes a CCTexturePVR with an URL */
110+ (id)pvrTextureWithContentsOfURL:(NSURL *)url;
111
112/** texture id name */
113@property (nonatomic,readonly) GLuint name;
114/** texture width */
115@property (nonatomic,readonly) uint32_t width;
116/** texture height */
117@property (nonatomic,readonly) uint32_t height;
118/** whether or not the texture has alpha */
119@property (nonatomic,readonly) BOOL hasAlpha;
120
121// cocos2d integration
122@property (nonatomic,readwrite) BOOL retainName;
123@property (nonatomic,readonly) CCTexture2DPixelFormat format;
124
125@end
126
127