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


C++ D3DXVec3TransformNormal函数代码示例

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


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

示例1: D3DXVec3TransformCoord

void ReflRender::BeginRT(Engine& engine, const RtFlags& flags)
{
	const DWORD cClipPlanes[6] = {D3DCLIPPLANE0, D3DCLIPPLANE1, D3DCLIPPLANE2, D3DCLIPPLANE3, D3DCLIPPLANE4, D3DCLIPPLANE5};

	_MyBase::BeginRT(engine, flags);

	CameraDesc desc = engine.GetContext().GetCamera().GetDesc();
	D3DXVec3TransformCoord(&desc.pos, &desc.pos, &_reflMat);
	D3DXVec3TransformNormal(&desc.dir, &desc.dir, &_reflMat);
	D3DXVec3TransformNormal(&desc.up, &desc.up, &_reflMat);
	desc.up = -desc.up;
	_reflCamera.SetDesc(desc);
	//reflCamera.AdjustFarPlane(sceneBox, maxFarDist);

	engine.GetContext().ApplyCamera(&_reflCamera);

	DWORD enableClipPlanes = cClipPlanes[0];
	engine.GetDriver().GetDevice()->SetClipPlane(0, _reflPlane);

	LSL_ASSERT(_clipPlanes.size() <= 5);

	for (unsigned i = 0; i < _clipPlanes.size(); ++i)
	{
		enableClipPlanes |= cClipPlanes[i + 1];
		engine.GetDriver().GetDevice()->SetClipPlane(i + 1, _clipPlanes[i]);
	}

	engine.GetContext().SetRenderState(rsClipPlaneEnable, enableClipPlanes);

	ApplyRT(engine, flags);
}
开发者ID:DimaKirk,项目名称:rrr3d,代码行数:31,代码来源:WaterPlane.cpp

示例2: D3DXMatrixRotationZ

void CElementManager::CreateCircle(const D3DXVECTOR3& pos, FLOAT intensity, const SMap *map, 
			FLOAT lastTime, FLOAT length, INT max, DWORD color, BOOL isPlayer) 
{
	D3DXVECTOR3 dir;
	D3DXMATRIX trans;
	if (intensity > 1.f) intensity = 1.f;
	INT cnt = static_cast<INT>(max*intensity+0.5f);
	D3DXMatrixRotationZ(&trans, 2*D3DX_PI/cnt);
	UINT t;
	do {
		rand_s(&t);
		dir.x = t%10-5.f;
		rand_s(&t);
		dir.y = t%10-5.f;
	} while (dir.x == 0.f && dir.y == 0.f);
	dir.z = 0.f;
	D3DXVec3Normalize(&dir, &dir);
	if (isPlayer) 
		for (INT i(0); i < cnt; ++i) {
			D3DXVec3TransformNormal(&dir, &dir, &trans);
			m_pEcho.push_back(new CLine(pos, dir, 
				intensity, map, intensity <= 2.f/9, lastTime, length, color));
		}
	else 
		for (INT i(0); i < cnt; ++i) {
			D3DXVec3TransformNormal(&dir, &dir, &trans);
			m_pAmbience.push_back(new CLine(pos, dir, 
				intensity, map, intensity <= 2.f/9, lastTime, length, color));
		}

}
开发者ID:wyrover,项目名称:Echo,代码行数:31,代码来源:ElementManager.cpp

示例3: D3DXVec3TransformCoord

void BoundingBox::Transform(const D3DXMATRIX& m)
{
    D3DXVec3TransformCoord(&center, &center, &m);
    D3DXVec3TransformNormal(&vx, &vx, &m);
    D3DXVec3TransformNormal(&vy, &vy, &m);
    D3DXVec3TransformNormal(&vz, &vz, &m);
}
开发者ID:Hrnchamd,项目名称:MGE-XE,代码行数:7,代码来源:dlmath.cpp

示例4: D3DXVECTOR3

