Sign in to follow this  

[SlimDX] Zoom in and out on a sprite?

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

Man, I am such a DirectX noob. :( I've laid out a world map which is a collection of tiles, drawn using SlimDX.Direct3D9.Sprite. I can pan my camera around that world by setting the translation in Sprite.Transform to the desired X/Y values. Now I want to zoom in and out using the mouse wheel, so I thought I would just use the wheel input to modulate the Z translation. It's fine as long as the Z value is between 0-1. I can't really tell if I'm getting a zooming effect in that range or not, but we'll cross that bridge when we get to it. The problem is that as soon as the Z value goes outside the 0-1 range, all the sprites disappear. I thought it might be some default clip plane settings. I tried using Device.SetClipPlane to get something like -100/+100 but it had no effect. I've also tried using Sprite.SetWorldViewLH to establish a zNear/zFar in the view matrix, but still no effect. Am I just doing it wrong (probably)? Or does the Sprite class just enforce a 0-1 clipping range, perhaps to represent z-order rather than an actual world position? If so, then I'm not sure what I would do to implement the zoom in/out... Gah!

Share this post


Link to post
Share on other sites
What, and do it the simple and obvious way? :P

So I did that, and after a bit of fiddling to make it zoom around the screen center, it works like a charm.

I guess I was over-complicating things because I know in the future I'll probably be adding some non-sprite geometry that's supposed to lay over top of this map and line up with things correctly. But maybe that won't be an issue. I guess I'll handle it when it comes up.

Share this post


Link to post
Share on other sites

This topic is 3318 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.

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