Cocos2d-x  v3.8
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
TextureCube Class Reference

TextureCube is a collection of six separate square textures that are put onto the faces of an imaginary cube. More...

Inherits Texture2D.

Public Member Functions

void setTexParameters (const TexParams &)
 Sets the min filter, mag filter, wrap s and wrap t texture parameters. More...
 
bool reloadTexture ()
 reload texture cube after GLESContext reconstructed. More...
 
- Public Member Functions inherited from Texture2D
virtual std::string getDescription () const
 Get texutre name, dimensions and coordinates message by a string.
 
void releaseGLTexture ()
 Release only the gl texture.
 
bool initWithData (const void *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size &contentSize)
 Initializes with a texture2d with data. More...
 
bool initWithMipmaps (MipmapInfo *mipmaps, int mipmapsNum, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh)
 Initializes with mipmaps. More...
 
bool updateWithData (const void *data, int offsetX, int offsetY, int width, int height)
 Update with texture data. More...
 
void drawAtPoint (const Vec2 &point)
 Drawing extensions to make it easy to draw basic quads using a Texture2D object. More...
 
void drawInRect (const Rect &rect)
 Draws a texture inside a rect. More...
 
bool initWithImage (Image *image)
 Extensions to make it easy to create a Texture2D object from an image file. More...
 
bool initWithImage (Image *image, PixelFormat format)
 Initializes a texture from a UIImage object. More...
 
bool initWithString (const char *text, const std::string &fontName, float fontSize, const Size &dimensions=Size(0, 0), TextHAlignment hAlignment=TextHAlignment::CENTER, TextVAlignment vAlignment=TextVAlignment::TOP)
 Initializes a texture from a string with dimensions, alignment, font name and font size. More...
 
bool initWithString (const char *text, const FontDefinition &textDefinition)
 Initializes a texture from a string using a text definition. More...
 
void setTexParameters (const TexParams &texParams)
 Sets the min filter, mag filter, wrap s and wrap t texture parameters. More...
 
void setAntiAliasTexParameters ()
 Sets antialias texture parameters: More...
 
void setAliasTexParameters ()
 Sets alias texture parameters: More...
 
void generateMipmap ()
 Generates mipmap images for the texture. More...
 
const char * getStringForFormat () const
 Returns the pixel format. More...
 
unsigned int getBitsPerPixelForFormat () const
 Returns the bits-per-pixel of the in-memory OpenGL texture. More...
 
unsigned int getBitsPerPixelForFormat (Texture2D::PixelFormat format) const
 Helper functions that returns bits per pixels for a given format. More...
 
const Size & getContentSizeInPixels ()
 Get content size. More...
 
bool hasPremultipliedAlpha () const
 Whether or not the texture has their Alpha premultiplied. More...
 
bool hasMipmaps () const
 Whether or not the texture has mip maps. More...
 
Texture2D::PixelFormat getPixelFormat () const
 Gets the pixel format of the texture. More...
 
int getPixelsWide () const
 Gets the width of the texture in pixels. More...
 
int getPixelsHigh () const
 Gets the height of the texture in pixels. More...
 
GLuint getName () const
 Gets the texture name. More...
 
GLfloat getMaxS () const
 Gets max S. More...
 
void setMaxS (GLfloat maxS)
 Sets max S. More...
 
GLfloat getMaxT () const
 Gets max T. More...
 
void setMaxT (GLfloat maxT)
 Sets max T. More...
 
Size getContentSize () const
 Get the texture content size. More...
 
void setGLProgram (GLProgram *program)
 Set a shader program to the texture. More...
 
GLProgramgetGLProgram () const
 Get a shader program from the texture. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static TextureCubecreate (const std::string &positive_x, const std::string &negative_x, const std::string &positive_y, const std::string &negative_y, const std::string &positive_z, const std::string &negative_z)
 create cube texture from 6 textures. More...
 
- Static Public Member Functions inherited from Texture2D
static void setDefaultAlphaPixelFormat (Texture2D::PixelFormat format)
 sets the default pixel format for UIImagescontains alpha channel. More...
 
static Texture2D::PixelFormat getDefaultAlphaPixelFormat ()
 Returns the alpha pixel format. More...
 
static void PVRImagesHavePremultipliedAlpha (bool haveAlphaPremultiplied)
 Treats (or not) PVR files as if they have alpha premultiplied. More...
 
static const PixelFormatInfoMap & getPixelFormatInfoMap ()
 Get pixel info map, the key-value pairs is PixelFormat and PixelFormatInfo. More...
 

Protected Member Functions

 TextureCube ()
 Constructor.
 
virtual ~TextureCube ()
 Destructor.
 

Additional Inherited Members

- Public Types inherited from Texture2D
enum  PixelFormat {
  AUTO, BGRA8888, RGBA8888, RGB888,
  RGB565, A8, I8, AI88,
  RGBA4444, RGB5A1, PVRTC4, PVRTC4A,
  PVRTC2, PVRTC2A, ETC, S3TC_DXT1,
  S3TC_DXT3, S3TC_DXT5, ATC_RGB, ATC_EXPLICIT_ALPHA,
  ATC_INTERPOLATED_ALPHA, DEFAULT = AUTO
}
 Possible texture pixel formats. More...
 
- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 

Detailed Description

TextureCube is a collection of six separate square textures that are put onto the faces of an imaginary cube.

Member Function Documentation

static TextureCube* create ( const std::string &  positive_x,
const std::string &  negative_x,
const std::string &  positive_y,
const std::string &  negative_y,
const std::string &  positive_z,
const std::string &  negative_z 
)
static

create cube texture from 6 textures.

Parameters
positive_xtexture for the right side of the texture cube face.
negative_xtexture for the up side of the texture cube face.
positive_ytexture for the top side of the texture cube face
negative_ytexture for the bottom side of the texture cube face
positive_ztexture for the forward side of the texture cube face.
negative_ztexture for the rear side of the texture cube face.
Returns
A new texture cube inited with given parameters.
void setTexParameters ( const TexParams )

Sets the min filter, mag filter, wrap s and wrap t texture parameters.

If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.

bool reloadTexture ( )

reload texture cube after GLESContext reconstructed.


The documentation for this class was generated from the following file: