本文整理汇总了C++中TexturePtr::normalisedCoord方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::normalisedCoord方法的具体用法?C++ TexturePtr::normalisedCoord怎么用?C++ TexturePtr::normalisedCoord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::normalisedCoord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateTexCoords
void NinePatch::updateTexCoords()
{
TexturePtr tex = material->textures[0];
float tw = (float)std::min(tex->dataWidth, tex->width);
float th = (float)std::min(tex->dataHeight, tex->height);
if(flip)
{
this->setTexCoord(0, tex->normalisedCoord(Vec2(0,0)));
this->setTexCoord(1, tex->normalisedCoord(Vec2(left, 0)));
this->setTexCoord(2, tex->normalisedCoord(Vec2(tw-right, 0)));
this->setTexCoord(3, tex->normalisedCoord(Vec2(tw, 0)));
this->setTexCoord(4, tex->normalisedCoord(Vec2(0,bottom)));
this->setTexCoord(5, tex->normalisedCoord(Vec2(left,bottom)));
this->setTexCoord(6, tex->normalisedCoord(Vec2(tw-right,bottom)));
this->setTexCoord(7, tex->normalisedCoord(Vec2(tw,bottom)));
this->setTexCoord(8, tex->normalisedCoord(Vec2(0,th-top)));
this->setTexCoord(9, tex->normalisedCoord(Vec2(left,th-top)));
this->setTexCoord(10, tex->normalisedCoord(Vec2(tw-right, th-top)));
this->setTexCoord(11, tex->normalisedCoord(Vec2(tw, th-top)));
this->setTexCoord(12, tex->normalisedCoord(Vec2(0,th)));
this->setTexCoord(13, tex->normalisedCoord(Vec2(left,th)));
this->setTexCoord(14, tex->normalisedCoord(Vec2(tw-right,th)));
this->setTexCoord(15, tex->normalisedCoord(Vec2(tw, th)));
}
else
{
this->setTexCoord(0, tex->normalisedCoord(Vec2(0,th)));
this->setTexCoord(1, tex->normalisedCoord(Vec2(left, th)));
this->setTexCoord(2, tex->normalisedCoord(Vec2(tw-right, th)));
this->setTexCoord(3, tex->normalisedCoord(Vec2(tw, th)));
this->setTexCoord(4, tex->normalisedCoord(Vec2(0,th-top)));
this->setTexCoord(5, tex->normalisedCoord(Vec2(left,th-top)));
this->setTexCoord(6, tex->normalisedCoord(Vec2(tw-right, th-top)));
this->setTexCoord(7, tex->normalisedCoord(Vec2(tw, th-top)));
this->setTexCoord(8, tex->normalisedCoord(Vec2(0,bottom)));
this->setTexCoord(9, tex->normalisedCoord(Vec2(left,bottom)));
this->setTexCoord(10, tex->normalisedCoord(Vec2(tw-right, bottom)));
this->setTexCoord(11, tex->normalisedCoord(Vec2(tw, bottom)));
this->setTexCoord(12, tex->normalisedCoord(Vec2(0,0)));
this->setTexCoord(13, tex->normalisedCoord(Vec2(left,0)));
this->setTexCoord(14, tex->normalisedCoord(Vec2(tw-right,0)));
this->setTexCoord(15, tex->normalisedCoord(Vec2(tw, 0)));
}
}