from __future__ import annotations
from dataclasses import dataclass, field
from picogl.backend.gl.enums.legacy.scale import gl_rotatef, gl_scalef, gl_translate_f
[docs]
class LegacyGLTranslation:
"""Translation Parameters"""
[docs]
def apply(self):
gl_translate_f(self.x, self.y, self.z)
[docs]
def _apply_zoom(self, value: float = 0.01):
gl_translate_f(self.x, self.y, value)
@dataclass
[docs]
class LegacyGLZoom:
"""Zoom parameters."""
# translation: GLTranslation = None
"""def apply(self):
self.apply_translation_and_zoom(self.translation, self.value)"""
[docs]
def apply_translation_and_zoom(self, translation, zoom):
gl_translate_f(translation.x, translation.y, zoom)
[docs]
def rescale(self):
gl_scalef(self.value, self.value, self.value)
@dataclass
[docs]
class LegacyGLRotation:
[docs]
def apply(self):
gl_rotatef(self.x, 1.0, 0.0, 0.0)
gl_rotatef(self.y, 0.0, 1.0, 0.0)
gl_rotatef(self.z, 0.0, 0.0, 1.0)
[docs]
def initialize(self):
self.x = 0.0
self.y = 0.0
self.z = 0.0
@dataclass
[docs]
class CameraPerspective:
"""
Represents parameters required to define a camera perspective.
This class provides default values for the far clipping plane, near clipping
plane, and field of view in the y-direction (fovy) for a perspective camera.
These parameters can be used to set up a perspective projection for 3D rendering.
"""
@dataclass