本文整理匯總了C++中Billboard::setRotation方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::setRotation方法的具體用法?C++ Billboard::setRotation怎麽用?C++ Billboard::setRotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Billboard
的用法示例。
在下文中一共展示了Billboard::setRotation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: createBillboard
void BillboardSetComponent::createBillboard(const PonykartParsers::BillboardBlock* const block)
{
Billboard* bb = billboardSet->createBillboard(block->getVectorProperty("Position")); // make our billboard
// set its color if it has one, and a rotation
auto quatIt=block->getQuatTokens().find("colour");
if (quatIt != block->getQuatTokens().end())
bb->setColour(toColourValue(quatIt->second));
bb->setRotation(Degree(block->getFloatProperty("Rotation", 0)));
auto rectQIt = block->getQuatTokens().find("texturecoords");
if (rectQIt != block->getQuatTokens().end())
bb->setTexcoordRect(rectQIt->second.x, rectQIt->second.y, rectQIt->second.z, rectQIt->second.w);
// It's best to not do this unless we really need to since it makes it less efficient
auto fTokens = block->getFloatTokens();
auto heightIt=fTokens.find("height"), widthIt=fTokens.find("width");
if (heightIt!=fTokens.end() && widthIt!=fTokens.end())
bb->setDimensions(widthIt->second, heightIt->second);
}
示例2: onTimeStep
void Projectile::onTimeStep() {
Object::onTimeStep();
Billboard* billboard = billboards_->getBillboard(0);
billboard->setRotation(billboard->getRotation() + Radian(0.2f));
time_ += 0.1f;
float width = billboard->getOwnWidth();
float height = billboard->getOwnWidth();
if (hit_) {
if (target_) node_->setPosition(target_->getPosition());
width = min(2.0f, width + 0.2f); // Grow the projectile
height = min(2.0f, height + 0.2f);
} else {
width = 0.2f * sinf(time_) + 1.0f; // Make the projectile oscillate in size
height = 0.2f * sinf(time_) + 1.0f;
}
billboard->setDimensions(width, height);
}