mirror of https://github.com/axmolengine/axmol.git
commit
7bae208166
|
@ -292,7 +292,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
updateBlendState(_customCommand);
|
updateBlendState(_customCommand);
|
||||||
updateUniforms(transform, _customCommand);
|
updateUniforms(transform, _customCommand);
|
||||||
_customCommand.init(_globalZOrder, transform, flags);
|
_customCommand.init(_globalZOrder);
|
||||||
renderer->addCommand(&_customCommand);
|
renderer->addCommand(&_customCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
updateBlendState(_customCommandGLPoint);
|
updateBlendState(_customCommandGLPoint);
|
||||||
updateUniforms(transform, _customCommandGLPoint);
|
updateUniforms(transform, _customCommandGLPoint);
|
||||||
_customCommandGLPoint.init(_globalZOrder, transform, flags);
|
_customCommandGLPoint.init(_globalZOrder);
|
||||||
renderer->addCommand(&_customCommandGLPoint);
|
renderer->addCommand(&_customCommandGLPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,6 +374,9 @@ void Grid3D::beforeBlit()
|
||||||
{
|
{
|
||||||
_oldDepthTest = renderer->getDepthTest();
|
_oldDepthTest = renderer->getDepthTest();
|
||||||
renderer->setDepthTest(true);
|
renderer->setDepthTest(true);
|
||||||
|
|
||||||
|
_oldDepthWrite = renderer->getDepthWrite();
|
||||||
|
renderer->setDepthWrite(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,8 +385,8 @@ void Grid3D::afterBlit()
|
||||||
auto renderer = Director::getInstance()->getRenderer();
|
auto renderer = Director::getInstance()->getRenderer();
|
||||||
if(_needDepthTestForBlit)
|
if(_needDepthTestForBlit)
|
||||||
{
|
{
|
||||||
//TODO:minggo
|
|
||||||
renderer->setDepthTest(_oldDepthTest);
|
renderer->setDepthTest(_oldDepthTest);
|
||||||
|
renderer->setDepthWrite(_oldDepthWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,11 +673,11 @@ void TiledGrid3D::calculateVertexPoints()
|
||||||
_vertices = malloc(numQuads*4*sizeof(Vec3));
|
_vertices = malloc(numQuads*4*sizeof(Vec3));
|
||||||
_originalVertices = malloc(numQuads*4*sizeof(Vec3));
|
_originalVertices = malloc(numQuads*4*sizeof(Vec3));
|
||||||
_texCoordinates = malloc(numQuads*4*sizeof(Vec2));
|
_texCoordinates = malloc(numQuads*4*sizeof(Vec2));
|
||||||
_indices = (GLushort*)malloc(numQuads*6*sizeof(GLushort));
|
_indices = (unsigned short*)malloc(numQuads*6*sizeof(unsigned short));
|
||||||
_vertexBuffer = malloc(numQuads * 4 * (sizeof(Vec3) + sizeof(Vec2) ) );
|
_vertexBuffer = malloc(numQuads * 4 * (sizeof(Vec3) + sizeof(Vec2) ) );
|
||||||
|
|
||||||
float *vertArray = (GLfloat*)_vertices;
|
float *vertArray = (float*)_vertices;
|
||||||
float *texArray = (GLfloat*)_texCoordinates;
|
float *texArray = (float*)_texCoordinates;
|
||||||
unsigned short *idxArray = _indices;
|
unsigned short *idxArray = _indices;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,6 @@ public:
|
||||||
virtual const BlendFunc &getBlendFunc() const override;
|
virtual const BlendFunc &getBlendFunc() const override;
|
||||||
|
|
||||||
// overrides
|
// overrides
|
||||||
//TODO minggo: should change Node::setGLProgramState(), then override
|
|
||||||
/** set ProgramState, you should bind attributes by yourself */
|
/** set ProgramState, you should bind attributes by yourself */
|
||||||
virtual void setProgramState(backend::ProgramState *programState);
|
virtual void setProgramState(backend::ProgramState *programState);
|
||||||
/** just remember bind attributes */
|
/** just remember bind attributes */
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace
|
||||||
std::string getShaderMacrosForLight()
|
std::string getShaderMacrosForLight()
|
||||||
{
|
{
|
||||||
//TODO: minggo
|
//TODO: minggo
|
||||||
GLchar def[256];
|
char def[256];
|
||||||
// auto conf = Configuration::getInstance();
|
// auto conf = Configuration::getInstance();
|
||||||
//
|
//
|
||||||
// snprintf(def, sizeof(def)-1, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
|
// snprintf(def, sizeof(def)-1, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
|
||||||
|
|
|
@ -1548,7 +1548,6 @@ void Terrain::QuadTree::resetNeedDraw(bool value)
|
||||||
|
|
||||||
void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTransform)
|
void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTransform)
|
||||||
{
|
{
|
||||||
//TODO new-renderer: interface isVisibleInFrustum removal
|
|
||||||
if(!camera->isVisibleInFrustum(&_worldSpaceAABB))
|
if(!camera->isVisibleInFrustum(&_worldSpaceAABB))
|
||||||
{
|
{
|
||||||
this->resetNeedDraw(false);
|
this->resetNeedDraw(false);
|
||||||
|
@ -1559,7 +1558,6 @@ void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTr
|
||||||
_bl->cullByCamera(camera, worldTransform);
|
_bl->cullByCamera(camera, worldTransform);
|
||||||
_br->cullByCamera(camera, worldTransform);
|
_br->cullByCamera(camera, worldTransform);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain::QuadTree::preCalculateAABB(const Mat4 & worldTransform)
|
void Terrain::QuadTree::preCalculateAABB(const Mat4 & worldTransform)
|
||||||
|
|
|
@ -377,7 +377,6 @@ void Director::setOpenGLView(GLView *openGLView)
|
||||||
{
|
{
|
||||||
// Configuration. Gather GPU info
|
// Configuration. Gather GPU info
|
||||||
Configuration *conf = Configuration::getInstance();
|
Configuration *conf = Configuration::getInstance();
|
||||||
//TODO: minggo
|
|
||||||
conf->gatherGPUInfo();
|
conf->gatherGPUInfo();
|
||||||
CCLOG("%s\n",conf->getInfo().c_str());
|
CCLOG("%s\n",conf->getInfo().c_str());
|
||||||
|
|
||||||
|
|
|
@ -528,25 +528,6 @@ LanguageType getLanguageTypeByISO2(const char* code)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBlending(backend::BlendFactor sfactor, backend::BlendFactor dfactor)
|
|
||||||
{
|
|
||||||
//TODO arnold: global state is removal
|
|
||||||
//if (sfactor == backend::BlendFactor::ONE && dfactor == backend::BlendFactor::ZERO)
|
|
||||||
//{
|
|
||||||
// glDisable(GL_BLEND);
|
|
||||||
// RenderState::StateBlock::_globalState->setBlend(false);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(toGLBlendFactor(sfactor), toGLBlendFactor(dfactor));
|
|
||||||
|
|
||||||
// RenderState::StateBlock::_globalState->setBlend(true);
|
|
||||||
// RenderState::StateBlock::_globalState->setBlendSrc(sfactor);
|
|
||||||
// RenderState::StateBlock::_globalState->setBlendDst(dfactor);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
backend::BlendFactor toBackendBlendFactor(int factor)
|
backend::BlendFactor toBackendBlendFactor(int factor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,10 +190,7 @@ namespace utils
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
CC_DLL LanguageType getLanguageTypeByISO2(const char* code);
|
CC_DLL LanguageType getLanguageTypeByISO2(const char* code);
|
||||||
|
|
||||||
CC_DLL void setBlending(backend::BlendFactor sfactor, backend::BlendFactor dfactor);
|
|
||||||
|
|
||||||
//TODO: minggo: should remove it.
|
|
||||||
CC_DLL backend::BlendFactor toBackendBlendFactor(int factor);
|
CC_DLL backend::BlendFactor toBackendBlendFactor(int factor);
|
||||||
|
|
||||||
CC_DLL int toGLBlendFactor(backend::BlendFactor blendFactor);
|
CC_DLL int toGLBlendFactor(backend::BlendFactor blendFactor);
|
||||||
|
|
|
@ -267,8 +267,6 @@ void SkeletonNode::batchDrawAllSubBones()
|
||||||
_batchBoneCommand.createVertexBuffer(sizeof(VertexData), _batchedVeticesCount, cocos2d::CustomCommand::BufferUsage::DYNAMIC);
|
_batchBoneCommand.createVertexBuffer(sizeof(VertexData), _batchedVeticesCount, cocos2d::CustomCommand::BufferUsage::DYNAMIC);
|
||||||
_batchBoneCommand.updateVertexBuffer(_batchedBoneVertexData.data(), sizeof(VertexData) * _batchedVeticesCount);
|
_batchBoneCommand.updateVertexBuffer(_batchedBoneVertexData.data(), sizeof(VertexData) * _batchedVeticesCount);
|
||||||
|
|
||||||
cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
|
|
||||||
|
|
||||||
#ifdef CC_STUDIO_ENABLED_VIEW
|
#ifdef CC_STUDIO_ENABLED_VIEW
|
||||||
//TODO
|
//TODO
|
||||||
// glLineWidth(1);
|
// glLineWidth(1);
|
||||||
|
|
|
@ -223,8 +223,7 @@ CSLoader::CSLoader()
|
||||||
CREATE_CLASS_NODE_READER_INFO(Node3DReader);
|
CREATE_CLASS_NODE_READER_INFO(Node3DReader);
|
||||||
CREATE_CLASS_NODE_READER_INFO(Sprite3DReader);
|
CREATE_CLASS_NODE_READER_INFO(Sprite3DReader);
|
||||||
CREATE_CLASS_NODE_READER_INFO(UserCameraReader);
|
CREATE_CLASS_NODE_READER_INFO(UserCameraReader);
|
||||||
//TODO minggo
|
CREATE_CLASS_NODE_READER_INFO(Particle3DReader);
|
||||||
// CREATE_CLASS_NODE_READER_INFO(Particle3DReader);
|
|
||||||
CREATE_CLASS_NODE_READER_INFO(GameNode3DReader);
|
CREATE_CLASS_NODE_READER_INFO(GameNode3DReader);
|
||||||
CREATE_CLASS_NODE_READER_INFO(Light3DReader);
|
CREATE_CLASS_NODE_READER_INFO(Light3DReader);
|
||||||
CREATE_CLASS_NODE_READER_INFO(TabControlReader);
|
CREATE_CLASS_NODE_READER_INFO(TabControlReader);
|
||||||
|
|
|
@ -49,12 +49,10 @@ public:
|
||||||
QuadCommand();
|
QuadCommand();
|
||||||
/**Destructor.*/
|
/**Destructor.*/
|
||||||
~QuadCommand();
|
~QuadCommand();
|
||||||
|
|
||||||
//TODO: remove textureID, program st
|
|
||||||
|
|
||||||
/** Initializes the command.
|
/** Initializes the command.
|
||||||
@param globalOrder GlobalZOrder of the command.
|
@param globalOrder GlobalZOrder of the command.
|
||||||
@param textureID The openGL handle of the used texture.
|
@param texture The texture used in the command.
|
||||||
@param blendType Blend function for the command.
|
@param blendType Blend function for the command.
|
||||||
@param quads Rendered quads for the command.
|
@param quads Rendered quads for the command.
|
||||||
@param quadCount The number of quads when rendering.
|
@param quadCount The number of quads when rendering.
|
||||||
|
|
|
@ -26,7 +26,6 @@ enum class ShaderStage : uint32_t
|
||||||
VERTEX_AND_FRAGMENT
|
VERTEX_AND_FRAGMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: simplify name
|
|
||||||
enum class VertexFormat : uint32_t
|
enum class VertexFormat : uint32_t
|
||||||
{
|
{
|
||||||
FLOAT4,
|
FLOAT4,
|
||||||
|
|
|
@ -993,7 +993,7 @@ void MySprite::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
// getGLProgram()->use();
|
// getGLProgram()->use();
|
||||||
// getGLProgram()->setUniformsForBuiltins(transform);
|
// getGLProgram()->setUniformsForBuiltins(transform);
|
||||||
|
|
||||||
cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
|
// cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, _texture->getName());
|
glBindTexture(GL_TEXTURE_2D, _texture->getName());
|
||||||
|
|
|
@ -146,7 +146,7 @@ void DrawNode3D::updateCommand(cocos2d::Renderer* renderer,const Mat4 &transform
|
||||||
//TODO arnold
|
//TODO arnold
|
||||||
//RenderState::StateBlock::_globalState->setDepthTest(true);
|
//RenderState::StateBlock::_globalState->setDepthTest(true);
|
||||||
|
|
||||||
cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
|
// cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferLines.size());
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferLines.size());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue