bool Cc3dSubMesh::init(){ this->setAnchorPoint(ccp(0,0)); //call parent init Cc3dNode::init(); //texture CCTexture2D*texture=CCTextureCache::sharedTextureCache()->addImage("toolKitRes/pic/defaultTexPic.png"); setTexture(texture); //material Cc3dMaterial*material=new Cc3dMaterial(); material->autorelease(); material->init(); setMaterial(material); //subMeshData Cc3dSubMeshData*subMeshData=new Cc3dSubMeshData();//empty subMeshData subMeshData->autorelease(); subMeshData->init(); setSubMeshData(subMeshData); //program Cc3dProgram*program=c3dGetProgram_c3dTexOnly(); setProgram(program); //uniformPassor m_passUnifoCallback=passUnifoCallback_texOnly; //lightSource Cc3dLightSource*lightSource=new Cc3dLightSource(); lightSource->autorelease(); lightSource->init(); setLightSource(lightSource); //indexVBO Cc3dIndexVBO3d*indexVBO=new Cc3dIndexVBO3d(); indexVBO->autorelease(); indexVBO->init(); setIndexVBO(indexVBO); return true; }
bool Cc3dSprite::init(){ this->setAnchorPoint(ccp(0,0)); //call parent init Cc3dNode::init(); //texture CCTexture2D*texture=CCTextureCache::sharedTextureCache()->addImage((c3dDefaultTexPicFolderPath+"defaultTexPic.png").c_str()); setTexture(texture); //material Cc3dMaterial*material=Cc3dMaterial::create(); setMaterial(material); //mesh Cc3dMesh*mesh=Cc3dMesh::create();//empty mesh setMesh(mesh); //program Cc3dProgram*program=c3dGetProgram_c3dTexOnly(); setProgram(program); //uniformPassor Cc3dUniformPassor*uniformPassor=Cc3dUniformPassor::create(); setUniformPassor(uniformPassor); //lightSource Cc3dLightSource*lightSource=Cc3dLightSource::create(); setLightSource(lightSource); //indexVBO Cc3dIndexVBO3d*indexVBO=Cc3dIndexVBO3d::create(); setIndexVBO(indexVBO); //enable array attribute Cc3dIndexVBO3d::enableAttribArrays(); return true; }