TurtleGL-3d 1.4.1__tar.gz → 1.4.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.
- {turtlegl_3d-1.4.1/src/TurtleGL_3d.egg-info → turtlegl_3d-1.4.2}/PKG-INFO +1 -1
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/pyproject.toml +1 -1
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/setup.py +1 -1
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2/src/TurtleGL_3d.egg-info}/PKG-INFO +1 -1
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/src/camera.py +16 -36
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/src/ray.py +13 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/LICENSE +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/README.md +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/setup.cfg +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/TurtleGL_3d.egg-info/SOURCES.txt +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/TurtleGL_3d.egg-info/dependency_links.txt +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/TurtleGL_3d.egg-info/requires.txt +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/TurtleGL_3d.egg-info/top_level.txt +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/__init__.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/airplane_game.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/christmas tree/turtleGL_christmas_tree_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/racing_game.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/texture example/turtleGL_texture_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_anime_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_cabin_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_cube_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_focal_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_from_file_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_grating_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_light_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_obj_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_plot3D_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/example/turtleGL_volume_example.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/src/plot3d.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/src/scene.py +0 -0
- {turtlegl_3d-1.4.1 → turtlegl_3d-1.4.2}/src/turtleGL/src/volume.py +0 -0
|
@@ -649,8 +649,7 @@ class camera():
|
|
|
649
649
|
intersection_point = ray_origin + t * ray_direction
|
|
650
650
|
return True, intersection_point[0], intersection_point[2], intersection_point[1]
|
|
651
651
|
|
|
652
|
-
def grating(self,face,
|
|
653
|
-
raylight = ray.sunlight[0][0]
|
|
652
|
+
def grating(self,face,ray_object):
|
|
654
653
|
if self.rend == 0:
|
|
655
654
|
total = (self.grating_size[0]//self.grating_length)*(self.grating_size[1]//self.grating_length)
|
|
656
655
|
c = 0
|
|
@@ -680,37 +679,27 @@ class camera():
|
|
|
680
679
|
for k in face:
|
|
681
680
|
a,t,u,v = self.ray_triangle_intersect(self.camera_position,ray,k[0])
|
|
682
681
|
if a:
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
682
|
+
factor = -1
|
|
683
|
+
rays = ray_object.get_ray([t,u,v])
|
|
684
|
+
for rayl in rays:
|
|
685
|
+
raylight = rayl[0]
|
|
686
|
+
rect_r = [x for x in raylight]
|
|
686
687
|
for m in face:
|
|
687
688
|
b,o,p,q = self.ray_triangle_intersect([t,u,v],rect_r,m[0])
|
|
688
689
|
if b and (m != k):
|
|
689
|
-
|
|
690
|
+
factor += rayl[1]
|
|
690
691
|
continue
|
|
691
|
-
|
|
692
|
-
pass
|
|
693
|
-
if mark == 1:
|
|
694
|
-
color = self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2]))
|
|
695
|
-
else:
|
|
696
|
-
color = self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2])**0.5)
|
|
692
|
+
color = self.multiply(k[1],factor if factor <= 1 else 1)
|
|
697
693
|
for xi in range(self.grating_length):
|
|
698
694
|
for yi in range(self.grating_length):
|
|
699
695
|
turtle.goto(i+xi,j+yi)
|
|
700
696
|
turtle.dot(2,color)
|
|
701
|
-
else:
|
|
702
|
-
for xi in range(self.grating_length):
|
|
703
|
-
for yi in range(self.grating_length):
|
|
704
|
-
turtle.goto(i+xi,j+yi)
|
|
705
|
-
turtle.dot(2,self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2])))
|
|
706
|
-
continue
|
|
707
697
|
else:
|
|
708
698
|
pass
|
|
709
699
|
c += 1
|
|
710
700
|
self.bar(c,total)
|
|
711
701
|
|
|
712
|
-
def grating_cv2(self,face,
|
|
713
|
-
raylight = ray.sunlight[0][0]
|
|
702
|
+
def grating_cv2(self,face,ray_object):
|
|
714
703
|
if self.rend == 0:
|
|
715
704
|
total = (self.grating_size[0]//self.grating_length)*(self.grating_size[1]//self.grating_length)
|
|
716
705
|
c = 0
|
|
@@ -740,30 +729,21 @@ class camera():
|
|
|
740
729
|
for k in face:
|
|
741
730
|
a,t,u,v = self.ray_triangle_intersect(self.camera_position,ray,k[0])
|
|
742
731
|
if a:
|
|
743
|
-
|
|
732
|
+
factor = -1
|
|
733
|
+
rays = ray_object.get_ray([t,u,v])
|
|
734
|
+
for rayl in rays:
|
|
735
|
+
raylight = rayl[0]
|
|
744
736
|
rect_r = [-x for x in raylight]
|
|
745
|
-
mark = 0
|
|
746
737
|
for m in face:
|
|
747
738
|
b,o,p,q = self.ray_triangle_intersect([t,u,v],rect_r,m[0])
|
|
748
739
|
if b and (m != k):
|
|
749
|
-
|
|
740
|
+
factor += rayl[1]
|
|
750
741
|
continue
|
|
751
|
-
|
|
752
|
-
pass
|
|
753
|
-
if mark == 1:
|
|
754
|
-
color = self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2])**2)
|
|
755
|
-
else:
|
|
756
|
-
color = self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2]))
|
|
742
|
+
color = self.multiply(k[1],factor if factor <= 1 else 1)
|
|
757
743
|
for xi in range(self.grating_length):
|
|
758
744
|
for yi in range(self.grating_length):
|
|
759
|
-
self.image[-j+self.image_size[1]//2+xi,
|
|
745
|
+
self.image[-j+self.image_size[1]//2+xi,
|
|
760
746
|
i+self.image_size[0]//2+yi] = self.hex_to_bgr(color)
|
|
761
|
-
else:
|
|
762
|
-
for xi in range(self.grating_length):
|
|
763
|
-
for yi in range(self.grating_length):
|
|
764
|
-
self.image[-j+self.image_size[1]//2+xi,
|
|
765
|
-
i+self.image_size[0]//2+yi] = self.hex_to_bgr(self.multiply(k[1],self.normalvect(raylight,k[0][0],k[0][1],k[0][2])))
|
|
766
|
-
continue
|
|
767
747
|
else:
|
|
768
748
|
pass
|
|
769
749
|
c += 1
|
|
@@ -39,6 +39,19 @@ class ray():
|
|
|
39
39
|
cos = self.normalvect(vector,point1,point2,point3)
|
|
40
40
|
return cos*brightness
|
|
41
41
|
|
|
42
|
+
def get_ray(self,point):
|
|
43
|
+
ray = []
|
|
44
|
+
for i in self.sunlight:
|
|
45
|
+
ray.append(i)
|
|
46
|
+
for i in self.pointlight:
|
|
47
|
+
dx = point[0]-i[0][0]
|
|
48
|
+
dy = point[1]-i[0][1]
|
|
49
|
+
dz = point[2]-i[0][2]
|
|
50
|
+
ray.append([[dx,dy,dz],i[1]/math.sqrt(dx**2+dy**2+dz**2)])
|
|
51
|
+
for i in self.ray:
|
|
52
|
+
ray.append([[i[1][0]-i[0][0],i[1][1]-i[0][1],i[1][2]-i[0][2]],i[2]])
|
|
53
|
+
return ray
|
|
54
|
+
|
|
42
55
|
def get_value(self,point1,point2,point3):
|
|
43
56
|
value = -1
|
|
44
57
|
for i in self.sunlight:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|