• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Float3函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Float3函数的典型用法代码示例。如果您正苦于以下问题:C++ Float3函数的具体用法?C++ Float3怎么用?C++ Float3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Float3函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetModelName

		Air::U1 Actor::Create()
		{
			if (m_Info.strModelName.empty()	||	m_Info.pSection	==	NULL)
			{
				return false;
			}
			m_pNode	=	m_Info.pSection->GetActorNode()->CreateChildSceneNode();
			SetModelName(m_Info.strModelName);

			Physics::Object::Info poInfo;
			poInfo.fMass	=	1;
			poInfo.uiShapeCount	=	1;
			poInfo.pShapeArray[0].SetCylinder(Float3(0,0,0),0.5,1);
			m_pHitShape	=	PhysicsSystem::GetSingleton()->CreateProduct<Physics::Object>(m_strProductName+"_CD",&poInfo);
			m_pHitShape->SetUserData(this);
			m_pNode->attachObject(m_pHitShape);
			return true;
		}
开发者ID:ingeyu,项目名称:airengine,代码行数:18,代码来源:AirGameActor.cpp


示例2: Float3

	void RenderSetSorted::AddRenderNodeSolution(RenderNode *nodePtr)
	{
		static bool added = false;
		if(!added)
		{
			PrintConsole::GetReference().AddSolution(L"ED2", "Sorting & Hierarchy", Float3(1.0f, 0.0f, 0.0f), 
				L"RenderSetSorted::AddRenderNodeSolution");
			added = true;
		}

		RenderShape *pShape = (RenderShape *)nodePtr;
		// Empty list
		if (0 == headPtr)
		{
			tailPtr = pShape;
			tailPtr->SetNext(0);
			headPtr = pShape;
		}
		else
		{
			RenderShape *pPrevious = 0;
			RenderShape *pCurrent = (RenderShape *)headPtr;

			// Check if this node is first
			if(!SortFunc(pCurrent, pShape))
			{
				pPrevious = pCurrent;
				pCurrent = (RenderShape *)pCurrent->GetNext();

				// Find where this node goes
				while(pCurrent && !SortFunc(pCurrent, pShape))
				{
					pPrevious = pCurrent;
					pCurrent = (RenderShape *)pCurrent->GetNext();
				}
				pPrevious->SetNext(pShape);
			}
			else
				headPtr = pShape;
			pShape->SetNext(pCurrent);
			if(!pCurrent)
				tailPtr = pShape;
		}
	}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:44,代码来源:RenderSetSortedSolution.cpp


示例3: acos

Float3 MlRachis::matchNormal(const Vector3F & wv, const Matrix33F & space)
{
	Vector3F ov = space.transform(wv);

	Vector3F va = ov;
	va.y = 0.f;
	va.z -= 0.05f;
	va.normalize();
	float a = acos(Vector3F::XAxis.dot(va));
	if(va.z > 0.f) a = -a;
	
	Vector3F vb = ov;
	vb.z = 0.f;
	vb.normalize();
	float b = acos(Vector3F::XAxis.dot(vb));
	if(vb.y < 0.f) b = -b;
	
	return Float3(a, b, 0.f);
}
开发者ID:ahmidou,项目名称:aphid,代码行数:19,代码来源:MlRachis.cpp


示例4: Float3

		void Frustum::BuildPlane(){


			Float3 dir,nc,fc,X,Y,Z;

			Z = Float3(-m_vDirection.x,-m_vDirection.y,-m_vDirection.z);
			Z.Normalize();

			X = m_vUp.Cross(Z);
			X.Normalize();

			Y = Z.Cross(X);

			nc = m_vPosition - Z * m_fNear;
			fc = m_vPosition - Z * m_fFar;

			Float3 ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr;
			float nw,nh,fw,fh;

			float	tang = (float)tan(m_fAngle * 0.5f) ;
			nh = m_fNear * tang;
			nw = nh * m_fAspect; 
			fh = m_fFar  * tang;
			fw = fh * m_fAspect;

			ntl = nc + Y * nh - X * nw;
			ntr = nc + Y * nh + X * nw;
			nbl = nc - Y * nh - X * nw;
			nbr = nc - Y * nh + X * nw;

			ftl = fc + Y * fh - X * fw;
			ftr = fc + Y * fh + X * fw;
			fbl = fc - Y * fh - X * fw;
			fbr = fc - Y * fh + X * fw;

			m_vecPlane[enFS_Top].SetVertex(ntr,ntl,ftl);
			m_vecPlane[enFS_Bottom].SetVertex(nbl,nbr,fbr);
			m_vecPlane[enFS_Left].SetVertex(ntl,nbl,fbl);
			m_vecPlane[enFS_Right].SetVertex(nbr,ntr,fbr);
			m_vecPlane[enFS_Near].SetVertex(ntl,ntr,nbr);
			m_vecPlane[enFS_Far].SetVertex(ftr,ftl,fbl);
		}