//just rotate lights a little in place
void Scene::UpdateLights(double fTime)
{
    D3DXVECTOR3 offAngleVec3 = D3DXVECTOR3(1, -4, 0);
    D3DXMATRIX rotY;
    D3DXVECTOR3 dir;

    D3DXVec3Normalize(&offAngleVec3, &offAngleVec3);
    D3DXMatrixRotationY(&rotY, (float)(fTime / 4.f) * 3.14159265f);
    D3DXVec3TransformNormal(&dir, &offAngleVec3, &rotY);
    m_lights[0].vLightDir = dir;

    D3DXVec3Normalize(&offAngleVec3, &offAngleVec3);
    D3DXMatrixRotationY(&rotY, (float)(-fTime / 3.f) * 3.14159265f);
    D3DXVec3TransformNormal(&dir, &offAngleVec3, &rotY);
    m_lights[1].vLightDir = dir;

    D3DXVec3Normalize(&offAngleVec3, &offAngleVec3);
    D3DXMatrixRotationY(&rotY, (float)(fTime / 2.f) * 3.14159265f);
    D3DXVec3TransformNormal(&dir, &offAngleVec3, &rotY);
    m_lights[2].vLightDir = dir;

    D3DXVec3Normalize(&offAngleVec3, &offAngleVec3);
    D3DXMatrixRotationY(&rotY, (float)(-fTime / 4.f) * 3.14159265f);
    D3DXVec3TransformNormal(&dir, &offAngleVec3, &rotY);
    m_lights[3].vLightDir = dir;
}
开发者ID:151706061,项目名称:D3DSamples,代码行数:27,代码来源:Scene.cpp

示例5: D3DXMatrixRotationAxis

void Camera::Pitch( float angle )
{
	D3DXMATRIX R;
	D3DXMatrixRotationAxis(&R, &mRight, angle);
	D3DXVec3TransformNormal(&mUp, &mUp, &R);
	D3DXVec3TransformNormal(&mLook, &mLook, &R);
}
开发者ID:jaffafa,项目名称:pacman-reloaded,代码行数:7,代码来源:Camera.cpp

示例6: D3DXMatrixRotationAxis

void Camera::Pitch(float _angle)
{
	D3DXMATRIX p;
	D3DXMatrixRotationAxis(&p, &right, _angle);

	D3DXVec3TransformNormal(&up, &up, &p);
	D3DXVec3TransformNormal(&look, &look, &p);
}
开发者ID:sywor,项目名称:3D_Projekt,代码行数:8,代码来源:Camera.cpp

示例7: D3DXMatrixRotationY

void Camera::RotateY( float angle )
{
	D3DXMATRIX R;
	D3DXMatrixRotationY(&R, angle);
	D3DXVec3TransformNormal(&mRight, &mRight, &R);
	D3DXVec3TransformNormal(&mUp, &mUp, &R);
	D3DXVec3TransformNormal(&mLook, &mLook, &R);
}
开发者ID:jaffafa,项目名称:pacman-reloaded,代码行数:8,代码来源:Camera.cpp

示例8: D3DXMatrixRotationY

void Camera::rotateY(float angle)
{
	D3DXMATRIX rotation;
	D3DXMatrixRotationY(&rotation,angle);

	D3DXVec3TransformNormal(&right,&right,&rotation);
	D3DXVec3TransformNormal(&up,&up,&rotation);
	D3DXVec3TransformNormal(&look,&look,&rotation);	
}
开发者ID:Kamelen,项目名称:D3D2proj2,代码行数:9,代码来源:Camera.cpp

示例9: D3DXMatrixRotationAxis

void Camera::pitch(float angle)
{
	D3DXMATRIX rotation;
	D3DXMatrixRotationAxis(&rotation,&right,angle);

	D3DXVec3TransformNormal(&up,&up,&rotation);
	D3DXVec3TransformNormal(&look,&look,&rotation);
	
}
开发者ID:Kamelen,项目名称:D3D2proj2,代码行数:9,代码来源:Camera.cpp

示例10: D3DXMatrixRotationY

void Camera::RotateY(float _angle)
{
	D3DXMATRIX r;
	D3DXMatrixRotationY(&r, _angle);

	D3DXVec3TransformNormal(&right, &right, &r);
	D3DXVec3TransformNormal(&up, &up, &r);
	D3DXVec3TransformNormal(&look, &look, &r);
}
开发者ID:sywor,项目名称:3D_Projekt,代码行数:9,代码来源:Camera.cpp

示例11: D3DXMatrixTranslation

