本文整理汇总了C++中btVector3::z方法的典型用法代码示例。如果您正苦于以下问题:C++ btVector3::z方法的具体用法?C++ btVector3::z怎么用?C++ btVector3::z使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类btVector3
的用法示例。
在下文中一共展示了btVector3::z方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTerrainSize
void terrain::setTerrainSize(btVector3 size)
{
if(size == m_terrainSize) return;
btVector3 modscale = (size - m_terrainSize) / m_terrainSize; // the difference between the new and old size divided by the old size
if(m_terrainSize.z() == 0) modscale.setZ(size.z()); // incase of NAN
m_terrainMinHeight = m_terrainMaxHeight = 0;
for(int i=0; i<m_terrainVertexCount; i++){
m_terrainVerts[i].x += modscale.x() * m_terrainVerts[i].x;
m_terrainVerts[i].y += modscale.y() * m_terrainVerts[i].y;
if(m_terrainSize.z() == 0)
m_terrainVerts[i].z = size.z();
else
m_terrainVerts[i].z += modscale.z() * m_terrainVerts[i].z;
if(m_terrainVerts[i].z > m_terrainMaxHeight)
m_terrainMaxHeight = m_terrainVerts[i].z;
else if(m_terrainVerts[i].z < m_terrainMinHeight)
m_terrainMinHeight = m_terrainVerts[i].z;
}
buildNormals();
m_terrainSize = size;
tTool->setSize(m_terrainSize);
m_parent->printText(QString("Terrain Resized %1,%2,%3").arg(m_terrainSize.x()).arg(m_terrainSize.y()).arg(m_terrainSize.z()));
this->terrainRefresh();
emit newTerrain();
}
示例2: renderSPH
void renderSPH()
{
static const btVector3 activeColor = btVector3(1, 1, 1);
static const btVector3 inactiveColor = btVector3(.3, .3, .7);
for(int n = 0; n < fluid->numParticles(); ++n)
{
btVector3 p = fluid->getPosition(n);
btVector3 vel = fluid->getVelocity(n);
float speed = std::min(1.0f, vel.length() / 1.0f);
btVector3 color = (1.0f - speed) * inactiveColor + speed * activeColor;
glPushMatrix();
glColor3f(color.x(), color.y(), color.z() );
float xt = (p.getX() - minBound.x()) / (maxBound.x() - minBound.x());
float yt = (p.getY() - minBound.y()) / (maxBound.y() - minBound.y());
float zt = (p.getZ() - minBound.z()) / (maxBound.z() - minBound.z());
glTranslatef(xt*scale.x() + origin.x(), yt*scale.y() + origin.y(), zt*scale.z() + origin.z());
glBegin( GL_LINE_LOOP );
GLUquadricObj *quadric;
quadric = gluNewQuadric();
gluQuadricDrawStyle(quadric, GLU_FILL );
gluSphere( quadric , 1.0f , 8 , 8);
glGetError();
gluDeleteQuadric(quadric);
glEnd();
glPopMatrix();
}
}
示例3: drawLine
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
ScnDebugRenderComponent::pImpl()->drawLine(
MaVec3d( from.x(), from.y(), from.z() ),
MaVec3d( to.x(), to.y(), to.z() ),
RsColour( color.x(), color.y(), color.z(), 1.0f ) );
}
示例4: draw
void BeGraphicsModel::draw( unsigned int current_material, const btTransform& transform, const btVector3& scale )
{
// btScalar m[16];
transform.getOpenGLMatrix(m_matrix);
// m_system->matrixPush(GL_MODELVIEW);
glPushMatrix();
// m_system->matrixMult(GL_MODELVIEW, m_matrix);
m_system->matrixMult(m_matrix);
// m_system->matrixLoad(GL_MODELVIEW, m_matrix);
// m_system->matrixPush(GL_MODELVIEW);
// glPushMatrix();
if ( scale.x() != 1.0f || scale.y() != 1.0f || scale.z() != 1.0f )
m_system->matrixScale(GL_MODELVIEW, scale.x(), scale.y(), scale.z());
draw(current_material);
// glPopMatrix();
// m_system->matrixPop(GL_MODELVIEW);
// m_system->matrixPop(GL_MODELVIEW);
glPopMatrix();
//glEnable(GL_CULL_FACE);
//glCullFace(GL_BACK);
}
示例5: addSingleResult
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
{
elfCollision* collision;
m_collisionObject = rayResult.m_collisionObject;
if (normalInWorldSpace)
{
m_hitNormalWorld = rayResult.m_hitNormalLocal;
}
else
{
m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
}
m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction);
collision = elfCreateCollision();
collision->position.x = m_hitPointWorld.x();
collision->position.y = m_hitPointWorld.y();
collision->position.z = m_hitPointWorld.z();
collision->normal.x = m_hitNormalWorld.x();
collision->normal.y = m_hitNormalWorld.y();
collision->normal.z = m_hitNormalWorld.z();
collision->actor = ((elfPhysicsObject*)((btRigidBody*)m_collisionObject)->getUserPointer())->actor;
elfIncRef((elfObject*)collision->actor);
elfAppendListObject(m_list, (elfObject*)collision);
return rayResult.m_hitFraction;
}
示例6: getPrincipalInertia
static inline btVector3 getPrincipalInertia(const btVector3 & p, const btScalar & m)
{
return m * btVector3(
p.y() * p.y() + p.z() * p.z(),
p.x() * p.x() + p.z() * p.z(),
p.x() * p.x() + p.y() * p.y());
}
示例7: setTarget
void Camera::setTarget(btVector3 target) {
btScalar yaw =
atan((pos.x() - target.x()) / (pos.z() - target.z()));
btScalar pitch =
atan((pos.y() - target.y()) / (pos.z() - target.z()));
quat = btQuaternion(btVector3(0, 1, 0), M_PI) * btQuaternion(yaw, pitch, 0);
}
示例8: drawContactPoint
void PhysicsDebugRenderer::drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
{
const glm::vec3 center(PointOnB.x(), PointOnB.y(), PointOnB.z());
const glm::vec3 cubeSize(0.1f, 0.1f, 0.1f);
const glm::vec3 cubeColor(color.x(), color.y(), color.z());
DebugRenderer::DrawCube(center, cubeSize, cubeColor);
}
示例9: drawLine
void PhysicsDebugRenderer::drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)
{
const glm::vec3 start(from.x(), from.y(), from.z());
const glm::vec3 end(to.x(), to.y(), to.z());
const glm::vec3 lineColor(color.x(), color.y(), color.z());
DebugRenderer::DrawLine(start, end, lineColor);
}
示例10: drawLine
void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color) override {
DebugRenderQueue::addLine(
Vec3(from.x(), from.y(), from.z()),
Vec3(to.x(), to.y(), to.z()),
Vec4(color.x(), color.y(), color.z(), 1.0f)
);
}
示例11: drawLine
void glDebugDraw::drawLine(const btVector3 &from, const btVector3 &to,
const btVector3 &color)
{
glColor3f(color.x(), color.y(), color.z());
glBegin(GL_LINES);
glVertex3f(from.x(), from.y(), from.z());
glVertex3f(to.x(), to.y(), to.z());
glEnd();
}
示例12: getLocalInertia
btVector3 btRigidBody::getLocalInertia() const
{
btVector3 inertiaLocal;
const btVector3 inertia = m_invInertiaLocal;
inertiaLocal.setValue(inertia.x() != btScalar(0.0) ? btScalar(1.0) / inertia.x() : btScalar(0.0),
inertia.y() != btScalar(0.0) ? btScalar(1.0) / inertia.y() : btScalar(0.0),
inertia.z() != btScalar(0.0) ? btScalar(1.0) / inertia.z() : btScalar(0.0));
return inertiaLocal;
}
示例13: drawTriangle
void PhysicsDebugDraw::drawTriangle( const btVector3& a, const btVector3& b, const btVector3& c,const btVector3& color, btScalar alpha )
{
const Vector3 v1 = { a.x(), a.y(), a.z() };
const Vector3 v2 = { b.x(), b.y(), b.z() };
const Vector3 v3 = { c.x(), c.y(), c.z() };
const Color color2 = color::fromFloatRGBA( color.x(), color.y(), color.z(), 1.0f );
const Vector3 points[] = { v1, v2, v3, v1 };
debugrenderer::drawLines( points, TIKI_COUNT( points ), color2 );
}
示例14: drawLine
void PhysicsDebugDrawer::drawLine(const btVector3& from, const btVector3& to, const btVector3& color)
{
// Draw a line with the 'from' position being slightly darker.
glm::vec3 glmColor = glm::vec3(color.x(), color.y(), color.z());
lines.positions.push_back(glm::vec3(from.x(), from.y(), from.z()));
lines.colors.push_back(glmColor * 0.80f);
lines.positions.push_back(glm::vec3(to.x(), to.y(), to.z()));
lines.colors.push_back(glmColor);
}
示例15: drawLine
void PhysicsDebug::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
mIC->BeginVertex();
mIC->SetPosition3(from.get128());
mIC->SetColor(FromRGBf(color.x(), color.y(), color.z()));
mIC->EndVertex();
mIC->BeginVertex();
mIC->SetPosition3(to.get128());
mIC->SetColor(FromRGBf(color.x(), color.y(), color.z()));
mIC->EndVertex();
}