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

@@ -44,10 +44,11 @@ class DrawHandler():
44
44
  if not self.draw_data: return
45
45
 
46
46
  self.ctx.enable(mgl.BLEND)
47
- self.ctx.blend_func = mgl.ADDITIVE_BLENDING
47
+ self.ctx.disable(mgl.DEPTH_TEST)
48
+ self.ctx.blend_func = mgl.DEFAULT_BLENDING
48
49
 
49
50
  # Reverse the draw order, and convert to C-like array
50
- self.draw_data.reverse()
51
+ # self.draw_data.reverse()
51
52
  data = np.array(self.draw_data, dtype='f4')
52
53
  ratio = np.array([2 / self.engine.win_size[0], 2 / self.engine.win_size[1]])
53
54
  data[:,:2] = data[:,:2] * ratio - 1
@@ -67,6 +68,8 @@ class DrawHandler():
67
68
  self.draw_data.clear()
68
69
 
69
70
  self.ctx.disable(mgl.BLEND)
71
+ self.ctx.enable(mgl.DEPTH_TEST)
72
+
70
73
 
71
74
  def draw_rect(self, color: tuple, rect: tuple) -> None:
72
75
  """
@@ -87,8 +90,8 @@ class DrawHandler():
87
90
  v4 = (*p4, *color, 0, 0.0)
88
91
 
89
92
  self.draw_data.extend([
90
- v1, v3, v2,
91
- v2, v3, v4
93
+ v1, v2, v3,
94
+ v2, v4, v3
92
95
  ])
93
96
 
94
97
  def draw_circle(self, color: tuple, center: tuple, radius: int, resolution: int=20, outer_color: tuple=None) -> None:
@@ -118,7 +121,7 @@ class DrawHandler():
118
121
  v2 = (center[0] + radius * cos(theta), center[1] + radius * sin(theta), *outer_color, 0, 0.0)
119
122
  theta += delta_theta
120
123
  v3 = (center[0] + radius * cos(theta), center[1] + radius * sin(theta), *outer_color, 0, 0.0)
121
- self.draw_data.extend([v1, v2, v3])
124
+ self.draw_data.extend([v1, v3, v2])
122
125
 
123
126
  def draw_line(self, color: tuple, p1: tuple, p2: tuple, thickness: int=1):
124
127
  """
@@ -150,7 +153,7 @@ class DrawHandler():
150
153
  v3 = (*(p2 - perp_vector), *color, 0, 0.0)
151
154
  v4 = (*(p2 + perp_vector), *color, 0, 0.0)
152
155
 
153
- self.draw_data.extend([v1, v3, v4, v2, v1, v4])
156
+ self.draw_data.extend([v1, v4, v3, v2, v4, v1])
154
157
 
155
158
  def blit(self, image: Image, rect: tuple, alpha: float=1.0):
156
159
  rect = validate_rect(rect)
@@ -166,8 +169,8 @@ class DrawHandler():
166
169
  v4 = (*p4, *image.index, 1, 1, 1, alpha)
167
170
 
168
171
  self.draw_data.extend([
169
- v1, v3, v2,
170
- v2, v3, v4
172
+ v1, v2, v3,
173
+ v2, v4, v3
171
174
  ])
172
175
 
173
176
  def __del__(self) -> None:
basilisk/engine.py CHANGED
@@ -142,13 +142,12 @@ class Engine():
142
142
  self._update()
143
143
  if not self.running: return
144
144
 
145
-
146
145
  # Clear the screen and render the frame
147
146
  if render:
148
147
  # Render all draw calls from the past frame
149
148
  self.ctx.screen.use()
150
149
  self.draw_handler.render()
151
- self.frame.render()
150
+ # self.frame.render()
152
151
 
153
152
  # Even though we may not render here, the user might be rendering in their file, so we need to flip
154
153
  pg.display.flip()
@@ -270,20 +270,23 @@ void main() {
270
270
  lightResult.diffuse *= mix(vec3(1.0), ambient_sky, 0.25);
271
271
  lightResult.diffuse *= ao;
272
272
 
273
- vec3 finalColor = albedo * 0.3 * mix(vec3(1.0), reflect_sky, mtl.metallicness);
274
- finalColor += (lightResult.diffuse + lightResult.specular + lightResult.clearcoat);
275
-
276
- // Output fragment color
277
- float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722)) + dot(lightResult.specular, vec3(.2)) + dot(mtl.emissiveColor, vec3(1));
278
- fragColor = vec4(finalColor + mtl.emissiveColor, 1.0);
279
-
280
- normalTexture = vec4(abs(N), 1.0);
273
+ vec3 finalColor = lightResult.diffuse + lightResult.specular + lightResult.clearcoat;
281
274
 
275
+ float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722)) + dot(lightResult.specular, vec3(.15)) + dot(mtl.emissiveColor, vec3(1));
282
276
  // Filter out bright pixels for bloom
