basilisk-engine 0.1.46__py3-none-any.whl → 0.1.48__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/render/image.py CHANGED
@@ -22,25 +22,29 @@ class Image():
22
22
  texture: mgl.Texture | None=None
23
23
  """Texture of the image. Only created and retrived if needed by other module"""
24
24
 
25
- def __init__(self, path: str | os.PathLike | pg.Surface | mgl.Texture) -> None:
25
+ def __init__(self, path: str | os.PathLike | pg.Surface | mgl.Texture, flip_x: bool=False, flip_y: bool=True) -> None:
26
26
  """
27
27
  A basilisk image object that contains a moderngl texture
28
28
  Args:
29
29
  path: str | os.PathLike | pg.Surface
30
30
  The string path to the image. Can also read a pygame surface
31
+ flip_x: bool=True
32
+ Flips the image vertically. Should be True for using the internal cube lmao
33
+ flip_y: bool=True
34
+ Flips the image vertically. Should be True for blender imports
31
35
  """
32
36
 
33
37
  # Check if the user is loading a pygame surface
34
38
  if isinstance(path, str) or isinstance(path, os.PathLike):
35
- return self._from_path(path)
39
+ return self._from_path(path, flip_x, flip_y)
36
40
  elif isinstance(path, pg.Surface):
37
- return self._from_surface(path)
41
+ return self._from_surface(path, flip_x, flip_y)
38
42
  elif isinstance(path, mgl.Texture):
39
- return self._from_texture(path)
43
+ return self._from_texture(path, flip_x, flip_y)
40
44
 
41
45
  raise TypeError(f'Invalid path type: {type(path)}. Expected a string or os.PathLike')
42
46
 
43
- def _from_path(self, path: str | os.PathLike) -> None:
47
+ def _from_path(self, path: str | os.PathLike, flip_x: bool=False, flip_y: bool=True) -> None:
44
48
  """
45
49
  Loads a basilisk image from a pygame surface
46
50
  Args:
@@ -51,6 +55,8 @@ class Image():
51
55
 
52
56
  # Load image
53
57
  img = PIL_Image.open(path).convert('RGBA')
58
+ if flip_x: img = img.transpose(PIL_Image.FLIP_LEFT_RIGHT)
59
+ if flip_y: img = img.transpose(PIL_Image.FLIP_TOP_BOTTOM)
54
60
  # Set the size in one of the size buckets
55
61
  size_buckets = texture_sizes
56
62
  self.size = size_buckets[np.argmin(np.array([abs(size - img.size[0]) for size in size_buckets]))]
@@ -61,11 +67,13 @@ class Image():
61
67
  # Default index value (to be set by image handler)
62
68
  self.index = glm.ivec2(1, 1)
63
69
 
64
- def _from_surface(self, surf: pg.Surface) -> None:
70
+ def _from_surface(self, surf: pg.Surface, flip_x: bool=False, flip_y: bool=True) -> None:
65
71
  """
66
72
  Loads a basilisk image from a pygame surface
67
73
  Args:
68
74
  """
75
+
76
+ surf = pg.transform.flip(surf, flip_x, flip_y)
69
77
 
70
78
  # Set the size in one of the size buckets
71
79
  size_buckets = texture_sizes
@@ -77,7 +85,7 @@ class Image():
77
85
  # Default index value (to be set by image handler)
78
86
  self.index = glm.ivec2(1, 1)
79
87
 
80
- def _from_texture(self, texture: mgl.Texture):
88
+ def _from_texture(self, texture: mgl.Texture, flip_x: bool=False, flip_y: bool=True):
81
89
  """
82
90
 
83
91
  """
basilisk/render/sky.py CHANGED
@@ -26,11 +26,11 @@ class Sky:
26
26
  """
27
27
  self.vao.render()
28
28
 
29
- def write(self):
29
+ def write(self, target: ...=None):
30
30
  # Write the texture cube to the sky shader
31
31
  self.shader.bind(self.texture_cube, 'skyboxTexture', 8)
32
32
 
33
- shader = self.engine.shader
33
+ shader = target if target else self.scene.shader
34
34
  if 'skyboxTexture' not in shader.uniforms: return
35
35
  shader.bind(self.texture_cube, 'skyboxTexture', 8)
36
36
 
basilisk/scene.py CHANGED
@@ -40,6 +40,7 @@ class Scene():
40
40
 
41
41
  self.engine = engine
42
42
  self.ctx = engine.ctx
43
+ self.sky = None
43
44
  self.shader = shader if shader else engine.shader
44
45
  self.camera = FreeCamera()
45
46
  self.light_handler = LightHandler(self)
@@ -287,4 +288,5 @@ class Scene():
287
288
  def shader(self, value):
288
289
  self._shader = value
289
290
  value.set_main(self)
290
- if self.light_handler: self.light_handler.write(value)
291
+ if self.light_handler: self.light_handler.write(value)
292
+ if self.sky: self.sky.write()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: basilisk-engine
3
- Version: 0.1.46
3
+ Version: 0.1.48
4
4
  Summary: Python 3D Framework
5
5
  Home-page: https://basilisk-website.vercel.app/
6
6
  Author: Name
@@ -1,7 +1,7 @@
1
1
  basilisk/__init__.py,sha256=23OM1kiXMU44J2TVp66efVSrbQAeiuTDmcdhNAftFfY,1134
2
2
  basilisk/config.py,sha256=Ajm3BjCryuX5bmJglqRZDR1SjE0sDjTbulta5GZ67hA,1712
3
3
  basilisk/engine.py,sha256=rUI4DCeCFCMPBxd-A3DSZKHXu-CVb1I3F5nJ6MhNrU4,6016
4
- basilisk/scene.py,sha256=tb7SyK_BaG5JXqKFAifT3nSx0dNS7-zX4RSEUE-2uX8,12324
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
7
7
  basilisk/bsk_assets/Roboto-Regular.ttf,sha256=kqYnZjMRQMpbyLulIChCLSdgYa1XF8GsUIoRi2Gcauw,168260
@@ -74,7 +74,7 @@ basilisk/render/chunk.py,sha256=WZ5cC-FPndbkdWEQLQ0v9tBvybjbbLMjXLJC2mYnXfA,2927
74
74
  basilisk/render/chunk_handler.py,sha256=-Hozyus67mgJ8fTWx3fsLezFVt3W4d-I0I1ai29odWA,6405
75
75
  basilisk/render/frame.py,sha256=EIdqo49ztcNCqB4E7PxkcwgUMv9BDdl_RsNKKTw8P2Y,4128
76
76
  basilisk/render/framebuffer.py,sha256=8QVpnh0mPfbtkSF9McqmlK9i77Q-hpjWmvx8Ff73vp8,6871
77
- basilisk/render/image.py,sha256=d-5RGr-TlsGqvI-GQ8_pV-FNdmTzD0mlk2K3K4XNuwQ,3984
77
+ basilisk/render/image.py,sha256=xqBSYqV5iy_QDiu8cs_KzrBE49NTMPim_7qInKaHJGk,4607
78
78
  basilisk/render/image_handler.py,sha256=K3cTm9GNVCT0GfN874AqNRGsRfrTr8VZJbNO7J1tXAY,4183
79
79
  basilisk/render/light.py,sha256=SOOh5zAGUCgQdJjWb5MlJgtvdxkEV8AWqQ4P93bJj2g,3783
80
80
  basilisk/render/light_handler.py,sha256=gvg4OhDMy8dZg5XNcOZB4_1G2uE1gBFRxlBeoG3l3vM,2104
@@ -83,7 +83,7 @@ basilisk/render/material_handler.py,sha256=mNgLNJCFYGqMwr0qZQiZ8mMwEXqvFgBMlHBFb
83
83
  basilisk/render/post_process.py,sha256=QAIwNccycEJqA1UVGKUqwVus11sJX9qm3Mjl0gdGYSo,6519
84
84
  basilisk/render/shader.py,sha256=xh2p8kPFCPD479wyf6X3NUsgGfy3sbnSypNqFd8k83c,4870
85
85
  basilisk/render/shader_handler.py,sha256=Tk-wbejg7UhXyq1c9pHjb-590zqAakNLCZu2ZbKCCAs,3260
86
- basilisk/render/sky.py,sha256=2HWv8_2tfJfCiLz6WVE3BnWSAi4Ttulks5l-IF9YG3g,4747
86
+ basilisk/render/sky.py,sha256=10kPdEpo8l7s8Iz-XP0W9_CXAHTANHZ3BRjzkdPVTnQ,4786
87
87
  basilisk/shaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  basilisk/shaders/batch.frag,sha256=F_rGIQaY5jfep3WTCNY9Q3uLfu2lNuUSZZR7GZy_HCk,9514
89
89
  basilisk/shaders/batch.vert,sha256=LYzcqcwCyCpnxF5V-ilx79HU2cYz66hylBmZChcVmos,5555
@@ -104,7 +104,7 @@ basilisk/shaders/particle.frag,sha256=IskhyXelHs9GqABKwTYSwooWL0nP-nkmXl6a5iT6Q3
104
104
  basilisk/shaders/particle.vert,sha256=oiBz6S_2dzqioAhyzVYT1ZKOED4h4R6IoP-UJ8KRHhU,3227
105
105
  basilisk/shaders/sky.frag,sha256=dJRdSbg16aZYYjxdoG1spVQRIVBGNVdyX0rqp4ER6v8,556
106
106
  basilisk/shaders/sky.vert,sha256=oAnrknEgsd9MawE_zx8P0u9nUSFEBYBg5ykBmWpqZ_g,332
107
- basilisk_engine-0.1.46.dist-info/METADATA,sha256=EKpZDCMzIALAWkQjmiKgUDcgLJdDdRg68dq2GL32rfY,3793
108
- basilisk_engine-0.1.46.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
109
- basilisk_engine-0.1.46.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
110
- basilisk_engine-0.1.46.dist-info/RECORD,,
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,,