当前位置: 首页 > news >正文

wordpress域名重复/seo服务优化

wordpress域名重复,seo服务优化,桂林在线交流,网站建设服务器百度云导入动画 spinespine 是一款2d动画制作工具,具体介绍见:http://zh.esotericsoftware.com/我们让我们的引擎支持它制作的动画。首先从github下载官方runTimes,这里选择spine-c。然后我们要处理的是它的渲染与创建。/************************************…
导入动画 spine
spine 是一款2d动画制作工具,具体介绍见:http://zh.esotericsoftware.com/

我们让我们的引擎支持它制作的动画。
首先从github下载官方runTimes,这里选择spine-c。
然后我们要处理的是它的渲染与创建。
/********************************************************************Copyright(C), 2012-2013,FileName:SkeletonAnimation.hDescription:Author:cloudCreated:2014/11/07history:
7:11:2014 15:41 by
*********************************************************************/
#pragma once
#include "export/Node.h"
#include "spine/spine.h"
#include "base/GLFix.h"
#include "base/render/Quad.h"namespace cloud
{class SkeletonAnimation :public Node{public:SkeletonAnimation(const char* atasPath,const char* jsonPath);~SkeletonAnimation();		void initialize(const char* atasPath,const char* jsonPath);void update(float dt);void createTexture(const char* texturePath);void removeTexture();void render(const Mat4& parentMat4);Size getTextureSize();void playAnimation(const char* animationName,bool isLoop);void stopAnimation(int endTrackIdx = -1);protected:std::string _animationName;spAnimationState* _state;spSkeleton* _skeleton;GLuint _textureID;Size _textureSize;std::string _texturePath;QuadCommand      _quadCommand;Quad* _quads;BlendFunc        _blendFunc; int _totalQuads;};
}

/********************************************************************Copyright(C), 2012-2013,FileName:SkeletonAnimation.cppDescription:Author:cloudCreated:2014/11/07history:
7:11:2014 15:42 by
*********************************************************************/
#include "base/TextureManager.h"
#include "spine/SkeletonAnimation.h"
#include "base/render/Renderer.h"
#include "base/EngineLog.h"//TODO:未加入事件回调namespace cloud
{	SkeletonAnimation::SkeletonAnimation(const char* atasPath,const char* jsonPath):_skeleton(NULL),_state(NULL),_quads(NULL),_totalQuads(0){_blendFunc = BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);std::string dirPath = atasPath;int pos = dirPath.rfind("/");if (pos > -1){dirPath = dirPath.substr(0,pos+1);}else{dirPath = "";}initialize(atasPath,jsonPath);_totalQuads = _skeleton->slotsCount;_quads = (Quad*)malloc( _totalQuads * sizeof(Quad));memset(_quads, 0, _totalQuads * sizeof(Quad));}SkeletonAnimation::~SkeletonAnimation(){if (_quads){free(_quads);}spAnimationState_dispose(_state);spSkeleton_dispose(_skeleton);}void SkeletonAnimation::initialize(const char* atasPath,const char* jsonPath){spAtlas* atlas = spAtlas_createFromFile(atasPath,this);spSkeletonJson* json = spSkeletonJson_create(atlas);		spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, jsonPath);spSkeletonJson_dispose(json);_skeleton = spSkeleton_create(skeletonData);		_state = spAnimationState_create(spAnimationStateData_create(_skeleton->data));	}void SkeletonAnimation::playAnimation(const char* animationName,bool isLoop){		_animationName = animationName;spAnimationState_setAnimationByName(_state, 0, animationName, isLoop);	if(!isScheduleUpdate())scheduleUpdate();}void SkeletonAnimation::stopAnimation(int endTrackIdx){if(isScheduleUpdate())unscheduleUpdate();if (endTrackIdx != -1){spAnimationState_setAnimationByName(_state, endTrackIdx, _animationName.c_str(), false);			}}void SkeletonAnimation::update(float dt){//spBone* rootBone = _skeleton->bones[0];spSkeleton_update(_skeleton,dt);spAnimationState_update(_state, dt);spAnimationState_apply(_state, _skeleton);spSkeleton_updateWorldTransform(_skeleton);}void SkeletonAnimation::createTexture(const char* texturePath){int textureWidth;int textureHeight;_textureID = TextureManager::getInstance()->createTexture(texturePath,textureWidth,textureHeight);_textureSize = Size(textureWidth,textureHeight);_contentSize = _textureSize;_texturePath = texturePath;}void SkeletonAnimation::removeTexture(){TextureManager::getInstance()->removeTexture(_texturePath.c_str());_texturePath = "";}void SkeletonAnimation::render(const Mat4& parentMat4){//float vertices[8];for (int i = 0, n = _skeleton->slotsCount; i < n; i++){spSlot* slot = _skeleton->drawOrder[i];if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;spRegionAttachment* regionAttachment = (spRegionAttachment*)slot->attachment;spRegionAttachment_computeWorldVertices(regionAttachment, slot->bone, vertices);float r = slot->r;float g = slot->g;float b = slot->b;float a =slot->a;Quad* quad = _quads+ i;quad->bl._color.r = r;quad->bl._color.g = g;quad->bl._color.b = b;quad->bl._color.a = a;quad->tl._color.r = r;quad->tl._color.g = g;quad->tl._color.b = b;quad->tl._color.a = a;quad->tr._color.r = r;quad->tr._color.g = g;quad->tr._color.b = b;quad->tr._color.a = a;quad->br._color.r = r;quad->br._color.g = g;quad->br._color.b = b;quad->br._color.a = a;quad->bl._position.x = vertices[SP_VERTEX_X1];quad->bl._position.y = vertices[SP_VERTEX_Y1];quad->tl._position.x = vertices[SP_VERTEX_X2];quad->tl._position.y = vertices[SP_VERTEX_Y2];quad->tr._position.x = vertices[SP_VERTEX_X3];quad->tr._position.y = vertices[SP_VERTEX_Y3];quad->br._position.x = vertices[SP_VERTEX_X4];quad->br._position.y = vertices[SP_VERTEX_Y4];quad->bl._texCoord.x = regionAttachment->uvs[SP_VERTEX_X1];quad->bl._texCoord.y = regionAttachment->uvs[SP_VERTEX_Y1];quad->tl._texCoord.x = regionAttachment->uvs[SP_VERTEX_X2];quad->tl._texCoord.y = regionAttachment->uvs[SP_VERTEX_Y2];quad->tr._texCoord.x = regionAttachment->uvs[SP_VERTEX_X3];quad->tr._texCoord.y = regionAttachment->uvs[SP_VERTEX_Y3];quad->br._texCoord.x = regionAttachment->uvs[SP_VERTEX_X4];quad->br._texCoord.y = regionAttachment->uvs[SP_VERTEX_Y4];		}_quadCommand.init(_quads,_textureID,_totalQuads,_blendFunc,this->transform(parentMat4));Renderer::getInstance()->addQuadCommand(&_quadCommand);}Size SkeletonAnimation::getTextureSize(){return _textureSize;}
}

