kraken-engine 1.1.1__cp313-cp313-win_amd64.whl → 1.3.0__cp313-cp313-win_amd64.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.
@@ -8,228 +8,276 @@ __all__: list[str] = ['contains', 'overlap']
8
8
  @typing.overload
9
9
  def contains(outer: pykraken._core.Rect, inner: pykraken._core.Rect) -> bool:
10
10
  """
11
- Checks if one rectangle completely contains another rectangle.
11
+ Check whether one rectangle completely contains another rectangle.
12
12
 
13
- Parameters:
13
+ Args:
14
14
  outer (Rect): The outer rectangle.
15
15
  inner (Rect): The inner rectangle.
16
16
 
17
17
  Returns:
18
- bool: Whether the outer rectangle completely contains the inner rectangle.
18
+ bool: True if the outer rectangle completely contains the inner rectangle.
19
19
  """
20
20
  @typing.overload
21
21
  def contains(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
22
22
  """
23
- Checks if a rectangle completely contains a circle.
23
+ Check whether a rectangle completely contains a circle.
24
24
 
25
- Parameters:
25
+ Args:
26
26
  rect (Rect): The rectangle.
27
27
  circle (Circle): The circle.
28
28
 
29
29
  Returns:
30
- bool: Whether the rectangle completely contains the circle.
30
+ bool: True if the rectangle completely contains the circle.
31
31
  """
32
32
  @typing.overload
33
33
  def contains(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
34
34
  """
35
- Checks if a rectangle completely contains a line.
35
+ Check whether a rectangle completely contains a line.
36
36
 
37
- Parameters:
37
+ Args:
38
38
  rect (Rect): The rectangle.
39
39
  line (Line): The line.
40
40
 
41
41
  Returns:
42
- bool: Whether the rectangle completely contains the line.
42
+ bool: True if the rectangle completely contains the line.
43
43
  """
44
44
  @typing.overload
45
45
  def contains(outer: pykraken._core.Circle, inner: pykraken._core.Circle) -> bool:
46
46
  """
47
- Checks if one circle completely contains another circle.
47
+ Check whether one circle completely contains another circle.
48
48
 
49
- Parameters:
49
+ Args:
50
50
  outer (Circle): The outer circle.
51
51
  inner (Circle): The inner circle.
52
52
 
53
53
  Returns:
54
- bool: Whether the outer circle completely contains the inner circle.
54
+ bool: True if the outer circle completely contains the inner circle.
55
55
  """
56
56
  @typing.overload
57
57
  def contains(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
58
58
  """
59
- Checks if a circle completely contains a rectangle.
59
+ Check whether a circle completely contains a rectangle.
60
60
 
61
- Parameters:
61
+ Args:
62
62
  circle (Circle): The circle.
63
63
  rect (Rect): The rectangle.
64
64
 
65
65
  Returns:
66
- bool: Whether the circle completely contains the rectangle.
66
+ bool: True if the circle completely contains the rectangle.
67
67
  """
68
68
  @typing.overload
69
69
  def contains(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
70
70
  """
71
- Checks if a circle completely contains a line.
71
+ Check whether a circle completely contains a line.
72
72
 
73
- Parameters:
73
+ Args:
74
74
  circle (Circle): The circle.
75
75
  line (Line): The line.
76
76
 
77
77
  Returns:
78
- bool: Whether the circle completely contains the line.
78
+ bool: True if the circle completely contains the line.
79
79
  """
80
80
  @typing.overload
81
81
  def overlap(a: pykraken._core.Rect, b: pykraken._core.Rect) -> bool:
82
82
  """
83
- Checks if two rectangles overlap.
83
+ Check whether two rectangles overlap.
84
84
 
85
- Parameters:
85
+ Args:
86
86
  a (Rect): The first rectangle.
87
87
  b (Rect): The second rectangle.
88
88
 
89
89
  Returns:
90
- bool: Whether the rectangles overlap.
90
+ bool: True if the rectangles overlap.
91
91
  """
92
92
  @typing.overload
93
93
  def overlap(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
94
94
  """
95
- Checks if a rectangle and a circle overlap.
95
+ Check whether a rectangle and a circle overlap.
96
96
 
97
- Parameters:
97
+ Args:
98
98
  rect (Rect): The rectangle.
99
99
  circle (Circle): The circle.
100
100
 
101
101
  Returns:
102
- bool: Whether the rectangle and circle overlap.
102
+ bool: True if the rectangle and circle overlap.
103
103
  """
104
104
  @typing.overload
105
105
  def overlap(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
106
106
  """
107
- Checks if a rectangle and a line overlap.
107
+ Check whether a rectangle and a line overlap.
108
108
 
109
- Parameters:
109
+ Args:
110
110
  rect (Rect): The rectangle.
111
111
  line (Line): The line.
112
112
 
113
113
  Returns:
114
- bool: Whether the rectangle and line overlap.
114
+ bool: True if the rectangle and line overlap.
115
115
  """
116
116
  @typing.overload
117
117
  def overlap(rect: pykraken._core.Rect, point: pykraken._core.Vec2) -> bool:
118
118
  """
119
- Checks if a rectangle contains a point.
119
+ Check whether a rectangle contains a point.
120
120
 
121
- Parameters:
121
+ Args:
122
122
  rect (Rect): The rectangle.
123
123
  point (Vec2): The point.
124
124
 
125
125
  Returns:
126
- bool: Whether the rectangle contains the point.
126
+ bool: True if the rectangle contains the point.
127
127
  """
128
128
  @typing.overload
129
129
  def overlap(a: pykraken._core.Circle, b: pykraken._core.Circle) -> bool:
130
130
  """
131
- Checks if two circles overlap.
131
+ Check whether two circles overlap.
132
132
 
133
- Parameters:
133
+ Args:
134
134
  a (Circle): The first circle.
135
135
  b (Circle): The second circle.
136
136
 
137
137
  Returns:
138
- bool: Whether the circles overlap.
138
+ bool: True if the circles overlap.
139
139
  """
140
140
  @typing.overload
141
141
  def overlap(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
142
142
  """
143
- Checks if a circle and a rectangle overlap.
143
+ Check whether a circle and a rectangle overlap.
144
144
 
145
- Parameters:
145
+ Args:
146
146
  circle (Circle): The circle.
147
147
  rect (Rect): The rectangle.
148
148
 
149
149
  Returns:
150
- bool: Whether the circle and rectangle overlap.
150
+ bool: True if the circle and rectangle overlap.
151
151
  """
152
152
  @typing.overload
153
153
  def overlap(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
154
154
  """
155
- Checks if a circle and a line overlap.
155
+ Check whether a circle and a line overlap.
156
156
 
157
- Parameters:
157
+ Args:
158
158
  circle (Circle): The circle.
159
159
  line (Line): The line.
160
160
 
161
161
  Returns:
162
- bool: Whether the circle and line overlap.
162
+ bool: True if the circle and line overlap.
163
163
  """
164
164
  @typing.overload
165
165
  def overlap(circle: pykraken._core.Circle, point: pykraken._core.Vec2) -> bool:
166
166
  """
167
- Checks if a circle contains a point.
167
+ Check whether a circle contains a point.
168
168
 
169
- Parameters:
169
+ Args:
170
170
  circle (Circle): The circle.
171
171
  point (Vec2): The point.
172
172
 
173
173
  Returns:
174
- bool: Whether the circle contains the point.
174
+ bool: True if the circle contains the point.
175
175
  """
176
176
  @typing.overload
177
177
  def overlap(a: pykraken._core.Line, b: pykraken._core.Line) -> bool:
178
178
  """
179
- Checks if two lines overlap (intersect).
179
+ Check whether two lines overlap (intersect).
180
180
 
181
- Parameters:
181
+ Args:
182
182
  a (Line): The first line.
183
183
  b (Line): The second line.
184
184
 
185
185
  Returns:
186
- bool: Whether the lines intersect.
186
+ bool: True if the lines intersect.
187
187
  """
188
188
  @typing.overload
189
189
  def overlap(line: pykraken._core.Line, rect: pykraken._core.Rect) -> bool:
190
190
  """
191
- Checks if a line and a rectangle overlap.
191
+ Check whether a line and a rectangle overlap.
192
192
 
193
- Parameters:
193
+ Args:
194
194
  line (Line): The line.
195
195
  rect (Rect): The rectangle.
196
196
 
197
197
  Returns:
198
- bool: Whether the line and rectangle overlap.
198
+ bool: True if the line and rectangle overlap.
199
199
  """
200
200
  @typing.overload
201
201
  def overlap(line: pykraken._core.Line, circle: pykraken._core.Circle) -> bool:
202
202
  """
203
- Checks if a line and a circle overlap.
203
+ Check whether a line and a circle overlap.
204
204
 
205
- Parameters:
205
+ Args:
206
206
  line (Line): The line.
207
207
  circle (Circle): The circle.
208
208
 
209
209
  Returns:
210
- bool: Whether the line and circle overlap.
210
+ bool: True if the line and circle overlap.
211
211
  """
212
212
  @typing.overload
213
213
  def overlap(point: pykraken._core.Vec2, rect: pykraken._core.Rect) -> bool:
214
214
  """
215
- Checks if a point is inside a rectangle.
215
+ Check whether a point is inside a rectangle.
216
216
 
217
- Parameters:
217
+ Args:
218
218
  point (Vec2): The point.
219
219
  rect (Rect): The rectangle.
220
220
 
221
221
  Returns:
222
- bool: Whether the point is inside the rectangle.
222
+ bool: True if the point is inside the rectangle.
223
223
  """
224
224
  @typing.overload
225
225
  def overlap(point: pykraken._core.Vec2, circle: pykraken._core.Circle) -> bool:
226
226
  """
227
- Checks if a point is inside a circle.
227
+ Check whether a point is inside a circle.
228
228
 
229
- Parameters:
229
+ Args:
230
230
  point (Vec2): The point.
231
231
  circle (Circle): The circle.
232
232
 
233
233
  Returns:
234
- bool: Whether the point is inside the circle.
234
+ bool: True if the point is inside the circle.
235
+ """
236
+ @typing.overload
237
+ def overlap(polygon: pykraken._core.Polygon, point: pykraken._core.Vec2) -> bool:
238
+ """
239
+ Check whether a polygon contains a point.
240
+
241
+ Args:
242
+ polygon (Polygon): The polygon.
243
+ point (Vec2): The point.
244
+
245
+ Returns:
246
+ bool: True if the polygon contains the point.
247
+ """
248
+ @typing.overload
249
+ def overlap(point: pykraken._core.Vec2, polygon: pykraken._core.Polygon) -> bool:
250
+ """
251
+ Check whether a point is inside a polygon.
252
+
253
+ Args:
254
+ point (Vec2): The point.
255
+ polygon (Polygon): The polygon.
256
+
257
+ Returns:
258
+ bool: True if the point is inside the polygon.
259
+ """
260
+ @typing.overload
261
+ def overlap(polygon: pykraken._core.Polygon, rect: pykraken._core.Rect) -> bool:
262
+ """
263
+ Check whether a polygon and a rectangle overlap.
264
+
265
+ Args:
266
+ polygon (Polygon): The polygon.
267
+ rect (Rect): The rectangle.
268
+
269
+ Returns:
270
+ bool: True if the polygon and rectangle overlap.
271
+ """
272
+ @typing.overload
273
+ def overlap(rect: pykraken._core.Rect, polygon: pykraken._core.Polygon) -> bool:
274
+ """
275
+ Check whether a rectangle and a polygon overlap.
276
+
277
+ Args:
278
+ rect (Rect): The rectangle.
279
+ polygon (Polygon): The polygon.
280
+
281
+ Returns:
282
+ bool: True if the rectangle and polygon overlap.
235
283
  """
pykraken/_core/event.pyi CHANGED
@@ -3,7 +3,28 @@ Input event handling
3
3
  """
4
4
  from __future__ import annotations
5
5
  import pykraken._core
6
- __all__: list[str] = ['poll']
6
+ import typing
7
+ __all__: list[str] = ['cancel_scheduled', 'new_custom', 'poll', 'push', 'schedule']
8
+ def cancel_scheduled(event: pykraken._core.Event) -> None:
9
+ """
10
+ Cancel a scheduled event timer.
11
+
12
+ Args:
13
+ event (Event): The custom event whose timer should be cancelled.
14
+
15
+ Raises:
16
+ RuntimeError: If attempting to cancel a non-custom event type.
17
+ """
18
+ def new_custom() -> pykraken._core.Event:
19
+ """
20
+ Create a new custom event type.
21
+
22
+ Returns:
23
+ Event: A new Event object with a unique custom event type.
24
+
25
+ Raises:
26
+ RuntimeError: If registering a custom event type fails.
27
+ """
7
28
  def poll() -> list[pykraken._core.Event]:
8
29
  """
9
30
  Poll for all pending user input events.
@@ -13,3 +34,27 @@ def poll() -> list[pykraken._core.Event]:
13
34
  Returns:
14
35
  list[Event]: A list of input event objects.
15
36
  """
37
+ def push(event: pykraken._core.Event) -> None:
38
+ """
39
+ Push a custom event to the event queue.
40
+
41
+ Args:
42
+ event (Event): The custom event to push to the queue.
43
+
44
+ Raises:
45
+ RuntimeError: If attempting to push a non-custom event type.
46
+ """
47
+ def schedule(event: pykraken._core.Event, delay_ms: typing.SupportsInt, repeat: bool = False) -> None:
48
+ """
49
+ Schedule a custom event to be pushed after a delay. Will overwrite any existing timer for the same event.
50
+
51
+ Args:
52
+ event (Event): The custom event to schedule.
53
+ delay_ms (int): Delay in milliseconds before the event is pushed.
54
+ repeat (bool, optional): If True, the event will be pushed repeatedly at the
55
+ specified interval. If False, the event is pushed only once. Defaults to False.
56
+
57
+ Raises:
58
+ RuntimeError: If attempting to schedule a non-custom event type, or if timer
59
+ creation fails.
60
+ """
pykraken/_core/math.pyi CHANGED
@@ -4,7 +4,7 @@ Math related functions
4
4
  from __future__ import annotations
5
5
  import pykraken._core
6
6
  import typing
7
- __all__: list[str] = ['angle_between', 'clamp', 'cross', 'dot', 'from_polar', 'lerp', 'normalize', 'remap', 'scale_to_length', 'to_deg', 'to_rad']
7
+ __all__: list[str] = ['angle_between', 'clamp', 'cross', 'dot', 'from_polar', 'lerp', 'normalize', 'remap', 'rotate', 'scale_to_length', 'to_deg', 'to_rad']
8
8
  def angle_between(a: pykraken._core.Vec2, b: pykraken._core.Vec2) -> float:
9
9
  """
10
10
  Calculate the angle between two vectors.
@@ -22,7 +22,7 @@ def clamp(vec: pykraken._core.Vec2, min_vec: pykraken._core.Vec2, max_vec: pykra
22
22
  Clamp a vector between two boundary vectors.
23
23
 
24
24
  Args:
25
- vector (Vec2): The vector to clamp.
25
+ vec (Vec2): The vector to clamp.
26
26
  min_vec (Vec2): The minimum boundary vector.
27
27
  max_vec (Vec2): The maximum boundary vector.
28
28
 
@@ -118,7 +118,7 @@ def normalize(vec: pykraken._core.Vec2) -> pykraken._core.Vec2:
118
118
  Normalize a vector to unit length.
119
119
 
120
120
  Args:
121
- vector (Vec2): The input vector.
121
+ vec (Vec2): The input vector.
122
122
 
123
123
  Returns:
124
124
  Vec2: A new normalized vector.
@@ -140,6 +140,17 @@ def remap(in_min: typing.SupportsFloat, in_max: typing.SupportsFloat, out_min: t
140
140
  Raises:
141
141
  ValueError: If in_min equals in_max.
142
142
  """
143
+ def rotate(vec: pykraken._core.Vec2, radians: typing.SupportsFloat) -> pykraken._core.Vec2:
144
+ """
145
+ Rotate a vector by an angle without mutating the input.
146
+
147
+ Args:
148
+ vec (Vec2): The vector to rotate.
149
+ radians (float): Rotation angle in radians.
150
+
151
+ Returns:
152
+ Vec2: A new rotated vector.
153
+ """
143
154
  def scale_to_length(vector: pykraken._core.Vec2, length: typing.SupportsFloat) -> pykraken._core.Vec2:
144
155
  """
145
156
  Scale a vector to a given length.
pykraken/_core/time.pyi CHANGED
@@ -52,10 +52,10 @@ def set_max_delta(max_delta: typing.SupportsFloat) -> None:
52
52
  """
53
53
  Set the maximum allowed delta time between frames.
54
54
 
55
- Parameters:
56
- max_delta (float): The maximum delta time in seconds, greater than 0.0.
57
- This is useful to prevent large delta values during
58
- frame drops or pauses that could destabilize physics or animations.
55
+ Args:
56
+ max_delta (float): Maximum delta time in seconds (> 0.0).
57
+ Use this to avoid large deltas during frame drops or pauses
58
+ that could destabilize physics or animations.
59
59
  """
60
60
  def set_scale(scale: typing.SupportsFloat) -> None:
61
61
  """
@@ -0,0 +1,30 @@
1
+ """
2
+ Viewport management functions
3
+ """
4
+ from __future__ import annotations
5
+ import pykraken._core
6
+ import typing
7
+ __all__: list[str] = ['layout', 'set', 'unset']
8
+ def layout(count: typing.SupportsInt, mode: pykraken._core.ViewportMode = pykraken._core.ViewportMode.VERTICAL) -> list[pykraken._core.Rect]:
9
+ """
10
+ Layout the screen into multiple viewports.
11
+
12
+ Args:
13
+ count (int): The number of viewports to create (between 2 and 4).
14
+ mode (ViewportMode, optional): The layout mode for 2 viewports (VERTICAL or HORIZONTAL).
15
+ Defaults to VERTICAL.
16
+
17
+ Returns:
18
+ list[Rect]: A list of Rects representing the viewports.
19
+ """
20
+ def set(rect: pykraken._core.Rect) -> None:
21
+ """
22
+ Set the current viewport to the given rectangle.
23
+
24
+ Args:
25
+ rect (Rect): The rectangle defining the viewport.
26
+ """
27
+ def unset() -> None:
28
+ """
29
+ Unset the current viewport, reverting to the full rendering area.
30
+ """
pykraken/_core/window.pyi CHANGED
@@ -13,18 +13,16 @@ def close() -> None:
13
13
  """
14
14
  def create(title: str, resolution: pykraken._core.Vec2, scaled: bool = False) -> None:
15
15
  """
16
- Create a window with specified title and size.
16
+ Create a window with the requested title and resolution.
17
17
 
18
18
  Args:
19
- title (str): The window title. Must be non-empty and <= 255 characters.
20
- resolution (Vec2): The renderer resolution as (width, height).
21
- scaled (bool, optional): If True, creates a scaled up window using the
22
- display's usable bounds, retaining the resolution's ratio.
23
- Defaults to False.
19
+ title (str): Non-empty title no longer than 255 characters.
20
+ resolution (Vec2): Target renderer resolution as (width, height).
21
+ scaled (bool): When True, stretches to usable display bounds while maintaining aspect.
24
22
 
25
23
  Raises:
26
- RuntimeError: If a window already exists or window creation fails.
27
- ValueError: If title is empty, exceeds 255 characters, or size values are <= 0.
24
+ RuntimeError: If a window already exists or SDL window creation fails.
25
+ ValueError: If the title is invalid or any dimension is non-positive.
28
26
  """
29
27
  def get_scale() -> int:
30
28
  """
@@ -68,7 +66,7 @@ def is_fullscreen() -> bool:
68
66
  """
69
67
  def is_open() -> bool:
70
68
  """
71
- Check if the window is open.
69
+ Report whether the window is currently open.
72
70
 
73
71
  Returns:
74
72
  bool: True if the window is open and active.
@@ -79,6 +77,9 @@ def save_screenshot(path: str) -> None:
79
77
 
80
78
  Args:
81
79
  path (str): The path to save the screenshot to.
80
+
81
+ Raises:
82
+ RuntimeError: If the window is not initialized or the screenshot cannot be saved.
82
83
  """
83
84
  def set_fullscreen(fullscreen: bool) -> None:
84
85
  """
Binary file
@@ -3,35 +3,27 @@ import struct
3
3
 
4
4
 
5
5
  class ShaderUniform(BaseModel):
6
- """
7
- Base class for shader uniform data structures.
8
-
9
- Inherits from Pydantic's BaseModel to provide type validation and serialization
10
- for shader uniform buffers. Subclass this to define your shader's uniform layout,
11
- and use `to_bytes()` to convert the data to a binary format suitable for upload
12
- to the GPU via `ShaderState.set_uniform()`.
13
-
14
- Supported field types:
15
- - float: Packed as 'f' (4 bytes)
16
- - int: Packed as 'i' (4 bytes, signed)
17
- - bool: Packed as '?' (1 byte)
18
- - tuple/list of 2-4 floats: Packed as vectors (vec2, vec3, vec4)
6
+ """Base model for shader uniform data structures.
7
+
8
+ Subclass this to describe your shader's uniform layout. Instances can be
9
+ converted to bytes for uploads through ``ShaderState.set_uniform()``. Field
10
+ values are packed according to their types: ``float`` values use the ``f``
11
+ format, ``int`` values use ``i``, ``bool`` values use ``?``, and tuples or
12
+ lists of two to four floats are packed as vector components.
19
13
  """
20
14
 
21
15
  def to_bytes(self) -> bytes:
22
- """
23
- Converts the uniform data to a packed binary format.
24
-
25
- Serializes all fields in the model to a bytes object using Python's struct
26
- module, suitable for uploading to GPU uniform buffers. The packing format
27
- is automatically determined based on field types.
28
-
16
+ """Serialize the uniform data into a packed binary format.
17
+
18
+ The packing order follows the model's field order, and Python's ``struct``
19
+ module determines the byte layout based on field types.
20
+
29
21
  Returns:
30
- bytes: The packed binary representation of the uniform data.
31
-
22
+ bytes: Packed binary representation of the uniform data.
23
+
32
24
  Raises:
33
- ValueError: If a tuple/list field has an invalid length (not 2, 3, or 4).
34
- TypeError: If a field has an unsupported type.
25
+ ValueError: If a tuple or list field does not contain 2, 3, or 4 values.
26
+ TypeError: If a field uses an unsupported type.
35
27
  """
36
28
  fmt = ""
37
29
  values = []
@@ -9,26 +9,20 @@ import typing
9
9
  __all__: list[str] = ['BaseModel', 'ShaderUniform', 'struct']
10
10
  class ShaderUniform(pydantic.main.BaseModel):
11
11
  """
12
+ Base model for shader uniform data structures.
12
13
 
13
- Base class for shader uniform data structures.
14
-
15
- Inherits from Pydantic's BaseModel to provide type validation and serialization
16
- for shader uniform buffers. Subclass this to define your shader's uniform layout,
17
- and use `to_bytes()` to convert the data to a binary format suitable for upload
18
- to the GPU via `ShaderState.set_uniform()`.
19
-
20
- Supported field types:
21
- - float: Packed as 'f' (4 bytes)
22
- - int: Packed as 'i' (4 bytes, signed)
23
- - bool: Packed as '?' (1 byte)
24
- - tuple/list of 2-4 floats: Packed as vectors (vec2, vec3, vec4)
14
+ Subclass this to describe your shader's uniform layout. Instances can be
15
+ converted to bytes for uploads through ``ShaderState.set_uniform()``. Field
16
+ values are packed according to their types: ``float`` values use the ``f``
17
+ format, ``int`` values use ``i``, ``bool`` values use ``?``, and tuples or
18
+ lists of two to four floats are packed as vector components.
25
19
  """
26
20
  __abstractmethods__: typing.ClassVar[frozenset] # value = frozenset()
27
21
  __class_vars__: typing.ClassVar[set] = set()
28
22
  __private_attributes__: typing.ClassVar[dict] = {}
29
23
  __pydantic_complete__: typing.ClassVar[bool] = True
30
24
  __pydantic_computed_fields__: typing.ClassVar[dict] = {}
31
- __pydantic_core_schema__: typing.ClassVar[dict] = {'type': 'model', 'cls': ShaderUniform, 'schema': {'type': 'model-fields', 'fields': {}, 'model_name': 'ShaderUniform', 'computed_fields': list()}, 'custom_init': False, 'root_model': False, 'config': {'title': 'ShaderUniform'}, 'ref': 'pykraken.shader_uniform.ShaderUniform:2062985552560', 'metadata': {'pydantic_js_functions': [pydantic.main.BaseModel.__get_pydantic_json_schema__]}}
25
+ __pydantic_core_schema__: typing.ClassVar[dict] = {'type': 'model', 'cls': ShaderUniform, 'schema': {'type': 'model-fields', 'fields': {}, 'model_name': 'ShaderUniform', 'computed_fields': list()}, 'custom_init': False, 'root_model': False, 'config': {'title': 'ShaderUniform'}, 'ref': 'pykraken.shader_uniform.ShaderUniform:1434400820944', 'metadata': {'pydantic_js_functions': [pydantic.main.BaseModel.__get_pydantic_json_schema__]}}
32
26
  __pydantic_custom_init__: typing.ClassVar[bool] = False
33
27
  __pydantic_decorators__: typing.ClassVar[pydantic._internal._decorators.DecoratorInfos] # value = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
34
28
  __pydantic_fields__: typing.ClassVar[dict] = {}
@@ -43,17 +37,15 @@ class ShaderUniform(pydantic.main.BaseModel):
43
37
  model_config: typing.ClassVar[dict] = {}
44
38
  def to_bytes(self) -> bytes:
45
39
  """
40
+ Serialize the uniform data into a packed binary format.
46
41
 
47
- Converts the uniform data to a packed binary format.
48
-
49
- Serializes all fields in the model to a bytes object using Python's struct
50
- module, suitable for uploading to GPU uniform buffers. The packing format
51
- is automatically determined based on field types.
42
+ The packing order follows the model's field order, and Python's ``struct``
43
+ module determines the byte layout based on field types.
52
44
 
53
45
  Returns:
54
- bytes: The packed binary representation of the uniform data.
46
+ bytes: Packed binary representation of the uniform data.
55
47
 
56
48
  Raises:
57
- ValueError: If a tuple/list field has an invalid length (not 2, 3, or 4).
58
- TypeError: If a field has an unsupported type.
49
+ ValueError: If a tuple or list field does not contain 2, 3, or 4 values.
50
+ TypeError: If a field uses an unsupported type.
59
51
  """