Cocos2d-x  v4
Buffer Class Referenceabstract

Used to store vertex and index data data. More...

Inherits Ref.

Inherited by BufferGL, and BufferMTL.

Public Member Functions

virtual void updateData (void *data, std::size_t size)=0
 Update buffer data. More...
 
virtual void updateSubData (void *data, std::size_t offset, std::size_t size)=0
 Update buffer sub-region data. More...
 
virtual void usingDefaultStoredData (bool needDefaultStoredData)=0
 By default, static buffer data will automatically stored when it comes to foreground. More...
 
std::size_t getSize () const
 Get buffer size in bytes. 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...
 

Additional Inherited Members

- 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
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

Used to store vertex and index data data.

Member Function Documentation

◆ updateData()

virtual void updateData ( void *  data,
std::size_t  size 
)
pure virtual

Update buffer data.

Parameters
dataSpecifies a pointer to data that will be copied into the data store for initialization.
sizeSpecifies the size in bytes of the data store region being replaced.
See also
updateSubData(void* data, unsigned int offset, unsigned int size)

Implemented in BufferMTL, and BufferGL.

◆ updateSubData()

virtual void updateSubData ( void *  data,
std::size_t  offset,
std::size_t  size 
)
pure virtual

Update buffer sub-region data.

Parameters
dataSpecifies a pointer to the new data that will be copied into the data store.
offsetSpecifies the offset into the buffer object's data store where data replacement will begin, measured in bytes.
sizeSpecifies the size in bytes of the data store region being replaced.
See also
updateData(void* data, unsigned int size)

Implemented in BufferMTL, and BufferGL.

◆ usingDefaultStoredData()

virtual void usingDefaultStoredData ( bool  needDefaultStoredData)
pure virtual

By default, static buffer data will automatically stored when it comes to foreground.

This function is used to indicate whether external data needs to be used to update the buffer instead of using the default stored data.

Parameters
needDefaultStoredDataSpecifies whether to use the default stored data.

Implemented in BufferMTL, and BufferGL.

◆ getSize()

std::size_t getSize ( ) const
inline

Get buffer size in bytes.

Returns
The buffer size in bytes.

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