Ray OBB::GetContactPoint(Ray &ray) {
    D3DXMATRIX p, r, world, invWorld;
    D3DXMatrixTranslation(&p, m_pos.x, m_pos.y, m_pos.z);
    D3DXMatrixRotationQuaternion(&r, &m_rot);

    D3DXMatrixMultiply(&world, &r, &p);
    D3DXMatrixInverse(&invWorld, NULL, &world);

    D3DXVECTOR3 org, dir;
    D3DXVec3TransformCoord(&org, &ray.m_org, &invWorld);
    D3DXVec3TransformNormal(&dir, &ray.m_dir, &invWorld);

    D3DXPLANE planes[] = {D3DXPLANE(0.0f, 0.0f, -1.0f, -m_size.z),
                          D3DXPLANE(0.0f, 0.0f, 1.0f,  -m_size.z),
                          D3DXPLANE(0.0f, -1.0f, 0.0f, -m_size.y),
                          D3DXPLANE(0.0f, 1.0f, 0.0f,  -m_size.y),
                          D3DXPLANE(-1.0f, 0.0f, 0.0f, -m_size.x),
                          D3DXPLANE(1.0f, 0.0f, 0.0f,  -m_size.x)
                         };

    D3DXVECTOR3 result, normal;
    int numPlanes = 0;
    int numIntersections = 0;

    for (int i=0; i<6; i++) {
        float d = org.x * planes[i].a +
                  org.y * planes[i].b +
                  org.z * planes[i].c;

        if (d > -planes[i].d) {
            D3DXVECTOR3 r;
            if (D3DXPlaneIntersectLine(&r, &planes[i], &org, &(org + dir * 1000.0f)) != NULL) {
                numPlanes++;

                if (abs(r.x) <= m_size.x &&
                        abs(r.y) <= m_size.y &&
                        abs(r.z) <= m_size.z) {
                    D3DXVec3TransformCoord(&r, &r, &world);
                    result = r;
                    normal = D3DXVECTOR3(planes[i].a, planes[i].b, planes[i].c);
                    numIntersections++;
                }
            }
        }
    }

    if (numIntersections == 0) {
        //Warning! OBB No Intersections!
        return Ray(ray.m_org, -ray.m_dir);
    }

    D3DXVec3Normalize(&normal, &normal);
    D3DXVec3TransformNormal(&normal, &normal, &world);

    return Ray(result, normal);
}
开发者ID:7zhang,项目名称:studies,代码行数:56,代码来源:OBB.cpp

示例12: D3DXMatrixRotationAxis

void CPlayer::Rotate(float x, float y, float z)
{
	D3DXMATRIX mtxRotate;
	DWORD nCurrentCameraMode = m_pCamera->GetMode();

	// 1인칭 카메라 또는 3인칭 카메라의 경우 플레이어의 회전은 약간의 제약이 따름
	if ((nCurrentCameraMode == FIRST_PERSON_CAMERA) || (nCurrentCameraMode == THIRD_PERSON_CAMERA))
	{
		// 로컬 x축을 중심으로 회전 회전각도는 -89.0 ~ 89.0 사이로 제한.
		
		//if (x != 0.0f)
		//{
		//	m_fPitch += x;
		//	if (m_fPitch > +89.0f) { x -= (m_fPitch - 89.0f); m_fPitch = +89.0f; }
		//	if (m_fPitch < -89.9f) { x -= (m_fPitch + 89.0f); m_fPitch = -89.0f; }
		//}
		//// 로컬 y축을 중심으로 회전 회전각도 제한없음
		//if (y != 0.0f)
		//{
		//	//m_fYaw += y;
		//	if (m_fYaw > 360.0f) m_fYaw -= 360.0f;
		//	if (m_fYaw < 0.0f) m_fYaw += 360.0f;
		//}

		//// 로컬 z축 회전 몸통을 좌우로 기울이는 것 회전각도는 -20 ~ 20 사이로 제한
		//// z는 현재 m_fRoll에서 실제 회전하는 각도 z만큼 회전
		//if (z != 0.0f)
		//{
		//	m_fRoll += z;
		//	if (m_fRoll > 20.0f) { z -= (m_fRoll - 20.0f); m_fRoll = +20.0f; }
		//	if (m_fRoll < -20.0f) { z -= (m_fRoll + 20.0f); m_fRoll = -20.0f; }
		//}

		// 카메라를 x y z 만큼 회전. 플레이어가 회전하면 카메라가 회전
		m_pCamera->Rotate(x, y, z);

		if (y != 0.0f)
		{
			D3DXMatrixRotationAxis(&mtxRotate, &m_d3dxvUp, (float)D3DXToRadian(y));
			D3DXVec3TransformNormal(&m_d3dxvLook, &m_d3dxvLook, &mtxRotate);
			D3DXVec3TransformNormal(&m_d3dxvRight, &m_d3dxvRight, &mtxRotate);
		}
	}
	// 회전으로 인해 플레이어의 로컬 축이 서로 직교하지 않을수 잇으므로 z축을 기준으로 
	// 서로 직교하고 단위벡터가 되도록 한다.
	D3DXVec3Normalize(&m_d3dxvLook, &m_d3dxvLook);
	D3DXVec3Cross(&m_d3dxvRight, &m_d3dxvUp, &m_d3dxvLook);
	
	D3DXVec3Normalize(&m_d3dxvRight, &m_d3dxvRight);
	D3DXVec3Cross(&m_d3dxvUp, &m_d3dxvLook, &m_d3dxvRight);
	
	D3DXVec3Normalize(&m_d3dxvUp, &m_d3dxvUp);
	
	RegenerateWorldMatrix();
}
开发者ID:chanona,项目名称:Guardians,代码行数:55,代码来源:Player.cpp

