资源简介
设计了一种基于GPU编程实现的大规模地形场景的实时绘制与漫游算法。利用GPU端完成地形网格更新、地形块的自动选取、高度图和纹理图采样等大部分计算工作,大大减轻了CPU端的计算负载。
代码片段和文件信息
#include “camera.h“
Camera::Camera()
{
_cameraType = AIRCRAFT;
_pos = XMVectorSet(0.0f 0.0f 0.0f0.0f);
_right = XMVectorSet(1.0f 0.0f 0.0f0.0f);
_up = XMVectorSet(0.0f 1.0f 0.0f0.0f);
_look = XMVectorSet(0.0f 0.0f 1.0f0.0f);
}
Camera::Camera(CameraType cameraType)
{
_cameraType = cameraType;
_pos = XMVectorSet(0.0f 1.0f -5.0f 0.0f);
_right = XMVectorSet(1.0f 0.0f 0.0f0.0f);
_up = XMVectorSet(0.0f 1.0f 0.0f0.0f);
_look = XMVectorSet(1.0f 0.0f 1.0f0.0f);
}
Camera::~Camera()
{
}
void Camera::getPosition(XMVECTOR* pos)
{
*pos = _pos;
}
void Camera::setPosition(XMVECTOR* pos)
{
_pos = *pos;
}
void Camera::getRight(XMVECTOR* right)
{
*right = _right;
}
void Camera::getUp(XMVECTOR* up)
{
*up = _up;
}
void Camera::getLook(XMVECTOR* look)
{
*look = _look;
}
void Camera::walk(float units)
{
// move only on xz plane for land object
if( _cameraType == LANDobject )
{
//_pos += XMVECTOR(_look.x 0.0f _look.z) * units;
float newX =XMVectorGetX(_pos) + XMVectorGetX(_look)*units;
float newY =XMVectorGetY(_pos);
float newZ =XMVectorGetZ(_pos) + XMVectorGetZ(_look)*units;
float newW =XMVectorGetW(_pos);
_pos = XMVectorSet(newXnewYnewZnewW);
}
//if( _cameraType == AIRCRAFT )
// _pos += _look * units;
}
void Camera::strafe(float units)
{
// move only on xz plane for land object
if( _cameraType == LANDobject )
{
//_pos += XMVECTOR(_right.x 0.0f _right.z) * units;
float newX =XMVectorGetX(_pos) + XMVectorGetX(_right)*units;
float newY =XMVectorGetY(_pos);
float newZ =XMVectorGetZ(_pos) + XMVectorGetZ(_right)*units;
float newW =XMVectorGetW(_pos);
_pos = XMVectorSet(newXnewYnewZnewW);
}
//if( _cameraType == AIRCRAFT )
// _pos += _right * units;
}
void Camera::fly(float units)
{
// move only on y-axis for land object
if( _cameraType == LANDobject )
{
//_pos.y += units;
float newX =XMVectorGetX(_pos);
float newY =XMVectorGetY(_pos) + units;
float newZ =XMVectorGetZ(_pos);
float newW =XMVectorGetW(_pos);
_pos = XMVectorSet(newXnewYnewZnewW);
}
//if( _cameraType == AIRCRAFT )
// _pos += _up * units;
}
void Camera::pitch(float angle)
{
//D3DXMATRIX T;
//D3DXMatrixRotationAxis(&T &_right angle);
XMMATRIX T;
T = XMMatrixRotationAxis(_right angle);
// rotate _up and _look around _right vector
//D3DXVec3TransformCoord(&_up&_up &T);
//D3DXVec3TransformCoord(&_look&_look &T);
_up = XMVector3TransformCoord(_upT);
_look = XMVector3TransformCoord(_lookT);
}
void Camera::yaw(float angle)
{
XMMATRIX T;
// rotate around world y (0 1 0) always for land object
if( _cameraType == LANDobject )
//D3DXMatrixRotationY(&T angle);
T = XMMatrixRotationY(angle);
// rotate around own up vector for aircraft
//if( _cameraType == AIRCRAFT )
// D3DXMatrixRotationAxis(&T &_up angle);
// rotate _righ
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4889 2011-01-13 23:04 Large scale terrain rendering using D3D11\camera.cpp
文件 914 2010-12-15 21:32 Large scale terrain rendering using D3D11\camera.h
文件 5648 2010-12-23 16:02 Large scale terrain rendering using D3D11\createMesh.cpp
文件 457 2010-12-23 16:01 Large scale terrain rendering using D3D11\createMesh.h
目录 0 2012-05-06 22:01 Large scale terrain rendering using D3D11\DXUT\
目录 0 2012-05-06 22:01 Large scale terrain rendering using D3D11\DXUT\Core\
文件 335 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Core\dpiaware.manifest
文件 267270 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Core\DXUT.cpp
文件 18629 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Core\DXUT.h
文件 1605 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Core\DXUT_2008.sln
文件 11011 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Core\DXUT_2008.vcproj
文件 1606 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Core\DXUT_2010.sln
文件 17695 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Core\DXUT_2010.vcxproj
文件 877 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Core\DXUT_2010.vcxproj.filters
文件 45123 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Core\DXUTDevice11.cpp
文件 8723 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Core\DXUTDevice11.h
文件 44136 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Core\DXUTDevice9.cpp
文件 9375 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Core\DXUTDevice9.h
文件 68571 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Core\DXUTmisc.cpp
文件 25349 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Core\DXUTmisc.h
目录 0 2012-05-06 22:01 Large scale terrain rendering using D3D11\DXUT\Optional\
文件 25214 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Optional\directx.ico
文件 57189 2010-05-25 05:05 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTcamera.cpp
文件 20173 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTcamera.h
文件 242618 2010-05-27 15:59 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTgui.cpp
文件 47295 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTgui.h
文件 37245 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTguiIME.cpp
文件 5886 2010-05-19 01:52 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTguiIME.h
文件 9763 2010-05-14 08:48 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTLockFreePipe.h
文件 1611 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTOpt_2008.sln
文件 11645 2010-06-02 19:32 Large scale terrain rendering using D3D11\DXUT\Optional\DXUTOpt_2008.vcproj
............此处省略83个文件信息
相关资源
- 多核与GPU编程附录
- GPU自适应图像去噪完整程序
- tensorflow_gpu-1.6.0-cp36-cp36m-win_amd64.zip
- NVIDIA TURING GPU 架构白皮书.pdf
- tensorflow_gpu-1.12.0-cp37
- D3D11_SkeletonAnimation.rar
- GPU Pro 2.pdf
- D3D11_LoadOBJ
- imx6x gpu sdk
- gpu zen: advanced rendering techniques 彩色高
- Real-Time Rendering Fourth Edition
- CUDA并行程序设计 GPU编程指南[中文版
- tensorflow_gpu-1.4.0-cp35-cp35m-win_amd64.whl
- GPU Pro 360 Guide to Shadows-Wolfgang Engel-20
- cudnn-10.2-windows10-x64-v7.6.5.32.zip
- NVIDIA-Linux-x86_64-418.56.runnvidia driver ,用
- tensorflow_gpu==1.14.0版本
- tensorflow_gpu-1.4.0-cp36-cp36m-win_amd64.whl
- GPU精粹3 GPU编程
- cuDnn-win10-Cuda10.0(亲测)
- GPU Pro 2~7
- ffmpeg nvdia硬解封装GPU实现NV12-RGBA
- cusolver64_100.dll,cusparse64_100.dll
- 支持CUDA10的tensorflow-gpu轮子
- gpu精粹1、2
- tensorflow1.10.0-cp36win-gpu版
- CUDA并行程序设计 GPU编程指南 高清扫
- [GPU精粹3].(GPU.Gems.3).(美)Hubert.
- CUDA C 编程权威指南
- CUDA C编程权威指南 (完整版).pdf
评论
共有 条评论