basilisk-engine 0.1.9__py3-none-any.whl → 0.1.11__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/batch.py CHANGED
@@ -75,6 +75,25 @@ class Batch():
75
75
 
76
76
  return True
77
77
 
78
+ def swap_shader(self, shader):
79
+ """
80
+ Swap the shader without rebatching
81
+ """
82
+
83
+ # Check there is actually something to swap
84
+ if not self.vao: return
85
+
86
+ # Release old data
87
+ self.vao.release()
88
+
89
+ # Make new vao with old data
90
+ self.program = shader.program
91
+ self.vao = self.ctx.vertex_array(self.program, [(self.vbo,
92
+ '3f 2f 3f 3f 3f 3f 4f 3f 1f',
93
+ *['in_position', 'in_uv', 'in_normal', 'in_tangent', 'in_bitangent', 'obj_position', 'obj_rotation', 'obj_scale', 'obj_material'])],
94
+ skip_errors=True)
95
+
96
+
78
97
  def __repr__(self) -> str:
79
98
  return f'<Basilisk Batch | {self.chunk.chunk_key}, {self.vbo.size / 1024 / 1024} mb>'
80
99
 
basilisk/render/chunk.py CHANGED
@@ -89,6 +89,13 @@ class Chunk():
89
89
  if shader: return shader.program
90
90
  return self.chunk_handler.engine.shader.program
91
91
 
92
+ def swap_shader(self, shader):
93
+ """
94
+ Swaps the batches shader to the given shader
95
+ """
96
+
97
+ self.batch.swap_shader(shader)
98
+
92
99
  def __repr__(self) -> str:
93
100
  return f'<Basilisk Chunk | {self.position}, {len(self.nodes)} nodes, {"static" if self.static else "dynamic"}>'
94
101
 
@@ -152,4 +152,15 @@ class ChunkHandler():
152
152
  render_range_z[1] -= render_distance * (270 - fov < self.scene.camera.yaw < 270 + fov) - 1
153
153
  render_range_z[0] += render_distance * (90 - fov < self.scene.camera.yaw < 90 + fov) - 1
154
154
 
