Cameras

posted in OMG NUB! for project Gorgon
Published September 11, 2013
Advertisement
sitelogo.pngIn the 2.x version of Gorgon I wanted to add cameras. It was most tedious before when you wanted to translate an entire scene by an arbitrary amount. So when I started this thing, I created an Orthographic camera object. The previous version of Gorgon used an Orthographic camera internally and this was never exposed to the user. But in this case, I exposed the camera so that the user can define their own viewing mechanism.
There's more info and a video inside...

For the last few days I've been perfecting my camera object, particularly the Orthographic camera, so that you can define any coordinate system you need. By default, Gorgon uses a screen space coordinate system. This is a comfortable system that many users are familiar with: 0,0 is the upper left, and Width, Height is the lower right. But sometimes that just doesn't cut it. What if you want everything relative and resolution independent? Well with the new camera object you can define your viewing area using a relative unit system by telling it to use -1, -1 as the upper left and 1,1 as the lower right (this would be a rectangle with an offset of -1, -1 and width and height of 2). Now when you place a sprite and assign it the coordinate of 0.5f, 0.5f, it will place it 480x320 on a 640x480 screen or at 768x576 on a 1024x768 screen. Perfect when your resolution is no longer at a fixed size.
So that's nice. But wait, there's more:


What's that in the video? Well, there's also a perspective camera. For those instances where you want to add a 3D component to your sprites. Using the perspective camera, the Depth property now sends the sprite deeper into the view space and perspective is correctly applied to the movement of the camera relative to the objects. In the video we see the ship pushed into the background and when we move the camera, the ship moves in perspective.
Also note that everything is relative to the camera. If you follow the green icon (and not the mouse cursor arrow), you'll notice that the ship is moving relative to the camera. In the code, only the camera is changing position. The ship is at the exact same coordinates it was assigned and was never moved. This is where a camera really shines.
So, I know it's been ages since I typed anything here. But as you can see, I'm still working on Gorgon. The refactoring process is nearly complete, and the 2D portion is nearly done. Once the editor is cleaned up and finished it'll be ready for release... I hope. I can't give an estimate on when that will be. It certainly won't be soon as I am only one man.

Source
Previous Entry More the editor
Next Entry Font editor
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Gorgon 3.2

10171 views

Gorgon v3.1.46.255

3367 views

Gorgon v3.1.45.248

2996 views

Gorgon v3.1.29.243

4283 views

Gorgon v3.1

4107 views

Gorgon Update #10

3008 views

Gorgon Update #9

3208 views

Gorgon Update #8

2949 views

Gorgon Update #7

3172 views

v3.0 Release

3729 views
Advertisement