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


C++ D3DXMatrixRotationX函数代码示例

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


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

示例1: D3DXMatrixRotationX

void CMyObject::setRotAngels(D3DXVECTOR3 rotAngels)
{
	D3DXMATRIX mtxRotX;
	D3DXMATRIX mtxRotY;
	D3DXMATRIX mtxRotZ;

	m_rotAngles = rotAngels;
	D3DXMatrixRotationX(&mtxRotX,m_rotAngles.x);
	D3DXMatrixRotationY(&mtxRotY,m_rotAngles.y);
	D3DXMatrixRotationZ(&mtxRotZ,m_rotAngles.z);
	m_mtxRot = mtxRotX * mtxRotY * mtxRotZ;
}
开发者ID:XmakerenX,项目名称:Resoruse_Editor,代码行数:12,代码来源:CMyObject.cpp

示例2: Assert

void AmjuGLDX9::RotateX(float degs)
{
  AMJU_CALL_STACK;

  Assert(s_matrixMode == AmjuGL::AMJU_MODELVIEW_MATRIX);

  D3DXMATRIX m;
  D3DXMatrixIdentity(&m);
  D3DXMatrixRotationX(&m, D3DXToRadian(degs)); 
  g_matrixStack->MultMatrixLocal( &m);
  dd->SetTransform(D3DTS_WORLD, g_matrixStack->GetTop());
}
开发者ID:jason-amju,项目名称:amjulib,代码行数:12,代码来源:AmjuGL-DX9.cpp

示例3: D3DXMatrixTranslation

	Node::Node()
	{
		D3DXMatrixTranslation( &this->matTranslate,0,0,0 );
		D3DXMatrixTranslation( &this->matTranslate_Relative,0,0,0 );
		D3DXMatrixRotationX( &this->matRotateX, 0 );        // Pitch
		D3DXMatrixRotationY( &this->matRotateY, 0 );        // Yaw
		D3DXMatrixRotationZ( &this->matRotateZ, 0 );        // Roll
		D3DXMatrixScaling( &this->matScale,1,1,1 );
		
		this->hasParent = false;
		this->hasChildren = false;
	}
开发者ID:Siduron,项目名称:Siduron-Engine,代码行数:12,代码来源:Node.cpp

示例4: SetupWorldMatrice

