Jump to content
  • Advertisement
Sign in to follow this  
NoctisPax

Primitives completely ignoring Z?

This topic is 3462 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!