
    kj\                     4    d dl mZ d dlZ G d d          ZdS )    )OptionalNc                   R   e Zd ZdZ	 ddededed	efd
Zedefd            Zedefd            Zedefd            Z	edefd            Z
edej        fd            Z	 	 	 	 ddee         dee         dee         d	ee         ddf
dZdefdZedeeef         fd            ZdS )Projection3Dz3D Projectionqq?     R@      ?      Y@aspect_ratiofovnearfarc                     || _         || _        || _        || _        t	          j        d          | _        t          d          | _        | 	                                 dS )zCreate a 3D projection

        Keyword Args:
            aspect_ratio (float): Aspect ratio
            fov (float): Field of view
            near (float): Near plane value
            far (float): Far plane value
        r   N)
_aspect_ratio_fov_near_farglmmat4_matrixbytes_matrix_bytesupdateselfr
   r   r   r   s        \/home/agentuser/manim-venv/lib/python3.11/site-packages/moderngl_window/opengl/projection.py__init__zProjection3D.__init__	   sO     *	
	x{{"1XX    returnc                     | j         S )z$float: The projection's aspect ratio)r   r   s    r   r
   zProjection3D.aspect_ratio   s     !!r   c                     | j         S )zfloat: Current field of view)r   r    s    r   r   zProjection3D.fov!        yr   c                     | j         S )zfloat: Current near plane value)r   r    s    r   r   zProjection3D.near&   s     zr   c                     | j         S )zfloat : Current far plane value)r   r    s    r   r   zProjection3D.far+   r"   r   c                     | j         S )z%glm.mat4x4: Current projection matrix)r   r    s    r   matrixzProjection3D.matrix0   s     |r   Nc                    ||| _         ||| _        ||| _        ||| _        t	          j        t	          j        | j                  | j         | j        | j                  | _        | j                                        | _	        dS )zUpdate the projection matrix

        Keyword Args:
            aspect_ratio (float): Aspect ratio
            fov (float): Field of view
            near (float): Near plane value
            far (float): Far plane value
        N)
r   r   r   r   r   perspectiveradiansr   to_bytesr   r   s        r   r   zProjection3D.update5   s     #!-D?DIDJ?DIK	""D$6
DI
 
 "\2244r   c                     | j         S )zGet the byte representation of the projection matrix

        Returns:
            bytes: byte representation of the projection matrix
        )r   r    s    r   tobyteszProjection3D.tobytesR   s     !!r   c                 n    | j         | j         | j        z
  z  | j         | j        z  | j        | j         z
  z  fS )z
        (x, y) projection constants for the current projection.
        This is for example useful when reconstructing a view position
        of a fragment from a linearized depth value.
        )r   r   r    s    r   projection_constantsz!Projection3D.projection_constantsZ   s;     ITZ/0Y#
TY(>?
 	
r   )r   r   r   r	   )NNNN)__name__
__module____qualname____doc__floatr   propertyr
   r   r   r   r   r   r&   r   r   r   r,   tupler.    r   r   r   r      s        `e !16EJW\   & "e " " " X" U    X e    X U    X     X )-# $#5 5uo5 e_5 uo	5
 e_5 
5 5 5 5:" " " " " 	
eE5L&9 	
 	
 	
 X	
 	
 	
r   r   )typingr   r   r   r6   r   r   <module>r8      s\          



^
 ^
 ^
 ^
 ^
 ^
 ^
 ^
 ^
 ^
r   