basilisk-engine 0.1.48__py3-none-any.whl → 0.1.50__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.

Potentially problematic release.


This version of basilisk-engine might be problematic. Click here for more details.

basilisk/draw/draw.py CHANGED
@@ -93,7 +93,7 @@ def text(engine: Engine, text: str, position: tuple, scale: float=1.0):
93
93
  # Render the text if it has not been cached
94
94
  if text not in font_renderer.text_renders:
95
95
  surf = font_renderer.render(text).convert_alpha()
96
- text_image = Image(surf)
96
+ text_image = Image(surf, flip_y=False)
97
97
  font_renderer.text_renders[text] = (text_image, surf.get_rect())
98
98
 
99
99
  # Blit the text image
@@ -45,7 +45,7 @@ class DrawHandler():
45
45
 
46
46
  self.ctx.enable(mgl.BLEND)
47
47
  self.ctx.disable(mgl.DEPTH_TEST)
48
- self.ctx.blend_func = mgl.DEFAULT_BLENDING
48
+ # self.ctx.blend_func = mgl.DEFAULT_BLENDING
49
49
 
50
50
  # Reverse the draw order, and convert to C-like array
51
51
  # self.draw_data.reverse()
basilisk/engine.py CHANGED
@@ -145,7 +145,7 @@ class Engine():
145
145
  # Clear the screen and render the frame
146
146
  if render:
147
147
  # Render all draw calls from the past frame
148
- self.ctx.screen.use()
148
+ self.frame.output_buffer.use()
149
149
  self.draw_handler.render()
150
150
  self.frame.render(self.ctx.screen)
151
151
 
File without changes
@@ -0,0 +1,62 @@
1
+ import pygame as pg
2
+
3
+
4
+ class Mouse():
5
+ def __init__(self, grab=True):
6
+ self.x, self.y = pg.mouse.get_pos()
7
+ self.buttons = pg.mouse.get_pressed()
8
+ self.previous_buttons = pg.mouse.get_pressed()
9
+ self.grab = grab
10
+
11
+ def update(self, events):
12
+ """
13
+ Updates all mouse state variables.
14
+ Checks for mouse-related events.
15
+ """
16
+
17
+ self.x, self.y = pg.mouse.get_pos()
18
+ self.previous_buttons = self.buttons
19
+ self.buttons = pg.mouse.get_pressed()
20
+
21
+ for event in events:
22
+ if event.type == pg.KEYUP:
23
+ if event.key == pg.K_ESCAPE and self.grab:
24
+ # Unlock mouse
25
+ pg.event.set_grab(False)
26
+ pg.mouse.set_visible(True)
27
+ if event.type == pg.MOUSEBUTTONUP and self.grab:
28
+ # Lock mouse
29
+ pg.event.set_grab(True)
30
+ pg.mouse.set_visible(False)
31
+
32
+ def set_pos(self, x, y):
33
+ """Set the mouse position"""
34
+ pg.mouse.set_pos(x, y)
35
+
36
+ @property
37
+ def click(self): return self.buttons[0] and not self.previous_buttons[0]
38
+ @property
39
+ def left_click(self): return self.buttons[0] and not self.previous_buttons[0]
40
+ @property
41
+ def middle_click(self): return self.buttons[1] and not self.previous_buttons[1]
42
+ @property
43
+ def right_click(self): return self.buttons[2] and not self.previous_buttons[2]
44
+ @property
45
+ def left_down(self): return self.buttons[0]
46
+ @property
47
+ def middle_down(self): return self.buttons[1]
48
+ @property
49
+ def right_down(self): return self.buttons[2]
50
+
51
+ @property
52
+ def grab(self): return self._grab
53
+
54
+ @grab.setter
55
+ def grab(self, value):
56
+ self._grab = value
57
+ if self._grab:
58
+ pg.event.set_grab(True)
59
+ pg.mouse.set_visible(False)
60
+ else:
61
+ pg.event.set_grab(False)
62
+ pg.mouse.set_visible(True)
basilisk/input/path.py ADDED
@@ -0,0 +1,14 @@
1
+ import os
2
+ import sys
3
+
4
+
5
+ # Credit for function: https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile
6
+ def get_root():
7
+ """ Get absolute path to resource, works for dev and for PyInstaller """
8
+ try:
9
+ # PyInstaller creates a temp folder and stores path in _MEIPASS
10
+ base_path = sys._MEIPASS
11
+ except Exception:
12
+ base_path = os.path.abspath(".")
13
+
14
+ return base_path + '/basilisk'
basilisk/mesh/mesh.py CHANGED
@@ -30,7 +30,7 @@ class Mesh():
30
30
  bvh: NarrowBVH
31
31
  """BVH for accessing triangle intersections with a line"""
32
32
 
33
- def __init__(self, data: str | os.PathLike | np.ndarray, custom_format:bool=False) -> None:
33
+ def __init__(self, data: str | os.PathLike | np.ndarray, custom_format:bool=False, generate_bvh: bool=True) -> None:
34
34
  """
35
35
  Mesh object containing all the data needed to render an object and perform physics/collisions on it
36
36
  Args:
@@ -102,7 +102,7 @@ class Mesh():
102
102
  self.center_of_mass /= self.volume
103
103
 
104
104
  # data structrues
105
- self.bvh = NarrowBVH(self)
105
+ self.bvh = NarrowBVH(self) if generate_bvh else None
106
106
 
107
107
  def get_inertia_tensor(self, scale: glm.vec3) -> glm.mat3x3:
108
108
  """
@@ -0,0 +1 @@
1
+ source[0][
@@ -0,0 +1,25 @@
1
+ #version 330 core
2
+
3
+ out vec4 fragColor;
4
+
5
+ in vec2 uv;
6
+
7
+ uniform sampler2D screenTexture;
8
+ uniform sampler2D bloomTexture;
9
+
10
+
11
+
12
+ void main()
13
+ {
14
+ const float gamma = 2.2;
15
+ const float exposure = 1.2;
16
+ vec3 hdrColor = texture(screenTexture, uv).rgb + texture(bloomTexture, uv).rgb / 2;
17
+
18
+ // exposure tone mapping
19
+ vec3 mapped = vec3(1.0) - exp(-hdrColor * exposure);
20
+ // gamma correction
21
+ mapped = pow(mapped, vec3(1.0 / gamma));
22
+
23
+ fragColor = vec4(mapped, 1.0);
24
+ //fragColor = texture(screenTexture, uv) + texture(bloomTexture, uv) / 20000.0;
25
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: basilisk-engine
3
- Version: 0.1.48
3
+ Version: 0.1.50
4
4
  Summary: Python 3D Framework
5
5
  Home-page: https://basilisk-website.vercel.app/
6
6
  Author: Name
@@ -1,6 +1,6 @@
1
1
  basilisk/__init__.py,sha256=23OM1kiXMU44J2TVp66efVSrbQAeiuTDmcdhNAftFfY,1134
2
2
  basilisk/config.py,sha256=Ajm3BjCryuX5bmJglqRZDR1SjE0sDjTbulta5GZ67hA,1712
3
- basilisk/engine.py,sha256=rUI4DCeCFCMPBxd-A3DSZKHXu-CVb1I3F5nJ6MhNrU4,6016
3
+ basilisk/engine.py,sha256=QwKGhnxAulGsMmIIUrY80fUnbWVe-Y2-t2d8PH2xP4c,6025
4
4
  basilisk/scene.py,sha256=S0aoVMxA3SEO0ON3MTs1GF1JVLMi_TX7KNconeCAbYc,12389
5
5
  basilisk/audio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  basilisk/audio/sound.py,sha256=h2dQ3IKb_SRKNZqNuk-fdNg_Xfz0P7sqEXA33qiBXG4,692
@@ -26,8 +26,8 @@ basilisk/collisions/narrow/helper.py,sha256=2UV6upLEcdvmV3IUBogc_YQFHLQFrCuObBiq
26
26
  basilisk/collisions/narrow/line_intersections.py,sha256=hZCXAeAGbs9adGraa6tHUOlivGERo-WVdrNjmHFMjh4,4523
27
27
  basilisk/collisions/narrow/sutherland_hodgman.py,sha256=8FOrqxCApsQTmw4n_meSaLIzc5s_dD4tMJTHahzaZ-A,3065
28
28
  basilisk/draw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- basilisk/draw/draw.py,sha256=bbmx_q8GyDhWELDBTfy16e7Y-22amVyoTcf8orwveKw,3520
30
- basilisk/draw/draw_handler.py,sha256=9ueMTCPwvO8u5I9gJborCbawxebHnkfxou73ZLJidCk,6188
29
+ basilisk/draw/draw.py,sha256=qBx4RDVnAu0nDqk9bLs1nxXVz1BGl-L6QXOKg5Zw0ho,3534
30
+ basilisk/draw/draw_handler.py,sha256=C1Ma-9nxwQuom7lX2OhF4X65jB5V77MHnKOKpaHnt4g,6190
31
31
  basilisk/draw/font_renderer.py,sha256=esCaQ4rJ3kjeIZ0xr510k2JIE_K9bshO9_OkByYNo_0,1064
32
32
  basilisk/generic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  basilisk/generic/abstract_bvh.py,sha256=BZv9mgkUpNu3bcqmn9I60VqMZocebeyUOoER2Wdky3g,368
@@ -41,6 +41,9 @@ basilisk/generic/quat.py,sha256=gEqvQvNwx5K7e0zqY0TFTAFtNFSkOatleoP9HQQ-xyk,5102
41
41
  basilisk/generic/quat_methods.py,sha256=SO18ush7pfeGUmncPy4i5nsab1e_zkQkY6zT1bAsSDY,234
42
42
  basilisk/generic/raycast_result.py,sha256=waVmS9fYhLoz_G_DU2Mj7896rF0Xy_59JVGALq-kD7g,783
43
43
  basilisk/generic/vec3.py,sha256=AtPSz2S1ZqAm-sZUz4phB09hgFxMIsJnQdU1wmxiOBw,5137
44
+ basilisk/input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
+ basilisk/input/mouse.py,sha256=waXJLIyka4IVe3W2WH5SNNxiOQRouYo3NxafP3fg0qg,1937
46
+ basilisk/input/path.py,sha256=GpFYe3Uu6VZAuKh9Q2nQM1H8immiCp_snznLG9FKcvU,441
44
47
  basilisk/input_output/IO_handler.py,sha256=DDQEjmIHzWo99rk1riT_QJKGQ5F8-lOilmchRXeQuYI,2822
45
48
  basilisk/input_output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
49
  basilisk/input_output/clock.py,sha256=GHTagpPyPlLjWyonaHV8M-nPCcdHcHL4JobbuUOxYf0,1462
@@ -49,7 +52,7 @@ basilisk/input_output/mouse.py,sha256=SqkUtfYTW252DXXHS1dDaytFWChsuYGEQ238jUIfOW
49
52
  basilisk/input_output/path.py,sha256=GpFYe3Uu6VZAuKh9Q2nQM1H8immiCp_snznLG9FKcvU,441
50
53
  basilisk/mesh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
54
  basilisk/mesh/cube.py,sha256=PN6JvW3T8LzPYRnaGo6wsisRK0QI-ZbvMYDT9xs7iN8,1044
52
- basilisk/mesh/mesh.py,sha256=eEBCOSl8fn_VAHowojlkwzckZ7qAyDdneYSJHa2Lk48,9757
55
+ basilisk/mesh/mesh.py,sha256=ujPisedr2TR33O_SHynle84LDRE9qSCKyGGpiPCGokA,9808
53
56
  basilisk/mesh/mesh_from_data.py,sha256=puRa8ycBjX2LbQB-ZOjJiXuNHh16laWgSqbgjHdlhcQ,4988
54
57
  basilisk/mesh/model.py,sha256=qm1lo23nBjkR-JxXvHzIO3DLa2bNWsMRX4Ilm_5uemY,11722
55
58
  basilisk/mesh/narrow_aabb.py,sha256=oMB_djlWOxpLAsuxeA8_KQafSOcRkDMCu5okvPYuLMQ,3779
@@ -84,10 +87,12 @@ basilisk/render/post_process.py,sha256=QAIwNccycEJqA1UVGKUqwVus11sJX9qm3Mjl0gdGY
84
87
  basilisk/render/shader.py,sha256=xh2p8kPFCPD479wyf6X3NUsgGfy3sbnSypNqFd8k83c,4870
85
88
  basilisk/render/shader_handler.py,sha256=Tk-wbejg7UhXyq1c9pHjb-590zqAakNLCZu2ZbKCCAs,3260
86
89
  basilisk/render/sky.py,sha256=10kPdEpo8l7s8Iz-XP0W9_CXAHTANHZ3BRjzkdPVTnQ,4786
90
+ basilisk/render/tempCodeRunnerFile.py,sha256=ep1eVZzUd30SDCNE5l3OJsqp2fW2LEXrjYGW31AMWgw,10
87
91
  basilisk/shaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
92
  basilisk/shaders/batch.frag,sha256=F_rGIQaY5jfep3WTCNY9Q3uLfu2lNuUSZZR7GZy_HCk,9514
89
93
  basilisk/shaders/batch.vert,sha256=LYzcqcwCyCpnxF5V-ilx79HU2cYz66hylBmZChcVmos,5555
90
94
  basilisk/shaders/bloom_downsample.frag,sha256=rIQTnBkSNiTF57D-yvWwQv_3_PmxznquHdlma8ua8Uw,685
95
+ basilisk/shaders/bloom_frame.frag,sha256=Y0m8DnQKz3G9FKq7VjCGrVXZw2vSigyGX7-tlxZN0lE,567
91
96
  basilisk/shaders/bloom_upsample.frag,sha256=Pe1AupjM2OCMieW7oEYHoEx2LhbPtbpwcylruF5Ntm4,1156
92
97
  basilisk/shaders/crt.frag,sha256=ss6xhXwwOH9bXEhqyim--K4o1BOo1Wwq6tGAwjpRHEQ,1043
93
98
  basilisk/shaders/draw.frag,sha256=rcPmGMh850M1ypcFNlJCyFWxfZ739lVNl6OPTxPIYIE,605
@@ -104,7 +109,7 @@ basilisk/shaders/particle.frag,sha256=IskhyXelHs9GqABKwTYSwooWL0nP-nkmXl6a5iT6Q3
104
109
  basilisk/shaders/particle.vert,sha256=oiBz6S_2dzqioAhyzVYT1ZKOED4h4R6IoP-UJ8KRHhU,3227
105
110
  basilisk/shaders/sky.frag,sha256=dJRdSbg16aZYYjxdoG1spVQRIVBGNVdyX0rqp4ER6v8,556
106
111
  basilisk/shaders/sky.vert,sha256=oAnrknEgsd9MawE_zx8P0u9nUSFEBYBg5ykBmWpqZ_g,332
107
- basilisk_engine-0.1.48.dist-info/METADATA,sha256=_wxLpAUqXDb-OlfIVhY4Thf0tJevXUSw9Pis_hK4pMY,3793
108
- basilisk_engine-0.1.48.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
109
- basilisk_engine-0.1.48.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
110
- basilisk_engine-0.1.48.dist-info/RECORD,,
112
+ basilisk_engine-0.1.50.dist-info/METADATA,sha256=L3N_TMqX5mZEcWt6L9h9ZA9KEAlGH04kd4RqtsdW0a4,3793
113
+ basilisk_engine-0.1.50.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
114
+ basilisk_engine-0.1.50.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
115
+ basilisk_engine-0.1.50.dist-info/RECORD,,