283
- if (brightness > 0.5) {
284
- bloomColor = vec4(fragColor.rgb, 1.0);
277
+ float threshold = 0.5;
278
+ if (brightness > threshold) {
279
+ bloomColor = vec4(max(finalColor + mtl.emissiveColor - threshold, 0.0), 1.0);
285
280
  }
286
281
  else{
287
282
  bloomColor = vec4(0.0, 0.0, 0.0, 1.0);
288
283
  }
284
+
285
+
286
+ // Output fragment color
287
+ finalColor += albedo * 0.3 * mix(vec3(1.0), reflect_sky, mtl.metallicness) + mtl.emissiveColor;
288
+ fragColor = vec4(finalColor, 1.0);
289
+
290
+ normalTexture = vec4(abs(N), 1.0);
291
+
289
292
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: basilisk-engine
3
- Version: 0.1.44
3
+ Version: 0.1.45
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=xuah50P1y6fgllWvi75pLtDL2plf-GGSoZY4lQFLdSo,6002
3
+ basilisk/engine.py,sha256=OCl5urlFMnGncXpR3Ur6dZRl5jwfNGxrYUA37AKTGQA,6003
4
4
  basilisk/scene.py,sha256=3grqRcytDCplwAMOmc7lIJOzKzQUtSEWwk94tpj4W4Q,12223
5
5
  basilisk/audio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  basilisk/audio/sound.py,sha256=h2dQ3IKb_SRKNZqNuk-fdNg_Xfz0P7sqEXA33qiBXG4,692
@@ -27,7 +27,7 @@ basilisk/collisions/narrow/line_intersections.py,sha256=hZCXAeAGbs9adGraa6tHUOli
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
29
  basilisk/draw/draw.py,sha256=bbmx_q8GyDhWELDBTfy16e7Y-22amVyoTcf8orwveKw,3520
30
- basilisk/draw/draw_handler.py,sha256=GzCKEkW7tUsufIF0ZaQYVrgY5LkZDBJD519_iduurgc,6105
30
+ basilisk/draw/draw_handler.py,sha256=9ueMTCPwvO8u5I9gJborCbawxebHnkfxou73ZLJidCk,6188
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
@@ -89,7 +89,7 @@ basilisk/render/shader_handler.py,sha256=Tk-wbejg7UhXyq1c9pHjb-590zqAakNLCZu2ZbK
89
89
  basilisk/render/sky.py,sha256=2HWv8_2tfJfCiLz6WVE3BnWSAi4Ttulks5l-IF9YG3g,4747
90
90
  basilisk/render/tempCodeRunnerFile.py,sha256=ep1eVZzUd30SDCNE5l3OJsqp2fW2LEXrjYGW31AMWgw,10
91
91
  basilisk/shaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
- basilisk/shaders/batch.frag,sha256=ATxjwTy-bhf5O1eEhmfh9uf4FjFUQ4IlYA4V6W1_TZw,9437
92
+ basilisk/shaders/batch.frag,sha256=F_rGIQaY5jfep3WTCNY9Q3uLfu2lNuUSZZR7GZy_HCk,9514
93
93
  basilisk/shaders/batch.vert,sha256=LYzcqcwCyCpnxF5V-ilx79HU2cYz66hylBmZChcVmos,5555
94
94
  basilisk/shaders/bloom_downsample.frag,sha256=rIQTnBkSNiTF57D-yvWwQv_3_PmxznquHdlma8ua8Uw,685
95
95
  basilisk/shaders/bloom_frame.frag,sha256=Y0m8DnQKz3G9FKq7VjCGrVXZw2vSigyGX7-tlxZN0lE,567
@@ -109,7 +109,7 @@ basilisk/shaders/particle.frag,sha256=IskhyXelHs9GqABKwTYSwooWL0nP-nkmXl6a5iT6Q3
109
109
  basilisk/shaders/particle.vert,sha256=oiBz6S_2dzqioAhyzVYT1ZKOED4h4R6IoP-UJ8KRHhU,3227
110
110
  basilisk/shaders/sky.frag,sha256=dJRdSbg16aZYYjxdoG1spVQRIVBGNVdyX0rqp4ER6v8,556
111
111
  basilisk/shaders/sky.vert,sha256=oAnrknEgsd9MawE_zx8P0u9nUSFEBYBg5ykBmWpqZ_g,332
112
- basilisk_engine-0.1.44.dist-info/METADATA,sha256=JwByp7SjP1rOiHU8QqqLsK4UYbF-Z_0uxd3h4LJxzqo,3793
113
- basilisk_engine-0.1.44.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
114
- basilisk_engine-0.1.44.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
115
- basilisk_engine-0.1.44.dist-info/RECORD,,
112
+ basilisk_engine-0.1.45.dist-info/METADATA,sha256=z9JGp3QkuPs50qbj5FwUvoBxqcEedoxaKESKdeIlwLY,3793
113
+ basilisk_engine-0.1.45.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
114
+ basilisk_engine-0.1.45.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
115
+ basilisk_engine-0.1.45.dist-info/RECORD,,