mirror of https://github.com/axmolengine/axmol.git
Merge pull request #8099 from super626/billboard
Transparent Queue adjustment
This commit is contained in:
commit
7c8e1c9de5
|
@ -148,7 +148,8 @@ void BillBoard::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
//FIXME: frustum culling here
|
||||
{
|
||||
_quadCommand.init(_zDepthInView, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, _billboardTransform);
|
||||
renderer->addCommandToTransparentQueue(&_quadCommand);
|
||||
_quadCommand.setTransparent(true);
|
||||
renderer->addCommand(&_quadCommand);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -521,10 +521,8 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
}
|
||||
//support tint and fade
|
||||
meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
|
||||
if (mesh->_isTransparent)
|
||||
renderer->addCommandToTransparentQueue(&meshCommand);
|
||||
else
|
||||
renderer->addCommand(&meshCommand);
|
||||
meshCommand.setTransparent(mesh->_isTransparent);
|
||||
renderer->addCommand(&meshCommand);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ NS_CC_BEGIN
|
|||
RenderCommand::RenderCommand()
|
||||
: _type(RenderCommand::Type::UNKNOWN_COMMAND)
|
||||
, _globalOrder(0)
|
||||
, _isTransparent(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,12 @@ public:
|
|||
|
||||
/** Returns the Command type */
|
||||
inline Type getType() const { return _type; }
|
||||
|
||||
/** Retruns whether is transparent */
|
||||
inline bool isTransparent() const { return _isTransparent; }
|
||||
|
||||
/** set transparent flag */
|
||||
inline void setTransparent(bool isTransparent) { _isTransparent = isTransparent; }
|
||||
|
||||
protected:
|
||||
RenderCommand();
|
||||
|
@ -70,6 +76,9 @@ protected:
|
|||
|
||||
// commands are sort by depth
|
||||
float _globalOrder;
|
||||
|
||||
// transparent flag
|
||||
bool _isTransparent;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -268,12 +268,10 @@ void Renderer::addCommand(RenderCommand* command, int renderQueue)
|
|||
CCASSERT(!_isRendering, "Cannot add command while rendering");
|
||||
CCASSERT(renderQueue >=0, "Invalid render queue");
|
||||
CCASSERT(command->getType() != RenderCommand::Type::UNKNOWN_COMMAND, "Invalid Command Type");
|
||||
_renderGroups[renderQueue].push_back(command);
|
||||
}
|
||||
|
||||
void Renderer::addCommandToTransparentQueue(RenderCommand* command)
|
||||
{
|
||||
_transparentRenderGroups.push_back(command);
|
||||
if (command->isTransparent())
|
||||
_transparentRenderGroups.push_back(command);
|
||||
else
|
||||
_renderGroups[renderQueue].push_back(command);
|
||||
}
|
||||
|
||||
void Renderer::pushGroup(int renderQueueID)
|
||||
|
|
|
@ -108,9 +108,6 @@ public:
|
|||
|
||||
/** Adds a `RenderComamnd` into the renderer specifying a particular render queue ID */
|
||||
void addCommand(RenderCommand* command, int renderQueue);
|
||||
|
||||
/** add transprent command */
|
||||
void addCommandToTransparentQueue(RenderCommand* command);
|
||||
|
||||
/** Pushes a group into the render queue */
|
||||
void pushGroup(int renderQueueID);
|
||||
|
|
Loading…
Reference in New Issue