本文整理汇总了C++中IPhysicsObject::GetIsAwake方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::GetIsAwake方法的具体用法?C++ IPhysicsObject::GetIsAwake怎么用?C++ IPhysicsObject::GetIsAwake使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::GetIsAwake方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void PhysicsSceneRenderer::Render(PhysicsScene *p_scene, Camera *p_camera)
{
vec4 planes[6];
p_camera->getFrustumPlanes(planes);
auto & cloths = p_scene->GetCloths();
for (auto iter = cloths.begin(); iter != cloths.end(); ++iter)
{
ICloth *cloth = (*iter);
IPhysicsObject ** nodes = cloth->GetNodes();
for (unsigned int r = 0; r < cloth->GetHeight() - 1; ++r)
{
for (unsigned int c = 0; c < cloth->GetWidth() - 1; ++c)
{
{
auto obj0 = nodes[r * cloth->GetWidth() + c];
auto obj1 = nodes[(r + 1) * cloth->GetWidth() + c];
auto obj2 = nodes[(r + 1) * cloth->GetWidth() + (c + 1)];
auto col0 = GetRenderInfo(obj0).m_colour;
auto col1 = GetRenderInfo(obj1).m_colour;
auto col2 = GetRenderInfo(obj2).m_colour;
auto col = glm::mix(col0, glm::mix(col1, col2, 0.5F), 0.6667F);
col.a = 1.0F;
if (!(obj0->GetHasConstraintBroke() || obj1->GetHasConstraintBroke() || obj2->GetHasConstraintBroke()))
Gizmos::addTri(obj0->GetPosition(), obj1->GetPosition(), obj2->GetPosition(), col);
}
{
auto obj0 = nodes[r * cloth->GetWidth() + c];
auto obj1 = nodes[(r + 1) * cloth->GetWidth() + (c + 1)];
auto obj2 = nodes[r * cloth->GetWidth() + (c + 1)];
auto col0 = GetRenderInfo(obj0).m_colour;
auto col1 = GetRenderInfo(obj1).m_colour;
auto col2 = GetRenderInfo(obj2).m_colour;
auto col = glm::mix(col0, glm::mix(col1, col2, 0.5F), 0.6667F);
col.a = 1.0F;
if (!(obj0->GetHasConstraintBroke() || obj1->GetHasConstraintBroke() || obj2->GetHasConstraintBroke()))
Gizmos::addTri(obj0->GetPosition(), obj1->GetPosition(), obj2->GetPosition(), col);
}
}
}
}
int activeObjects = 0;
auto & objects = p_scene->GetPhysicsObjects();
for (auto iter = objects.begin(); iter != objects.end(); ++iter)
{
IPhysicsObject *obj = (*iter);
activeObjects += obj->GetIsAwake();
RenderInfo &info = GetRenderInfo(obj);
auto col = info.m_colour;
if (col.a == 0.0F)
continue;
ICollider * collider = obj->GetCollider();
switch (collider->GetType())
{
case ICollider::Type::SPHERE:
{
float r = ((SphereCollider*)collider)->GetRadius();
bool hidden = false;
for (int i = 0; i < 6; i++) {
float d = glm::dot(vec3(planes[i]), obj->GetPosition()) +
planes[i].w;
if (d < -r)
{
hidden = true;
continue;
}
}
if (hidden)
continue;
if (obj->GetIsAwake())
{
int j = glm::clamp((int)(r * 4), 2, 4);
Gizmos::addSphere(obj->GetPosition(), r, j, j * 2, col);
}
else
{
float r = ((SphereCollider*)collider)->GetRadius();
//.........这里部分代码省略.........