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


C++ D3DXVec3TransformCoord函数代码示例

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


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

示例1: D3DXVec3Cross

// Tilt the camera horisontally: look left/right
void Camera::TurnHorizontal(float angle)
{
	D3DXVECTOR3 up;
	D3DXVec3Cross(&up, &mDirection, &GetRight());
	D3DXMATRIX rotation;

	D3DXMatrixRotationAxis(&rotation, &up, angle);
	D3DXVec3TransformCoord(&mDirection, &mDirection, &rotation);
	D3DXVec3Normalize(&mDirection, &mDirection);
}
开发者ID:KimRestad,项目名称:3D-II-Lab2,代码行数:11,代码来源:Camera.cpp

示例2: D3DXVec3TransformCoord

int CPolyMesh3::MultVert( D3DXMATRIX multmat )
{
	int pno;
	for( pno = 0; pno < m_orgpointnum; pno++ ){
		D3DXVECTOR3 tmpv;
		D3DXVec3TransformCoord( &tmpv, m_pointbuf + pno, &multmat );
		*( m_pointbuf + pno ) = tmpv;
	}
	return 0;
}
开发者ID:Ochakko,项目名称:MameRoid3D,代码行数:10,代码来源:polymesh3.cpp

示例3: assert

void SpotLight::OnFrameMove(float elapsed_time) {
  assert(SpotLight::pPos != NULL);
  D3DXMATRIX rotation_matrix;
  D3DXMatrixRotationYawPitchRoll(&rotation_matrix,
    elapsed_time * rotation_.y,
    elapsed_time * rotation_.x,
    elapsed_time * rotation_.z);
  D3DXVec3TransformCoord(&position_, &position_, &rotation_matrix);
  SpotLight::pPos->SetFloatVectorArray(position_, instance_id_, 1);
}
开发者ID:reima,项目名称:sep3d,代码行数:10,代码来源:SpotLight.cpp

示例4: D3DXVECTOR3

void Camera::CalculateViewMatrix(D3DXMATRIX transMatrix)
{
	D3DXVECTOR3 xaxis = D3DXVECTOR3(1,0,0);
	D3DXVECTOR3 yaxis = D3DXVECTOR3(0,1,0);

	D3DXVec3TransformCoord(&right, &xaxis, &transMatrix);
	D3DXVec3TransformCoord(&up, &yaxis, &transMatrix); 

	D3DXVECTOR3 newPos;
       
	D3DXMATRIX baseMatrix;										// position matrix
	D3DXMatrixTranslation(&baseMatrix, 0, 0, zoom);				// inital position
	baseMatrix = baseMatrix * transMatrix;						// translated

	look = D3DXVECTOR3(transMatrix._41, transMatrix._42, transMatrix._43);
	newPos = D3DXVECTOR3(baseMatrix._41, baseMatrix._42, baseMatrix._43);
	
	D3DXMatrixLookAtLH(&viewMatrix, &newPos, &look, &up);
}
开发者ID:ludaxkris,项目名称:atmosphere-server,代码行数:19,代码来源:Camera.cpp

示例5: D3DXVec3TransformCoord

	//================================================================================
	//!	メソッド名	CSKIN_MESH::getWorldCenter
	//
	//	機能		ワールド座標系中心点を受け取る
	//	戻り値		ワールド座標系中心点
	//	更新		2007/12/08		<新規>
	//================================================================================
	VEC3
	CSKIN_MESH::getWorldCenter(void)
	{
	//	ワールド座標系中心点
		VEC3	aCenter;
	//	ワールド座標系の演算
		D3DXVec3TransformCoord(&aCenter, &sd_ptr->mesh->localCenter, getWorldMatrix());
	//	ワールド座標系中心点を返す
		return	aCenter;
	}
开发者ID:jun-ueoka,项目名称:KageTokiGIRL,代码行数:17,代码来源:Class_SkinMesh.cpp

示例6: D3DXMatrixRotationQuaternion

