bool Live2dXUnit::initWithConfig(CCDictionary* config,Live2dXNode* orginNode) { int textureid = config->valueForKey("texture")->intValue(); m_texture = orginNode->m_textures[textureid]; m_texture->retain(); typeAt(CCArray, uv, config); typeAt(CCArray, vertex, config); for (int i = 0; i < uv->count(); ++i) { CCArray* pos = (CCArray*)uv->objectAtIndex(i); float u = ((CCString*)pos->objectAtIndex(0))->floatValue(); float v = ((CCString*)pos->objectAtIndex(1))->floatValue(); m_all_uv.push_back({u,v}); CCArray* ver = (CCArray*)vertex->objectAtIndex(i); float x = ((CCString*)ver->objectAtIndex(0))->floatValue(); float y = ((CCString*)ver->objectAtIndex(1))->floatValue(); m_now_vertex.push_back({x,y,0}); m_now_color.push_back(ccc4(0xff, 0xff, 0xff, 0xff)); } typeAt(CCArray, triangle, config); for (int i = 0; i < triangle->count(); ++i) { CCArray* tri = (CCArray*)triangle->objectAtIndex(i); int i_0 = ((CCString*)tri->objectAtIndex(0))->intValue(); int i_1 = ((CCString*)tri->objectAtIndex(1))->intValue(); int i_2 = ((CCString*)tri->objectAtIndex(2))->intValue(); m_all_triangle.push_back({(GLushort)i_0,(GLushort)i_1,(GLushort)i_2}); } return true; }
inline bool ExpressionBuilder::test(int token) { if (i < m_tokenList.count() && typeAt(i) == token) { ++i; return true; } return false; }
inline Type ExpressionBuilder::lookup(int k) { const int l = i - 1 + k; return l < m_tokenList.count() ? typeAt(l) : Token_eof; }
Type ExpressionBuilder::next() { if(!hasNext()) return Token_eof; return typeAt(i++); }