Mercurial > projects > openmelee
comparison render.d @ 17:82efafc87d54
fixed camera zoom
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Tue, 24 Mar 2009 16:47:42 -0400 |
parents | af1e8620f027 |
children |
comparison
equal
deleted
inserted
replaced
16:cc494b8f8710 | 17:82efafc87d54 |
---|---|
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 void draw(vec2i screenSize, GL gl) | 316 void draw(vec2i screenSize, GL gl) |
317 { | 317 { |
318 | |
319 vec2 point1 = vec2.from(ship1.rBody.position); | |
320 vec2 point2 = vec2.from(ship2.rBody.position); | |
321 vec2 range = point1 - point2; | |
322 zoom = bzClamp(1000/range.length, 2, 60); | |
323 viewCenter = point1 - (range * 0.5f); | |
324 | |
318 this.screenSize = screenSize; | 325 this.screenSize = screenSize; |
319 | 326 |
320 gl.LoadIdentity(); | 327 gl.LoadIdentity(); |
321 gl.MatrixMode(GL_PROJECTION); | 328 gl.MatrixMode(GL_PROJECTION); |
322 gl.LoadIdentity(); | 329 gl.LoadIdentity(); |