示例13: D3DXMatrixRotationYawPitchRoll

void DX10_Camera_FirstPerson::Process(float _dt)
{
	// Get mouse input
	//m_pDirectInput->DetectMouseInput(&m_yawChange, &m_pitchChange);
	m_yaw += m_yawChange * _dt;
	m_pitch += m_pitchChange * _dt;

	// Prevent Gimbal Lock
	if (m_pitch > m_maxRotation)
	{
		m_pitch = m_maxRotation;
	}
	if (m_pitch < m_minRotation)
	{
		m_pitch = m_minRotation;
	}

	// Create a full rotation matrix
	D3DXMatrixRotationYawPitchRoll(&m_rotationMatrix, m_yaw, m_pitch, 0);
	D3DXVec3TransformCoord(&m_target, &m_defaultForward, &m_rotationMatrix);
	D3DXVec3Normalize(&m_target, &m_target);

	// Calculate a Yaw rotation matrix
	D3DXMATRIX RotateYTempMatrix;
	D3DXMatrixRotationY(&RotateYTempMatrix, m_yaw);

	// Update the Local camera Axis around the Y axis
	D3DXVec3TransformNormal(&m_right, &m_defaultRight, &RotateYTempMatrix);
	D3DXVec3TransformNormal(&m_up, &m_up, &RotateYTempMatrix);
	D3DXVec3TransformNormal(&m_forward, &m_defaultForward, &RotateYTempMatrix);

	// Adjust the position
	m_position += m_moveStrafe * m_right * _dt;
	m_position += m_moveForwards * m_forward * _dt;
	m_position += m_moveFly * m_up * _dt;

	// reset the the movement values
	m_moveStrafe = 0.0f;
	m_moveForwards = 0.0f;
	m_moveFly = 0.0f;
	m_yawChange = 0.0f;
	m_pitchChange = 0.0f;

	// Pick a target in front of the camera
	m_target = m_position + m_target;

	// Create the View matrix
	D3DXMatrixLookAtLH(&m_matView, &m_position, &m_target, &m_up);

	m_pRenderer->SetViewMatrix(m_matView);
	m_pRenderer->SetEyePosition(m_position);
}
开发者ID:Moorecj007,项目名称:DX10-Framework,代码行数:52,代码来源:DX10_Camera_FirstPerson.cpp

示例14: D3DXMatrixRotationAxis

void FpsCamera::rotate(float x, float y)
{
    Matrix rotateX, rotateY;
    D3DXMatrixRotationAxis(&rotateX, &m_right, x * m_delta);
    D3DXMatrixRotationY(&rotateY, y * m_delta);
    Matrix total;
    D3DXMatrixMultiply(&total, &rotateX, &rotateY);
    D3DXVec3TransformNormal(&m_right, &m_right, &total);
    D3DXVec3TransformNormal(&m_up, &m_up, &total);
    D3DXVec3TransformNormal(&m_view, &m_view, &total);
    normalize();
    buildView();
}
开发者ID:TheZeroSlave,项目名称:xargdemo,代码行数:13,代码来源:Camera.cpp

示例15: assert

void RayIntersection::intersect(engine::IAtomic* atomic, engine::CollisionCallBack callBack, void* data)
{    
    _callBack = callBack;
    _callBackData = data;
    _bsp = NULL;
    _bspSector = NULL;
    _atomic = dynamic_cast<Atomic*>( atomic ); assert( _atomic );
   
    assert( _atomic->_geometry->getOcTreeRoot() );
    _geometry  = _atomic->_geometry;
    _vertices  = _geometry->getVertices();
    _triangles = _geometry->getTriangles();

    if( _atomic->_frame->isDirtyHierarchy() )
    {
        _atomic->_frame->synchronizeSafe();
    }
    
    // transform ray to atomic space
    Matrix iLTM;
    D3DXMatrixInverse( &iLTM, NULL, &_atomic->_frame->LTM );
    D3DXVec3TransformCoord( &_asRay.start, &_ray.start, &iLTM );
    D3DXVec3TransformNormal( &_asRay.end, &_ray.end, &iLTM );

    collideAtomicOcTreeSector( _geometry->getOcTreeRoot() );
}
开发者ID:cheinkn,项目名称:basextreme,代码行数:26,代码来源:rayintersection.cpp


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