2010-07-16 10:34:42 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCPVRTEXTURE_H__
|
|
|
|
#define __CCPVRTEXTURE_H__
|
|
|
|
|
2010-07-19 16:45:53 +08:00
|
|
|
#include <string>
|
|
|
|
|
2010-07-16 10:34:42 +08:00
|
|
|
//#import <UIKit/UIKit.h>
|
|
|
|
#include <GLES/gl.h>
|
|
|
|
#include <GLES/glext.h>
|
|
|
|
#include "Cocos2dDefine.h"
|
2010-08-04 16:45:00 +08:00
|
|
|
#include "NSObject.h"
|
|
|
|
#include "NSMutableArray.h"
|
2010-07-16 10:34:42 +08:00
|
|
|
|
2010-08-04 15:46:12 +08:00
|
|
|
namespace cocos2d {
|
2010-07-22 18:39:40 +08:00
|
|
|
class NSData;
|
2010-07-16 10:34:42 +08:00
|
|
|
|
|
|
|
class CCPVRTexture : public NSObject
|
|
|
|
{
|
|
|
|
protected:
|
2010-07-28 11:29:13 +08:00
|
|
|
NSMutableArray<NSData*> * m_pImageData;
|
2010-07-16 10:34:42 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CCPVRTexture();
|
2010-08-06 16:05:19 +08:00
|
|
|
virtual ~CCPVRTexture();
|
2010-07-16 10:34:42 +08:00
|
|
|
|
2010-07-22 11:15:25 +08:00
|
|
|
CCPVRTexture * initWithContentsOfFile(const char* path);
|
2010-07-16 10:34:42 +08:00
|
|
|
/// @todo CCPVRTexture * initWithContentsOfURL(NSURL *url);
|
2010-07-22 11:15:25 +08:00
|
|
|
static CCPVRTexture * pvrTextureWithContentsOfFile(const char* path);
|
2010-07-16 10:34:42 +08:00
|
|
|
/// @todo static CCPVRTexture * pvrTextureWithContentsOfURL(NSURL *url);
|
|
|
|
|
|
|
|
CCX_PROPERTY_READONLY(GLuint, m_uName, Name)
|
2010-08-25 11:38:08 +08:00
|
|
|
CCX_PROPERTY_READONLY(unsigned int, m_uWidth, Width)
|
|
|
|
CCX_PROPERTY_READONLY(unsigned int, m_uHeight, Height)
|
2010-07-16 10:34:42 +08:00
|
|
|
CCX_PROPERTY_READONLY(GLenum, m_uInternalFormat, InternalFormat)
|
|
|
|
CCX_PROPERTY_READONLY(bool, m_bHasAlpha, HasAlpha)
|
|
|
|
|
|
|
|
// cocos2d integration
|
|
|
|
CCX_PROPERTY(bool, m_bRetainName, RetainName);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool unpackPVRData(NSData *data);
|
|
|
|
bool createGLTexture();
|
|
|
|
};
|
2010-08-04 15:46:12 +08:00
|
|
|
}//namespace cocos2d
|
2010-07-16 10:34:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif //__CCPVRTEXTURE_H__
|
|
|
|
|
|
|
|
|