Cocos2d-x  v3.17
 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 texture 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...
 
var drawAtPoint ( var point)
 Drawing extensions to make it easy to draw basic quads using a Texture2D object. More...
 
local drawAtPoint ( local 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, bool enableWrap=true, int overflow=0)
 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...
 
var initWithString ( var text, var textDefinition)
 Initializes a texture from a string using a text definition. More...
 
local initWithString ( local text, local 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...
 
var setAntiAliasTexParameters ()
 Sets antialias texture parameters: More...
 
local setAntiAliasTexParameters ()
 Sets antialias texture parameters: More...
 
void setAliasTexParameters ()
 Sets alias texture parameters: More...
 
var setAliasTexParameters ()
 Sets alias texture parameters: More...
 
local setAliasTexParameters ()
 Sets alias texture parameters: More...
 
void generateMipmap ()
 Generates mipmap images for the texture. More...
 
var generateMipmap ()
 Generates mipmap images for the texture. More...
 
local generateMipmap ()
 Generates mipmap images for the texture. More...
 
const char * getStringForFormat () const
 Returns the pixel format. More...
 
local getStringForFormat ()
 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...
 
var getContentSizeInPixels ()
 Get content size. More...
 
local getContentSizeInPixels ()
 Get content size. More...
 
bool hasPremultipliedAlpha () const
 Whether or not the texture has their Alpha premultiplied. More...
 
var hasPremultipliedAlpha ()
 Whether or not the texture has their Alpha premultiplied. More...
 
local hasPremultipliedAlpha ()
 Whether or not the texture has their Alpha premultiplied. More...
 
bool hasMipmaps () const
 Whether or not the texture has mip maps. More...
 
var hasMipmaps ()
 Whether or not the texture has mip maps. More...
 
Texture2D::PixelFormat getPixelFormat () const
 Gets the pixel format of the texture. More...
 
var getPixelFormat ()
 Gets the pixel format of the texture. More...
 
local getPixelFormat ()
 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...
 
var getPixelsHigh ()
 Gets the height of the texture in pixels. More...
 
local getPixelsHigh ()
 Gets the height of the texture in pixels. More...
 
GLuint getName () const
 Gets the texture name. More...
 
var getName ()
 Gets the texture name. More...
 
local getName ()
 Gets the texture name. More...
 
GLfloat getMaxS () const
 Gets max S. More...
 
var getMaxS ()
 Gets max S. More...
 
local getMaxS ()
 Gets max S. More...
 
void setMaxS (GLfloat maxS)
 Sets max S. More...
 
GLfloat getMaxT () const
 Gets max T. More...
 
var getMaxT ()
 Gets max T. More...
 
local getMaxT ()
 Gets max T. More...
 
void setMaxT (GLfloat maxT)
 Sets max T. More...
 
Size getContentSize () const
 Get the texture content size. More...
 
var getContentSize ()
 Get the texture content size. More...
 
local getContentSize ()
 Get the texture content size. More...
 
void setGLProgram (GLProgram *program)
 Set a shader program to the texture. More...
 
var setGLProgram ( var program)
 Set a shader program to the texture. More...
 
local setGLProgram ( local program)
 Set a shader program to the texture. More...
 
GLProgramgetGLProgram () const
 Get a shader program from the texture. More...
 
var getGLProgram ()
 Get a shader program from the texture. More...
 
local getGLProgram ()
 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...
 
local 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...
 
local getReferenceCount ()
 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...
 
local setDefaultAlphaPixelFormat ( local 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...
 
local PVRImagesHavePremultipliedAlpha ( local 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...
 
var getPixelFormatInfoMap ()
 Get pixel info map, the key-value pairs is PixelFormat and PixelFormatInfo. More...
 
local getPixelFormatInfoMap ()
 Get pixel info map, the key-value pairs is PixelFormat and PixelFormatInfo. More...
 

Protected Member Functions

 TextureCube ()
 Constructor.
 
 TextureCube ()
 Constructor.
 
 TextureCube ()
 Constructor.
 
virtual ~TextureCube ()
 Destructor.
 
local ~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
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 

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.
var create ( var  positive_x,
var  negative_x,
var  positive_y,
var  negative_y,
var  positive_z,
var  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.
local create ( local  positive_x,
local  negative_x,
local  positive_y,
local  negative_y,
local  positive_z,
local  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}.

var setTexParameters ( var  )

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}.

local setTexParameters ( local  )

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.

var reloadTexture ( )

reload texture cube after GLESContext reconstructed.

local reloadTexture ( )

reload texture cube after GLESContext reconstructed.


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