ncca-ngl 0.2.6__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.
@@ -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.projection: Mat4 = self.set_projection(
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.view: Mat4 = look_at(self.eye, self.eye + self.front, self.up)
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
- def process_mouse_movement(
75
- self, diffx: float, diffy: float, _constrain_pitch: bool = True
76
- ) -> None:
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.view = look_at(self.eye, self.eye + self.front, self.up)
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.projection @ self.view
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.projection = perspective(self.zoom, self.aspect, self.near, self.far)
177
+ self._projection = perspective(self.zoom, self.aspect, self.near, self.far)
ncca/ngl/prim_data.py CHANGED
@@ -605,7 +605,7 @@ 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, PrimData):
608
+ if isinstance(name, Prims):
609
609
  name = name.value
610
610
 
611
611
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ncca-ngl
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: A Python version of the NGL graphics library.
5
5
  Author: Jon Macey
6
6
  Author-email: Jon Macey <jmacey@bournemouth.ac.uk>
@@ -22,7 +22,7 @@ ncca/ngl/base_mesh.py,sha256=2JmVT5_bvgLHra1VnwRld-mh-20IqqekgEu1dbGU1a4,5736
22
22
  ncca/ngl/base_mesh.pyi,sha256=kobLuNnCSZlRRobIgVopQaS7Bjg0tJ3m4M64WXt5I-M,173
23
23
  ncca/ngl/bbox.py,sha256=PylB6ju_bkdDUqQkzO1n2E-jsmxiviNkyBLY-sN59n8,6578
24
24
  ncca/ngl/bezier_curve.py,sha256=A0aidWJ7c8Bh2KGCgCJ7aH8c8MakP8xrFFEFvCjva38,2297
25
- ncca/ngl/first_person_camera.py,sha256=Rrt3ibMh72K8gPBu6B8neIbYk5lnNZcDnvBB8mq5pz0,5890
25
+ ncca/ngl/first_person_camera.py,sha256=IUIdiy17bMnx7Z210bH9Hr5D0RKvq_3lQs7tPt_7WJ0,6104
26
26
  ncca/ngl/image.py,sha256=zpG8egzXWkUJKQxpRhXndpRxJDKOKHZkDjQuKSRXN2E,2692
27
27
  ncca/ngl/log.py,sha256=b7l-XNJIpP36VqcCGXBV_0XT5Nkd5eyuC7043lWegcw,1282
28
28
  ncca/ngl/mat2.py,sha256=kHyrxLWQ_zGBf5t6huKL6BDrjF5a1skU_9PpcyMFi0I,3710
@@ -31,7 +31,7 @@ ncca/ngl/mat4.py,sha256=i6ZKnMpwJdh8ULTjcnWKPo9UK39ulU4WeUdoet4yZAE,17574
31
31
  ncca/ngl/multi_buffer_vao.py,sha256=cuNE6gSrqkNcYvfIOYOZp4MVnpCvChUgnzsf7b60pWg,1752
32
32
  ncca/ngl/obj.py,sha256=AGldNouHrkrDs2UhATClGkgo4dzr6lzArR4YeCxQKmo,13667
33
33
  ncca/ngl/plane.py,sha256=96WuGzexYKhoeRVevGP2pZcustt9fzyyAjuwJHT25tk,1299
34
- ncca/ngl/prim_data.py,sha256=vOPMRfKJ05WdBbeaKPOmX5UzOpkY94G4gjFyr97ssDI,19117
34
+ ncca/ngl/prim_data.py,sha256=Ji08CdnCJP4KPYEwh5P_NcltC76rPfNPx3MXgnkUW-E,19114
35
35
  ncca/ngl/primitives.py,sha256=pThdSWLv7jJa9weBVOXhRgTfVVH54AWCbsDFCEI1YLg,4841
36
36
  ncca/ngl/pyside_event_handling_mixin.py,sha256=L8obXeTp-g2Va2eXyd1hnmSp-sY7p4GX6EcFYRnH1F4,10588
37
37
  ncca/ngl/quaternion.py,sha256=hvMoaV7uxx60boPg4cTqLJDyTpFZrEpUhikNqmNVTrU,5188
@@ -61,6 +61,6 @@ ncca/ngl/vec3.py,sha256=N_-LvP0nB0CQrZWG7TJntUl6QDHzIVLP-J1w8wPZTM0,12275
61
61
  ncca/ngl/vec3_array.py,sha256=fLRC8k0TwcaU7CnR2GmJ0prud4dcvvUX0JTbQH_2W3Y,3535
62
62
  ncca/ngl/vec4.py,sha256=mLl23D-3yAxh7GsP44ilRto-PMqIDxJjcZpNl2MyqGQ,6751
63
63
  ncca/ngl/vec4_array.py,sha256=PSJXfG0g2AT4oQCLHiVAP6EC5n7vMXRQy0N1rGvv1iw,3426
64
- ncca_ngl-0.2.6.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
65
- ncca_ngl-0.2.6.dist-info/METADATA,sha256=_9ILP8ufEF7HhSGITkNZ66Xdsc5dsVy3y3tsfvJeEvw,1596
66
- ncca_ngl-0.2.6.dist-info/RECORD,,
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,,