🔒 Locked
Some vector questions...
Advertisement
Original Post
Ok, its like this. I''m trying to build a 3d shooter using the d3d API. Everything was going well until I started make the camera controllable. Naturally, i used 3 vectors (origin, look at point, and up). Now, i cant figure out how to rotate the look vector around the origin. Any help/resources are appreciated. Oh yeah, whats a good format for level files with d3d? X files? I need one thats supported by 3d studio max...
I wouldn''t use 3ds MAX for building a level unless you have a tool to convert the 3d data to a more efficient format. The x file format works only well for models. For storing level data I would recommend some bsp type fileformat. The x file format prevents you from using visibility determination algorithms like portal rendering or BSP, which are essential for a solid 3d shooter.
Hmm, ok...Dyou know where I can find any tutorials on parsing bsp files and/or doing visiblity? As of now, im pretty much clueless...Also, is it ok to use DrawPrimitive for all of my drawing calls? Or should I use something else...?
[MODIFIED]
Oh yeah, Meduzza, I dont quite get what you're saying...which part do I modify to make it rotate left or right based on input? And where should this call be? And how do I implement the up vector, just leave it alone? Also, what about rotation on several axes? Also...
Edited by - Solarbeam on September 18, 2000 9:56:26 PM
[MODIFIED]
Oh yeah, Meduzza, I dont quite get what you're saying...which part do I modify to make it rotate left or right based on input? And where should this call be? And how do I implement the up vector, just leave it alone? Also, what about rotation on several axes? Also...
Edited by - Solarbeam on September 18, 2000 9:56:26 PM
Programming recources on the web are mostly incomplete or do
not cover all the stuff you might need.
For BSP try this: BSP FAQ, http://reality.sgi.com/bspfaq/index.html
Well, and maybe you try one of these books, they helped me alot.
Advanced 3D Game Programming
using DirectX 7
by Adrian Perez, published by Wordware
3D Graphics Programming
by Sergei Savechenko, published by SAMS
Real-Time Rendering by
Tomas Molles and Eric Haines, A K Peters Ltd. 1999
Edited by - cruz on September 19, 2000 9:52:27 AM
not cover all the stuff you might need.
For BSP try this: BSP FAQ, http://reality.sgi.com/bspfaq/index.html
Well, and maybe you try one of these books, they helped me alot.
Advanced 3D Game Programming
using DirectX 7
by Adrian Perez, published by Wordware
3D Graphics Programming
by Sergei Savechenko, published by SAMS
Real-Time Rendering by
Tomas Molles and Eric Haines, A K Peters Ltd. 1999
Edited by - cruz on September 19, 2000 9:52:27 AM
Um, ok, here''s the problem:
SetViewMatrix only works with vars of type D3DVECTOR. D3DXVec3TransformCoord() only works with types of D3DXVECTOR (note the ''x''). Now, how do i convert between the two? Is it even possible? Should I just use D3DXVECTORs, which most of my functions dont support? HELP!
SetViewMatrix only works with vars of type D3DVECTOR. D3DXVec3TransformCoord() only works with types of D3DXVECTOR (note the ''x''). Now, how do i convert between the two? Is it even possible? Should I just use D3DXVECTORs, which most of my functions dont support? HELP!
example:
D3DMATRIX matProj;
D3DXMatrixOrthoOffCenterLH((D3DXMATRIX *)&matProj, 0.0f, (float)m_nScreenW, (float)m_nScreenH, 0.0f, -1.0f, 1.0f);
pD3DDev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
it should work!.
D3DMATRIX matProj;
D3DXMatrixOrthoOffCenterLH((D3DXMATRIX *)&matProj, 0.0f, (float)m_nScreenW, (float)m_nScreenH, 0.0f, -1.0f, 1.0f);
pD3DDev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
it should work!.
You can cast D3DVECTOR* to D3DXVECTOR3* and back with no problems. They are essentially the same. I have no idea why did MS use both of them, but i know in DX8 they fixed it.
Solarbeam: in code i gave you "look" is "look at vector"; "origin" is "camera position vector". We rotate "look" around "origin" and Y axis (that''s left and right rotation). You''ll need to recreate view matrix after that:
------------
Cheers
Meduzza
Solarbeam: in code i gave you "look" is "look at vector"; "origin" is "camera position vector". We rotate "look" around "origin" and Y axis (that''s left and right rotation). You''ll need to recreate view matrix after that:
D3DXMatrixLookAt( &viewMatrix, &origin, &look, &D3DXVECTOR3( 0, 1, 0 ) );
------------
Cheers
Meduzza
for D3D stuff go to Mr Gamemaker. I was able to port his bsp code to opengl and he gives a very good explanation of how it works, why it works, and explains ALL the code it needs unlike most other resources. If you do D3D this is the site.
InFerN0
Not all who wander are lost...
InFerN0
Not all who wander are lost...
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement