Jump to content
  • Advertisement
Sign in to follow this  
football94

Terrain scaling

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

problem.

 

 

                    Thank you smile.png

        private void DrawCity(string technique)
        {



            effect1.CurrentTechnique = effect1.Techniques[technique];
            

            effect1.Parameters["xTexture"].SetValue(sceneryTexture);
            effect1.Parameters["xWorld"].SetValue(Matrix.Identity );
            effect1.Parameters["xLightPower"].SetValue(lightPower);
            effect1.Parameters["xWorldViewProjection"].SetValue(Matrix.Identity *Matrix.CreateScale(10) * view * proj * Matrix.CreateTranslation(0,0,0));
            effect1.Parameters["xLightPosition"].SetValue(position );
            effect1.Parameters["xAmbient"].SetValue(ambientPower);
            effect1.Parameters["xlightsWorld"].SetValue(Matrix.Identity * lightsViewProjectionMatrix);
            effect1.Parameters["xShadowMap"].SetValue(shadowMap);



            effect1.Begin();
            foreach (EffectPass pass in effect1.CurrentTechnique.Passes)
            {
                pass.Begin();

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

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

riemers link

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Loading_the_floorplan.php

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!