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

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

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

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

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

示例1: LSL_ASSERT

void RenderToCubeTex::BeginCubeSurf(Engine& engine){	LSL_ASSERT(IsBeginRT());	CameraDesc camDesc = engine.GetContext().GetCamera().GetDesc();	//camDesc.pos = D3DXVECTOR3(0, 0, 15.0f);	camDesc.pos = _viewPos;	camDesc.style = csPerspective;	camDesc.aspect = 1;	camDesc.nearDist = 1.0f;	camDesc.farDist = 100.0f;	camDesc.fov = D3DX_PI/2;	switch(_flags.faceType)	{	case D3DCUBEMAP_FACE_POSITIVE_X:		camDesc.dir = D3DXVECTOR3(-1.0f, 0.0f, 0.0f );		camDesc.up = D3DXVECTOR3( 0.0f, -1.0f, 0.0f );		break;	case D3DCUBEMAP_FACE_NEGATIVE_X:					camDesc.dir = D3DXVECTOR3(1.0f, 0.0f, 0.0f );					camDesc.up = D3DXVECTOR3( 0.0f, -1.0f, 0.0f );		break; 	case D3DCUBEMAP_FACE_POSITIVE_Y:					camDesc.dir = D3DXVECTOR3( 0.0f, -1.0f, 0.0f );		camDesc.up = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );		break;				case D3DCUBEMAP_FACE_NEGATIVE_Y:					camDesc.dir = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );		camDesc.up = D3DXVECTOR3( 0.0f, 0.0f, -1.0f );		break;								case D3DCUBEMAP_FACE_POSITIVE_Z:		camDesc.dir = D3DXVECTOR3( 0.0f, 0.0f, -1.0f );		camDesc.up = D3DXVECTOR3( 0.0f, -1.0f, 0.0f );		break;						case D3DCUBEMAP_FACE_NEGATIVE_Z:		camDesc.dir = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );		camDesc.up = D3DXVECTOR3( 0.0f, -1.0f, 0.0f );		break;	}	_myCamera.SetDesc(camDesc);		engine.GetContext().ApplyCamera(&_myCamera);	ApplyRT(engine, _flags);}
开发者ID:DimaKirk,项目名称:rrr3d,代码行数:51,


示例2: D3DXVECTOR3

void LightClass::SetPosition(float x, float y, float z){	m_position = D3DXVECTOR3(x, y, z);	return;}
开发者ID:labud,项目名称:DirectX11,代码行数:5,


示例3: lookAtPos

void GraphicsEngine::Render(){  this->camera.Update();    //////////////CAMERA CODE//////////////////////  // Define camera information.  /*D3DXVECTOR3 cameraPos(camera.m_pos.x, camera.m_pos.y,    camera.m_pos.z);  D3DXVECTOR3 lookAtPos(camera.m_view.x, camera.m_view.y,    camera.m_view.z);  D3DXVECTOR3 upDir(camera.m_up.x, camera.m_up.y,    camera.m_up.z);*/  //A Matrix to hold the world transforms of the objects  D3DXMATRIX worldTransform;  D3DXMatrixIdentity(&worldTransform);  // Build view matrix.  /*D3DXMatrixLookAtLH(&g_ViewMatrix, &cameraPos,    &lookAtPos, &upDir);*/  g_ViewMatrix = *camera.GetViewMatrix();  // Apply the view (camera).  g_D3DDevice->SetTransform(D3DTS_VIEW, &g_ViewMatrix);  // Set the projection matrix.  D3DXMatrixPerspectiveFovLH(&g_projection, 45.0f,    WINDOW_WIDTH/WINDOW_HEIGHT, 0.1f, 1000.0f);  g_D3DDevice->SetTransform(D3DTS_PROJECTION, &g_projection);  //////////////////////END CAMERA CODE///////////  // Clear the backbuffer.  g_D3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,    D3DCOLOR_ARGB(40,40,40,100), 1.0f, 0);  //Sort the Objects By their z value in view space  SortBackToFront();  //////////////////////////////////////////////////////////////////////////////  ///////////////////////////BEGIN SCENE////////////////////////////////////////  //////////////////////////////////////////////////////////////////////////////    // Begin the scene.  Start rendering.  g_D3DDevice->BeginScene();  //Render Skybox    static int time = 0;     time += 16;    g_D3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);    g_D3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );            D3DXMatrixIdentity(&worldTransform);    unsigned int passes;    effectMap["HackMapping"]->GetEffect()->Begin(&passes, 0);    effectMap["HackMapping"]->GetEffect()->BeginPass(0);    GetWorldMtx(&worldTransform, D3DXVECTOR3(gmMgr->graphics_->camera.GetPos().x,gmMgr->graphics_->camera.GetPos().y, gmMgr->graphics_->camera.GetPos().z), D3DXVECTOR3(1,1,1),D3DXVECTOR3(0,time/10000.0f,0));    effectMap["HackMapping"]->GetEffect()->SetMatrix("g_world", &worldTransform);    effectMap["HackMapping"]->GetEffect()->SetMatrix("g_wvp", &(worldTransform * g_ViewMatrix * g_projection));    effectMap["HackMapping"]->GetEffect()->SetTexture("g_texture", this->GetTexture("glow"));    effectMap["HackMapping"]->GetEffect()->SetTexture("g_normals", textureMap["default"]);    effectMap["HackMapping"]->GetEffect()->SetBool("Lighting", false);    effectMap["HackMapping"]->GetEffect()->CommitChanges();    skybox->mesh->DrawSubset(0);    effectMap["HackMapping"]->GetEffect()->SetBool("Lighting", true);    effectMap["HackMapping"]->GetEffect()->CommitChanges();    effectMap["HackMapping"]->GetEffect()->EndPass();    effectMap["HackMapping"]->GetEffect()->End();    g_D3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);    g_D3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );  //}    // Clear the backbuffer.  g_D3DDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER,    D3DCOLOR_ARGB(0,0,0,0), 1.0f, 0);  // Texture filter.  g_D3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);  g_D3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);  g_D3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW );  RenderScene();  g_D3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );//.........这里部分代码省略.........
开发者ID:anthonySerra,项目名称:CodeSamples,代码行数:101,


示例4: D3DXVECTOR3

bool SkeletonClass::UpdateBuffers(ID3D10Device* device){	VertexType* vertices;	void* verticesPtr;	HRESULT result;	if((m_SkeletonModel[0].x == 0) && (m_SkeletonModel[0].y == 0) && (m_SkeletonModel[0].z == 0))	{		return true; 	}		// Create the vertex array.	vertices = new VertexType[m_vertexCount];	if(!vertices)	{		return false;	}	for(DWORD i = 0; i < m_vertexCount; ++i) 	{		vertices[i].position = D3DXVECTOR3(m_SkeletonModel[i].x, m_SkeletonModel[i].y, m_SkeletonModel[i].z);		vertices[i].color =  D3DXVECTOR4(0.0f, 1.0f, 0.0f, 1.0f); 		if( i >= 8 && i <= 11)		{			vertices[i].color =  D3DXVECTOR4(1.0f, 1.0f, 0.0f, 1.0f); 		}		if(m_Skeleton.eSkeletonPositionTrackingState[i] == NUI_SKELETON_POSITION_INFERRED)		{			vertices[i].color =  D3DXVECTOR4(1.0f, 0.0f, 0.0f, 1.0f);		}		if(m_Skeleton.eSkeletonPositionTrackingState[i] == NUI_SKELETON_POSITION_NOT_TRACKED)		{			vertices[i].color =  D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);		}	}	// Initialize the vertex buffer pointer to null first.	verticesPtr = 0;	// Lock the vertex buffer.	result = m_vertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&verticesPtr);	if(FAILED(result))	{		return false;	}	// Copy the data into the vertex buffer.	memcpy(verticesPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));	// Unlock the vertex buffer.	m_vertexBuffer->Unmap();	// Release the vertex array as it is no longer needed.	delete [] vertices;	vertices = 0;	return true;}
开发者ID:xtr3m3nerd,项目名称:DirectXKinectFramework,代码行数:62,


示例5: D3DXVECTOR3

bool ModelClass::InitializeBuffers(ID3D11Device* device){	VertexType* vertices;	unsigned long* indices;	D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;	D3D11_SUBRESOURCE_DATA vertexData, indexData;	HRESULT result;	int i;	// Create the vertex array.	vertices = new VertexType[m_vertexCount];	if(!vertices)	{		return false;	}	// Create the index array.	indices = new unsigned long[m_indexCount];	if(!indices)	{		return false;	}	// Load the vertex array and index array with data.	for(i=0; i<m_vertexCount; i++)	{		vertices[i].position = D3DXVECTOR3(m_model[i].x, m_model[i].y, m_model[i].z);		vertices[i].texture = D3DXVECTOR2(m_model[i].tu, m_model[i].tv);		vertices[i].normal = D3DXVECTOR3(m_model[i].nx, m_model[i].ny, m_model[i].nz);		vertices[i].tangent = D3DXVECTOR3(m_model[i].tx, m_model[i].ty, m_model[i].tz);		vertices[i].binormal = D3DXVECTOR3(m_model[i].bx, m_model[i].by, m_model[i].bz);		indices[i] = i;	}	// Set up the description of the static vertex buffer.	vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;	vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;	vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;	vertexBufferDesc.CPUAccessFlags = 0;	vertexBufferDesc.MiscFlags = 0;	vertexBufferDesc.StructureByteStride = 0;	// Give the subresource structure a pointer to the vertex data.	vertexData.pSysMem = vertices;	vertexData.SysMemPitch = 0;	vertexData.SysMemSlicePitch = 0;	// Now create the vertex buffer.	result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);	if(FAILED(result))	{		return false;	}	// Set up the description of the static index buffer.	indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;	indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;	indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;	indexBufferDesc.CPUAccessFlags = 0;	indexBufferDesc.MiscFlags = 0;	indexBufferDesc.StructureByteStride = 0;	// Give the subresource structure a pointer to the index data.	indexData.pSysMem = indices;	indexData.SysMemPitch = 0;	indexData.SysMemSlicePitch = 0;	// Create the index buffer.	result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);	if(FAILED(result))	{		return false;	}	// Release the arrays now that the vertex and index buffers have been created and loaded.	delete [] vertices;	vertices = 0;	delete [] indices;	indices = 0;	return true;}
开发者ID:liu1700,项目名称:Fire-Engine,代码行数:85,


示例6: QuatToVec3

	D3DXVECTOR3 QuatToVec3(D3DXQUATERNION a_Quat)	{		return D3DXVECTOR3(a_Quat.x,a_Quat.y,a_Quat.z);	}
开发者ID:mileswhiticker,项目名称:gam204-assessment-03,代码行数:4,


示例7: D3DXVECTOR3

void Enemy::SetPos(D3DXVECTOR3 pos){	obj->position = D3DXVECTOR3(pos.x,pos.y,pos.z);	actor->setGlobalPose(PxTransform(PxVec3(pos.x,pos.y,pos.z)));}
开发者ID:Themperror,项目名称:ThempX,代码行数:5,


示例8: D3DXMatrixTranslation

void EditorLinePrimitive::RecalcTransforms(){	//Matrices we need	D3DXMATRIX matWorld,matScale,MatRot,MatTemp;	//Temporary translation	D3DXVECTOR3 Trans;	//Copy from the original location, 	//so we can modify it without hurting anything	Trans=Location;	//Devide Trans through Scale	/*Trans.x/=Scale.x;	Trans.y/=Scale.y;	Trans.z/=Scale.z;*/	//Apply translation to the WorldMatrix	D3DXMatrixTranslation(&matWorld,Trans.x,Trans.y,Trans.z);	//Now scale another matrix	D3DXMatrixScaling( &matScale, Scale.x, Scale.y, Scale.z );		//Apply rotation	D3DXMatrixIdentity(&MatRot);	D3DXVECTOR3 DeltaRot = Rotation - RotationMatrixAngles;	if(Rotation != D3DXVECTOR3(0,0,0))	{		// Calculate matrix with the new angles		if(bLocalRotation)		{			D3DXVECTOR3 Up(0,1,0);			D3DXVECTOR3 Front(1,0,0);			D3DXVECTOR3 Right;						D3DXVec3TransformNormal(&Up, &Up, &RotationMatrix);			D3DXVec3TransformNormal(&Front, &Front, &RotationMatrix);			D3DXVec3Cross(&Right, &Up, &Front);			D3DXMATRIX X;			D3DXMatrixRotationAxis(&X, &Front, DeltaRot.x);			D3DXMATRIX Y;			D3DXMatrixRotationAxis(&Y, &Up, DeltaRot.y);			D3DXMATRIX Z;			D3DXMatrixRotationAxis(&Z, &Right, DeltaRot.z);			RotationMatrix *= X * Y * Z;		}else		{			D3DXMatrixIdentity(&MatRot);			D3DXMatrixRotationAxis(&MatTemp, &D3DXVECTOR3(1,0,0), Rotation.x);        // Pitch			D3DXMatrixMultiply(&MatRot, &MatRot, &MatTemp);			D3DXMatrixRotationAxis(&MatTemp, &D3DXVECTOR3(0,1,0), Rotation.y);         // Yaw			D3DXMatrixMultiply(&MatRot, &MatRot, &MatTemp);			D3DXMatrixRotationAxis(&MatTemp, &D3DXVECTOR3(0,0,1), Rotation.z);       // Roll			D3DXMatrixMultiply(&RotationMatrix, &MatRot, &MatTemp);			//RotationMatrix = X * Y * Z;		}		RotationMatrixAngles = Rotation;	}else if(!bJustUseRotationMatrix)	{		// Reset matrix to identity (Todo: ROTATION! 
C++ D3DXVECTOR4函数代码示例
C++ D3DXVECTOR2函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。