开发者ID:ingeyu,项目名称:airengine,代码行数:42,代码来源:AirEngineFrustum.cpp


示例5: Float2

LoaderFbxTextureDesc::LoaderFbxTextureDesc()
{
	textureName_ = "Unknown";
	fileName_	 = "Unknown";
	
	scale_					= Float2(0.0f, 0.0f);
	translation_			= Float2(0.0f, 0.0f);
	rotation_				= Float3(0.0f, 0.0f, 0.0f);
	swap_					= false;
	alphaSource_			= 0;
	croppingLeft_			= 0;
	croppingTop_			= 0;
	croppingRight_			= 0;
	croppingBottom_			= 0;
	mappingType_			= 0;
	planarMappingNormal_	= 0;
	blendMode_				= 0;
	defaultAlpha_			= 0.0f;
	materialUse_			= 0;
	textureUse_				= 0;
}
开发者ID:CaterHatterPillar,项目名称:xkill-source,代码行数:21,代码来源:LoaderFbxTextureDesc.cpp


示例6: OnUpdate

	virtual void OnUpdate()
	{
		float k = Root::Instance()->GetTime();
		float r = 3.0f;

		float x = Math::Cos(k) * r;
		float z = Math::Sin(k) * r;

		gBillboard->SetPosition(Float3(x, 5, z));

		gLightDir->SetPosition(Float3(x, 5, z));
		gLightDir->SetDirection(-Float3(x, 0, z));

		gLightPoint->SetPosition(Float3(x, 5, z));
		gLightPoint->SetDirection(-Float3(x, 0, z));

		gLightSpot->SetPosition(Float3(x, 5, z));
		gLightSpot->SetDirection(-Float3(x, 0, z));
	}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:19,代码来源:Demo04_Lighting.cpp


示例7: rectangle

void ImGui::beginContainer(int left, int right, int bottom, int top, Container *container)
{
    if (left > right or bottom > top)
    {
        Command command;
        command.type = Command::PushScissor;
        command.scissor.left = 0;
        command.scissor.right = 0;
        command.scissor.bottom = 0;
        command.scissor.top = 0;

        commands.append(command);
        return;
    }

    rectangle(left, right+10, bottom-10, top, 0.44f, 1.0f, 0.0f, 1.0f, Float3(1.0f), Float4(0.0f));

    Command command;
    command.type = Command::PushScissor;
    command.scissor.left = left;
    command.scissor.right = right;
    command.scissor.bottom = bottom;
    command.scissor.top = top;

    commands.append(command);

    scrollX = container->scrollX;
    scrollY = container->scrollY;

    containerLeft = left;
    containerRight = right;
    containerTop = top;
    containerBottom = bottom;

    container->left = left;
    container->right = right;
    container->bottom = bottom;
    container->top = top;
}
开发者ID:pendingchaos,项目名称:WIP12,代码行数:39,代码来源:imgui.cpp


示例8: ParamsFindP

//==================================================================
bool ParamsFindP(	ParamList &params,
					const SymbolList &globalSymbols,
					Float3	*pOut_vectorP,
					int	expectedN,
					int fromIdx )
{
	bool	gotP = false;
	
	for (size_t i=fromIdx; i < params.size(); i += 2)
	{
		DASSERT( params[i].type == Param::STR );
		
		const Symbol* pSymbol = globalSymbols.FindSymbol( params[i] );
		if ( pSymbol && pSymbol->IsName( "P" ) )
		{
			DASSTHROW( (i+1) < params.size(), "Invalid number of arguments" );
			
			const FltVec	&fltVec = params[ i+1 ].NumVec();

			DASSTHROW( (int)fltVec.size() == 3 * expectedN,
							"Invalid number of arguments."
							 " Expecting %i but it's %u", 3 * expectedN, fltVec.size() );

			DASSTHROW( (int)(fltVec.size() % 3) == 0,
							"Invalid number of arguments."
							 " Should be multiple of 3 but it's %u", fltVec.size() );

			size_t	srcN = fltVec.size();

			for (size_t si=0, di=0; si < srcN; si += 3, di += 1)
				pOut_vectorP[ di ] = Float3( &fltVec[ si ] );
			
			return true;
		}
	}
	
	return false;
}
开发者ID:UIKit0,项目名称:RibTools,代码行数:39,代码来源:RI_Primitive_Base.cpp


