本文整理汇总了C++中Animation::RemainingTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::RemainingTime方法的具体用法?C++ Animation::RemainingTime怎么用?C++ Animation::RemainingTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::RemainingTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPlane
//FIXME: a lot less map requests (therefore a lot higher map rendering speed) can be made
//if you draw volumes of cells separately. transparency may break
void Map_Render_Debug::drawPlane(int bx1, int by1, int bx2, int by2, int bz) {
int tx = (int)floor(bx1 / 64.0f);
int ty = (int)floor(by1 / 64.0f);
rmp_cityscape* cityscape = Map.cellCityscape(tx,ty); //cityscape to gather data from
for (int x = bx1; x <= bx2; x++)
for (int y = by1; y <= by2; y++) {
int cx = (int)floor(x / 64.0f); //current cityscape
int cy = (int)floor(y / 64.0f);
if ((tx != cx) || (ty != cy)) {
tx = cx; ty = cy; //precache new one
cityscape = Map.cellCityscape(tx,ty);
}
int kx = x - 64*(x / 64);//abs(x % 64);//x-abs(cx*64);
int ky = y - 64*(y / 64);//abs(y % 64);//y-abs(cy*64);
//int texID =
if ((cityscape->rmp_city_scape) && (bz < cityscape->maxHeight)) {
Vertex_Buffer* vBuffer = 0;
TexID texBase = 0;
for (uint i = 0; i < VBOEntry.Count; i++) {
if (strcmp(VBOEntry[i]->GraphicsName,cityscape->GraphicsName[0]) == 0) {
vBuffer = &VBOEntry[i]->VBO;
texBase = VBOEntry[i]->SpriteBase;
break;
}
}
if (vBuffer == 0) {
//debugrender_vboentry* vboEntry = VBOEntry.Add();
VBOEntry.Count++; //Add();
if (VBOEntry.Count >= VBOEntry.AllocCount) {
logWrite("BAD ERROR: attempting to draw more different VBO's than allocated entries");
return;
}
VBOEntry[VBOEntry.Count-1]->GraphicsName = cityscape->GraphicsName[0];
VBOEntry[VBOEntry.Count-1]->VBO.Clear();
vBuffer = &VBOEntry[VBOEntry.Count-1]->VBO;
//Get sprite base TexID to use later to bind texture atlas (also this is offset for blockgeometry)
char texName[256];
snprintf(texName,256,"%s_0",VBOEntry[VBOEntry.Count-1]->GraphicsName);
VBOEntry[VBOEntry.Count-1]->SpriteBase = Graphics.GetTextureID(texName);
texBase = VBOEntry[VBOEntry.Count-1]->SpriteBase;
}
//Block fetched from map:
rmp_block_info* block = &cityscape->rmp_city_scape[bz*64*64+ky*64+kx];
//Block with (possibly) animated textures:
rmp_block_info _block;
memcpy(&_block,block,sizeof(rmp_block_info));
TexID tex_left = texBase+block->tex_left;
TexID tex_right = texBase+block->tex_right;
TexID tex_top = texBase+block->tex_top;
TexID tex_bottom = texBase+block->tex_bottom;
TexID tex_lid = texBase+block->tex_lid;
AnimSeqID anim_left = Animations.GetAnimationSeq(tex_left);
AnimSeqID anim_right = Animations.GetAnimationSeq(tex_right);
AnimSeqID anim_top = Animations.GetAnimationSeq(tex_top);
AnimSeqID anim_bottom = Animations.GetAnimationSeq(tex_bottom);
AnimSeqID anim_lid = Animations.GetAnimationSeq(tex_lid);
//Animate faces
float tgtAnimationTime = 0.0f;
if (anim_left != BAD_ID) { //HAX
Animation anim = Animations.GetAnimation(anim_left);
anim.startTime = 0.0f;
_block.tex_left = anim.GetTexID()-texBase;
tgtAnimationTime = Timer.Time() + anim.RemainingTime();
}
if (anim_right != BAD_ID) {
Animation anim = Animations.GetAnimation(anim_right);
anim.startTime = 0.0f;
_block.tex_right = anim.GetTexID()-texBase;
tgtAnimationTime = Timer.Time() + anim.RemainingTime();
}
if (anim_top != BAD_ID) {
Animation anim = Animations.GetAnimation(anim_top);
anim.startTime = 0.0f;
_block.tex_top = anim.GetTexID()-texBase;
tgtAnimationTime = Timer.Time() + anim.RemainingTime();
}
if (anim_bottom != BAD_ID) {
Animation anim = Animations.GetAnimation(anim_bottom);
anim.startTime = 0.0f;
_block.tex_bottom = anim.GetTexID()-texBase;
tgtAnimationTime = Timer.Time() + anim.RemainingTime();
}
if (anim_lid != BAD_ID) {
Animation anim = Animations.GetAnimation(anim_lid);
//.........这里部分代码省略.........