Sign in to follow this  
NoctisPax

Primitives completely ignoring Z?

Recommended Posts

EDIT: Resolved. I'm a moron. 0.0f z Scale FTL :(. This has been driving me crazy for pretty much the last several hours (so much so, in fact, that I was driven to finally register and post here after lurking for eons). I'm far from a DirectX Virtuoso, so I suspect I'm just missing something obvious, but I can't figure it out or Google it for the life of me. Basically, I have your typical, fractal terrain engine. It's drawing the grid just fine in wireframe mode (or any mode), except that it completely ignores my Z/height coordinate, which makes it the most boring terrain engine ever, being capable of showing only a flat, square plain. I can animate by shifting it slowly along X and Y (with the expected results), but it does nothing with Z at all, even if I let it increment beyond the clipping planes. I've watched it in the debugger and there is definitely a value in Z -- the generation algorithm is working and generating what I suspect is very pretty terrain. But it does me no good because no matter how high or low Z is, it remains completely flat in the display. The code is:
            dxDevice.Clear(ClearFlags.Target, Color.Bisque, 1.0f, 0);
            dxDevice.BeginScene();
            dxDevice.VertexFormat = CustomVertex.PositionColored.Format;

            dxDevice.Transform.World = TransformMatrix;
            for (int i = 0; i < Map.MeshHeight - 1; i++)
            {
                CustomVertex.PositionColored[] verts = CurrentMap.GetStrip(i);

                dxDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, (Map.MeshHeight - 2) * 2, verts);
            }

            dxDevice.EndScene();
            dxDevice.Present();
I know DrawUserPrims is not the best way to go, but I've tried every possible function, this just happens to be the latest version of the code. All of them display the same symptom. Here are some of the sample vertices from a standard terrain gen:
Quote:
X: 0 Y: 33 Z: 25.12481 X: 33 Y: 0 Z: 28.22867 X: 33 Y: 33 Z: 29.81911 ...
Any help greatly appreciated! Thanks. [Edited by - NoctisPax on May 31, 2009 2:11:59 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this