示例9: VertexBuffer

//----------------------------------------------------------------------------
TriMesh* RoughPlaneSolidBox::CreateRamp ()
{
    float x = 8.0f;
    float y = 8.0f;
    float z = y*Mathf::Tan((float)mModule.Angle);

    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);
    int vstride = vformat->GetStride();

    VertexBuffer* vbuffer = new0 VertexBuffer(6, vstride);
    VertexBufferAccessor vba(vformat, vbuffer);

    vba.Position<Float3>(0) = Float3(-x, 0.0f, 0.0f);
    vba.Position<Float3>(1) = Float3(+x, 0.0f, 0.0f);
    vba.Position<Float3>(2) = Float3(-x, y, 0.0f);
    vba.Position<Float3>(3) = Float3(+x, y, 0.0f);
    vba.Position<Float3>(4) = Float3(-x, y, z);
    vba.Position<Float3>(5) = Float3(+x, y, z);
    vba.TCoord<Float2>(0, 0) = Float2(0.25f, 0.0f);
    vba.TCoord<Float2>(0, 1) = Float2(0.75f, 0.0f);
    vba.TCoord<Float2>(0, 2) = Float2(0.0f, 1.0f);
    vba.TCoord<Float2>(0, 3) = Float2(1.0f, 1.0f);
    vba.TCoord<Float2>(0, 4) = Float2(0.25f, 1.0f);
    vba.TCoord<Float2>(0, 5) = Float2(0.75f, 1.0f);

    IndexBuffer* ibuffer = new0 IndexBuffer(18, sizeof(int));
    int* indices = (int*)ibuffer->GetData();
    indices[ 0] = 0;  indices[ 1] = 1;  indices[ 2] = 4;
    indices[ 3] = 1;  indices[ 4] = 5;  indices[ 5] = 4;
    indices[ 6] = 0;  indices[ 7] = 4;  indices[ 8] = 2;
    indices[ 9] = 1;  indices[10] = 3;  indices[11] = 5;
    indices[12] = 3;  indices[13] = 2;  indices[14] = 4;
    indices[15] = 3;  indices[16] = 4;  indices[17] = 5;

    TriMesh* ramp = new0 TriMesh(vformat, vbuffer, ibuffer);

    std::string path = Environment::GetPathR("Metal.wmtf");
    Texture2D* texture = Texture2D::LoadWMTF(path);
    ramp->SetEffectInstance(Texture2DEffect::CreateUniqueInstance(texture,
        Shader::SF_LINEAR, Shader::SC_REPEAT, Shader::SC_REPEAT));

    return ramp;
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:46,代码来源:RoughPlaneSolidBox.cpp


示例10: mCategory

	SLSound::SLSound()
		: mCategory(0)
		, mFlags(0)
	{
		mBQObjectI = NULL;
		mBQPlayI = NULL;
		mVolumeI = NULL;
		mBQBufferQueueI = NULL;
		mBQEffectSendI = NULL;

		mPosition = Float3(0, 0, 0);
		mVolume = 1;
		mAttenStart = mAttenEnd = 0;
		mInvAttenDist = 1;

		mPlayTime = 0;
		mPlayOffset = 0;
		mPlayEnd = FALSE;

		mFadeMode = 0;
		mFadeTime = SL_FADETIME;

		i_thread = NULL;
	}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:24,代码来源:SLSound.cpp


