ncca-ngl 0.2.5__py3-none-any.whl → 0.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ncca/ngl/PrimData/NGLDebug.log +0 -0
- ncca/ngl/first_person_camera.py +18 -15
- ncca/ngl/prim_data.py +3 -0
- {ncca_ngl-0.2.5.dist-info → ncca_ngl-0.2.7.dist-info}/METADATA +1 -1
- {ncca_ngl-0.2.5.dist-info → ncca_ngl-0.2.7.dist-info}/RECORD +6 -5
- {ncca_ngl-0.2.5.dist-info → ncca_ngl-0.2.7.dist-info}/WHEEL +0 -0
|
File without changes
|
ncca/ngl/first_person_camera.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import math
|
|
2
2
|
|
|
3
3
|
from .mat4 import Mat4
|
|
4
|
-
from .util import perspective
|
|
4
|
+
from .util import PerspMode, look_at, perspective
|
|
5
5
|
from .vec3 import Vec3
|
|
6
6
|
|
|
7
7
|
|
|
@@ -32,7 +32,7 @@ class FirstPersonCamera:
|
|
|
32
32
|
view (Mat4): The view matrix.
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
|
-
def __init__(self, eye: Vec3, look: Vec3, up: Vec3, fov: float) -> None:
|
|
35
|
+
def __init__(self, eye: Vec3, look: Vec3, up: Vec3, fov: float, persp_mode: PerspMode = PerspMode.OpenGL) -> None:
|
|
36
36
|
"""
|
|
37
37
|
Initialize the FirstPersonCamera.
|
|
38
38
|
|
|
@@ -58,12 +58,9 @@ class FirstPersonCamera:
|
|
|
58
58
|
self.aspect: float = 1.2
|
|
59
59
|
self.fov: float = fov
|
|
60
60
|
self._update_camera_vectors()
|
|
61
|
-
self.
|
|
62
|
-
self.fov, self.aspect, self.near, self.far
|
|
63
|
-
)
|
|
64
|
-
from .util import look_at
|
|
61
|
+
self._projection: Mat4 = self.set_projection(self.fov, self.aspect, self.near, self.far, persp_mode)
|
|
65
62
|
|
|
66
|
-
self.
|
|
63
|
+
self._view: Mat4 = look_at(self.eye, self.eye + self.front, self.up)
|
|
67
64
|
|
|
68
65
|
def __str__(self) -> str:
|
|
69
66
|
return f"Camera {self.eye} {self.look} {self.world_up} {self.fov}"
|
|
@@ -71,9 +68,15 @@ class FirstPersonCamera:
|
|
|
71
68
|
def __repr__(self) -> str:
|
|
72
69
|
return f"Camera {self.eye} {self.look} {self.world_up} {self.fov}"
|
|
73
70
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
@property
|
|
72
|
+
def projection(self) -> Mat4:
|
|
73
|
+
return self._projection
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def view(self) -> Mat4:
|
|
77
|
+
return self._view
|
|
78
|
+
|
|
79
|
+
def process_mouse_movement(self, diffx: float, diffy: float, _constrain_pitch: bool = True) -> None:
|
|
77
80
|
"""
|
|
78
81
|
Process mouse movement to update the camera's direction vectors.
|
|
79
82
|
|
|
@@ -115,10 +118,10 @@ class FirstPersonCamera:
|
|
|
115
118
|
self.front.normalize()
|
|
116
119
|
from .util import look_at
|
|
117
120
|
|
|
118
|
-
self.
|
|
121
|
+
self._view = look_at(self.eye, self.eye + self.front, self.up)
|
|
119
122
|
|
|
120
123
|
def set_projection(
|
|
121
|
-
self, fov: float, aspect: float, near: float, far: float
|
|
124
|
+
self, fov: float, aspect: float, near: float, far: float, persp_mode: PerspMode = PerspMode.OpenGL
|
|
122
125
|
) -> Mat4:
|
|
123
126
|
"""
|
|
124
127
|
Set the projection matrix for the camera.
|
|
@@ -133,7 +136,7 @@ class FirstPersonCamera:
|
|
|
133
136
|
Mat4: The projection matrix.
|
|
134
137
|
"""
|
|
135
138
|
|
|
136
|
-
return perspective(fov, aspect, near, far)
|
|
139
|
+
return perspective(fov, aspect, near, far, persp_mode)
|
|
137
140
|
|
|
138
141
|
def move(self, x: float, y: float, delta: float) -> None:
|
|
139
142
|
"""
|
|
@@ -156,7 +159,7 @@ class FirstPersonCamera:
|
|
|
156
159
|
Returns:
|
|
157
160
|
Mat4: The view-projection matrix.
|
|
158
161
|
"""
|
|
159
|
-
return self.
|
|
162
|
+
return self._projection @ self._view
|
|
160
163
|
|
|
161
164
|
def process_mouse_scroll(self, y_offset: float) -> None:
|
|
162
165
|
"""
|
|
@@ -171,4 +174,4 @@ class FirstPersonCamera:
|
|
|
171
174
|
self.zoom = 1.0
|
|
172
175
|
if self.zoom >= 45.0:
|
|
173
176
|
self.zoom = 45.0
|
|
174
|
-
self.
|
|
177
|
+
self._projection = perspective(self.zoom, self.aspect, self.near, self.far)
|
ncca/ngl/prim_data.py
CHANGED
|
@@ -605,6 +605,9 @@ class PrimData:
|
|
|
605
605
|
def primitive(name: Union[str, enum]) -> np.ndarray:
|
|
606
606
|
prim_folder = Path(__file__).parent / "PrimData"
|
|
607
607
|
prims = np.load(prim_folder / "Primitives.npz")
|
|
608
|
+
if isinstance(name, Prims):
|
|
609
|
+
name = name.value
|
|
610
|
+
|
|
608
611
|
try:
|
|
609
612
|
return prims[name]
|
|
610
613
|
except KeyError:
|
|
@@ -2,6 +2,7 @@ ncca/ngl/.ruff_cache/.gitignore,sha256=njpg8ebsSuYCFcEdVLFxOSdF7CXp3e1DPVvZITY68
|
|
|
2
2
|
ncca/ngl/.ruff_cache/0.13.0/10564494386971134025,sha256=cw-J0gIy5ofUkDLcl9l1KuyGeSnM8hZtj8urcZcsVJI,1210
|
|
3
3
|
ncca/ngl/.ruff_cache/0.13.0/7783445477288392980,sha256=eeVnGNALeos37aECRfh4CHPcV_ubWjMAfxMhg3IId5c,82
|
|
4
4
|
ncca/ngl/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
|
5
|
+
ncca/ngl/PrimData/NGLDebug.log,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
6
|
ncca/ngl/PrimData/Primitives.npz,sha256=8viufkX_FyT6afB4ZJR_ikv3D3tBG6IuHIXBdw0nE0o,15016264
|
|
6
7
|
ncca/ngl/PrimData/buddah.npy,sha256=D9fBmoqKJdynSqPq9_AWFlGIGFb983G8ZCfvUQogXkk,9600128
|
|
7
8
|
ncca/ngl/PrimData/bunny.npy,sha256=URHm_8eGdFjIzosEbYxVYr-YeQyuAz7fq-V0Ake4mcg,6688064
|
|
@@ -21,7 +22,7 @@ ncca/ngl/base_mesh.py,sha256=2JmVT5_bvgLHra1VnwRld-mh-20IqqekgEu1dbGU1a4,5736
|
|
|
21
22
|
ncca/ngl/base_mesh.pyi,sha256=kobLuNnCSZlRRobIgVopQaS7Bjg0tJ3m4M64WXt5I-M,173
|
|
22
23
|
ncca/ngl/bbox.py,sha256=PylB6ju_bkdDUqQkzO1n2E-jsmxiviNkyBLY-sN59n8,6578
|
|
23
24
|
ncca/ngl/bezier_curve.py,sha256=A0aidWJ7c8Bh2KGCgCJ7aH8c8MakP8xrFFEFvCjva38,2297
|
|
24
|
-
ncca/ngl/first_person_camera.py,sha256=
|
|
25
|
+
ncca/ngl/first_person_camera.py,sha256=IUIdiy17bMnx7Z210bH9Hr5D0RKvq_3lQs7tPt_7WJ0,6104
|
|
25
26
|
ncca/ngl/image.py,sha256=zpG8egzXWkUJKQxpRhXndpRxJDKOKHZkDjQuKSRXN2E,2692
|
|
26
27
|
ncca/ngl/log.py,sha256=b7l-XNJIpP36VqcCGXBV_0XT5Nkd5eyuC7043lWegcw,1282
|
|
27
28
|
ncca/ngl/mat2.py,sha256=kHyrxLWQ_zGBf5t6huKL6BDrjF5a1skU_9PpcyMFi0I,3710
|
|
@@ -30,7 +31,7 @@ ncca/ngl/mat4.py,sha256=i6ZKnMpwJdh8ULTjcnWKPo9UK39ulU4WeUdoet4yZAE,17574
|
|
|
30
31
|
ncca/ngl/multi_buffer_vao.py,sha256=cuNE6gSrqkNcYvfIOYOZp4MVnpCvChUgnzsf7b60pWg,1752
|
|
31
32
|
ncca/ngl/obj.py,sha256=AGldNouHrkrDs2UhATClGkgo4dzr6lzArR4YeCxQKmo,13667
|
|
32
33
|
ncca/ngl/plane.py,sha256=96WuGzexYKhoeRVevGP2pZcustt9fzyyAjuwJHT25tk,1299
|
|
33
|
-
ncca/ngl/prim_data.py,sha256=
|
|
34
|
+
ncca/ngl/prim_data.py,sha256=Ji08CdnCJP4KPYEwh5P_NcltC76rPfNPx3MXgnkUW-E,19114
|
|
34
35
|
ncca/ngl/primitives.py,sha256=pThdSWLv7jJa9weBVOXhRgTfVVH54AWCbsDFCEI1YLg,4841
|
|
35
36
|
ncca/ngl/pyside_event_handling_mixin.py,sha256=L8obXeTp-g2Va2eXyd1hnmSp-sY7p4GX6EcFYRnH1F4,10588
|
|
36
37
|
ncca/ngl/quaternion.py,sha256=hvMoaV7uxx60boPg4cTqLJDyTpFZrEpUhikNqmNVTrU,5188
|
|
@@ -60,6 +61,6 @@ ncca/ngl/vec3.py,sha256=N_-LvP0nB0CQrZWG7TJntUl6QDHzIVLP-J1w8wPZTM0,12275
|
|
|
60
61
|
ncca/ngl/vec3_array.py,sha256=fLRC8k0TwcaU7CnR2GmJ0prud4dcvvUX0JTbQH_2W3Y,3535
|
|
61
62
|
ncca/ngl/vec4.py,sha256=mLl23D-3yAxh7GsP44ilRto-PMqIDxJjcZpNl2MyqGQ,6751
|
|
62
63
|
ncca/ngl/vec4_array.py,sha256=PSJXfG0g2AT4oQCLHiVAP6EC5n7vMXRQy0N1rGvv1iw,3426
|
|
63
|
-
ncca_ngl-0.2.
|
|
64
|
-
ncca_ngl-0.2.
|
|
65
|
-
ncca_ngl-0.2.
|
|
64
|
+
ncca_ngl-0.2.7.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
65
|
+
ncca_ngl-0.2.7.dist-info/METADATA,sha256=M6DICVnyLStX-WNzY-6ThLULlB9tWQkMu7Q8EGF1SRw,1596
|
|
66
|
+
ncca_ngl-0.2.7.dist-info/RECORD,,
|
|
File without changes
|