您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Float3函数代码示例

51自学网 2021-06-01 20:47:29
  C++
这篇教程C++ Float3函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例14: Float3

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


示例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,


示例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,


示例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,


示例18: Float3

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


示例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,


示例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,


示例21: switch

void ImGui::render(){    for (auto command : commands)    {        switch (command.type)        {        case Command::Rectangle:        {            decltype(Command::rect) rect = command.rect;            gfxApi->pushState();            gfxApi->setBlendingEnabled(true);            gfxApi->setBlendFactors(GfxSrcAlpha,                                    GfxSrcAlpha,                                    GfxOneMinusSrcAlpha,                                    GfxOneMinusSrcAlpha);            gfxApi->setDepthFunction(GfxAlways);            gfxApi->begin(compiledVertex, nullptr, nullptr, nullptr, compiledFragment);            gfxApi->setMesh(mesh);            float w = gfxApi->getViewportWidth();            float h = gfxApi->getViewportHeight();            float fleft = rect.left / w * 2.0f - 1.0f;            float fright = rect.right / w * 2.0f - 1.0f;            float ftop = rect.top / h * 2.0f - 1.0f;            float fbottom = rect.bottom / h * 2.0f - 1.0f;            gfxApi->uniform(compiledVertex, "offset", Float2(fleft, fbottom));            gfxApi->uniform(compiledVertex, "size", Float2(fright-fleft, ftop-fbottom));            gfxApi->uniform(compiledVertex, "gradientStart", rect.gradientStart);            gfxApi->uniform(compiledVertex, "gradientSize", rect.gradientSize);            gfxApi->uniform(compiledVertex, "gradientPower", rect.gradientPower);            gfxApi->uniform(compiledVertex, "color", Float3(rect.colorR, rect.colorG, rect.colorB));            gfxApi->uniform(compiledFragment, "topRight", Float2(rect.right, rect.top));            gfxApi->uniform(compiledFragment, "bottomLeft", Float2(rect.left, rect.bottom));            gfxApi->uniform(compiledFragment, "brightness", rect.brightness);            gfxApi->uniform(compiledFragment, "topLeftCornerRoundness", rect.topLeftCornerRoundness);            gfxApi->uniform(compiledFragment, "topRightCornerRoundness", rect.topRightCornerRoundness);            gfxApi->uniform(compiledFragment, "bottomLeftCornerRoundness", rect.bottomLeftCornerRoundness);            gfxApi->uniform(compiledFragment, "bottomRightCornerRoundness", rect.bottomRightCornerRoundness);            gfxApi->draw();            gfxApi->end();            gfxApi->popState();            break;        }        case Command::Text:        {            float w = gfxApi->getViewportWidth();            float h = gfxApi->getViewportHeight();            float fleft = command.text.left / w * 2.0f - 1.0f;            float fbottom = command.text.bottom / h * 2.0f - 1.0f;            font->render(command.text.size,                         Float2(fleft, fbottom),                         command.textStr.getData(),                         nullptr,                         Float3(command.text.colorR,                                command.text.colorG,                                command.text.colorB));            break;        }        case Command::PushScissor:        {            gfxApi->pushState();            gfxApi->setScissorEnabled(true);            gfxApi->setScissor(command.scissor.left,                               command.scissor.bottom,                               command.scissor.right-command.scissor.left,                               command.scissor.top-command.scissor.bottom);            break;        }        case Command::PopScissor:        {            gfxApi->popState();            break;        }        default:        {            SDL_assert(false);            break;        }        }    }    commands.clear();}
开发者ID:pendingchaos,项目名称:WIP12,代码行数:91,


示例22: Node

//.........这里部分代码省略.........			*indices++ = v1;			*indices++ = v2;			*indices++ = v0;			*indices++ = v2;			*indices++ = v3;		}	}	// Create the volume texture.  Three Gaussian distributions are used for	// the RGB color channels.  The alpha channel is constant.	const int bound = 64;	Texture3D* texture = new0 Texture3D(Texture::TF_A8R8G8B8, bound, bound,	                                    bound, 1);	unsigned char* data = (unsigned char*)texture->GetData(0);	const float mult = 1.0f/(bound - 1.0f);	const float rParam = 0.01f;	const float gParam = 0.01f;	const float bParam = 0.01f;	const float extreme = 8.0f;	APoint rCenter( 0.5f*extreme,  0.0f,         0.0f);	APoint gCenter(-0.5f*extreme, -0.5f*extreme, 0.0f);	APoint bCenter(-0.5f*extreme, +0.5f*extreme, 0.0f);	unsigned char commonAlpha = 12;	APoint point;	for (int z = 0; z < bound; ++z)	{		point[2] = -extreme + 2.0f*extreme*mult*z;		for (int y = 0; y < bound; ++y)		{			point[1] = -extreme + 2.0f*extreme*mult*y;			for (int x = 0; x < bound; ++x)			{				point[0] = -extreme + 2.0f*extreme*mult*x;				AVector diff = point - rCenter;				float sqrLength = diff.SquaredLength();				float rGauss = 1.0f - rParam*sqrLength;				if (rGauss < 0.0f)				{					rGauss = 0.0f;				}				diff = point - gCenter;				sqrLength = diff.SquaredLength();				float gGauss = 1.0f - gParam*sqrLength;				if (gGauss < 0.0f)				{					gGauss = 0.0f;				}				diff = point - bCenter;				sqrLength = diff.SquaredLength();				float bGauss = 1.0f - bParam*sqrLength;				if (bGauss < 0.0f)				{					bGauss = 0.0f;				}				*data++ = (unsigned char)(255.0f*bGauss);				*data++ = (unsigned char)(255.0f*gGauss);				*data++ = (unsigned char)(255.0f*rGauss);				*data++ = commonAlpha;			}		}	}	// The volume texture effect that is shared by all square meshes.	std::string effectFile = Environment::GetPathR("VolumeTextures.wmfx");	VolumeTextureEffect* effect = new0 VolumeTextureEffect(effectFile);	VisualEffectInstance* instance = effect->CreateInstance(texture);	// The grid of squares.	const int numVertices = numSamples*numSamples;	float inv = 1.0f/(numSamples - 1.0f);	VertexBufferAccessor vba;	for (int slice = 0; slice < numSlices; ++slice)	{		VertexBuffer* vbuffer = new0 VertexBuffer(numVertices, vstride);		vba.ApplyTo(vformat, vbuffer);		float w = slice/(numSlices - 1.0f);		float z = 2.0f*w - 1.0f;		for (int i1 = 0, i = 0; i1 < numSamples; ++i1)		{			float v = i1*inv;			float y = 2.0f*v - 1.0f;			for (int i0 = 0; i0 < numSamples; ++i0, ++i)			{				float u = i0*inv;				float x = 2.0f*u - 1.0f;				vba.Position<Float3>(i) = Float3(x, y, z);				vba.TCoord<Float3>(0, i) = Float3(u, v, w);			}		}		TriMesh* mesh = new0 TriMesh(vformat, vbuffer, ibuffer);		mesh->SetEffectInstance(instance);		mScene->AttachChild(mesh);	}}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:101,



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


C++ Float4函数代码示例
C++ Float2函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。