示例11: Float3

	// extents, renderable, nearDistance, depth, nearPlaneArea
	void Camera::SetLODSolution(IRenderer* renderable, float maxExtent, float nearDistance, 
		float depth, float minArea)
	{
		static bool added = false;
		if(!added)
		{
			PrintConsole::GetReference().AddSolution(L"ED2", "LOD", Float3(1.0f, 0.0f, 0.0f), 
				L"Camera::SetLODSolution");
			added = true;
		}

		unsigned int numLODs = renderable->GetNumLODs();

		if( numLODs != 1 )
		{
			float projectedRadius = (nearDistance * maxExtent) / depth;
			
			float projectedArea = (float)M_PI * projectedRadius * projectedRadius;

			float areaOccupiedRatio = min( 1.0f, projectedArea / minArea );

			renderable->SetCurrentLOD( (unsigned int)((numLODs-1) * areaOccupiedRatio) );
		}
	}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:25,代码来源:LODSolution.cpp


示例12: OnInit

	virtual void OnInit()
	{
		SetupUI();

		// Create Mesh
		MeshSourcePtr pMeshSource = MeshManager::Instance()->LoadMesh("Mesh/fox.mesh");
		
		gMesh = new Mesh;
		gMesh->SetSource(pMeshSource);
		gMesh->LoadAnimation("Idle1", "Mesh/fox_idle1.anim");
		gMesh->SetLighting(true);

		gMesh->PlayAnimation("Idle1");

		LookMesh(gMesh);

		// Setup Main Light
		World::Instance()->MainLight()->SetDirection(Float3(-1, 0, 1));
		World::Instance()->MainLight()->SetAmbient(Float3(0.2f, 0.2f, 0.2f));
		World::Instance()->MainLight()->SetDiffuse(Float3(0.2f, 0.2f, 0.2f));

		// Create Lights
		gLightDir = new Light(eLightType::DIRECTION);
		gLightPoint = new Light(eLightType::POINT);
		gLightSpot = new Light(eLightType::SPOT);

		gLightDir->SetDiffuse(Float3(1, 0, 0));
		gLightPoint->SetDiffuse(Float3(0, 1, 0));
		gLightSpot->SetDiffuse(Float3(0, 0, 1));

		gLightDir->SetVisible(true);
		gLightPoint->SetVisible(false);
		gLightSpot->SetVisible(false);

		// Create Billboard
		gBillboard = new Billboard;
		gBillboard->SetSize(Float2(1, 1));
		gBillboard->SetTexture("flare.png");
		gBillboard->GetMaterial()->blendMode = eBlendMode::ADD;
	}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:40,代码来源:Demo04_Lighting.cpp


