当前位置: 首页>>代码示例>>C++>>正文


C++ btVector3::z方法代码示例

本文整理汇总了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();
}
开发者ID:jsj2008,项目名称:roverSim,代码行数:33,代码来源:terrain.cpp

示例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();
    }
}
开发者ID:jiangong01,项目名称:cs274c,代码行数:29,代码来源:sph.cpp

示例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 ) );
	}
开发者ID:Psybrus,项目名称:Psybrus,代码行数:7,代码来源:ScnPhysicsWorldComponent.cpp

示例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);
}
开发者ID:ethicalfive,项目名称:critterding,代码行数:28,代码来源:be_model_system.cpp

示例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;
	}
开发者ID:DreadIsBack,项目名称:BlendELF,代码行数:30,代码来源:physics.cpp

示例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());
}
开发者ID:Anth5,项目名称:vdrift,代码行数:7,代码来源:fracturebody.cpp

示例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);
}
开发者ID:afavaro,项目名称:SPACEBATS,代码行数:7,代码来源:Camera.cpp

示例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);
}
开发者ID:PhilCK,项目名称:reaper-squad,代码行数:8,代码来源:PhysicsDebugRenderer.cpp

示例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);
}
开发者ID:PhilCK,项目名称:reaper-squad,代码行数:8,代码来源:PhysicsDebugRenderer.cpp

示例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)
		);
		
	}
开发者ID:napoleon89,项目名称:Pawprint,代码行数:8,代码来源:game.cpp

示例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();
}
开发者ID:flupke,项目名称:ballistics,代码行数:9,代码来源:gl_debug_draw.cpp

示例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;
}
开发者ID:93i,项目名称:godot,代码行数:10,代码来源:btRigidBody.cpp

示例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 );
	}
开发者ID:IreNox,项目名称:tiki3,代码行数:10,代码来源:physicsdebugdraw.cpp

示例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);
}
开发者ID:GuMiner,项目名称:agow,代码行数:10,代码来源:PhysicsDebugDrawer.cpp

示例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();
}
开发者ID:cskilbeck,项目名称:Game,代码行数:11,代码来源:PhysicsDebug.cpp


注:本文中的btVector3::z方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。