//-----------------------------------------------------------------------------
// Desc: 设置世界矩阵
//-----------------------------------------------------------------------------
VOID SetupWorldMatrice()
{
	//建立一个绕X轴动态旋转的世界矩阵
	D3DXMATRIX matWorld;
	UINT  iTime  = timeGetTime() % 1000;
	FLOAT fAngle = iTime * (2.0f * D3DX_PI) / 1000.0f;
	D3DXMatrixIdentity( &matWorld );
	D3DXMatrixRotationX( &matWorld, fAngle );

	//设置世界矩阵
	g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:15,代码来源:Transfrom.cpp

示例5: D3DXMatrixRotationX

void cPart::Update(float delta, D3DXMATRIXA16* pmatParentWorld){
	
	
	if (m_eState == E_STATE_WALK){
		if (m_epart != PT_fist){
			m_fAngle += m_fAngleSpeed * delta;
			D3DXMatrixRotationX(&m_matRot, m_fAngle);
		}
	}
	else if (m_eState == E_STATE_ATTACK && m_epart == PT_arm_right){
		m_fXAngle -= D3DXToRadian(-360) * delta;
		D3DXMatrixRotationX(&m_matRot, m_fXAngle);
	}
	else {
		D3DXMatrixRotationX(&m_matRot, m_fAngle);
	}

	if (m_fAngle < -D3DX_PI / 4.0f)
	{
		m_fAngle = (-D3DX_PI / 4.0f);
		m_fAngleSpeed *= -1;
	}

	if (m_fAngle > D3DX_PI / 4.0f)
	{
		m_fAngle = (D3DX_PI / 4.0f);
		m_fAngleSpeed *= -1;
	}
	

	m_matWorldTM = m_matPrevT * m_matRot * m_matPostT;
	if (pmatParentWorld)
	{
		m_matWorldTM = m_matWorldTM * (*pmatParentWorld);
	}

	for each (auto p in m_vecChildren)
	{
		p->Update(delta, &m_matWorldTM);
	}
开发者ID:arkiny,项目名称:Direct3D,代码行数:40,代码来源:cPart.cpp

示例6: D3DXMatrixRotationX

// Sets the object's rotation.
void SceneObject::SetRotation( float x, float y, float z )
{
	m_rotation.x = x;
	m_rotation.y = y;
	m_rotation.z = z;

	D3DXMATRIX rotationX, rotationY;
	D3DXMatrixRotationX( &rotationX, m_rotation.x );
	D3DXMatrixRotationY( &rotationY, m_rotation.y );
	D3DXMatrixRotationZ( &m_rotationMatrix, m_rotation.z );
	D3DXMatrixMultiply( &m_rotationMatrix, &m_rotationMatrix, &rotationX );
	D3DXMatrixMultiply( &m_rotationMatrix, &m_rotationMatrix, &rotationY );
}
开发者ID:zonedoutspace,项目名称:evamp,代码行数:14,代码来源:SceneObject.cpp

示例7: Animate

/**-----------------------------------------------------------------------------
 * 애니메이션 설정
 *------------------------------------------------------------------------------
 */
VOID Animate()
{
	D3DXMATRIXA16	matX;
	D3DXMATRIXA16	matY;

	D3DXMatrixRotationX( &matX, g_xRot );
	D3DXMatrixRotationY( &matY, g_yRot );
	g_matWorld = matX * matY;
	g_pd3dDevice->SetTransform( D3DTS_WORLD, &g_matWorld ); /// 디바이스에 월드행렬 설정
	SetupLights();
	SetupPS();
	LogFPS();						// 로깅
}
开发者ID:blastingzone,项目名称:ComputerGraphicsAdvenced,代码行数:17,代码来源:main.cpp

示例8: SetupRotation

void SetupRotation()
{
	D3DXMATRIX matWorld, matWorldX, matWorldY, matWorldZ;

	D3DXMatrixRotationX(&matWorldX, timeGetTime()/400.0f);
	D3DXMatrixRotationY(&matWorldY, timeGetTime()/400.0f);
	D3DXMatrixRotationZ(&matWorldZ, timeGetTime()/400.0f);

	D3DXMatrixMultiply(&matWorld, &matWorldX, &matWorldY);
	D3DXMatrixMultiply(&matWorld, &matWorld, &matWorldZ);

	g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
}
开发者ID:viticm,项目名称:pap2,代码行数:13,代码来源:TestRender.cpp

示例9: D3DXMatrixRotationX

//----------------------------------------------------------------
void Renderer::rotateX (float fAngle)
{
	D3DXMATRIX kTempMatrix;

	// generate translation matrix
	D3DXMatrixRotationX(&kTempMatrix, fAngle);

	// convert from MatrixMode to D3DTRANSFORMSTATETYPE
	D3DTRANSFORMSTATETYPE eMatMode = static_cast<D3DTRANSFORMSTATETYPE>(m_eCurrentMatMode);

	// set the matrix
	m_pkDevice->MultiplyTransform(eMatMode, &kTempMatrix);
}
开发者ID:GabrielAldaya,项目名称:bcengine2d,代码行数:14,代码来源:Renderer.cpp

示例10: QDrawSphere

/// Draws a sphere of a given radius at a given place.
/// Very good for bounding spheres
void QDrawSphere(IDirect3DDevice9* pDev,const D3DXVECTOR3& pos,float radius,D3DCOLOR col)
{
	const int STEPS=32;
	D3DXVECTOR3 points[STEPS+1];
	pDev->SetMaterial(&InitMtrl(BLACK_COL,BLACK_COL,BLACK_COL,col,0));	// set colour
	pDev->SetTexture(0,NULL);	// no texture
	pDev->SetFVF(D3DFVF_XYZ);

	// xz loop
	for(int i=0;i<STEPS+1;i++)
	{
		float ang=D3DX_PI*2*i/STEPS;
		points[i].x=sin(ang);
		points[i].y=0;
		points[i].z=cos(ang);
	}
	D3DXMATRIX trans,rot,scale;
	D3DXMatrixTranslation(&trans,pos.x,pos.y,pos.z);
	D3DXMatrixScaling(&scale,radius,radius,radius);
	D3DXMatrixRotationX(&rot,D2R(0));
	pDev->SetTransform(D3DTS_WORLD,&(scale*rot*trans));	
	pDev->DrawPrimitiveUP(D3DPT_LINESTRIP,         //PrimitiveType
							 STEPS,              //PrimitiveCount
							 points,            //pVertexStreamZeroData
							 sizeof(D3DXVECTOR3));   //VertexStreamZeroStride
	D3DXMatrixRotationX(&rot,D2R(90));
	pDev->SetTransform(D3DTS_WORLD,&(scale*rot*trans));	
	pDev->DrawPrimitiveUP(D3DPT_LINESTRIP,         //PrimitiveType
							 STEPS,              //PrimitiveCount
							 points,            //pVertexStreamZeroData
							 sizeof(D3DXVECTOR3));   //VertexStreamZeroStride
	D3DXMatrixRotationZ(&rot,D2R(90));
	pDev->SetTransform(D3DTS_WORLD,&(scale*rot*trans));	
	pDev->DrawPrimitiveUP(D3DPT_LINESTRIP,         //PrimitiveType
							 STEPS,              //PrimitiveCount
							 points,            //pVertexStreamZeroData
							 sizeof(D3DXVECTOR3));   //VertexStreamZeroStride
}
开发者ID:MarcusKhoo,项目名称:Apollo13,代码行数:40,代码来源:QDraw.cpp

示例11: OnFrameMove

//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    if( g_bSpinning )
        D3DXMatrixRotationY( &g_World, 60.0f * DEG2RAD((float)fTime) );
    else
        D3DXMatrixRotationY( &g_World, DEG2RAD( 180.0f ) );

    D3DXMATRIX mRot;
    D3DXMatrixRotationX( &mRot, DEG2RAD( -90.0f ) );
    g_World = mRot * g_World;
}
开发者ID:KNeal,项目名称:Oculus,代码行数:17,代码来源:Tutorial13.cpp

示例12: D3DXMatrixRotationY

void PRTHierarchy::UpdateTransformationMatrices() {
	D3DXMATRIX rotX, rotY, rotYInverse;
	D3DXMatrixRotationY(&rotY, mRotationY);
	D3DXMatrixRotationX(&rotX, mRotationX);
	
	D3DXMatrixIdentity(&mWorldTransform);

	D3DXMATRIX rot = rotX * rotY;
	mWorldTransform = mScaleMatrix * rot;
	mRenderMesh->SetWorldTransformation(mWorldTransform);
	mApproxMesh->SetWorldTransformation(mWorldTransform);
	mRenderMesh->SetRotationMatrix(rot);
	mApproxMesh->SetRotationMatrix(rot);
}
开发者ID:flosmn,项目名称:MeshPRT,代码行数:14,代码来源:PRTHierarchy.cpp

示例13: m

void xForm::SetCameraPosition(const xVec3& origin, const xMat3& axis)
{
  xMat4 m(axis, origin); // camera to world space
  m.InverseSelf(); // world to camera space
  D3DXMATRIX mat = dxMat(m), out, out2;

  D3DXMatrixRotationZ(&out, DEG2RAD(90));
  D3DXMatrixMultiply(&out2, &mat, &out); // result in out2

  D3DXMatrixRotationX(&out, DEG2RAD(-90));
  D3DXMatrixMultiply(&mat, &out2, &out); // result in mat

  m_pd3dDevice->SetTransform(D3DTS_VIEW, &mat);
}
开发者ID:galek,项目名称:xform-megatexture,代码行数:14,代码来源:xForm.cpp

示例14: memcpy

void Chunk::Render(Camera* p_pCamera)
{
	D3DXMATRIX _Mat = p_pCamera->GetViewMatrix() * p_pCamera->GetProjMatrix();

	D3D11_MAPPED_SUBRESOURCE _CBMSR;

	m_pDevCon->Map(m_pConstantBufferMatrix, 0, D3D11_MAP::D3D11_MAP_WRITE_DISCARD, 0, &_CBMSR);
	memcpy(_CBMSR.pData, &_Mat, sizeof(D3DXMATRIX));
	m_pDevCon->Unmap(m_pConstantBufferMatrix, 0);

	D3DXMATRIX _SunRotation;
	D3DXMatrixRotationX(&_SunRotation, TimeSinceStart);

	ChunkConstantBuffer _CCB;

	D3DXVECTOR3 _LightDir(2, -3, 1);
	D3DXVec3Normalize(&_LightDir, &_LightDir);

	_CCB.LightDir = D3DXVECTOR4(_LightDir.x, _LightDir.y, _LightDir.z, 0);

	D3DXVec4Transform(&_CCB.LightDir, &_CCB.LightDir, &_SunRotation);

	float Intensity = 1;
	_CCB.RGBLightColor_ALightIntensity = D3DXVECTOR4(1 * Intensity, 1 * Intensity, 0.7f * Intensity, 0);

	m_pDevCon->Map(m_pConstantBufferLight, 0, D3D11_MAP::D3D11_MAP_WRITE_DISCARD, 0, &_CBMSR);
	memcpy(_CBMSR.pData, &_CCB, sizeof(ChunkConstantBuffer));
	m_pDevCon->Unmap(m_pConstantBufferLight, 0);



	UINT stride = sizeof(ChunkVertexStruct);
	UINT offset = 0;

	m_pDevCon->IASetIndexBuffer(m_pIndexBuffer, DXGI_FORMAT::DXGI_FORMAT_R32_UINT, 0);
	m_pDevCon->IASetVertexBuffers(0, 1, &m_pVertexBuffer, &stride, &offset);
	m_pDevCon->IASetInputLayout(m_pInputLayout);
	m_pDevCon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

	m_pDevCon->VSSetShader(m_pVertexShader, nullptr, 0);
	m_pDevCon->VSSetConstantBuffers(0, 1, &m_pConstantBufferMatrix);

	m_pDevCon->PSSetShader(m_pPixelShader, nullptr, 0);
	m_pDevCon->PSSetShaderResources(0, 1, &m_pDirtTexture);
	m_pDevCon->PSSetConstantBuffers(0, 1, &m_pConstantBufferLight);


	m_pDevCon->DrawIndexed(FaceCount * 2 * 3, 0, 0);

}
开发者ID:Namoor,项目名称:GSP914,代码行数:50,代码来源:Chunk.cpp

示例15: D3DXMatrixScaling

bool Sample::Frame() {
	D3DXMATRIX matRotation, matScale;
	D3DXMatrixScaling(&matScale, 100, 100, 100);
	D3DXMatrixRotationX(&matRotation, D3DXToRadian(90.0f));
	m_matWorld[2] = matScale * matRotation;

	if (I_Input.m_DIMouseState.rgbButtons[0])
	{
		m_vDir.y += m_fSpeed * g_fSecPerFrame * I_Input.m_DIMouseState.lX;
		m_vDir.x += m_fSpeed * g_fSecPerFrame * I_Input.m_DIMouseState.lY;
	}
	if (I_Input.KeyCheck(DIK_SPACE))
	{
		m_fSpeed += g_fSecPerFrame * 20.0f;
		if (m_fSpeed >= 50.0f) m_fSpeed = 50.0f;
	}
	else
	{
		m_fSpeed -= g_fSecPerFrame * 10.0f;
		if (m_fSpeed <= 5.0f) m_fSpeed = 5.0f;
	}
	if (I_Input.KeyCheck(DIK_W))
	{
		m_Camera.MoveLook(g_fSecPerFrame* m_fSpeed);
	}
	if (I_Input.KeyCheck(DIK_S))
	{
		m_Camera.MoveLook(-g_fSecPerFrame* m_fSpeed);
	}
	m_vDir.w = 0.0f;
	if (I_Input.m_DIMouseState.lZ != 0)
	{
		m_vDir.w = m_fSpeed * g_fSecPerFrame * I_Input.m_DIMouseState.lZ;
	}


	if (I_Input.KeyCheck(DIK_F4))
	{
		m_bCameraType = !m_bCameraType;
	}
	if (m_bCameraType)
	{
		m_Camera.Update(m_vDir);
	}
	else
	{
		m_Camera.Frame(m_vDir);
	}
	return true;
};
开发者ID:serialkk,项目名称:cudgel,代码行数:50,代码来源:Sample.cpp


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