mirror of https://github.com/axmolengine/axmol.git
BatchCommand API fixes
don't pass Texture Id. Instead fetch it from the `TextureAtlas`
This commit is contained in:
parent
eeeae56684
commit
e402f35e7f
|
@ -384,7 +384,6 @@ void ParticleBatchNode::draw(void)
|
||||||
|
|
||||||
_batchCommand.init(
|
_batchCommand.init(
|
||||||
_globalZOrder,
|
_globalZOrder,
|
||||||
_textureAtlas->getTexture()->getName(),
|
|
||||||
_shaderProgram,
|
_shaderProgram,
|
||||||
_blendFunc,
|
_blendFunc,
|
||||||
_textureAtlas,
|
_textureAtlas,
|
||||||
|
|
|
@ -358,7 +358,6 @@ void SpriteBatchNode::draw()
|
||||||
|
|
||||||
_batchCommand.init(
|
_batchCommand.init(
|
||||||
_globalZOrder,
|
_globalZOrder,
|
||||||
_textureAtlas->getTexture()->getName(),
|
|
||||||
_shaderProgram,
|
_shaderProgram,
|
||||||
_blendFunc,
|
_blendFunc,
|
||||||
_textureAtlas,
|
_textureAtlas,
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "renderer/CCBatchCommand.h"
|
#include "renderer/CCBatchCommand.h"
|
||||||
#include "ccGLStateCache.h"
|
#include "ccGLStateCache.h"
|
||||||
#include "CCTextureAtlas.h"
|
#include "CCTextureAtlas.h"
|
||||||
|
#include "CCTexture2D.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -38,10 +39,13 @@ BatchCommand::BatchCommand()
|
||||||
_shader = nullptr;
|
_shader = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchCommand::init(float globalOrder, GLuint textureID, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform)
|
void BatchCommand::init(float globalOrder, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform)
|
||||||
{
|
{
|
||||||
|
CCASSERT(shader, "shader cannot be nill");
|
||||||
|
CCASSERT(textureAtlas, "textureAtlas cannot be nill");
|
||||||
|
|
||||||
_globalOrder = globalOrder;
|
_globalOrder = globalOrder;
|
||||||
_textureID = textureID;
|
_textureID = textureAtlas->getTexture()->getName();
|
||||||
_blendType = blendType;
|
_blendType = blendType;
|
||||||
_shader = shader;
|
_shader = shader;
|
||||||
|
|
||||||
|
|
|
@ -43,19 +43,15 @@ public:
|
||||||
BatchCommand();
|
BatchCommand();
|
||||||
~BatchCommand();
|
~BatchCommand();
|
||||||
|
|
||||||
void init(float depth, GLuint texutreID, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform);
|
void init(float depth, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform);
|
||||||
|
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
//Material
|
||||||
int32_t _materialID;
|
int32_t _materialID;
|
||||||
|
|
||||||
//Maternal
|
|
||||||
GLuint _textureID;
|
GLuint _textureID;
|
||||||
|
|
||||||
GLProgram* _shader;
|
GLProgram* _shader;
|
||||||
// GLuint _shaderID;
|
|
||||||
|
|
||||||
BlendFunc _blendType;
|
BlendFunc _blendType;
|
||||||
|
|
||||||
TextureAtlas *_textureAtlas;
|
TextureAtlas *_textureAtlas;
|
||||||
|
|
Loading…
Reference in New Issue