Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
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 &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. More...
 
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 a Texture2D object 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.
 
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...
 
local initWithString ( local text, local fontName, local fontSize, local 0, local CENTER, local 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...
 
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 by string.
 
var getStringForFormat ()
 Returns the pixel format by string.
 
local getStringForFormat ()
 Returns the pixel format by string.
 
unsigned int getBitsPerPixelForFormat () const
 Returns the bits-per-pixel of the in-memory OpenGL texture.
 
unsigned int getBitsPerPixelForFormat (Texture2D::PixelFormat format) const
 Helper functions that returns bits per pixels for a given format.
 
const SizegetContentSizeInPixels ()
 Get content size in pixels.
 
local getContentSizeInPixels ()
 Get content size in pixels.
 
bool hasPremultipliedAlpha () const
 Whether or not the texture has their Alpha premultiplied.
 
var hasPremultipliedAlpha ()
 Whether or not the texture has their Alpha premultiplied.
 
local hasPremultipliedAlpha ()
 Whether or not the texture has their Alpha premultiplied.
 
bool hasMipmaps () const
 Whether or not the texture has mip maps.
 
var hasMipmaps ()
 Whether or not the texture has mip maps.
 
local hasMipmaps ()
 Whether or not the texture has mip maps.
 
Texture2D::PixelFormat getPixelFormat () const
 Gets the pixel format of the texture.
 
int getPixelsWide () const
 Gets the width of the texture in pixels.
 
var getPixelsWide ()
 Gets the width of the texture in pixels.
 
local getPixelsWide ()
 Gets the width of the texture in pixels.
 
int getPixelsHigh () const
 Gets the height of the texture in pixels.
 
var getPixelsHigh ()
 Gets the height of the texture in pixels.
 
local getPixelsHigh ()
 Gets the height of the texture in pixels.
 
GLuint getName () const
 Gets the texture name.
 
var getName ()
 Gets the texture name.
 
local getName ()
 Gets the texture name.
 
GLfloat getMaxS () const
 Gets max S.
 
var getMaxS ()
 Gets max S.
 
local getMaxS ()
 Gets max S.
 
void setMaxS (GLfloat maxS)
 Sets max S.
 
var setMaxS ( var maxS)
 Sets max S.
 
local setMaxS ( local maxS)
 Sets max S.
 
GLfloat getMaxT () const
 Gets max T.
 
var getMaxT ()
 Gets max T.
 
local getMaxT ()
 Gets max T.
 
void setMaxT (GLfloat maxT)
 Sets max T.
 
var setMaxT ( var maxT)
 Sets max T.
 
local setMaxT ( local maxT)
 Sets max T.
 
Size getContentSize () const
 Get the texture content size.
 
var getContentSize ()
 Get the texture content size.
 
local getContentSize ()
 Get the texture content size.
 
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 for drawAtPoint & drawInRect.
 
std::string getPath () const
 Return texture file name.
 
local getPath ()
 Return texture file name.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local 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...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

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...
 
var create ( var positive_x, var negative_x, var positive_y, var negative_y, var positive_z, var negative_z)
 create cube texture from 6 textures. More...
 
local create ( local positive_x, local negative_x, local positive_y, local negative_y, local positive_z, local 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 Image contains alpha channel. More...
 
local setDefaultAlphaPixelFormat ( local format)
 sets the default pixel format for Image contains alpha channel. More...
 
static Texture2D::PixelFormat getDefaultAlphaPixelFormat ()
 Returns the default alpha pixel format.
 
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.
 
var getPixelFormatInfoMap ()
 Get pixel info map, the key-value pairs is PixelFormat and PixelFormatInfo.
 
local getPixelFormatInfoMap ()
 Get pixel info map, the key-value pairs is PixelFormat and PixelFormatInfo.
 

Protected Member Functions

 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.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

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.

texture for the right side of the texture cube face. texture for the left side of the texture cube face. texture for the top side of the texture cube face texture for the bottom side of the texture cube face texture for the forward side of the texture cube face. texture for the rear side of the texture cube face. 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.

texture for the right side of the texture cube face. texture for the left side of the texture cube face. texture for the top side of the texture cube face texture for the bottom side of the texture cube face texture for the forward side of the texture cube face. texture for the rear side of the texture cube face. 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.

texture for the right side of the texture cube face. texture for the left side of the texture cube face. texture for the top side of the texture cube face texture for the bottom side of the texture cube face texture for the forward side of the texture cube face. texture for the rear side of the texture cube face. A new texture cube inited with given parameters.

void setTexParameters ( const TexParams texParams)

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

the min/mag filter of TextureCube

var setTexParameters ( var  texParams)

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

the min/mag filter of TextureCube

local setTexParameters ( local  texParams)

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

the min/mag filter of TextureCube

bool reloadTexture ( )

reload texture cube after GLESContext reconstructed.

True if the reloading is succeed, otherwise return false.

var reloadTexture ( )

reload texture cube after GLESContext reconstructed.

True if the reloading is succeed, otherwise return false.

local reloadTexture ( )

reload texture cube after GLESContext reconstructed.

True if the reloading is succeed, otherwise return false.


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