文件名称:Picking
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:5.08mb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
思路: 场景中的每个mesh关联到一个唯一的COLOR值。 Pick检测时, 将当前场景渲染到纹理, (在PS中各mesh仅用自己的关键COLOR),即刻取回当前鼠标的位置的COLOR, 查找COLOR就可以知道当前被Pick的Mesh。
使用Render To Texture 的快速Picking, 无需锁住Vertex Buffer进行三角面和射线的相交测试, 仅在读取数据的时候锁住纹理的一个相素, 但是显卡要支持Render To Texture,纹理尺寸必须支持非2的n次方,D3DFMT_A8R8G8B8 或 D3DFMT_X8R8G8B8
可以改进的地方:
1。用类封装
2。Pick可以返回指向mesh的指针
需要:
DX SDK Aug, 2006以上,VC2005 -Ever mesh in the scene has a unique color value(DWORD). Picking, render the scene to target(texture), just use the unique color( see .fx file ), retrieve the mouse position(screen space ) color at once, check the color and you will get the mesh. Picking with Render to texture, Not need lock vertex buffer to check intersection ray and triangle, within retrieving just lock one pixel. Device must support render to target、D3DFMT_A8R8G8B8 or D3DFMT_X8R8G8B8、not 2^n texture size、support shader of course.
Compile Environment:
DX SDK above Aug. , 2006 vc 2005
Thinking:
1. Use a class to encapsulate
2. Picking check return the pointer of the mesh( or reference )
使用Render To Texture 的快速Picking, 无需锁住Vertex Buffer进行三角面和射线的相交测试, 仅在读取数据的时候锁住纹理的一个相素, 但是显卡要支持Render To Texture,纹理尺寸必须支持非2的n次方,D3DFMT_A8R8G8B8 或 D3DFMT_X8R8G8B8
可以改进的地方:
1。用类封装
2。Pick可以返回指向mesh的指针
需要:
DX SDK Aug, 2006以上,VC2005 -Ever mesh in the scene has a unique color value(DWORD). Picking, render the scene to target(texture), just use the unique color( see .fx file ), retrieve the mouse position(screen space ) color at once, check the color and you will get the mesh. Picking with Render to texture, Not need lock vertex buffer to check intersection ray and triangle, within retrieving just lock one pixel. Device must support render to target、D3DFMT_A8R8G8B8 or D3DFMT_X8R8G8B8、not 2^n texture size、support shader of course.
Compile Environment:
DX SDK above Aug. , 2006 vc 2005
Thinking:
1. Use a class to encapsulate
2. Picking check return the pointer of the mesh( or reference )
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Picking/Picking.manifest
Picking/Picking.rc
Picking/Picking_2003.sln
Picking/Picking_2003.vcproj
Picking/Picking_2005.sln
Picking/Picking_2005.suo
Picking/Picking_2005.vcproj
Picking/Picking_2005.vcproj.5E141221D0B64B8.yao.user
Picking/Picking_2005.vcproj.RAINBOWKNIGHT.jqian.user
Picking/resource.h
Picking/ring.x
Picking/room.x
Picking/spotlight.bmp
Picking/spotlight.x
Picking/Thumbs.db
Picking/Common/directx.ico
Picking/Common/dxstdafx.cpp
Picking/Common/dxstdafx.h
Picking/Common/DXUT.cpp
Picking/Common/DXUT.h
Picking/Common/DXUTenum.cpp
Picking/Common/DXUTenum.h
Picking/Common/DXUTgui.cpp
Picking/Common/DXUTgui.h
Picking/Common/DXUTMesh.cpp
Picking/Common/DXUTMesh.h
Picking/Common/DXUTmisc.cpp
Picking/Common/DXUTmisc.h
Picking/Common/DXUTRes.cpp
Picking/Common/DXUTRes.h
Picking/Common/DXUTSettingsDlg.cpp
Picking/Common/DXUTSettingsDlg.h
Picking/Common/DXUTsound.cpp
Picking/Common/DXUTsound.h
Picking/Common/DXUT_2003.sln
Picking/Common/DXUT_2003.vcproj
Picking/Common/DXUT_2005.sln
Picking/Common/DXUT_2005.vcproj
Picking/Common/Thumbs.db
Picking/Common
Picking/Media/Airplane/airplane 2.x
Picking/Media/Airplane/bihull.bmp
Picking/Media/Airplane/wings.bmp
Picking/Media/Airplane
Picking/Media/Misc/car.x
Picking/Media/Misc/env2.bmp
Picking/Media/Misc/floor.bmp
Picking/Media/Misc/ground2.bmp
Picking/Media/Misc/seafloor.bmp
Picking/Media/Misc/sphere.x
Picking/Media/Misc/4.jpg
Picking/Media/Misc/Thumbs.db
Picking/Media/Misc
Picking/Media/UI/arrow.x
Picking/Media/UI/dxutcontrols.dds
Picking/Media/UI/DXUTShared.fx
Picking/Media/UI
Picking/Media
Picking/Shader/00.fx
Picking/Shader/ObjectPickPS.psh
Picking/Shader/ObjectPickVS.vsh
Picking/Shader/RenderToTarget.fx
Picking/Shader/RenderToTex.fx
Picking/Shader/ShadowMap.fx
Picking/Shader
Picking/Picking_2005.ncb
Picking/save.jpg
Picking/save.bmp
Picking/Picking.cpp
Picking
Picking/Picking.rc
Picking/Picking_2003.sln
Picking/Picking_2003.vcproj
Picking/Picking_2005.sln
Picking/Picking_2005.suo
Picking/Picking_2005.vcproj
Picking/Picking_2005.vcproj.5E141221D0B64B8.yao.user
Picking/Picking_2005.vcproj.RAINBOWKNIGHT.jqian.user
Picking/resource.h
Picking/ring.x
Picking/room.x
Picking/spotlight.bmp
Picking/spotlight.x
Picking/Thumbs.db
Picking/Common/directx.ico
Picking/Common/dxstdafx.cpp
Picking/Common/dxstdafx.h
Picking/Common/DXUT.cpp
Picking/Common/DXUT.h
Picking/Common/DXUTenum.cpp
Picking/Common/DXUTenum.h
Picking/Common/DXUTgui.cpp
Picking/Common/DXUTgui.h
Picking/Common/DXUTMesh.cpp
Picking/Common/DXUTMesh.h
Picking/Common/DXUTmisc.cpp
Picking/Common/DXUTmisc.h
Picking/Common/DXUTRes.cpp
Picking/Common/DXUTRes.h
Picking/Common/DXUTSettingsDlg.cpp
Picking/Common/DXUTSettingsDlg.h
Picking/Common/DXUTsound.cpp
Picking/Common/DXUTsound.h
Picking/Common/DXUT_2003.sln
Picking/Common/DXUT_2003.vcproj
Picking/Common/DXUT_2005.sln
Picking/Common/DXUT_2005.vcproj
Picking/Common/Thumbs.db
Picking/Common
Picking/Media/Airplane/airplane 2.x
Picking/Media/Airplane/bihull.bmp
Picking/Media/Airplane/wings.bmp
Picking/Media/Airplane
Picking/Media/Misc/car.x
Picking/Media/Misc/env2.bmp
Picking/Media/Misc/floor.bmp
Picking/Media/Misc/ground2.bmp
Picking/Media/Misc/seafloor.bmp
Picking/Media/Misc/sphere.x
Picking/Media/Misc/4.jpg
Picking/Media/Misc/Thumbs.db
Picking/Media/Misc
Picking/Media/UI/arrow.x
Picking/Media/UI/dxutcontrols.dds
Picking/Media/UI/DXUTShared.fx
Picking/Media/UI
Picking/Media
Picking/Shader/00.fx
Picking/Shader/ObjectPickPS.psh
Picking/Shader/ObjectPickVS.vsh
Picking/Shader/RenderToTarget.fx
Picking/Shader/RenderToTex.fx
Picking/Shader/ShadowMap.fx
Picking/Shader
Picking/Picking_2005.ncb
Picking/save.jpg
Picking/save.bmp
Picking/Picking.cpp
Picking
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.