示例13: Float3

			U1 Resource::CreateHardwareBuff( MeshHDBuffer* pOutBuff,CalCoreMesh* pInMesh ){
				std::vector<ABuff>	vertexData;
				std::vector<UInt>								indexData;
	
				SInt	iMeshCount	=	pInMesh->getCoreSubmeshCount();
				SInt	iVertexCount	=	0;
				SInt	iIndexCount		=	0;
				//首先计算顶点数 和 索引数
				for(SInt i=0;i<iMeshCount;i++){
					CalCoreSubmesh*	pSubMesh	=	pInMesh->getCoreSubmesh(i);
					iVertexCount	+=	pSubMesh->getVectorVertex().size();
					iIndexCount		+=	pSubMesh->getFaceCount()*3;
				}
				if(	iVertexCount	==	0	||
					iIndexCount		==	0)
				{
					return	false;
				}
				//分配空间
				vertexData.resize(iVertexCount);
				indexData.resize(iIndexCount);
	
				SInt	iV	=	0;
				SInt	iI	=	0;
	
				
				for(SInt i=0;i<iMeshCount;i++){
					CalCoreSubmesh*	pSubMesh							=	pInMesh->getCoreSubmesh(i);
					//计算切线
					pSubMesh->enableTangents(0,true);
	
					std::vector<CalCoreSubmesh::Vertex>&							lstVector	=	pSubMesh->getVectorVertex();
					std::vector<std::vector<CalCoreSubmesh::TangentSpace> >&		lstTangent	=	pSubMesh->getVectorVectorTangentSpace();
					std::vector<std::vector<CalCoreSubmesh::TextureCoordinate> >&	lstTexcoord	=	pSubMesh->getVectorVectorTextureCoordinate();
					std::vector<CalCoreSubmesh::Face>&								lstFace		=	pSubMesh->getVectorFace();
					
					SInt iFaceCount	=	lstFace.size();
					//索引缓冲
					for(SInt	j=0;j<iFaceCount;j++){
						indexData[iI]	=	lstFace[j].vertexId[0]	+	iV;
						indexData[iI+1]	=	lstFace[j].vertexId[1]	+	iV;
						indexData[iI+2]	=	lstFace[j].vertexId[2]	+	iV;
						iI	+=	3;
					}
					
					//顶点缓冲数据
					for(SInt j=0;j<iVertexCount;j++){
						CalCoreSubmesh::Vertex&				ver		=	lstVector[j];
						CalCoreSubmesh::TangentSpace		tang	=	lstTangent[0][j];
						CalCoreSubmesh::TextureCoordinate	uv		=	lstTexcoord[0][j];
		
						//位置
						vertexData[iV].Position		=	Float3(ver.position.x,ver.position.y,ver.position.z);


						SInt	iBoneCount	=	ver.vectorInfluence.size();
						for(SInt	k=0;k<4;k++){
							if(k<iBoneCount){
 								vertexData[iV].BoneWeight[k]	=	ver.vectorInfluence[k].weight*255.0f;
								//如果只传递自己需要的矩阵 
								//骨骼索引变成0~n
 								vertexData[iV].BoneIndex[k]		=	ver.vectorInfluence[k].boneId;
							}else{
								vertexData[iV].BoneWeight[k]	=	0;
								vertexData[iV].BoneIndex[k]		=	0;

							}

						}

						//法线
						vertexData[iV].Normal		=	Float3(ver.normal.x,ver.normal.y,ver.normal.z);
						//UV
						vertexData[iV].UV.x		=	uv.u;
						vertexData[iV].UV.y		=	uv.v;
						//切线
						vertexData[iV].Tangent.x		=	tang.tangent.x;
						vertexData[iV].Tangent.y		=	tang.tangent.y;
						vertexData[iV].Tangent.z		=	tang.tangent.z;
	
	
	
						iV++;
					}
					AString	strName	=	m_strProductName	+	pInMesh->getName();
					Render::Vertex::IDeclare::Info	dInfo;
					dInfo.SetPNTT_Animation();
 					pOutBuff->pVertexDeclare	=	Render::System::GetSingleton()->CreateProduct<Render::Vertex::IDeclare>("PNTTANIM",&dInfo);
					Render::Buffer::Info		vInfo;
					vInfo.SetVertexBuffer(iVertexCount,52);
					vInfo.InitData			=	&vertexData[0];
					pOutBuff->pVertexBuff		=	Render::System::GetSingleton()->CreateProduct<Render::Buffer>(strName+"VB",&vInfo);

					vInfo.SetIndexBuffer32(iFaceCount*3);
					vInfo.InitData			=	&indexData[0];
					pOutBuff->pIndexBuff		=	Render::System::GetSingleton()->CreateProduct<Render::Buffer>(strName+"IB",&vInfo);

				}
				return	true;
			}
开发者ID:ingeyu,项目名称:airengine,代码行数:100,代码来源:AirEngineCharacterResource.cpp


示例14: Float3

Float3<T> Float3<T>::operator -() const
{
	return Float3(-this->x, -this->y, -this->z);
}
开发者ID:pcercuei,项目名称:OpenTESArena,代码行数:4,代码来源:Float3.cpp


示例15: switch

