basilisk-engine 0.1.37__py3-none-any.whl → 0.1.38__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/frame.py CHANGED
@@ -52,14 +52,15 @@ class Frame:
52
52
 
53
53
  if self.engine.event_resize: self.bloom.generate_bloom_buffers()
54
54
 
55
+ self.bloom.render()
56
+
55
57
  for process in self.post_processes:
56
- self.ping_pong_buffer = process.apply(self.framebuffer, self.ping_pong_buffer)
58
+ self.ping_pong_buffer = process.apply([('screenTexture', self.framebuffer)], self.ping_pong_buffer)
57
59
 
58
60
  temp = self.framebuffer
59
61
  self.framebuffer = self.ping_pong_buffer
60
62
  self.ping_pong_buffer = temp
61
63
 
62
- self.bloom.render()
63
64
  self.ctx.screen.use()
64
65
  self.shader.bind(self.framebuffer.texture, 'screenTexture', 0)
65
66
  self.shader.bind(self.bloom.texture, 'bloomTexture', 1)
@@ -35,7 +35,7 @@ class PostProcess:
35
35
 
36
36
  # Load Shaders
37
37
  self.shader = Shader(self.engine, self.engine.root + f'/shaders/frame.vert', frag)
38
- self.engine.scene.shader_handler.add(self.shader)
38
+ self.engine.shader_handler.add(self.shader)
39
39
 
40
40
  # Load VAO
41
41
  self.vbo = self.ctx.buffer(np.array([[-1, -1, 0, 0, 0], [1, -1, 0, 1, 0], [1, 1, 0, 1, 1], [-1, 1, 0, 0, 1], [-1, -1, 0, 0, 0], [1, 1, 0, 1, 1]], dtype='f4'))
@@ -49,15 +49,15 @@ class PostProcess:
49
49
  self.fbo.texture.filter = self.filter
50
50
 
51
51
 
52
- def apply(self, source: mgl.Texture | Image | Framebuffer, destination: mgl.Texture | Image | Framebuffer=None) -> mgl.Texture | Image | Framebuffer:
52
+ def apply(self, source: list[tuple[str, mgl.Texture]] | list[tuple[str, Image]] | list[tuple[str, Framebuffer]], destination: mgl.Texture | Image | Framebuffer=None) -> mgl.Texture | Image | Framebuffer:
53
53
  """
54
54
  Applies a post process shader to a texture source.
55
55
  Returns the modified texture or renders to the destination if given
56
56
  """
57
57
 
58
- if isinstance(source, Framebuffer): return self._apply_to_framebuffer(source, destination)
59
- elif isinstance(source, mgl.Texture): return self._apply_to_texture(source, destination)
60
- elif isinstance(source, Image): return self._apply_to_image(source, destination)
58
+ if isinstance(source[0][1], Framebuffer): return self._apply_to_framebuffer(source, destination)
59
+ elif isinstance(source[0][1], mgl.Texture): return self._apply_to_texture(source, destination)
60
+ elif isinstance(source[0][1], Image): return self._apply_to_image(source, destination)
61
61
 
62
62
  raise ValueError(f'PostProces.apply: Invalid postprocess source type {type(source)}')
63
63
 
@@ -74,8 +74,9 @@ class PostProcess:
74
74
  self.fbo.clear()
75
75
 
76
76
  # Load the source texture to the shader
77
- self.shader.program['screenTexture'] = 0
78
- source.use(location=0)
77
+ for i, src in enumerate(source):
78
+ self.shader.program[src[0]] = i
79
+ src[1].use(location=i)
79
80
 
80
81
  # Apply the post process
81
82
  self.vao.render()
@@ -93,12 +94,13 @@ class PostProcess:
93
94
  fbo.texture.filter = self.filter
94
95
  else:
95
96
  fbo = detination
96
- old_filter = fbo.filter
97
+ old_filter = fbo.texture_filter
97
98
  fbo.texture.filter = self.filter
98
99
 
99
100
  # Load the source texture to the shader
100
- self.shader.program['screenTexture'] = 0
101
- source.texture.use(location=0)
101
+ for i, src in enumerate(source):
102
+ self.shader.program[src[0]] = i
103
+ src[1].texture.use(location=i)
102
104
 
103
105
  fbo.use()
104
106
  fbo.clear()
@@ -137,4 +139,9 @@ class PostProcess:
137
139
 
138
140
  # Make an image from the texture
139
141
  image = Image()
