Delta Engine
»
Support
»
Rendering
»
Questions about Camera2DControlledScreenSpace
Joined: 12/19/2011(UTC) Posts: 529
Thanks: 10 times Was thanked: 16 time(s) in 15 post(s)
|
Hi @ all
I recently browsed the latest source code of delta because the new release was done and I noticed there is a class controlled Camera2DControlledScreenSpace. I assume, based on the name that it works like the normal ScreenSpace but can also be used as camera. My question is now, if I use it as camera for something, how do I have to use it and does it also clip the rendering automatically (in case that I'm using a tilemap or something similar which is based on groups of sprites) and also doesn't draw all things which are completely outside of the draw area. I want to use it in one of my projects and let's assume I want to work on a tile based level, so I would have to implement a camera but I also have to manage all cell rendering like sorting out all non-visible cells and clipping all cells which are partly visible but also partly outside the draw area. I have slight expectations that this special ScreenSpace class could help me with that job so I don't have to implement a own solution (or only one which uses that class and provides some special methods for my project if necessary)
I hope it's understandable what I want to say and I'm looking forward to the answer :) |
|
|
|
|
Medals:  Joined: 8/20/2011(UTC) Posts: 1,421 Location: Hannover
Thanks: 18 times Was thanked: 97 time(s) in 92 post(s)
|
Hi Internetfreak,
yes, the Camera2DControlledScreenSpace is an extension to the default QuadraticScreenSpace class to allow zooming and panning. It was written 3 months ago for the first Game Jam game Blobs (which is now available in the public release, so you can check it out yourself).
For a more updated version that even has rotation and lots of other tweaks you should check out the current Game Jam game "Fps"
|
|
|
|
Joined: 12/19/2011(UTC) Posts: 529
Thanks: 10 times Was thanked: 16 time(s) in 15 post(s)
|
Ok, I will check it out. With that extension, I would not have to worry about implementing an own camera class, right? The camera is a bit too complex for me now (I cannot assume how much effort it would be so maybe it's easier than I think but if I can get a good working solution so why implement something new?) |
|
|
|
|
Medals:  Joined: 8/20/2011(UTC) Posts: 1,421 Location: Hannover
Thanks: 18 times Was thanked: 97 time(s) in 92 post(s)
|
Actually with all the classes in place adding or improving a camera in either 2D or 3D is really simple. All you do is store your position and other parameters you are interested in (zoom, rotation or direction). Then you use the existing functionality to adjust your viewing field.
But you are right, we will have to cleanup the cameras from the sample games a bit so it is far easier to use them in other games.
|
|
|
|
Joined: 12/19/2011(UTC) Posts: 529
Thanks: 10 times Was thanked: 16 time(s) in 15 post(s)
|
Ok sounds good but what about clipping? I assume that delta will at least sort out all things which are not visible on this frame but does this camera also clip or do I have to do that on my own? this is one question which will decide how I build my code, so an answer or at least an hint is very welcome |
|
|
|
|
Medals:  Joined: 8/20/2011(UTC) Posts: 1,421 Location: Hannover
Thanks: 18 times Was thanked: 97 time(s) in 92 post(s)
|
I don't know from the top of my head, it might not be implemented in the Fps or Blobs game, but it could very well be in there. It should not matter to you, just use it and add tons of entities, sprites or whatever and if you see there is a performance problem that can be fixed with better clipping, just implement it yourself or ask us to improve the system to handle your use case.
|
|
|
|
Joined: 12/19/2011(UTC) Posts: 529
Thanks: 10 times Was thanked: 16 time(s) in 15 post(s)
|
Ok thanks for the answer. That should be enough for now to check out the samples and then I will try to implement it in my project. I will see what happens or not. clipping is nice to always start drawing at 0|0 and still be able to visualize if a sprite is partly outside of the border but ok, I will see that in my tests |
|
|
|
|
Joined: 5/15/2013(UTC) Posts: 45 Location: Hannover
Was thanked: 2 time(s) in 2 post(s)
|
Thanks Internetfreak! Let us know your results! |
|
|
|
|
Delta Engine
»
Support
»
Rendering
»
Questions about Camera2DControlledScreenSpace
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.