
    3jO	                     0    S r SSKJr  S r " S S\5      rg)zSelection-buffer handling code

This code is resonsible for turning gluint *
arrays into structured representations for use
by Python-level code.
    )integer_typesc                 "    U S:  a  U S-  S-   n U $ )Nr   il         )values    M/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/GL/selection.py
uintToLongr   	   s    qy#z1L    c                   T    \ rS rSrSr\" S5      rSrS r\	" \5      rS r
S rS rS	rg
)GLSelectRecord   a  Minimalist object for storing an OpenGL selection-buffer record

Provides near and far as *float* values by dividing by 
self.DISTANCE_DIVISOR (2**32-1)
From the spec:
    Depth values (which are in the range [0,1]) are multiplied by 
    2^32 - 1, before being placed in the hit record.

Names are unmodified, so normally are slices of the array passed in 
to GLSelectRecord.fromArray( array )
l    )nearfarnamesc                    / nSn[        U5      n[        U5       Hg  nUS-   U:  a    U$ X   nXS-      nXS-      n	XS-   US-   U-     V
s/ s H  n
[        U
5      PM     nn
UR                  U " XU5      5        USU-   -  nMi     U$ s  sn
f )z,Produce list with all records from the arrayr            )lenranger   append)clsarraytotalresultindexarrayLengthitemcountr   r   vr   s               r   	fromArrayGLSelectRecord.fromArray   s    %j5NDqyK'  LEq>Da.C-27575=-IJ-Ijm-IEJMMCE35QuWE #  Ks   Bc                 h    U R                  U5      U l        U R                  U5      U l        X0l        g)zInitialise/store the valuesN)convertDistancer   r   r   )selfr   r   r   s       r   __init__GLSelectRecord.__init__.   s+    (($0	''.
r	   c                 2    [        U5      U R                  -  $ )z?Convert a distance value from array uint to 0.0-1.0 range float)r   DISTANCE_DIVISOR)r$   r   s     r   r#   GLSelectRecord.convertDistance3   s    5"T%:%:::r	   c                    [        U[        5      (       a&  U R                  U R                  U R                  4U   $ XR
                  ;   a   [        X5      $ g! [         a#  n[        SU< SU R                  < S35      eSnAff = f)z.Allow for treating the record as a three-tuplezDon't have an index/key z for z instantN)

isinstancer   r   r   r   	__slots__getattrAttributeErrorKeyError	__class__)r$   keyerrs      r   __getitem__GLSelectRecord.__getitem__6   sy    sM**IIdhhtzz2377NN"++ # " !  s   
A 
B"B  B)r   r   r   N)__name__
__module____qualname____firstlineno____doc__floatr(   r,   r    classmethodr%   r#   r3   __static_attributes__r   r	   r   r   r      s9    
 Y'&I Y(I
;
r	   r   N)r9   OpenGL._bytesr   r   objectr   r   r	   r   <module>r?      s     (1f 1r	   