bool ElCamera::isViewOutOfDate()
{
	// Overridden from Frustum to use local orientation / position offsets
	// Attached to node?
	if (mParentNode != 0)
	{
		if (mRecalcView ||
			mParentNode->getDerivedOrientation() != mLastParentOrientation ||
			mParentNode->getDerivedPosition() != mLastParentPosition)
		{
			// Ok, we're out of date with SceneNode we're attached to
			mLastParentOrientation = mParentNode->getDerivedOrientation();
			mLastParentPosition = mParentNode->getDerivedPosition();

			mRealOrientation = mLastParentOrientation * mOrientation;
			D3DXMATRIX m;
			D3DXMatrixRotationQuaternion(&m, &mLastParentOrientation);
			D3DXVec3TransformCoord(&mRealPosition, &mPosition, &m);
			mRealPosition += mLastParentPosition;
			
			mRecalcView = true;
		}
	}
	else
	{
		// Rely on own updates
		mRealOrientation = mOrientation;
		mRealPosition = mPosition;
	}

	// Deriving reflected orientation / position
	if (mRecalcView)
	{
		if (mReflect)
		{
			// Calculate reflected orientation, position
			D3DXMATRIX rot;
			D3DXMatrixRotationQuaternion(&rot, &mRealOrientation);
			D3DXMATRIX trans;
			D3DXMatrixTranslation(&trans, mRealPosition.x, mRealPosition.y, mRealPosition.z);
			
			D3DXMATRIX m = rot * trans * mReflectMatrix;

			D3DXVECTOR3 scale;
			D3DXMatrixDecompose(&scale, &mDerivedOrientation, &mDerivedPosition, &m);
		}
		else
		{
			mDerivedOrientation = mRealOrientation;
			mDerivedPosition = mRealPosition;
		}
	}

	return mRecalcView;
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:55,代码来源:ElCamera.cpp

示例7: vCenter

bool CCubeBox::Collision(D3DXVECTOR3& vGo, D3DXVECTOR3& vPos)
{
    FLOAT StdDist[3] = { m_wx/2, m_wy/2, m_wz/2 };
    //矩形中心
    D3DXVECTOR3 vCenter( m_x + StdDist[0], m_y + StdDist[1], m_z + StdDist[2]);
    //原位置指向中心
    D3DXVECTOR3 D = vCenter - vPos; 
    //若方向相反
    //if (D3DXVec3Dot(&vGo, &D) <= 0) return false;
    //长宽高单位向量
    D3DXVECTOR3 vSub[3];
    vSub[0] = D3DXVECTOR3( 1, 0, 0 );
    vSub[1] = D3DXVECTOR3( 0, 1, 0 );
    vSub[2] = D3DXVECTOR3( 0, 0, 1 );
    //前进方向分量
    FLOAT vGoSub[3];
    //距中心分量
    FLOAT vDSub[3];
    for (int i = 0; i < 3; i++)
    {
        D3DXVec3TransformCoord(&vSub[i], &vSub[i], &m_matRot);
        vGoSub[i] = D3DXVec3Dot(&vGo, &vSub[i]);
        vDSub[i] = D3DXVec3Dot(&D, &vSub[i]);
    }
    //二者的差距
    FLOAT inner[3];
    for (int i = 0; i<3; i++)
    {
        inner[i] = StdDist[i] - abs(vDSub[i] - vGoSub[i])+0.5f;
        //有一个<0,就没碰
        if (inner[i] < 0) return false;
    }
    //三个都大于0
    int Min = 0;
    FLOAT s = 100000.0f;
    for (int i =0; i < 3; i++)
    {
        if (inner[i] / abs(vGoSub[i]) < s)
        {
            s = inner[i] / abs(vGoSub[i]);
            Min = i;
        }
    }
    //只修正最小一个分量
    if (vGoSub[Min] > 0)
    {
        vGoSub[Min] = vGoSub[Min] - inner[Min];
    }else{
        vGoSub[Min] = vGoSub[Min] + inner[Min];
    }
    //最后生成修正值
    vGo = vGoSub[0] * vSub[0] + vGoSub[1] * vSub[1] + vGoSub[2] * vSub[2];
    return true;

}
开发者ID:redclock,项目名称:GIEngine,代码行数:55,代码来源:CubeBox.cpp

示例8: D3DXToRadian

void cCamera::Rotation(float speed/* 음수이냐 양수냐로 방향 설정 */)
{
    D3DXVECTOR3 vcEps = cCore::Input.GetMouseEps()/2.f;

    FLOAT   fYaw    ;
    FLOAT   fPitch  ;

    D3DXVECTOR3 vcZ;
    D3DXVECTOR3 vcY;
    D3DXVECTOR3 vcX;

    D3DXMATRIX rtY;
    D3DXMATRIX rtX;

    // 월드 좌표 y 축에 대한 회전
    fYaw    = D3DXToRadian(vcEps.x * speed);
    D3DXMatrixRotationY(&rtY, fYaw);

    vcZ = m_vLookAt-m_vEyePt;
    vcY = D3DXVECTOR3(m_mtView._12, m_mtView._22, m_mtView._32);

    D3DXVec3TransformCoord(&vcZ, &vcZ, &rtY);
    D3DXVec3TransformCoord(&vcY, &vcY, &rtY);

    m_vLookAt= vcZ + m_vEyePt;
    m_vUpVec  = vcY;
    D3DXMatrixLookAtLH(&m_mtView, &m_vEyePt, &m_vLookAt, &m_vUpVec);

    // 카메라의 x 축에 대한 회전
    fPitch  = D3DXToRadian(vcEps.y * speed);
    vcX = D3DXVECTOR3(m_mtView._11, m_mtView._21, m_mtView._31);
    vcY = D3DXVECTOR3(m_mtView._12, m_mtView._22, m_mtView._32);
    vcZ = m_vLookAt-m_vEyePt;

    D3DXMatrixRotationAxis(&rtX, &vcX, fPitch);
    D3DXVec3TransformCoord(&vcZ, &vcZ, &rtX);
    D3DXVec3TransformCoord(&vcY, &vcY, &rtX);

    m_vLookAt= vcZ + m_vEyePt;
    m_vUpVec  = vcY;
    D3DXMatrixLookAtLH(&m_mtView, &m_vEyePt, &m_vLookAt, &m_vUpVec);
}
开发者ID:NeuroWhAI,项目名称:WhatBox,代码行数:42,代码来源:cCamera.cpp

示例9: D3DXToRadian

void DXCamera::SetRotate( const D3DXVECTOR3* deltaVec, float speed )
{
	D3DXVECTOR3 epsilonVec = *deltaVec;

	float yaw;
	float pitch;

	D3DXVECTOR3 xVec;
	D3DXVECTOR3 yVec;
	D3DXVECTOR3 zVec;

	D3DXMATRIX rtY;
	D3DXMATRIX rtX;

	// 월드 좌표 y 축에 대한 회전
	yaw = D3DXToRadian( epsilonVec.x * speed );
	D3DXMatrixRotationY( &rtY, yaw );

	zVec = _lookVec - _eyeVec;
	yVec = D3DXVECTOR3( _view._12, _view._22, _view._32 );

	D3DXVec3TransformCoord( &zVec, &zVec, &rtY );
	D3DXVec3TransformCoord( &yVec, &yVec, &rtY );

	_lookVec = zVec + _eyeVec;
	_upVec = yVec;
	D3DXMatrixLookAtLH( &_view, &_eyeVec, &_lookVec, &_upVec );

	// 카메라의 x 축에 대한 회전
	pitch = D3DXToRadian( epsilonVec.y * speed );
	xVec = D3DXVECTOR3( _view._11, _view._21, _view._31 );
	yVec = D3DXVECTOR3( _view._12, _view._22, _view._32 );
	zVec = _lookVec - _eyeVec;

	D3DXMatrixRotationAxis( &rtX, &xVec, pitch );
	D3DXVec3TransformCoord( &zVec, &zVec, &rtX );
	D3DXVec3TransformCoord( &yVec, &yVec, &rtX );

	_lookVec = zVec + _eyeVec;
	_upVec = yVec;
	D3DXMatrixLookAtLH( &_view, &_eyeVec, &_lookVec, &_upVec );
}
开发者ID:popoory67,项目名称:NinetailEngine,代码行数:42,代码来源:DXCamera.cpp

示例10: dir

void Camera::update(float dt)
{
	// Find the net direction the camera is traveling in (since the
	// camera could be running and strafing).
	D3DXVECTOR3 dir(0.0f, 0.0f, 0.0f);
	if( gDInput->keyDown(DIK_W) )
		dir += mLookW;
	if( gDInput->keyDown(DIK_S) )
		dir -= mLookW;
	if( gDInput->keyDown(DIK_D) )
		dir += mRightW;
	if( gDInput->keyDown(DIK_A) )
		dir -= mRightW;

	// Move at mSpeed along net direction.
	D3DXVec3Normalize(&dir, &dir);
	mPosW += dir*mSpeed*dt;


	// We rotate at a fixed speed.
	float pitch  = gDInput->mouseDY() / 150.0f;
	float yAngle = gDInput->mouseDX() / 150.0f;


	// Rotate camera's look and up vectors around the camera's right vector.
	D3DXMATRIX R;
	D3DXMatrixRotationAxis(&R, &mRightW, pitch);
	D3DXVec3TransformCoord(&mLookW, &mLookW, &R);
	D3DXVec3TransformCoord(&mUpW, &mUpW, &R);


	// Rotate camera axes about the world's y-axis.
	D3DXMatrixRotationY(&R, yAngle);
	D3DXVec3TransformCoord(&mRightW, &mRightW, &R);
	D3DXVec3TransformCoord(&mUpW, &mUpW, &R);
	D3DXVec3TransformCoord(&mLookW, &mLookW, &R);


	// Rebuild the view matrix to reflect changes.
	buildView();
	mViewProj = mView * mProj;
}
开发者ID:as2120,项目名称:ZNginx,代码行数:42,代码来源:Camera.cpp

示例11: D3DXMatrixRotationYawPitchRoll

void CameraClass::RenderForText()
{
	D3DXVECTOR3 up, position, lookAt;
	float yaw, pitch, roll;
	D3DXMATRIX rotationMatrix;


	// Setup the vector that points upwards.
	up.x = 0.0f;
	up.y = 1.0f;
	up.z = 0.0f;

	// Setup the position of the camera in the world.
	position.x = m_positionX;
	position.y = m_positionY;
	position.z = m_positionZ;

	// Setup where the camera is looking by default.
	lookAt.x = 0.0f;
	lookAt.y = 0.0f;
	lookAt.z = 1.0f;

	// Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
	pitch = m_rotationX * 0.0174532925f;
	yaw   = m_rotationY * 0.0174532925f;
	roll  = m_rotationZ * 0.0174532925f;

	// Create the rotation matrix from the yaw, pitch, and roll values.
	D3DXMatrixRotationYawPitchRoll(&rotationMatrix, yaw, pitch, roll);

	// Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
	D3DXVec3TransformCoord(&lookAt, &lookAt, &rotationMatrix);
	D3DXVec3TransformCoord(&up, &up, &rotationMatrix);

	// Translate the rotated camera position to the location of the viewer.
	lookAt = position + lookAt;

	// Finally create the view matrix from the three updated vectors.
	D3DXMatrixLookAtLH(&m_viewMatrix, &position, &lookAt, &up);

	return;
}
开发者ID:GlennPatrickCullen,项目名称:DirectXApplication,代码行数:42,代码来源:cameraclass.cpp

示例12: d3_frustum_hit_check

/*------------------------------------------------------------------------------*
| <<< メッシュが視錐台の中にあるかチェック >>>
|	入力	pHit   = メッシュのヒットワーク
|			mWorld = メッシュのワールド座標
|	戻り値	0 :	視錐台の中
|			1 :	一部分が切れている
|			2 :	視錐台の外
*------------------------------------------------------------------------------*/
int		d3_frustum_hit_check(D3_HIT *pHit, MTX *mWorld)
{

	for(int	i =	0; i < 8; i++) D3DXVec3TransformCoord(&pHit->vecWorld[i], &pHit->vecLocal[i], mWorld);
	pHit->vecWorld[8].x	= mWorld->_41;		// バウンディングボックスの中心点
	pHit->vecWorld[8].y	= mWorld->_42;
	pHit->vecWorld[8].z	= mWorld->_43;
	
	//--- 面の作成 --------------------------------------------------
	D3DXPlaneFromPoints(&pHit->planeWorld[0], &pHit->vecWorld[0], &pHit->vecWorld[1], &pHit->vecWorld[2]);	// Near
	D3DXPlaneFromPoints(&pHit->planeWorld[1], &pHit->vecWorld[6], &pHit->vecWorld[7], &pHit->vecWorld[5]);	// Far
	D3DXPlaneFromPoints(&pHit->planeWorld[2], &pHit->vecWorld[2], &pHit->vecWorld[6], &pHit->vecWorld[4]);	// Left
	D3DXPlaneFromPoints(&pHit->planeWorld[3], &pHit->vecWorld[7], &pHit->vecWorld[3], &pHit->vecWorld[5]);	// Right
	D3DXPlaneFromPoints(&pHit->planeWorld[4], &pHit->vecWorld[2], &pHit->vecWorld[3], &pHit->vecWorld[6]);	// Top
	D3DXPlaneFromPoints(&pHit->planeWorld[5], &pHit->vecWorld[1], &pHit->vecWorld[0], &pHit->vecWorld[4]);	// Bottom

	//---------------------------------------------------------------
	WORD	bOutside[8];
	int		out	= 0;

	ZeroMemory(&bOutside, sizeof(bOutside));
	// bitfieldの中の6つの円錐台平面、および結果(1の場合、外部)
	// すべてに対するチェック境界頂点
	float	aa[8];

	for(int	iPoint = 0;	iPoint < 8;	iPoint++)
	{
		for(int	iPlane = 0;	iPlane < 6;	iPlane++)
		{
			aa[iPoint] = 
			   d3.planeFrustum[iPlane].a * pHit->vecWorld[iPoint].x
			+  d3.planeFrustum[iPlane].b * pHit->vecWorld[iPoint].y
			+  d3.planeFrustum[iPlane].c * pHit->vecWorld[iPoint].z
			+  d3.planeFrustum[iPlane].d;

			if(d3.planeFrustum[iPlane].a * pHit->vecWorld[iPoint].x
			+  d3.planeFrustum[iPlane].b * pHit->vecWorld[iPoint].y
			+  d3.planeFrustum[iPlane].c * pHit->vecWorld[iPoint].z
			+  d3.planeFrustum[iPlane].d < 0)
			{
				bOutside[iPoint] |=	(1 << iPlane);
				out++;
			}
		}
	}
	if(out == 0){ return 0;}

	if((bOutside[0]	& bOutside[1] &	bOutside[2]	& bOutside[3]
	&	bOutside[4]	& bOutside[5] &	bOutside[6]	& bOutside[7]) != 0)
	{
		return 2;
	}
	return 1;
}
开发者ID:Github-J,项目名称:WinGames,代码行数:62,代码来源:_collision.cpp

示例13: D3DXVECTOR3

void Mesh::validate_bounding_box()
{
	bb.reset();
	for (int i = 0; i < vertices_.size(); i++)
	{
		D3DXVECTOR3 world_position, local_position = D3DXVECTOR3(vertices_[i].position);
		D3DXVec3TransformCoord(&world_position, &local_position, &frame_);

		bb.enlarge_bb_with_point(D3DXVECTOR4(world_position, 1));
	}
}
开发者ID:Muret,项目名称:Zephyr,代码行数:11,代码来源:Mesh.cpp

示例14: D3DXMatrixRotationAxis

/// 카메라 좌표계의 Y축으로 angle만큼 회전한다.
D3DXMATRIXA16* ZCamera::RotateLocalY( float angle )
{
    D3DXMATRIXA16 matRot;
    D3DXMatrixRotationAxis( &matRot, &m_vUp, angle );

    D3DXVECTOR3 vNewDst;
    D3DXVec3TransformCoord( &vNewDst, &m_vView, &matRot );	// view * rot로 새로운 dst vector를 구한다.
    vNewDst += m_vEye;										// 실제 dst position =  eye Position + dst vector

    return SetView( &m_vEye, &vNewDst, &m_vUp );
}
开发者ID:blastingzone,项目名称:ComputerGraphicsAdvenced,代码行数:12,代码来源:ZCamera.cpp

示例15: D3DXVec3TransformCoord

void Picking::TransformRay(Ray* ray, D3DXMATRIX* matrix)
{
	//转化射线的起始点, w = 1.
	D3DXVec3TransformCoord(&ray->m_vOrigin, &ray->m_vOrigin, matrix);

	//转化射线的方向向量, w = 0.
	D3DXVec3TransformNormal(&ray->m_vDirection, &ray->m_vDirection, matrix);

	//单位化方向向量
	D3DXVec3Normalize(&ray->m_vDirection, &ray->m_vDirection);
}
开发者ID:puppetmasterzj,项目名称:DXDemo,代码行数:11,代码来源:Picking.cpp


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