140
- return image
142
+ return image
143
+
144
+ def __del__(self):
145
+ if self.vao: self.vao.release()
146
+ if self.vbo: self.vbo.release()
147
+ if self.fbo: self.fbo.release()
@@ -0,0 +1 @@
1
+ source[0][
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: basilisk-engine
3
- Version: 0.1.37
3
+ Version: 0.1.38
4
4
  Summary: Python 3D Framework
5
5
  Home-page: https://basilisk-website.vercel.app/
6
6
  Author: Name
@@ -72,7 +72,7 @@ basilisk/render/bloom.py,sha256=VX-8k1ySGNX8OCo-29ph4MPWPXYZuSPLrKwa3seaK98,4184
72
72
  basilisk/render/camera.py,sha256=Bzyqp1ESNqjTR03hZIhil7pU1In5JDz-7sCj1Pter-M,9909
73
73
  basilisk/render/chunk.py,sha256=yFAflMaiOKH3Fl7cBIm4RGtOhXwYyVIFTO4_UgBX9x8,2866
74
74
  basilisk/render/chunk_handler.py,sha256=zJPYv3vw6_mtYQ0fW46j87dGrZENMBcRuHFzFOxqY-Q,6572
75
- basilisk/render/frame.py,sha256=YQl_73PPgWmwhPSe9HHdh-1Kve9_I2w800aDtz4dMAA,3525
75
+ basilisk/render/frame.py,sha256=_8G1nUlK7QmUoOHUrEAGp5qbXvN5Jot2osgUXJ15jpc,3556
76
76
  basilisk/render/framebuffer.py,sha256=3A7k9vhtInMNwrhY3l3DydjGhivLz9hH_DwNNFSpKOM,7209
77
77
  basilisk/render/image.py,sha256=r-khPFJkZS8D0n_I4HeKk72lzbHeEYEM0Cp-KuR22Jk,4104
78
78
  basilisk/render/image_handler.py,sha256=CJyel7POIserAoLQ8YCc3SY24zia2ry6P3wMNK0-Vms,4295
@@ -80,10 +80,11 @@ basilisk/render/light.py,sha256=hFqODv9iK4GEDZeDyBHxOWwwd4v8Pm089_xoScBMjVY,3879
80
80
  basilisk/render/light_handler.py,sha256=baJ1p0ob_5OK2Dyd5zZYcldAGWUyVlF21dp_Yfopyd8,2162
81
81
  basilisk/render/material.py,sha256=umGdE-wI8CEXTArPzZc5rmyHKendsQWkOkpb0l5B6m8,10304
82
82
  basilisk/render/material_handler.py,sha256=dXdJeH4h9m6dJRrAsm-aGDtNzlvDcAtdX3pEgKg4wzA,4198
83
- basilisk/render/post_process.py,sha256=w71zgvnc1VyQAK7xTAyEe1FsUBDzch_6TrkhxZ27MgA,5098
83
+ basilisk/render/post_process.py,sha256=RQCk8E0Xr4QUGDDYH-OfNQCDnjy6VTs_7YoniGGxIWU,5407
84
84
  basilisk/render/shader.py,sha256=jgVuFe4TjV6IMtEnVknYQ78RdKq8ZybDIFP9usNjgeY,4954
85
85
  basilisk/render/shader_handler.py,sha256=k3pbbBBUxDlgwD0c_dhtn2bOXQMMAKzeRiZxDvychgc,2931
86
86
  basilisk/render/sky.py,sha256=tu4ldzQpGjhS8SgooGo9lQZFNbog6-M43ju7vV95iE8,4888
87
+ basilisk/render/tempCodeRunnerFile.py,sha256=ep1eVZzUd30SDCNE5l3OJsqp2fW2LEXrjYGW31AMWgw,10
87
88
  basilisk/shaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
89
  basilisk/shaders/batch.frag,sha256=Iz0FugHCv8yjTZdTXBVTNqaSv1-YXB02Un2h1EMu2xA,9830
89
90
  basilisk/shaders/batch.vert,sha256=xh-9DWRVi5ySMl23vqSEueGDdz1K_2RT9CKMtlY-xmA,5672
@@ -104,7 +105,7 @@ basilisk/shaders/particle.frag,sha256=XZurKUl0oK9sfXXTa1-6rsGS7qBsuQSKajKN4tbMFa
104
105
  basilisk/shaders/particle.vert,sha256=NbA_WKpxx1IAQt5wso5dZAZRqwVlejPjNdFg_GeJXEE,3313
105
106
  basilisk/shaders/sky.frag,sha256=Fr9SQHPKPV9a1mgSeprSiOaFjPrQX9qqZu3Uc_fQT0c,579
106
107
  basilisk/shaders/sky.vert,sha256=v_BSdnMiljSJGPqno-J_apAiom38IrBzbDoxM7pIgwI,345
107
- basilisk_engine-0.1.37.dist-info/METADATA,sha256=Jp9eDTsE97VPyajGxujwXUWp4I6mT3guZQZoPxDpVmg,3882
108
- basilisk_engine-0.1.37.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
109
- basilisk_engine-0.1.37.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
110
- basilisk_engine-0.1.37.dist-info/RECORD,,
108
+ basilisk_engine-0.1.38.dist-info/METADATA,sha256=irGGvAh5prOpzl05k8k0_ScC3LpkrK-6xqF_EzOGhW4,3882
109
+ basilisk_engine-0.1.38.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
110
+ basilisk_engine-0.1.38.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
111
+ basilisk_engine-0.1.38.dist-info/RECORD,,