void PhysicsComponent::onEvent(Event* e)
{
	EventType type = e->getType();
	switch(type)
	{
	case EVENT_ATTRIBUTE_UPDATED: //Removes physics objects when the corresponding physics attribute is removed
	{
		Event_AttributeUpdated* attributeUpdated = static_cast<Event_AttributeUpdated*>(e);
		int attributeIndex = attributeUpdated->index;
		if(attributeUpdated->attributeEnum == ATTRIBUTE_PHYSICS)
		{
			if(attributeUpdated->isDeleted)
			{
				if(attributeIndex < physicsObjects_->size() && physicsObjects_->at(attributeIndex) != nullptr)
				{
  					dynamicsWorld_->removeRigidBody(physicsObjects_->at(attributeIndex));
					delete physicsObjects_->at(attributeIndex);
					physicsObjects_->at(attributeIndex) = nullptr;
				}
				else
				{
					DEBUGPRINT("Mismatch when synchronizing deletion of physics objects with physics attributes");
				}
			}
			else if(attributeUpdated->isCreated)
			{
			}
			else
			{
				itrPhysics.at(attributeIndex)->reloadDataIntoBulletPhysics = true;
			}
		}
		/*else if(attributeUpdated->attributeEnum == ATTRIBUTE_CAMERA)
		{
			if(attributeUpdated->isDeleted)
			{
  				dynamicsWorld_->removeRigidBody(frustumPhysicsObjects_->at(attributeIndex));
				delete frustumPhysicsObjects_->at(attributeIndex);
				frustumPhysicsObjects_->at(attributeIndex) = nullptr;
			}
		}*/
		break;
	}
	case EVENT_MODIFY_PHYSICS_OBJECT:
	{
		Event_ModifyPhysicsObject* modifyPhysicsObject = static_cast<Event_ModifyPhysicsObject*>(e);

		int physicsAttributeIndex = modifyPhysicsObject->ptr_physics.index();
		if(physicsAttributeIndex < physicsObjects_->size() && physicsAttributeIndex > -1)
		{
			PhysicsObject* physicsObject = physicsObjects_->at(physicsAttributeIndex);
			if(physicsObject != NULL)
			{
				//Cast void pointer sent in Event_ModifyPhysicsObject to its expected data type and modify physics object accordingly
				switch(modifyPhysicsObject->modifyWhatDataInPhysicsObjectData)
				{
				case XKILL_Enums::ModifyPhysicsObjectData::GRAVITY:
					{
						Float3* gravity = static_cast<Float3*>(modifyPhysicsObject->data);
						
						physicsObject->setGravity(btVector3(gravity->x, gravity->y, gravity->z));
						break;
					}
				case XKILL_Enums::ModifyPhysicsObjectData::VELOCITY:
					{
						Float3* velocity = static_cast<Float3*>(modifyPhysicsObject->data);
						
						physicsObject->setLinearVelocity(btVector3(velocity->x, velocity->y, velocity->z));
						break;
					}
				case XKILL_Enums::ModifyPhysicsObjectData::VELOCITYPERCENTAGE:
					{
						Float3* velocityPercentage = static_cast<Float3*>(modifyPhysicsObject->data);
						
						btVector3 currentLinearVelocity = physicsObject->getLinearVelocity();
						physicsObject->setLinearVelocity(btVector3(currentLinearVelocity.x()*velocityPercentage->x, currentLinearVelocity.y()*velocityPercentage->y, currentLinearVelocity.z()*velocityPercentage->z));
						break;
					}
				case XKILL_Enums::ModifyPhysicsObjectData::FLAG_STATIC:
					{
						bool* staticPhysicsObject = static_cast<bool*>(modifyPhysicsObject->data);
						
						if(*staticPhysicsObject == true)
						{
							physicsObject->setCollisionFlags(physicsObject->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
						}
						else if(*staticPhysicsObject == false)
						{
							physicsObject->setCollisionFlags(physicsObject->getCollisionFlags() & ~ btCollisionObject::CF_STATIC_OBJECT);
						}
						break;
					}
				case XKILL_Enums::ModifyPhysicsObjectData::COLLISIONFILTERMASK:
					{
						/*In order to modify "collisionFilterMask", a physics objects needs to be removed from the Bullet Physics dynamics world and then readded using "addRigidBody", where "collisionFilterMask" is passed as argument.
						Write physics object data to physics attribute, modify "collisionFilterMask", and set the "reloadDataIntoBulletPhysics" flag, and this class will handle the removal and addition of the physics object.*/
						
						short* collisionFilterMaskFromEvent = static_cast<short*>(modifyPhysicsObject->data);

						AttributePtr<Attribute_Physics> ptr_physics = itrPhysics.at(physicsAttributeIndex);
//.........这里部分代码省略.........
开发者ID:CaterHatterPillar,项目名称:xkill-source,代码行数:101,代码来源:PhysicsComponent.cpp


示例16: Float3

	void MeshGroup::_genMesh(const Array<Mesh *> & arr, int first, int last, bool hasLightingColor)
	{
		MeshSourcePtr source = arr[0]->GetSource();
		Mesh * mesh = new Mesh;

		for (int i = 0; i < source->GetMeshBufferCount(); ++i)
		{
			SubMesh * submesh = mesh->NewSubMesh();
			VertexBufferPtr srcVB = source->GetMeshBuffer(i)->GetRenderOp()->vertexBuffers[0];
			IndexBufferPtr srcIB = source->GetMeshBuffer(i)->GetRenderOp()->indexBuffer;
			int p_offset = source->GetMeshBuffer(i)->GetRenderOp()->vertexDeclarations[0].GetElementOffset(eVertexSemantic::POSITION);
			int n_offset = source->GetMeshBuffer(i)->GetRenderOp()->vertexDeclarations[0].GetElementOffset(eVertexSemantic::NORMAL);
			int stride = srcVB->GetStride();

			VertexBufferPtr vb = HWBufferManager::Instance()->NewVertexBuffer(stride, srcVB->GetCount() * (last - first));
			
			const char * v_src = (const char *)srcVB->Lock(eLockFlag::READ);
			char * v_dest = (char *)vb->Lock(eLockFlag::WRITE);
			for (int j = first; j < last; ++j)
			{
				const Mat4 & worldTM = arr[j]->GetWorldTM();
				bool hasScale = arr[j]->GetWorldScale() != Float3(1, 1, 1);

				for (int k = 0; k < srcVB->GetCount(); ++k)
				{
					memcpy(v_dest, v_src, stride);

					Float3 * position = (Float3 *)(v_dest + p_offset);
					position->TransformA(worldTM);
					
					if (n_offset != -1)
					{
						Float3 * normal = (Float3 *)(v_dest + n_offset);
						normal->TransformN(worldTM);

						if (hasScale)
						{
							normal->Normalize();
						}
					}

					v_dest += stride;
					v_src += stride;
				}
			}
			vb->Unlock();
			srcVB->Unlock();

			IndexBufferPtr ib = HWBufferManager::Instance()->NewIndexBuffer(srcIB->GetCount() * (last - first));

			int startVertex = 0;
			const short * i_src = (const short *)srcIB->Lock(eLockFlag::READ);
			char * i_dest = (char *)ib->Lock(eLockFlag::WRITE);
			for (int j = first; j < last; ++j)
			{
				for (int k = 0; k < srcIB->GetCount(); ++k)
				{
					*i_dest++ = (*i_src++) + startVertex;
				}

				startVertex += srcVB->GetCount();
			}
			ib->Unlock();
			srcIB->Unlock();
			
			submesh->GetRenderOp()->vertexDeclarations[0] = source->GetMeshBuffer(i)->GetRenderOp()->vertexDeclarations[0];
			submesh->GetRenderOp()->vertexBuffers[0] = vb;
			submesh->GetRenderOp()->indexBuffer = ib;
			submesh->GetRenderOp()->primCount = ib->GetCount() / 3;
			submesh->GetRenderOp()->primType = ePrimType::TRIANGLE_LIST;

			if (hasLightingColor)
			{
				int count = submesh->GetRenderOp()->vertexBuffers[0]->GetCount();
				submesh->GetRenderOp()->vertexDeclarations[LIGHTING_COLOR_STREAM].AddElement(eVertexSemantic::LIGHTING_COLOR, eVertexType::UBYTE4);
				submesh->GetRenderOp()->vertexBuffers[LIGHTING_COLOR_STREAM] = HWBufferManager::Instance()->NewVertexBuffer(4, count);

				Array<Rgba32> lightColors;
				Rgba32 * data = (Rgba32 *)submesh->GetRenderOp()->vertexBuffers[LIGHTING_COLOR_STREAM]->Lock(eLockFlag::WRITE);
				for (int j = first; j < last; ++j)
				{
					arr[j]->GetLightingColor(lightColors);
					d_assert (lightColors.Size() > 0);

					memcpy(data, &lightColors[0], 4 * count);

					startVertex += count;
					lightColors.Clear();
				}
				submesh->GetRenderOp()->vertexBuffers[LIGHTING_COLOR_STREAM]->Unlock();
			}

			*submesh->GetMaterial() = *source->GetMeshBuffer(i)->GetMaterial();

			submesh->SetMeshShader(source->GetMeshBuffer(i)->GetShader());
		}

		mesh->SetSLMode(hasLightingColor ? eStaticLightingMode::LIGHTING_COLOR : eStaticLightingMode::NONE);

		mMeshes.PushBack(mesh);
//.........这里部分代码省略.........
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:101,代码来源:MMeshGroup.cpp


示例17: centerDataSpace

TiledDatasetView::TiledDatasetView() :
centerDataSpace( Float3( -1.0f, -1.0f, -1.0f ) ),
extentDataSpace( Float3( -1.0f, -1.0f, -1.0f ) ),
widthNumPixels ( -1 )
{
}
开发者ID:mikeroberts3000,项目名称:Mojo,代码行数:6,代码来源:TiledDatasetView.cpp


示例18: Float3

Float3 Float4x4::TranslatePart() const {
	return Float3( m_value[0][3], m_value[1][3], m_value[2][3] );
}
开发者ID:entityhat,项目名称:style,代码行数:3,代码来源:sMatrix4x4.cpp


示例19: pow

			const Float3 Quaternion::Axis() const
			{
				const float s = pow( 1 - w * w, 0.5f );
				return Float3( x/s, y/s, z/s );
			}
开发者ID:kpongky,项目名称:At-Math,代码行数:5,代码来源:Quaternion.cpp


示例20: VertexBuffer

//----------------------------------------------------------------------------
void ReflectionsAndShadows::CreatePlanes ()
{
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);
    int vstride = vformat->GetStride();

    // Create the floor mesh.
    VertexBuffer* vbuffer = new0 VertexBuffer(4, vstride);
    VertexBufferAccessor floor(vformat, vbuffer);

    float xValue = 128.0f;
    float yValue = 256.0f;
    float zValue = 0.0f;
    floor.Position<Float3>(0) = Float3(-xValue, -yValue, zValue);
    floor.Position<Float3>(1) = Float3(+xValue, -yValue, zValue);
    floor.Position<Float3>(2) = Float3(+xValue, +yValue, zValue);
    floor.Position<Float3>(3) = Float3(-xValue, +yValue, zValue);
    floor.TCoord<Float2>(0, 0) = Float2(0.0f, 0.0f);
    floor.TCoord<Float2>(0, 1) = Float2(1.0f, 0.0f);
    floor.TCoord<Float2>(0, 2) = Float2(1.0f, 1.0f);
    floor.TCoord<Float2>(0, 3) = Float2(0.0f, 1.0f);

    IndexBuffer* ibuffer = new0 IndexBuffer(6, sizeof(int));
    int* indices = (int*)ibuffer->GetData();
    indices[0] = 0;  indices[1] = 1;  indices[2] = 2;
    indices[3] = 0;  indices[4] = 2;  indices[5] = 3;

    mPlane0 = new0 TriMesh(vformat, vbuffer, ibuffer);

    Texture2DEffect* effect = new0 Texture2DEffect(Shader::SF_LINEAR_LINEAR,
        Shader::SC_REPEAT, Shader::SC_REPEAT);
    std::string path = Environment::GetPathR("Sand.wmtf");
    Texture2D* texture = Texture2D::LoadWMTF(path);
    mPlane0->SetEffectInstance(effect->CreateInstance(texture));

    mScene->AttachChild(mPlane0);

    // Create the wall mesh.
    vbuffer = new0 VertexBuffer(4, vstride);
    VertexBufferAccessor wall(vformat, vbuffer);

    xValue = -128.0f;
    yValue = 256.0f;
    zValue = 128.0f;
    wall.Position<Float3>(0) = Float3(xValue, -yValue, 0.0f);
    wall.Position<Float3>(1) = Float3(xValue, +yValue, 0.0f);
    wall.Position<Float3>(2) = Float3(xValue, +yValue, zValue);
    wall.Position<Float3>(3) = Float3(xValue, -yValue, zValue);
    wall.TCoord<Float2>(0, 0) = Float2(0.0f, 0.0f);
    wall.TCoord<Float2>(0, 1) = Float2(1.0f, 0.0f);
    wall.TCoord<Float2>(0, 2) = Float2(1.0f, 1.0f);
    wall.TCoord<Float2>(0, 3) = Float2(0.0f, 1.0f);

    mPlane1 = new0 TriMesh(vformat, vbuffer, ibuffer);

    path = Environment::GetPathR("Stone.wmtf");
    texture = Texture2D::LoadWMTF(path);
    mPlane1->SetEffectInstance(effect->CreateInstance(texture));

    mScene->AttachChild(mPlane1);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:63,代码来源:ReflectionsAndShadows.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Float4函数代码示例发布时间:2022-05-30
下一篇:
C++ Float2函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap