ncca-ngl 0.2.3__tar.gz → 0.2.5__tar.gz
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-0.2.3 → ncca_ngl-0.2.5}/PKG-INFO +1 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/pyproject.toml +1 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/__init__.py +2 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/abstract_vao.py +2 -6
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/prim_data.py +1 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/quaternion.py +48 -12
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec2.py +3 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec3.py +1 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec4.py +1 -1
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/LICENSE.txt +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/.ruff_cache/.gitignore +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/.ruff_cache/0.13.0/10564494386971134025 +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/.ruff_cache/0.13.0/7783445477288392980 +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/.ruff_cache/CACHEDIR.TAG +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/Primitives.npz +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/buddah.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/bunny.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/cube.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/dodecahedron.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/dragon.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/football.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/icosahedron.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/octahedron.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/pack_arrays.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/teapot.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/tetrahedron.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/PrimData/troll.npy +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/base_mesh.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/base_mesh.pyi +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/bbox.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/bezier_curve.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/first_person_camera.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/image.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/log.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/mat2.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/mat3.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/mat4.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/multi_buffer_vao.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/obj.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/plane.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/primitives.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/pyside_event_handling_mixin.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/random.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shader.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shader_lib.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shader_program.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/checker_fragment.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/checker_vertex.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/colour_fragment.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/colour_vertex.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/diffuse_fragment.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/diffuse_vertex.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/text_fragment.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/text_geometry.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/shaders/text_vertex.glsl +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/simple_index_vao.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/simple_vao.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/text.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/texture.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/transform.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/util.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vao_factory.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec2_array.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec3_array.py +0 -0
- {ncca_ngl-0.2.3 → ncca_ngl-0.2.5}/src/ncca/ngl/vec4_array.py +0 -0
|
@@ -41,7 +41,7 @@ from .simple_vao import SimpleVAO
|
|
|
41
41
|
from .text import Text
|
|
42
42
|
from .texture import Texture
|
|
43
43
|
from .transform import Transform, TransformRotationOrder
|
|
44
|
-
from .util import calc_normal, clamp, frustum, lerp, look_at, ortho, perspective
|
|
44
|
+
from .util import PerspMode, calc_normal, clamp, frustum, lerp, look_at, ortho, perspective
|
|
45
45
|
from .vao_factory import VAOFactory, VAOType
|
|
46
46
|
from .vec2 import Vec2
|
|
47
47
|
from .vec2_array import Vec2Array
|
|
@@ -110,4 +110,5 @@ all = [
|
|
|
110
110
|
PrimData,
|
|
111
111
|
FirstPersonCamera,
|
|
112
112
|
PySideEventHandlingMixin,
|
|
113
|
+
PerspMode,
|
|
113
114
|
]
|
|
@@ -52,14 +52,10 @@ class AbstractVAO(abc.ABC):
|
|
|
52
52
|
def remove_vao(self):
|
|
53
53
|
raise NotImplementedError
|
|
54
54
|
|
|
55
|
-
def set_vertex_attribute_pointer(
|
|
56
|
-
self, id, size, type, stride, offset, normalize=False
|
|
57
|
-
):
|
|
55
|
+
def set_vertex_attribute_pointer(self, id, size, type, stride, offset, normalize=False):
|
|
58
56
|
if not self.bound:
|
|
59
57
|
logger.error("VAO not bound in set_vertex_attribute_pointer")
|
|
60
|
-
gl.glVertexAttribPointer(
|
|
61
|
-
id, size, type, normalize, stride, ctypes.c_void_p(offset)
|
|
62
|
-
)
|
|
58
|
+
gl.glVertexAttribPointer(id, size, type, normalize, stride, ctypes.c_void_p(offset))
|
|
63
59
|
gl.glEnableVertexAttribArray(id)
|
|
64
60
|
|
|
65
61
|
def set_num_indices(self, count):
|
|
@@ -10,6 +10,7 @@ Attributes:
|
|
|
10
10
|
import math
|
|
11
11
|
|
|
12
12
|
from .mat4 import Mat4
|
|
13
|
+
from .vec3 import Vec3
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Quaternion:
|
|
@@ -75,9 +76,7 @@ class Quaternion:
|
|
|
75
76
|
return Quaternion(s, x, y, z)
|
|
76
77
|
|
|
77
78
|
def __add__(self, rhs):
|
|
78
|
-
return Quaternion(
|
|
79
|
-
self.s + rhs.s, self.x + rhs.x, self.y + rhs.y, self.z + rhs.z
|
|
80
|
-
)
|
|
79
|
+
return Quaternion(self.s + rhs.s, self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
|
|
81
80
|
|
|
82
81
|
def __iadd__(self, rhs):
|
|
83
82
|
self.s += rhs.s
|
|
@@ -87,20 +86,57 @@ class Quaternion:
|
|
|
87
86
|
return self
|
|
88
87
|
|
|
89
88
|
def __sub__(self, rhs):
|
|
90
|
-
return Quaternion(
|
|
91
|
-
self.s - rhs.s, self.x - rhs.x, self.y - rhs.y, self.z - rhs.z
|
|
92
|
-
)
|
|
89
|
+
return Quaternion(self.s - rhs.s, self.x - rhs.x, self.y - rhs.y, self.z - rhs.z)
|
|
93
90
|
|
|
94
91
|
def __isub__(self, rhs):
|
|
95
92
|
return self.__sub__(rhs)
|
|
96
93
|
|
|
94
|
+
# def __mul__(self, rhs):
|
|
95
|
+
# return Quaternion(
|
|
96
|
+
# self.s * rhs.s - self.x * rhs.x - self.y * rhs.y - self.z * rhs.z,
|
|
97
|
+
# self.s * rhs.x + self.x * rhs.s + self.y * rhs.z - self.z * rhs.y,
|
|
98
|
+
# self.s * rhs.y - self.x * rhs.z + self.y * rhs.s + self.z * rhs.x,
|
|
99
|
+
# self.s * rhs.z + self.x * rhs.y - self.y * rhs.x + self.z * rhs.s,
|
|
100
|
+
# )
|
|
101
|
+
|
|
97
102
|
def __mul__(self, rhs):
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
if isinstance(rhs, Quaternion):
|
|
104
|
+
return Quaternion(
|
|
105
|
+
self.s * rhs.s - self.x * rhs.x - self.y * rhs.y - self.z * rhs.z,
|
|
106
|
+
self.s * rhs.x + self.x * rhs.s + self.y * rhs.z - self.z * rhs.y,
|
|
107
|
+
self.s * rhs.y - self.x * rhs.z + self.y * rhs.s + self.z * rhs.x,
|
|
108
|
+
self.s * rhs.z + self.x * rhs.y - self.y * rhs.x + self.z * rhs.s,
|
|
109
|
+
)
|
|
110
|
+
elif isinstance(rhs, Vec3):
|
|
111
|
+
qw = self.s
|
|
112
|
+
qx = self.x
|
|
113
|
+
qy = self.y
|
|
114
|
+
qz = self.z
|
|
115
|
+
|
|
116
|
+
vx = rhs.x
|
|
117
|
+
vy = rhs.y
|
|
118
|
+
vz = rhs.z
|
|
119
|
+
|
|
120
|
+
# pq
|
|
121
|
+
pw = -qx * vx - qy * vy - qz * vz
|
|
122
|
+
px = qw * vx + qy * vz - qz * vy
|
|
123
|
+
py = qw * vy - qx * vz + qz * vx
|
|
124
|
+
pz = qw * vz + qx * vy - qy * vx
|
|
125
|
+
|
|
126
|
+
# pqp*
|
|
127
|
+
return Vec3(
|
|
128
|
+
-pw * qx + px * qw - py * qz + pz * qy,
|
|
129
|
+
-pw * qy + px * qz + py * qw - pz * qx,
|
|
130
|
+
-pw * qz - px * qy + py * qx + pz * qw,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
def normalize(self):
|
|
134
|
+
length = math.sqrt(self.s * self.s + self.x * self.x + self.y * self.y + self.z * self.z)
|
|
135
|
+
if length > 0:
|
|
136
|
+
self.s /= length
|
|
137
|
+
self.x /= length
|
|
138
|
+
self.y /= length
|
|
139
|
+
self.z /= length
|
|
104
140
|
|
|
105
141
|
def __str__(self) -> str:
|
|
106
142
|
"""
|
|
@@ -5,6 +5,8 @@ Simple float only Vec2 class for 3D graphics, very similar to the pyngl ones
|
|
|
5
5
|
import ctypes
|
|
6
6
|
import math
|
|
7
7
|
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
8
10
|
from .util import clamp
|
|
9
11
|
|
|
10
12
|
|
|
@@ -74,7 +76,7 @@ class Vec2:
|
|
|
74
76
|
Raises:
|
|
75
77
|
ValueError: If v is not a float or int.
|
|
76
78
|
"""
|
|
77
|
-
if not isinstance(v, (int, float)):
|
|
79
|
+
if not isinstance(v, (int, float, np.float32)):
|
|
78
80
|
raise ValueError("need float or int")
|
|
79
81
|
else:
|
|
80
82
|
setattr(self, name, v)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|