Merge pull request #19505 from minggo/fix-todo

Fix todo
This commit is contained in:
minggo 2019-03-13 15:24:49 +08:00 committed by GitHub
commit 7bae208166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 14 additions and 43 deletions

View File

@ -292,7 +292,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
updateBlendState(_customCommand);
updateUniforms(transform, _customCommand);
_customCommand.init(_globalZOrder, transform, flags);
_customCommand.init(_globalZOrder);
renderer->addCommand(&_customCommand);
}
@ -300,7 +300,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
updateBlendState(_customCommandGLPoint);
updateUniforms(transform, _customCommandGLPoint);
_customCommandGLPoint.init(_globalZOrder, transform, flags);
_customCommandGLPoint.init(_globalZOrder);
renderer->addCommand(&_customCommandGLPoint);
}

View File

@ -374,6 +374,9 @@ void Grid3D::beforeBlit()
{
_oldDepthTest = renderer->getDepthTest();
renderer->setDepthTest(true);
_oldDepthWrite = renderer->getDepthWrite();
renderer->setDepthWrite(true);
}
}
@ -382,8 +385,8 @@ void Grid3D::afterBlit()
auto renderer = Director::getInstance()->getRenderer();
if(_needDepthTestForBlit)
{
//TODO:minggo
renderer->setDepthTest(_oldDepthTest);
renderer->setDepthWrite(_oldDepthWrite);
}
}
@ -670,11 +673,11 @@ void TiledGrid3D::calculateVertexPoints()
_vertices = malloc(numQuads*4*sizeof(Vec3));
_originalVertices = malloc(numQuads*4*sizeof(Vec3));
_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) ) );
float *vertArray = (GLfloat*)_vertices;
float *texArray = (GLfloat*)_texCoordinates;
float *vertArray = (float*)_vertices;
float *texArray = (float*)_texCoordinates;
unsigned short *idxArray = _indices;

View File

@ -119,7 +119,6 @@ public:
virtual const BlendFunc &getBlendFunc() const override;
// overrides
//TODO minggo: should change Node::setGLProgramState(), then override
/** set ProgramState, you should bind attributes by yourself */
virtual void setProgramState(backend::ProgramState *programState);
/** just remember bind attributes */

View File

@ -67,7 +67,7 @@ namespace
std::string getShaderMacrosForLight()
{
//TODO: minggo
GLchar def[256];
char def[256];
// auto conf = Configuration::getInstance();
//
// snprintf(def, sizeof(def)-1, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"

View File

@ -1548,7 +1548,6 @@ void Terrain::QuadTree::resetNeedDraw(bool value)
void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTransform)
{
//TODO new-renderer: interface isVisibleInFrustum removal
if(!camera->isVisibleInFrustum(&_worldSpaceAABB))
{
this->resetNeedDraw(false);
@ -1559,7 +1558,6 @@ void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTr
_bl->cullByCamera(camera, worldTransform);
_br->cullByCamera(camera, worldTransform);
}
// }
}
void Terrain::QuadTree::preCalculateAABB(const Mat4 & worldTransform)

View File

@ -377,7 +377,6 @@ void Director::setOpenGLView(GLView *openGLView)
{
// Configuration. Gather GPU info
Configuration *conf = Configuration::getInstance();
//TODO: minggo
conf->gatherGPUInfo();
CCLOG("%s\n",conf->getInfo().c_str());

View File

@ -528,25 +528,6 @@ LanguageType getLanguageTypeByISO2(const char* code)
}
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)
{

View File

@ -190,10 +190,7 @@ namespace utils
* @lua NA
*/
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 int toGLBlendFactor(backend::BlendFactor blendFactor);

View File

@ -267,8 +267,6 @@ void SkeletonNode::batchDrawAllSubBones()
_batchBoneCommand.createVertexBuffer(sizeof(VertexData), _batchedVeticesCount, cocos2d::CustomCommand::BufferUsage::DYNAMIC);
_batchBoneCommand.updateVertexBuffer(_batchedBoneVertexData.data(), sizeof(VertexData) * _batchedVeticesCount);
cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
#ifdef CC_STUDIO_ENABLED_VIEW
//TODO
// glLineWidth(1);

View File

@ -223,8 +223,7 @@ CSLoader::CSLoader()
CREATE_CLASS_NODE_READER_INFO(Node3DReader);
CREATE_CLASS_NODE_READER_INFO(Sprite3DReader);
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(Light3DReader);
CREATE_CLASS_NODE_READER_INFO(TabControlReader);

View File

@ -49,12 +49,10 @@ public:
QuadCommand();
/**Destructor.*/
~QuadCommand();
//TODO: remove textureID, program st
/** Initializes 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 quads Rendered quads for the command.
@param quadCount The number of quads when rendering.

View File

@ -26,7 +26,6 @@ enum class ShaderStage : uint32_t
VERTEX_AND_FRAGMENT
};
//TODO: simplify name
enum class VertexFormat : uint32_t
{
FLOAT4,

View File

@ -993,7 +993,7 @@ void MySprite::onDraw(const Mat4 &transform, uint32_t flags)
// getGLProgram()->use();
// getGLProgram()->setUniformsForBuiltins(transform);
cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
// cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, _texture->getName());

View File

@ -146,7 +146,7 @@ void DrawNode3D::updateCommand(cocos2d::Renderer* renderer,const Mat4 &transform
//TODO arnold
//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());
}