
halobear333
Members-
Posts
14 -
Joined
-
Last visited
halobear333's Achievements
Newbie (1/14)
0
Reputation
-
Sorry, a reference from the show The Simpsons that pretty much everyone in north america would understand :) It means that my response was really stupid and I deserve a hit upside the head.
-
D'oh :)
-
In Render(), after Device.EndScene you need Device.Present(). What's happening is that the screen is indeed being cleared, but the output produced by DrawIndexedPrimitives is not being put onto the screen.
-
Your full screen app is set to vsync, while your windowed app is not. The 60 fps is determined by your monitor's refresh rate, presumably 60 hz. Make sure the PresentParameters.PresentationInterval is the same for both progs.
-
D3DXComputeBoundingBox There's also D3DXComputeBoundingSphere, as well as functions that determine if a ray intersects with these boxes or spheres.
-
In c++ look at D3DXVec3Project and D3DXVec3Unproject In managed, look at Vector3.Project or Unproject. You supply these functions with the current viewport, and the world, view and projection matrices. The return value is the position in world or screen space.
-
Do you look at the c++ help? Even if you don't know c++ the descriptions and such can be very helpfull. And yes, I agree that it's annoying that one has to do that :)
-
Here you go. I don't have a tidy little example program for it, but it should be very easy to integrate, as I made it as simple and independent as possible. There's also instructions at the top of D3D_Camera.vb. This is in vb.net 2002 (I'm poor) so there's a small chance 2003 won't like it, but I doubt it. If there's a problem I'll post a simple demo. d3d_camera.zip
-
The bit about the bounding box is true: it defines the maximum dimensions of the object. If you know an objects greatest dimension you could figure out what scale would allow it to fit in the window. It's pretty easy to do: For the "front" of the box, cycle through the vertices of the mesh and find the vertice with the greatest Z value. The "back" will be the lowest or most negative Z value. The top and bottom will be defined by the greatest and lowest Y values, and the left and right sides by the X values. C++ also has functions to create bounding boxes, though I'm not sure how to do it in managed directx (darn MS and their horrible documentation) Find out which side is farthest from the center of the object and you have you have the largest dimension. I just had a though about how to "cheat" fitting the object into the window: there should be a linear (y = mx + b) relationship between an objects largest extent and the scale needed to fit it into the screen. If you know the max dimension of two different objects and the scales needed for them, you should be able to plug those values into the equation and solve for m (b should be zero, I think). Then for any object, once you know its max dimension, you can calculate a scale (in theory). Don't be discouraged about the idea of taking it slow. For example, it was very gratifying when I first managed to create a really solid camera class. It uses quaternions (4 dimensional vectors) for rotation and works in both 1st and 3rd person modes. If you or anyone else wants, I'll polish and comment it and post the code. For me 3D rotations were the greatest hurdle, and the nice thing is that the quaternion code there can be used to rotate other, noncamera objects. Sorry for rambling :-\
-
Unfortunately, what you are asking would require some hardcore math to do nicely. You'd have to determine the dimensions of the object in screen(2D) coordinates, then find out what scale factor would make the object fit into the screen width and height. For example, in the case of a sphere, you'd use its radius, and see what scale factor should be used for it to fit in screen space given the cameras position relative to it. Not easy. I recommend waiting a while before tackling something like this, as it's very easy in 3D programming to get ahead of yourself and get discouraged :) I struggled for a long time before I decided to take baby steps and create some simple classes (a camera class for example). Doing this gives a solid foundation to build upon.
-
All you really need to know about matrices is that they're an array of values that allow you to perform all the transformations (scaling, translating, rotating, etc) you want in one place. Different components of the matrix correspond to your position, and directional vectors. I personally don't know the detailed math behind them. Usually you start with an "identity" matrix, which holds default values, such as position at 0,0,0, and scale of 1, 1, 1. You then multiply this matrix with another matrix containing the next transformation. A general example: 1) Set a matrix to identity 2) Multiply by a scaled matrix 3) Multiply by a translated matrix 4) Apply matrix to world matrix In managed directx Dim mat As Matrix mat = Matrix.Identity mat.Multiply(Matrix.Scale(2, 2, 2)) mat.Multiply(Matrix.Translate(0, 4, 5)) D3DDev.Transform.World = mat Do this before rendering all objects. In your case, wanting the object at the origin, leave out the translate part. If you get funky results, keep in mind that the order of multiplication counts. Translating then rotating gives different results than rotating then translating.
-
Thanks, though I already know how to use vertex buffers. :) I'm still mystified as to why the box, sphere etc mesh objects don't have their own texture coordinates, but I guess that's a question only MS can answer. Doesn't make sense to me. Guess I'll be generating my geometry the hard way (manually). Again, thanks for the help
-
Thanks for the answer. There's no way of generating texture coordinates for them? What a gyp! For simple geometry I was leaning away from using X files since I like to be able to customize # of slices etc, but ah well. Actually, around a year ago when I played a bit with managed directx 9 the documentation installed fine. Hasn't since the 2003 release though, and googling has shown that many, many other 2002 users have the same prob. I have a nice chm help file for c++, but the managed help (HxS format) is inaccessable within the program. I'm currently trying to find a program that will read HxS format.
-
I've recently come over from opengl programming and have a fair amount of 3d programming experience, but: How the devil do you apply texture coordinates to a mesh object (ie a box, sphere, teapot, etc). I assume it's similar to how you generate normals: clone the mesh to a FVF that has normals and call computenormals() But nowhere do I see computetexturecoords :) Surely you don't have to do this manually? Kind of defeats the purpose of having these premade objects. I should point out that I have .Net 2002, so haven't been able to install the documentation, and can't find the info in that behemoth, msdn.com.