本文整理汇总了C++中Animation::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::Load方法的具体用法?C++ Animation::Load怎么用?C++ Animation::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::Load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Animation
Animation *SystemMenuResource::LoadAnimation( const U8Archive &arc, const std::string &lanName )
{
u8 *stuff = arc.GetFile( "/arc/anim/" + lanName + ".brlan" );
if( !stuff )
{
return NULL;
}
Animation *brlan = new Animation( lanName );
brlan->Load( (const RLAN_Header*)stuff );
return brlan;
}
示例2: LoadAnimations
void ColladaDoc::LoadAnimations(
lpxmlnode pNode)
{
lpxmlnode pCurrNode = pNode;
while(pCurrNode != NULL) {
Animation anim;
anim.Load(pCurrNode->first_node());
library_animations.push_back(anim);
pCurrNode = pCurrNode->next_sibling();
};
}
示例3: LoadScene
void World::LoadScene(const char * scene_path)
{
// Using case-insensitive strings and streams for easier parsing
ci_ifstream input;
input.open(scene_path, ios::in);
// Invalid file
if (input.fail())
{
fprintf(stderr, "Error loading file: %s\n", scene_path);
getchar();
exit(-1);
}
ci_string item;
while (std::getline(input, item, '['))
{
ci_istringstream iss(item);
ci_string result;
if (std::getline(iss, result, ']'))
{
if (result == "player")
{
// Box attributes
PlayerModel* player = new PlayerModel();
player->Load(iss);
mModel.push_back(player);
mPlayerModel = player;
}
else if (result == "discoball")
{
// Box attributes
Discoball* discoBallz = new Discoball();
discoBallz->Load(iss);
mModel.push_back(discoBallz);
}
else if (result == "bunnny")
{
// Box attributes
BunnyModel* bunny = new BunnyModel();
bunny->Load(iss);
mModel.push_back(bunny);
}
else if (result == "barrel")
{
// Box attributes
BarrelModel* barrel = new BarrelModel();
barrel->Load(iss);
mModel.push_back(barrel);
}
else if (result == "cube")
{
// Box attributes
CubeModel* cube = new CubeModel();
cube->Load(iss);
mModel.push_back(cube);
}
else if (result == "sphere")
{
SphereModel* sphere = new SphereModel();
sphere->Load(iss);
mModel.push_back(sphere);
}
else if (result == "animationkey")
{
AnimationKey* key = new AnimationKey();
key->Load(iss);
mAnimationKey.push_back(key);
}
else if (result == "animation")
{
Animation* anim = new Animation();
anim->Load(iss);
mAnimation.push_back(anim);
}
else if (result.empty() == false && result[0] == '#')
{
// this is a comment line
}
else
{
fprintf(stderr, "Error loading scene file... !");
getchar();
exit(-1);
}
}
}
input.close();
if (DRAW_ANIM_PATH) {
for (vector<Animation*>::iterator it = mAnimation.begin(); it < mAnimation.end(); ++it)
{
(*it)->CreateVertexBuffer();
}
}
}
示例4: rcd_file
/**
* Load sprites from the disk.
* @param filename Name of the RCD file to load.
* @return Error message if load failed, else \c nullptr.
* @todo Try to re-use already loaded blocks.
* @todo Code will use last loaded surface as grass.
*/
const char *SpriteManager::Load(const char *filename)
{
RcdFileReader rcd_file(filename);
if (!rcd_file.CheckFileHeader("RCDF", 2)) return "Bad header";
ImageMap sprites; // Sprites loaded from this file.
TextMap texts; // Texts loaded from this file.
TrackPiecesMap track_pieces; // Track pieces loaded from this file.
/* Load blocks. */
for (uint blk_num = 1;; blk_num++) {
if (!rcd_file.ReadBlockHeader()) return nullptr; // End reached.
/* Skip meta blocks. */
if (strcmp(rcd_file.name, "INFO") == 0) {
rcd_file.SkipBytes(rcd_file.size);
continue;
}
if (strcmp(rcd_file.name, "8PXL") == 0 || strcmp(rcd_file.name, "32PX") == 0) {
ImageData *imd = LoadImage(&rcd_file);
if (imd == nullptr) {
return "Image data loading failed";
}
std::pair<uint, ImageData *> p(blk_num, imd);
sprites.insert(p);
continue;
}
if (strcmp(rcd_file.name, "SURF") == 0) {
if (!this->LoadSURF(&rcd_file, sprites)) return "Surface block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "TSEL") == 0) {
if (!this->LoadTSEL(&rcd_file, sprites)) return "Tile-selection block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "PATH") == 0) {
if (!this->LoadPATH(&rcd_file, sprites)) return "Path-sprites block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "TCOR") == 0) {
if (!this->LoadTCOR(&rcd_file, sprites)) return "Tile-corners block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "FUND") == 0) {
if (!this->LoadFUND(&rcd_file, sprites)) return "Foundation block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "PLAT") == 0) {
if (!this->LoadPLAT(&rcd_file, sprites)) return "Platform block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "SUPP") == 0) {
if (!this->LoadSUPP(&rcd_file, sprites)) return "Support block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "BDIR") == 0) {
if (!this->LoadBDIR(&rcd_file, sprites)) return "Build arrows block loading failed.";
continue;
}
if (strcmp(rcd_file.name, "GCHK") == 0) {
if (!_gui_sprites.LoadGCHK(&rcd_file, sprites)) return "Loading Checkable GUI sprites failed.";
continue;
}
if (strcmp(rcd_file.name, "GBOR") == 0) {
if (!_gui_sprites.LoadGBOR(&rcd_file, sprites)) return "Loading Border GUI sprites failed.";
continue;
}
if (strcmp(rcd_file.name, "GSLI") == 0) {
if (!_gui_sprites.LoadGSLI(&rcd_file, sprites)) return "Loading Slider bar GUI sprites failed.";
continue;
}
if (strcmp(rcd_file.name, "GSCL") == 0) {
if (!_gui_sprites.LoadGSCL(&rcd_file, sprites)) return "Loading Scrollbar GUI sprites failed.";
continue;
}
if (strcmp(rcd_file.name, "GSLP") == 0) {
if (!_gui_sprites.LoadGSLP(&rcd_file, sprites, texts)) return "Loading slope selection GUI sprites failed.";
continue;
}
//.........这里部分代码省略.........
示例5: Load
void Puppet::Load(const std::string &filename, Entity *entity)
{
this->filename = filename;
animations.clear();
// delete parts?
parts.clear();
TiXmlDocument xmlDoc(Assets::GetContentPath() + filename);
if (xmlDoc.LoadFile())
{
/// TextureAtlas
TiXmlElement *xmlTextureAtlas = xmlDoc.FirstChildElement("TextureAtlas");
if (xmlTextureAtlas)
{
textureAtlas = new TextureAtlas();
textureAtlas->Load(xmlTextureAtlas);
}
/// Parts
TiXmlElement *xmlParts = xmlDoc.FirstChildElement("Parts");
if (xmlParts)
{
LoadParts(xmlParts, entity);
}
/// Animations
TiXmlElement *xmlAnimations = xmlDoc.FirstChildElement("Animations");
if (xmlAnimations)
{
/// Animation
TiXmlElement *xmlAnimation = xmlAnimations->FirstChildElement("Animation");
while (xmlAnimation)
{
Animation animation;
XMLFileNode xmlFileNodeKeyFrameAnim(xmlAnimation);
animation.Load(&xmlFileNodeKeyFrameAnim);
/// PartKeyFrames
TiXmlElement *xmlPartKeyFrames = xmlAnimation->FirstChildElement("PartKeyFrames");
while (xmlPartKeyFrames)
{
PartKeyFrames partKeyFrames;
partKeyFrames.SetPuppet(this);
XMLFileNode xmlFileNodeKeyFramePart(xmlPartKeyFrames);
partKeyFrames.Load(&xmlFileNodeKeyFramePart);
/// KeyFrame
TiXmlElement *xmlKeyFrame = xmlPartKeyFrames->FirstChildElement("KeyFrame");
while (xmlKeyFrame)
{
KeyFrame keyFrame;
XMLFileNode xmlFileNodeKeyFrame(xmlKeyFrame);
keyFrame.Load(&xmlFileNodeKeyFrame);
partKeyFrames.AddKeyFrame(keyFrame);
xmlKeyFrame = xmlKeyFrame->NextSiblingElement("KeyFrame");
}
animation.AddPartKeyFrames(partKeyFrames);
xmlPartKeyFrames = xmlPartKeyFrames->NextSiblingElement("PartKeyFrames");
}
animation.RefreshDuration();
animations.push_back(animation);
xmlAnimation = xmlAnimation->NextSiblingElement("Animation");
}
}
}
else
{
Debug::Log("Warning: Could not open puppet file: " + Assets::GetContentPath() + filename);
Debug::Log(" " + std::string(xmlDoc.ErrorDesc()));
printf(" Row: %d\n", xmlDoc.ErrorRow());
}
}
示例6: LoadScene
void World::LoadScene(const char * scene_path)
{
// Using case-insensitive strings and streams for easier parsing
ci_ifstream input;
input.open(scene_path, ios::in);
// Invalid file
if (input.fail())
{
fprintf(stderr, "Error loading file: %s\n", scene_path);
getchar();
exit(-1);
}
ci_string item;
while (std::getline(input, item, '['))
{
ci_istringstream iss(item);
ci_string result;
if (std::getline(iss, result, ']'))
{
if (result == "cube")
{
CubeModel* cube = new CubeModel();
cube->Load(iss);
mModel.push_back(cube);
}
else if (result == "sphere")
{
#if defined(PLATFORM_OSX)
int sphereTextureID = TextureLoader::LoadTexture("Textures/moonTexture.jpg");
#else
int sphereTextureID = TextureLoader::LoadTexture("../Assets/Textures/moonTexture.jpg");
#endif
SphereModel* moon = new SphereModel(sphereTextureID, vec3(10.0f, 10.0f, 10.0f));
moon->Load(iss);
mModel.push_back(moon);
}
else if (result == "animationkey")
{
AnimationKey* key = new AnimationKey();
key->Load(iss);
mAnimationKey.push_back(key);
}
else if (result == "animation")
{
Animation* anim = new Animation();
anim->Load(iss);
mAnimation.push_back(anim);
}
else if (result.empty() == false && result[0] == '#')
{
// this is a comment line
}
else
{
fprintf(stderr, "Error loading scene file... !");
getchar();
exit(-1);
}
}
}
input.close();
// Set Animation vertex buffers
for (vector<Animation*>::iterator it = mAnimation.begin(); it < mAnimation.end(); ++it)
{
// Draw model
(*it)->CreateVertexBuffer();
}
}
示例7: LoadScene
void World::LoadScene(const char * scene_path){
// Using case-insensitive strings and streams for easier parsing
ci_ifstream input;
input.open(scene_path, ios::in);
// Invalid file
if(input.fail() ){
fprintf(stderr, "Error loading file: %s\n", scene_path);
getchar();
exit(-1);
}
ci_string item;
while( std::getline( input, item, '[' ) ){
ci_istringstream iss( item );
ci_string result;
if( std::getline( iss, result, ']') ){
if( result == "cube" ){
// Box attributes
//CubeModel* cube = new CubeModel();
ourGuy->Load(iss);
mModel.push_back(ourGuy);
}
else if( result == "ground" ){
// Box attributes
CubeModel* cube = new CubeModel();
cube->Load(iss);
mModel.push_back(cube);
}
else if( result == "sphere" ){
//SphereModel* sphere = new SphereModel();
ourSphere->Load(iss);
mModel.push_back(ourSphere);
}
else if ( result == "animationkey" ){
AnimationKey* key = new AnimationKey();
key->Load(iss);
mAnimationKey.push_back(key);
}
else if (result == "animation"){
Animation* anim = new Animation();
anim->Load(iss);
mAnimation.push_back(anim);
}//*/
else if (result == "bspline"){
BSpline* spline = new BSpline();
spline->Load(iss);
mBSpline.push_back(spline);
}//*/
else if ( result.empty() == false && result[0] == '#'){
// this is a comment line
}
else{
fprintf(stderr, "Error loading scene file... !");
getchar();
exit(-1);
}
}
}
input.close();
// Set Animation vertex buffers
for (vector<Animation*>::iterator it = mAnimation.begin(); it < mAnimation.end(); ++it)
// Draw model
(*it)->CreateVertexBuffer();
}