155
- return (render_range_x, render_range_y, render_range_z)
155
+ return (render_range_x, render_range_y, render_range_z)
156
+
157
+ def swap_default(self, shader):
158
+ """
159
+ Swaps the shader of the default chunks
160
+ """
161
+
162
+ group = self.shader_groups[None]
163
+ for chunk in group[0].values():
164
+ chunk.swap_shader(shader)
165
+ for chunk in group[1].values():
166
+ chunk.swap_shader(shader)
basilisk/render/shader.py CHANGED
@@ -94,7 +94,8 @@ class Shader:
94
94
  """
95
95
 
96
96
  self.engine.scene.shader_handler.add(self)
97
- self.engine.scene.node_handler.chunk_handler.update_all()
97
+ # self.engine.scene.node_handler.chunk_handler.update_all()
98
+ self.engine.scene.node_handler.chunk_handler.swap_default(self)
98
99
 
99
100
  def write(self, name: str, value) -> None:
100
101
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: basilisk-engine
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Summary: Python 3D Framework
5
5
  Home-page: https://basilisk-website.vercel.app/
6
6
  Author: Name
@@ -64,10 +64,10 @@ basilisk/physics/impulse.py,sha256=zv6MoGTSlu8qVbsbe2QxERGeyQZYbtzR_WVSqVLsmhw,5
64
64
  basilisk/physics/physics_body.py,sha256=_mi-AVMgQqUsC3bQIca5tgk2xWXTIUw0D_uC4DcQqqs,1508
65
65
  basilisk/physics/physics_engine.py,sha256=IPMshr4j5TII5JdcRqiULc6BfkeCLPxdICKqQeZGAtY,1735
66
66
  basilisk/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
- basilisk/render/batch.py,sha256=Vmsm7zA2xi2xE4KKutxkasYfhnRNfyF8CI_HBIZNBIc,2998
67
+ basilisk/render/batch.py,sha256=VvcKXNmiPxdQ92jzoARPGhLujUGomm6nQX7f7rkoyAQ,3775
68
68
  basilisk/render/camera.py,sha256=FOJOVKaYsX2kfBZRlGTAurBHwH85aCqcXpn92ldgN_M,7587
69
- basilisk/render/chunk.py,sha256=YNtoXrZN175u0USSCkpO3_0FiMrBIoaqMZl9XAoJLAA,2656
70
- basilisk/render/chunk_handler.py,sha256=-vlrlEDqZIoBom2YK8c1yu9sGb7AHH-IbkI4IWYYd5Y,6168
69
+ basilisk/render/chunk.py,sha256=R6Jlugxisnl_jkxp0KYkwTt9lzmz-IFCOgdSqGMBf1c,2824
70
+ basilisk/render/chunk_handler.py,sha256=KY-AqnydAc4ae2yKUsLrjs1GdvjoGdZbyXmSSnTtOFY,6497
71
71
  basilisk/render/frame.py,sha256=cYeuEAyiMwXUQZgHfNPGEH43zZfrmNXyOpCjxtz2Ji8,3292
72
72
  basilisk/render/framebuffer.py,sha256=wuYKIzKxkzuYnCxo2ufIdN8FceoZcb4pgVB0Xz6LGO8,4430
73
73
  basilisk/render/image.py,sha256=e5EDImMdqkdSeK76cPiTPH9TRdIfUZ_HljiP4EQMedo,2961
@@ -77,7 +77,7 @@ basilisk/render/light_handler.py,sha256=Le5InqqjgglSXUu7MwkVVsb7WbNJeRkRKldYDQGr
77
77
  basilisk/render/material.py,sha256=JmmwCxSYkPLHw73bH-7SzPo5ewzbU3QPTIvI_2pInXQ,9655
78
78
  basilisk/render/material_handler.py,sha256=dbfQs0u7qkEan0e0FsnqPpxbmkSNAQmH2B9jv4vx-bs,4242
79
79
  basilisk/render/post_process.py,sha256=Ks9HhGNBEeTkv9g7l7vPOEVOnOBu_gGDW2UaJaTN2I0,4926
80
- basilisk/render/shader.py,sha256=uFV1gv-MiWRG-nvv2akB0K2SrADWQ54vBYqHeJoy0PY,3913
80
+ basilisk/render/shader.py,sha256=C4LtkAqC_QE1I9ftiFBTsCNM9uv811gOAyriXuqGRKk,3988
81
81
  basilisk/render/shader_handler.py,sha256=YDl4XGsAUrA_JavmsG2nuoo6k8WyzKNsx20App-RVSk,2511
82
82
  basilisk/render/sky.py,sha256=TwLJ_6dYWCOAb06HZocrRdBzlbR6mQ0ojmmJgCC6im4,4910
83
83
  basilisk/shaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -97,7 +97,7 @@ basilisk/shaders/particle.frag,sha256=Cv8cWQpVVQvhZeWj3NqL0D5nLtSO3EWV0VzOU-ZVL4
97
97
  basilisk/shaders/particle.vert,sha256=ElXzT7ywiZ0SjrFcUistVDBi4wOobQ7_J5O7XVxrsVs,3027
98
98
  basilisk/shaders/sky.frag,sha256=vTmZ1Xsd601_gmeBRfLYodHuBoBDI-M_1IybRt0ZDFk,178
99
99
  basilisk/shaders/sky.vert,sha256=v_BSdnMiljSJGPqno-J_apAiom38IrBzbDoxM7pIgwI,345
100
- basilisk_engine-0.1.9.dist-info/METADATA,sha256=h1Q6Ltn2WzgCrewFwg6q1zW4CmWGuj-HxKxWhYGoJlA,1146
101
- basilisk_engine-0.1.9.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
102
- basilisk_engine-0.1.9.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
103
- basilisk_engine-0.1.9.dist-info/RECORD,,
100
+ basilisk_engine-0.1.11.dist-info/METADATA,sha256=xmPqNLfK1M4QUY_NF1ZrtS6v8FR59Eee7OD-Uo3bcgQ,1147
101
+ basilisk_engine-0.1.11.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
102
+ basilisk_engine-0.1.11.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
103
+ basilisk_engine-0.1.11.dist-info/RECORD,,