Jump to content
  • Advertisement
Sign in to follow this  

Terrain scaling

This topic is 1020 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

Hi guys


 Ive been experimenting with a terrain from riemers xna tutorial website( link below) and came

across a problem with scaling the terrain, in my draw method(code below) I added Matrix.CreateScale and the

terrain looks to be scaled but when begin to move across the terrain I get an out of bounds exception

and I think the problem is even though the terrain is scaled visually  it still seems to reading the boundary data

from the original size of the terrain,so I was hoping if anyone had any tips on how to help me solve the




                    Thank you smile.png

        private void DrawCity(string technique)

            effect1.CurrentTechnique = effect1.Techniques[technique];

            effect1.Parameters["xWorld"].SetValue(Matrix.Identity );
            effect1.Parameters["xWorldViewProjection"].SetValue(Matrix.Identity *Matrix.CreateScale(10) * view * proj * Matrix.CreateTranslation(0,0,0));
            effect1.Parameters["xLightPosition"].SetValue(position );
            effect1.Parameters["xlightsWorld"].SetValue(Matrix.Identity * lightsViewProjectionMatrix);

            foreach (EffectPass pass in effect1.CurrentTechnique.Passes)

                device.VertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements);

                device.Vertices[0].SetSource(cityVertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes);
                device.DrawPrimitives(PrimitiveType.TriangleList, 0, cityVertexBuffer.SizeInBytes / 3);

riemers link


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!