gamengine3d 1.0.1__tar.gz → 1.0.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gamengine3d
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A Unity-like 3D engine in Python using pygame
5
5
  Author-email: Samarth Javagal <samarthjavagal@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,33 @@
1
+
2
+ #version 330
3
+
4
+ struct Light {
5
+ vec3 position;
6
+ vec3 color;
7
+ float intensity;
8
+ };
9
+
10
+ #define MAX_LIGHTS 8
11
+ uniform int num_lights;
12
+ uniform Light lights[MAX_LIGHTS];
13
+ uniform float ambient;
14
+
15
+ in vec3 frag_pos;
16
+ in vec3 frag_normal;
17
+ in vec3 frag_color;
18
+
19
+ out vec4 f_color;
20
+
21
+ void main() {
22
+ vec3 normal = normalize(frag_normal);
23
+ vec3 color = frag_color / 255.0; // <-- convert vertex color to 0-1
24
+ vec3 result = ambient * color;
25
+
26
+ for (int i = 0; i < num_lights; i++) {
27
+ vec3 light_dir = normalize(lights[i].position - frag_pos);
28
+ float diff = max(dot(normal, light_dir), 0.0);
29
+ result += diff * lights[i].intensity * lights[i].color * color;
30
+ }
31
+
32
+ f_color = vec4(result, 1.0);
33
+ }
@@ -0,0 +1,20 @@
1
+
2
+ #version 330
3
+
4
+ in vec3 in_vert;
5
+ in vec3 in_color;
6
+ in vec3 in_normal;
7
+
8
+ out vec3 frag_pos;
9
+ out vec3 frag_normal;
10
+ out vec3 frag_color;
11
+
12
+ uniform mat4 mvp;
13
+ uniform mat4 model; // optional if you want model transforms
14
+
15
+ void main() {
16
+ frag_pos = vec3(model * vec4(in_vert, 1.0)); // world space position
17
+ frag_normal = mat3(transpose(inverse(model))) * in_normal; // transform normal
18
+ frag_color = in_color;
19
+ gl_Position = mvp * vec4(in_vert, 1.0);
20
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gamengine3d
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A Unity-like 3D engine in Python using pygame
5
5
  Author-email: Samarth Javagal <samarthjavagal@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -11,4 +11,6 @@ gamengine3d.egg-info/SOURCES.txt
11
11
  gamengine3d.egg-info/dependency_links.txt
12
12
  gamengine3d.egg-info/requires.txt
13
13
  gamengine3d.egg-info/top_level.txt
14
- gamengine3d/shaders/__init__.py
14
+ gamengine3d/shaders/__init__.py
15
+ gamengine3d/shaders/default.frag
16
+ gamengine3d/shaders/default.vert
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "gamengine3d"
8
- version = "1.0.1"
8
+ version = "1.0.2"
9
9
  description = "A Unity-like 3D engine in Python using pygame"
10
10
  authors = [
11
11
  { name = "Samarth Javagal", email = "samarthjavagal@gmail.com" }
@@ -32,4 +32,4 @@ where = ["."]
32
32
  include = ["gamengine3d*"]
33
33
 
34
34
  [tool.setuptools.package-data]
35
- "gamengine3d" = ["shaders/*.glsl"]
35
+ "gamengine3d" = ["shaders/*.vert", "shaders/*.frag"]
File without changes
File without changes
File without changes