Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    55
  • comments
    8
  • views
    25562

Cameras

Sign in to follow this  
Tape_Worm

556 views

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
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

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
  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!