Click here to Skip to main content
15,908,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conversion of image Handle hDib to Char* array in C++ Pin
AhmdAxf3-Oct-12 2:44
AhmdAxf3-Oct-12 2:44 
QuestionRe: Conversion of image Handle hDib to Char* array in C++ Pin
AhmdAxf3-Oct-12 2:48
AhmdAxf3-Oct-12 2:48 
AnswerRe: Conversion of image Handle hDib to Char* array in C++ Pin
Richard MacCutchan3-Oct-12 4:33
mveRichard MacCutchan3-Oct-12 4:33 
QuestionI want to use R-Tree in my GIS project,how R-Tree is work? Pin
mengfei35813-Sep-12 14:59
mengfei35813-Sep-12 14:59 
AnswerRe: I want to use R-Tree in my GIS project,how R-Tree is work? Pin
CPallini13-Sep-12 23:18
mveCPallini13-Sep-12 23:18 
GeneralRe: I want to use R-Tree in my GIS project,how R-Tree is work? Pin
mengfei35823-Sep-12 15:04
mengfei35823-Sep-12 15:04 
GeneralRe: I want to use R-Tree in my GIS project,how R-Tree is work? Pin
CPallini23-Sep-12 21:25
mveCPallini23-Sep-12 21:25 
QuestionDirectX9 D3DXIntersect function Pin
Seeker200213-Sep-12 9:42
Seeker200213-Sep-12 9:42 
Hi everybody, Smile | :)

This is for the more advanced people!

I know that the DirectX9 D3DXIntersect function has the ability to gives the exact coordinates of the intersecting ray-to-polygon, and can give the distance from the ray’s starting point to the intersection point.

Now my question is, how do I retrieve that information of the exact coordinates of the ray’s intersecting point?

I think the information if I’m not mistaken is found in the LPD3DXBUFFER * ppAllHits, but I’m not sure as to how to setup the buffer, nor access the information.

Please help… Thanks!


C++
// DirectX9 D3DXIntersect function:
// Determines if a ray intersects with a mesh.
 
HRESULT D3DXIntersect(
LPD3DXBASEMESHpMesh,
CONST D3DXVECTOR3 * pRayPos,
CONST D3DXVECTOR3 * pRayDir,
BOOL *pHit,
DWORD * pFaceIndex,
FLOAT * pU,
FLOAT * pV,
FLOAT * pDist,
LPD3DXBUFFER * ppAllHits,
DWORD * pCountOfHits);


VB
____________________________________________

My variables and code:

Note:  My code works great.

I just need help with getting and returning the exact coordinates of my ray’s intersection with the mesh.
____________________________________________


C++
float XBegin, float YBegin, float ZBegin;   // <-- Starting Position of Ray
float XEnd, float YEnd, float ZEnd;           // <-- Ending Position of Ray
sMesh *LevelMesh;
BOOL Hit;
float u, v, Dist;
float XDiff, YDiff, ZDiff, Radius;
DWORD FaceIndex;
D3DXVECTOR3 vecDir;
 
// looking for collision intersection
while(LevelMesh != NULL) {
D3DXIntersect(LevelMesh->m_Mesh, \
&D3DXVECTOR3(XBegin,YBegin,ZBegin), &vecDir, \
&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);
if(Hit == TRUE) {
if(Dist < Radius)
return TRUE; // polygons hit
}
return FALSE; // No polygons hit
}

AnswerRe: DirectX9 D3DXIntersect function Pin
Seeker200226-Sep-12 18:30
Seeker200226-Sep-12 18:30 
QuestionHow to add a library to IDE or What exactly it means adding a library to IDE ?? Pin
SanjeevCharla13-Sep-12 3:02
SanjeevCharla13-Sep-12 3:02 
AnswerRe: How to add a library to IDE or What exactly it means adding a library to IDE ?? Pin
Richard MacCutchan13-Sep-12 4:34
mveRichard MacCutchan13-Sep-12 4:34 
AnswerRe: How to add a library to IDE or What exactly it means adding a library to IDE ?? Pin
jschell13-Sep-12 8:23
jschell13-Sep-12 8:23 
GeneralRe: How to add a library to IDE or What exactly it means adding a library to IDE ?? Pin
SanjeevCharla13-Sep-12 16:05
SanjeevCharla13-Sep-12 16:05 
GeneralRe: How to add a library to IDE or What exactly it means adding a library to IDE ?? Pin
jschell14-Sep-12 8:49
jschell14-Sep-12 8:49 
QuestionUse of Multiple Check boxes in MFC Pin
jawadali47712-Sep-12 20:12
jawadali47712-Sep-12 20:12 
SuggestionRe: Use of Multiple Check boxes in MFC Pin
sanjaylk12-Sep-12 20:35
sanjaylk12-Sep-12 20:35 
GeneralRe: Use of Multiple Check boxes in MFC Pin
jawadali47712-Sep-12 21:20
jawadali47712-Sep-12 21:20 
GeneralRe: Use of Multiple Check boxes in MFC Pin
David Crow13-Sep-12 3:31
David Crow13-Sep-12 3:31 
QuestionTool tips on Status bar created on a dialog Pin
Craig Hewitt12-Sep-12 19:00
professionalCraig Hewitt12-Sep-12 19:00 
AnswerRe: Tool tips on Status bar created on a dialog Pin
Jochen Arndt12-Sep-12 21:30
professionalJochen Arndt12-Sep-12 21:30 
Questionend winword.exe by c++ Pin
kesten112-Sep-12 7:22
kesten112-Sep-12 7:22 
AnswerRe: end winword.exe by c++ Pin
pasztorpisti12-Sep-12 7:31
pasztorpisti12-Sep-12 7:31 
GeneralRe: end winword.exe by c++ Pin
kesten112-Sep-12 7:55
kesten112-Sep-12 7:55 
GeneralRe: end winword.exe by c++ Pin
pasztorpisti12-Sep-12 8:10
pasztorpisti12-Sep-12 8:10 
QuestionRe: end winword.exe by c++ Pin
David Crow12-Sep-12 10:19
David Crow12-Sep-12 10:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.