deleted Meshcommand

This commit is contained in:
songchengjiang 2014-09-01 09:33:08 +08:00
parent 9f715e4e00
commit 3f8b430b3e
3 changed files with 1 additions and 45 deletions

View File

@ -28,25 +28,17 @@
#include "base/CCCamera.h" #include "base/CCCamera.h"
#include "renderer/CCRenderer.h" #include "renderer/CCRenderer.h"
#include "renderer/CCGLProgramCache.h" #include "renderer/CCGLProgramCache.h"
#include "renderer/CCVertexIndexBuffer.h"
NS_CC_BEGIN NS_CC_BEGIN
BillBorad::BillBorad() BillBorad::BillBorad()
: _zDepthInView(0.0f) : _zDepthInView(0.0f)
//, _vertexBuffer(nullptr)
//, _indexBuffer(nullptr)
{ {
} }
BillBorad::~BillBorad() BillBorad::~BillBorad()
{ {
//if (_vertexBuffer)
// _vertexBuffer->release();
//if (_indexBuffer)
// _indexBuffer->release();
} }
BillBorad* BillBorad::createWithTexture(Texture2D *texture) BillBorad* BillBorad::createWithTexture(Texture2D *texture)
@ -54,7 +46,6 @@ BillBorad* BillBorad::createWithTexture(Texture2D *texture)
BillBorad *billborad = new (std::nothrow) BillBorad(); BillBorad *billborad = new (std::nothrow) BillBorad();
if (billborad && billborad->initWithTexture(texture)) if (billborad && billborad->initWithTexture(texture))
{ {
//billborad->genRenderInformation();
billborad->autorelease(); billborad->autorelease();
return billborad; return billborad;
} }
@ -68,7 +59,6 @@ BillBorad* BillBorad::create(const std::string& filename)
BillBorad *billborad = new (std::nothrow) BillBorad(); BillBorad *billborad = new (std::nothrow) BillBorad();
if (billborad && billborad->initWithFile(filename)) if (billborad && billborad->initWithFile(filename))
{ {
//billborad->genRenderInformation();
billborad->autorelease(); billborad->autorelease();
return billborad; return billborad;
} }
@ -81,7 +71,6 @@ BillBorad* BillBorad::create(const std::string& filename, const Rect& rect)
BillBorad *billborad = new (std::nothrow) BillBorad(); BillBorad *billborad = new (std::nothrow) BillBorad();
if (billborad && billborad->initWithFile(filename, rect)) if (billborad && billborad->initWithFile(filename, rect))
{ {
//billborad->genRenderInformation();
billborad->autorelease(); billborad->autorelease();
return billborad; return billborad;
} }
@ -94,7 +83,6 @@ BillBorad* BillBorad::create()
BillBorad *billborad = new (std::nothrow) BillBorad(); BillBorad *billborad = new (std::nothrow) BillBorad();
if (billborad && billborad->init()) if (billborad && billborad->init())
{ {
//billborad->genRenderInformation();
billborad->autorelease(); billborad->autorelease();
return billborad; return billborad;
} }
@ -120,29 +108,8 @@ void BillBorad::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
//if(_insideBounds) //if(_insideBounds)
{ {
_quadCommand.init(_zDepthInView, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, transform * _mv); _quadCommand.init(_zDepthInView, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, transform * _mv);
//_meshCommand.init(-modelViewMat.m[14], _texture->getName(), getGLProgramState(), _blendFunc, _vertexBuffer->getVBO(), _indexBuffer->getVBO(), GL_TRIANGLES, GL_UNSIGNED_SHORT, _indexBuffer->getIndexNumber(), transMat);
renderer->addTransparentCommand(&_quadCommand); renderer->addTransparentCommand(&_quadCommand);
} }
} }
//void BillBorad::genRenderInformation()
//{
// _vertexBuffer = VertexBuffer::create(sizeof(_quad), 1);
// _vertexBuffer->updateVertices((void*)&_quad, 1, 0);
// _vertexBuffer->retain();
//
// std::vector<unsigned short> indices;
// indices.push_back(0);indices.push_back(1);indices.push_back(2);
// indices.push_back(3);indices.push_back(2);indices.push_back(1);
// _indexBuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_SHORT_16, indices.size());
// _indexBuffer->updateIndices((void*)&indices[0], (int)indices.size(), 0);
// _indexBuffer->retain();
//
//#define kQuadSize sizeof(_quad.bl)
// setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
// getGLProgramState()->setVertexAttribPointer(GLProgram::ATTRIBUTE_NAME_POSITION, 3, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, vertices));
// getGLProgramState()->setVertexAttribPointer(GLProgram::ATTRIBUTE_NAME_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, colors));
// getGLProgramState()->setVertexAttribPointer(GLProgram::ATTRIBUTE_NAME_TEX_COORD, 2, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, texCoords));
//}
NS_CC_END NS_CC_END

View File

@ -26,13 +26,9 @@
#define __CCBILLBOARD_H__ #define __CCBILLBOARD_H__
#include "2d/CCSprite.h" #include "2d/CCSprite.h"
#include "renderer/CCMeshCommand.h"
NS_CC_BEGIN NS_CC_BEGIN
//class VertexBuffer;
//class IndexBuffer;
/** /**
* Inherit from Sprite, achieve BillBorad. * Inherit from Sprite, achieve BillBorad.
*/ */
@ -90,13 +86,6 @@ CC_CONSTRUCTOR_ACCESS:
protected: protected:
//void genRenderInformation();
protected:
// MeshCommand _meshCommand;
// VertexBuffer *_vertexBuffer;
// IndexBuffer *_indexBuffer;
Mat4 _preViewMat; Mat4 _preViewMat;
Mat4 _mv; Mat4 _mv;
float _zDepthInView; float _zDepthInView;

View File

@ -8,6 +8,6 @@
# project structure. # project structure.
# Project target. # Project target.
target=android-20 target=android-10
android.library.reference.1=../../../cocos/platform/android/java android.library.reference.1=../../../cocos/platform/android/java