还要实例化它的三个函数:
#include "extension.h"
#include "base/fileUtils/FileUtils.h"
#include "SkeletonAnimation.h"
void _spAtlasPage_createTexture (spAtlasPage* self, const char* path)
{cloud::SkeletonAnimation* skeletonAnimation = (cloud::SkeletonAnimation*) self->atlas->rendererObject;if(skeletonAnimation){skeletonAnimation->createTexture(path);self->width = skeletonAnimation->getTextureSize().width;self->height = skeletonAnimation->getTextureSize().height;}
}void _spAtlasPage_disposeTexture (spAtlasPage* self)
{cloud::SkeletonAnimation* skeletonAnimation = (cloud::SkeletonAnimation*) self->atlas->rendererObject;if(skeletonAnimation)skeletonAnimation->removeTexture();
}char* _spUtil_readFile (const char* path, int* length)
{unsigned char* outData = NULL;unsigned int outLen = 0;cloud::FileUtils::getInstance()->readFile(path,&outData,outLen);*length = outLen;return (char*)outData;
}

调用代码如下:
SkeletonAnimation* ske = new SkeletonAnimation("spineboy.atlas","spineboy.json");ske->setScale(0.3f);ske->setPosition(Point(winSize.width* 0.5,winSize.height * 0.3));ske->playAnimation("walk",true);addChild(ske,3);

要注意的几点是:
_spAtlasPage_createTexture里要被纹理的长宽,重新赋值回去。
spin的纹理为png,而且默认是上下颠倒了的。

http://www.lbrq.cn/news/1112275.html

相关文章:

  • 做网赌需要在哪些网站投广告/东莞做网站优化
  • 做网站被骗了警察不管/今天刚刚发生的新闻最新新闻
  • 网站编程赚钱/上海全网营销推广
  • 上海部道网站 建设/网站优化排名推荐
  • 网站域名购买后能修改吗/微博搜索引擎优化
  • 佛山网站建设 骏域/百度如何购买关键词
  • wordpress 设置url/网站关键词优化网站推广
  • 大连市网站推广公司/品牌策划的五个步骤
  • 网站建设页面/全网推广平台有哪些
  • 做中学学中做网站/哈尔滨seo优化软件
  • 首钢建设二公司网站/网站设计公司
  • 自己做淘宝网站/重庆网络推广外包
  • 哪个网站做高仿衣服/谷歌搜索引擎入口google
  • 网站做点线表格/新手学seo
  • 哪些网站可以直接做英文字谜/seo哪家强
  • 网站开场flash怎么做的/免费人脉推广
  • 网站建设要/站长之家网站
  • 如何做自己的网站百度推广/搜索优化引擎
  • 重庆网站推广优化/3天引流800个人技巧
  • 网站一个人可以做吗/长沙官网seo收费标准
  • 给公司网站做seo的好处/站长工具樱花
  • 最好的免费发布网站/网站建设报价方案
  • 站长工具关键词挖掘/页面seo是什么意思
  • 如何创建自己的网站链接/如何建立自己的网络销售
  • 网站开发 简历项目经历/宁德市教育局官网
  • 淘宝自己建的网站/苏州seo报价
  • 广告公司做的网站字体侵权/开个网站平台要多少钱
  • 网站建设的3个基本原则/百度优化是什么
  • 营销型网站要多少钱/优化方案丛书官网
  • 西宁网站建设官网/seo基础理论
  • SpringBoot中使用MessageSource的getMessage获取i18n资源文件中的消息
  • BIST会对锁步核做什么?
  • 异世界历险之数据结构世界(排序(插入,希尔,堆排))
  • Python爬虫入门到实战(3)-对网页进行操作
  • ota之.加密算法,mcu加密方式
  • 【C++详解】STL-stack、queue的模拟实现,容器适配器,deque双端队列介绍