cocos2d-x 动画详解之零 基础CCTexture2D,CCTextureAtlas,CCTextureCache
2012-03-06 16:37
417 查看
CCTexture2D class.
This class allows to easily create OpenGL 2D textures from images, text or raw data. The created CCTexture2D object will always have power-of-two dimensions. Depending on how you create the CCTexture2D object, the actual image area of the texture might be smaller than the texture dimensions i.e. "contentSize" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0). Be aware that the content of the generated textures will be upside-down!
CCTexture2D 通过图片 文本 和 数据生成OpenGL 2D纹理。
拥有俩个尺寸
CCTextureAtlas
A class that implements a Texture Atlas.
Supported features: The atlas file can be a PVRTC, PNG or any other fomrat supported by Texture2D Quads can be udpated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
TextureAtlas
(以下内容是:cocoachina的猪头解释的,原贴在:http://www.cocoachina.com/bbs/read.php?tid-8261.html)
供AtlasSpriteManager与AtlasSprite的材质类
从Texture2D继承而来,在其基础上增加了一个非常重要的成员变量
ccV3F_C4B_T2F_Quad * quads
实际上AtlasSprite相比Sprite能快更得进行大批量渲染也是因为这个
TextureAtlas维护了一个ccV3F_C4B_T2F_Quad数组,使用一张texture进行batch render
其他与Texture2d没什么不同
这个过程是这样的:
1.首先是AtlasSpriteManager使用一张TextureAtlas初始化,并设定Quad数组的长度
2.往AtlasSpriteManager加入AtlasSprite,这个加入的过程其实只是往AtlasSpriteManager的Quad数组中更新一个Quad
3.渲染的时候 使用一张Texture根据Quad数组中的不同值一个个渲染
支持的特征有:
1、地图集文件可以是PVRTC PNG 或者其他Texture2D支持的格式;
2、四边形可以在运行期间被添加、移除、重新排序
3、TextureAtlas 的capacity(包括ccV3F_C4B_T2F_Quad数组的容器)能够在运行期被增加或减少
4、OpenGL的组件:V3F,C4B,T2F
呈现的四边形是使用OpenGL ES的交错的顶点数组列表
CCTextureCache Class
Singleton that handles the loading of textures Once the texture is loaded, the next time it will return a reference of the previously loaded texture reducing GPU & CPU memory.
可以理解为texture的缓存集合
CCTexture2D->CCTextureAtlas
CCTextureCache 包含CCTexture2D and CCTextureAtlas
This class allows to easily create OpenGL 2D textures from images, text or raw data. The created CCTexture2D object will always have power-of-two dimensions. Depending on how you create the CCTexture2D object, the actual image area of the texture might be smaller than the texture dimensions i.e. "contentSize" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0). Be aware that the content of the generated textures will be upside-down!
CCTexture2D 通过图片 文本 和 数据生成OpenGL 2D纹理。
拥有俩个尺寸
CCTextureAtlas
A class that implements a Texture Atlas.
Supported features: The atlas file can be a PVRTC, PNG or any other fomrat supported by Texture2D Quads can be udpated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
TextureAtlas
(以下内容是:cocoachina的猪头解释的,原贴在:http://www.cocoachina.com/bbs/read.php?tid-8261.html)
供AtlasSpriteManager与AtlasSprite的材质类
从Texture2D继承而来,在其基础上增加了一个非常重要的成员变量
ccV3F_C4B_T2F_Quad * quads
实际上AtlasSprite相比Sprite能快更得进行大批量渲染也是因为这个
TextureAtlas维护了一个ccV3F_C4B_T2F_Quad数组,使用一张texture进行batch render
其他与Texture2d没什么不同
这个过程是这样的:
1.首先是AtlasSpriteManager使用一张TextureAtlas初始化,并设定Quad数组的长度
2.往AtlasSpriteManager加入AtlasSprite,这个加入的过程其实只是往AtlasSpriteManager的Quad数组中更新一个Quad
3.渲染的时候 使用一张Texture根据Quad数组中的不同值一个个渲染
支持的特征有:
1、地图集文件可以是PVRTC PNG 或者其他Texture2D支持的格式;
2、四边形可以在运行期间被添加、移除、重新排序
3、TextureAtlas 的capacity(包括ccV3F_C4B_T2F_Quad数组的容器)能够在运行期被增加或减少
4、OpenGL的组件:V3F,C4B,T2F
呈现的四边形是使用OpenGL ES的交错的顶点数组列表
CCTextureCache Class
Singleton that handles the loading of textures Once the texture is loaded, the next time it will return a reference of the previously loaded texture reducing GPU & CPU memory.
可以理解为texture的缓存集合
CCTexture2D->CCTextureAtlas
CCTextureCache 包含CCTexture2D and CCTextureAtlas
相关文章推荐
- cocos2d-x 详解之 CCTexture2D(纹理图片)和 CCTextureCache(纹理缓存)
- cocos2d-x 详解之 CCTexture2D(纹理图片)和 CCTextureCache(纹理缓存)
- CCSpriteBatchNode和CCTextureAtlas 详解-沈大海cocos2d-x教程21
- 使用CCAnimate、CCAnimation、CCTextureCache、CCTexture2D来实现动画效果
- CCTexture2D、CCTexturePVR、CCTextureCache、CCTextureAtlas
- cocos2d-x中CCTextureCache图片资源的异步加载
- cocos2d-x学习笔记(14)--CCTextureCache
- cocos2d-x 学习: CCTextureAtlas 简介
- CCTexture2D CCSpriteBatchNode CCTextureCache CCSpriteFrameCache 分析
- cocos2d-x 之 CCTextureAtlas 简介
- 缓存与预加载技术(图片缓存CCSpriteFrameCache、动画缓存 CCAnimationCache、纹理缓存CCTextureCache、音乐音效SimpleAudioEngine)
- Cocos2D-x , CCTextureCache的多线程加载原理和使用方法
- cocos2d-x中的缓存CCTextureCache、CCSPriteFrameCache、CCAnimationCache
- cocos2d-x中CCTextureCache图片资源的异步加载
- cocos2d-x中CCTextureCache图片资源的异步加载<转>
- CCTexture2D、CCTextureAtlas、CCSprite及CCSpriteBatchNode
- cocos2d-x 2.2.3 CCTextureCache的addImage简单分析
- cocos2d-x之CCTextureCache 用法总结
- CCSpriteBatchNode 和 CCTextureAtlas 详解
- cocos2d-x节点(CCTextureCache.h)API