About to draw chunk
All checks were successful
Build Dusk / build-linux (push) Successful in 1m5s
Build Dusk / build-psp (push) Successful in 1m5s

This commit is contained in:
2025-11-16 09:11:58 -06:00
parent be422d0a1e
commit 7c194ab4b4
10 changed files with 221 additions and 100 deletions

View File

@@ -0,0 +1,28 @@
import math
from OpenGL.GL import *
from OpenGL.GLU import *
from dusk.defs import defs
pixelsPerUnit = float(defs.get('RPG_CAMERA_PIXELS_PER_UNIT'))
yOffset = float(defs.get('RPG_CAMERA_Z_OFFSET'))
fov = float(defs.get('RPG_CAMERA_FOV'))
scale = 8.0
def setupCamera(vw, vh):
z = (vh / 2.0) / (
(pixelsPerUnit * scale) * math.tan(math.radians(fov / 2.0))
)
lookAt = ( 0, 0, 0 )
aspectRatio = vw / vh
position = lookAt[0], lookAt[1] - yOffset, lookAt[2] + z
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(fov, aspectRatio, 0.1, 1000.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
gluLookAt(
position[0], position[1], position[2],
lookAt[0], lookAt[1], lookAt[2],
0.0, 1.0, 0.0
)