Merge pull request #111 from lvlonggame/merge-bundle

modify assert(0)
This commit is contained in:
XiaoYang 2014-08-22 13:27:01 +08:00
commit 72e71d210e
4 changed files with 53 additions and 5 deletions

View File

@ -981,7 +981,7 @@ bool Bundle3D::loadJson(const std::string& path)
_jsonBuffer[size] = '\0';
if (_jsonReader.ParseInsitu<0>(_jsonBuffer).HasParseError())
{
assert(0);
CCASSERT(false, "Parse json failed");
clear();
return false;
}
@ -1100,7 +1100,7 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
const rapidjson::Value& skin_data_array = _jsonReader[SKIN ];
assert(skin_data_array.IsArray());
CCASSERT(skin_data_array.IsArray(), "skin data is not an array");
const rapidjson::Value& skin_data_array_val_0 = skin_data_array[(rapidjson::SizeType)0];
if (!skin_data_array_val_0.HasMember(BONES))
@ -2009,7 +2009,7 @@ NTextureData::Usage Bundle3D::parseGLTextureType(const std::string& str)
}
else
{
CCASSERT(false, "Wrong GL type");
CCASSERT(false, "Wrong Texture type");
return NTextureData::Usage::Unknown;
}
}
@ -2031,6 +2031,30 @@ unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str)
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD1;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD2")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD2;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD3")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD3;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD4")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD4;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD5")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD5;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD6")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD6;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD7")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD7;
}
else if (str == "VERTEX_ATTRIB_NORMAL")
{
return GLProgram::VERTEX_ATTRIB_NORMAL;
@ -2045,7 +2069,7 @@ unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str)
}
else
{
assert(0);
CCASSERT(false, "Wrong Attribute type");
return -1;
}
}

View File

@ -46,7 +46,7 @@
NS_CC_BEGIN
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT, GLProgram::ATTRIBUTE_NAME_BLEND_INDEX};
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::ATTRIBUTE_NAME_TEX_COORD2,GLProgram::ATTRIBUTE_NAME_TEX_COORD3,GLProgram::ATTRIBUTE_NAME_TEX_COORD4,GLProgram::ATTRIBUTE_NAME_TEX_COORD5,GLProgram::ATTRIBUTE_NAME_TEX_COORD6,GLProgram::ATTRIBUTE_NAME_TEX_COORD7,GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT, GLProgram::ATTRIBUTE_NAME_BLEND_INDEX};
Sprite3D* Sprite3D::create(const std::string &modelPath)
{

View File

@ -95,6 +95,12 @@ const char* GLProgram::ATTRIBUTE_NAME_COLOR = "a_color";
const char* GLProgram::ATTRIBUTE_NAME_POSITION = "a_position";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD = "a_texCoord";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD1 = "a_texCoord1";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD2 = "a_texCoord2";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD3 = "a_texCoord3";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD4 = "a_texCoord4";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD5 = "a_texCoord5";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD6 = "a_texCoord6";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD7 = "a_texCoord7";
const char* GLProgram::ATTRIBUTE_NAME_NORMAL = "a_normal";
const char* GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT = "a_blendWeight";
const char* GLProgram::ATTRIBUTE_NAME_BLEND_INDEX = "a_blendIndex";
@ -283,6 +289,12 @@ void GLProgram::bindPredefinedVertexAttribs()
{GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORD},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::VERTEX_ATTRIB_TEX_COORD1},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD2, GLProgram::VERTEX_ATTRIB_TEX_COORD2},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD3, GLProgram::VERTEX_ATTRIB_TEX_COORD3},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD4, GLProgram::VERTEX_ATTRIB_TEX_COORD4},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD5, GLProgram::VERTEX_ATTRIB_TEX_COORD5},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD6, GLProgram::VERTEX_ATTRIB_TEX_COORD6},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD7, GLProgram::VERTEX_ATTRIB_TEX_COORD7},
{GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::VERTEX_ATTRIB_NORMAL},
};

View File

@ -85,6 +85,12 @@ public:
VERTEX_ATTRIB_COLOR,
VERTEX_ATTRIB_TEX_COORD,
VERTEX_ATTRIB_TEX_COORD1,
VERTEX_ATTRIB_TEX_COORD2,
VERTEX_ATTRIB_TEX_COORD3,
VERTEX_ATTRIB_TEX_COORD4,
VERTEX_ATTRIB_TEX_COORD5,
VERTEX_ATTRIB_TEX_COORD6,
VERTEX_ATTRIB_TEX_COORD7,
VERTEX_ATTRIB_NORMAL,
VERTEX_ATTRIB_BLEND_WEIGHT,
VERTEX_ATTRIB_BLEND_INDEX,
@ -154,6 +160,12 @@ public:
static const char* ATTRIBUTE_NAME_POSITION;
static const char* ATTRIBUTE_NAME_TEX_COORD;
static const char* ATTRIBUTE_NAME_TEX_COORD1;
static const char* ATTRIBUTE_NAME_TEX_COORD2;
static const char* ATTRIBUTE_NAME_TEX_COORD3;
static const char* ATTRIBUTE_NAME_TEX_COORD4;
static const char* ATTRIBUTE_NAME_TEX_COORD5;
static const char* ATTRIBUTE_NAME_TEX_COORD6;
static const char* ATTRIBUTE_NAME_TEX_COORD7;
static const char* ATTRIBUTE_NAME_NORMAL;
static const char* ATTRIBUTE_NAME_BLEND_WEIGHT;
static const char* ATTRIBUTE_NAME_BLEND_INDEX;