diff --git a/main/Engine2/CellAttach.py b/main/Engine2/CellAttach.py index 1ce5d4f..a302f7b 100644 --- a/main/Engine2/CellAttach.py +++ b/main/Engine2/CellAttach.py @@ -1,6 +1,6 @@ import threading -from main.Engine2.Mesh import * -from main.Engine2.Settings2 import * +from .Mesh import * +from .Settings2 import * class CellAttach: @@ -13,6 +13,8 @@ class CellAttach: def __init__(self, cells: list[object], draw_type=GL_TRIANGLES, shader=None, image=None) -> None: if ESP: print("Attaching Cells...") + + self.level_name = cells[0].level_name self.image = image self.cells = cells @@ -81,12 +83,23 @@ def load_world(self): self.colors.append(CHUNK_COLOR_G) self.colors.append(CHUNK_COLOR_B) - self.world = Mesh( - vertices=self.world_formatted_vertices, - imagefile=self.image, - material=self.world_shader, - draw_type=self.world_draw_type, - vertex_colors=self.colors, - vertex_uvs=self.world_formatted_uvs, - vertex_normals=self.world_formatted_normals - ) + if self.level_name == "tree1": + self.world = Mesh( + vertices=self.world_formatted_vertices, + imagefile=self.image, + material=self.world_shader, + draw_type=self.world_draw_type, + vertex_colors=self.colors, + vertex_uvs=self.world_formatted_uvs, + vertex_normals=self.world_formatted_normals + ) + else: + self.world = Mesh( + vertices=self.world_formatted_vertices, + imagefile=self.image, + material=self.world_shader, + draw_type=self.world_draw_type, + vertex_colors=self.colors, + vertex_uvs=self.world_formatted_uvs, + vertex_normals=self.world_formatted_normals + ) diff --git a/main/Engine2/Cullings/DistanceCulling.py b/main/Engine2/Cullings/DistanceCulling.py index 7e329ec..eb133e8 100644 --- a/main/Engine2/Cullings/DistanceCulling.py +++ b/main/Engine2/Cullings/DistanceCulling.py @@ -1,7 +1,7 @@ import numpy as np import pygame from math import sqrt -from main.Engine2.Settings2 import * +from Engine2.Settings2 import * class DistanceCulling: diff --git a/main/Engine2/Screen.py b/main/Engine2/Screen.py index 52a4e1d..7e504f8 100644 --- a/main/Engine2/Screen.py +++ b/main/Engine2/Screen.py @@ -1,6 +1,8 @@ # This file prepares the page with initial processing settings and executes the main loop import datetime import os + +import pygame from pygame.locals import * from .Camera import * from .Settings2 import * @@ -28,7 +30,7 @@ def __init__(self, screen_posX, screen_posY, screen_width, screen_height): pygame.display.gl_set_attribute(pygame.GL_CONTEXT_PROFILE_MASK, pygame.GL_CONTEXT_PROFILE_CORE) pygame.display.gl_set_attribute(pygame.GL_DEPTH_SIZE, 24) # GPU DEPTH BUFFER SIZE - self.screen = pygame.display.set_mode((screen_width, screen_height), DOUBLEBUF | OPENGL) + self.screen = pygame.display.set_mode((screen_width, screen_height), DOUBLEBUF | OPENGL, pygame.FULLSCREEN) pygame.display.set_caption(SCREEN_CAPTION_LOADING) self.clock = pygame.time.Clock() self.camera = None diff --git a/main/Engine2/Settings2.py b/main/Engine2/Settings2.py index 96007bf..82da53f 100644 --- a/main/Engine2/Settings2.py +++ b/main/Engine2/Settings2.py @@ -1,7 +1,7 @@ from OpenGL.GL import GL_LINES # Debug settings -ENGINE_STATUS_PRINT = False +ENGINE_STATUS_PRINT = True ENGINE_REPORT_SAVE = False ESP = ENGINE_STATUS_PRINT @@ -44,10 +44,10 @@ # SCREEN_POS_Y = 200 SCREEN_POS_X = 100 SCREEN_POS_Y = 30 -# SCREEN_WIDTH = 1000 -# SCREEN_HEIGHT = 800 -SCREEN_WIDTH = 1800 -SCREEN_HEIGHT = 1000 +SCREEN_WIDTH = 1920 +SCREEN_HEIGHT = 1080 +# SCREEN_WIDTH = 1800 +# SCREEN_HEIGHT = 1000 SCREEN_MULTISAMPLEBUFFERS = 1 SCREEN_MULTISAMPLESAMPLES = 4 SCREEN_DEPTH_SIZE = 24 diff --git a/main/ICU.py b/main/ICU.py index 057d64c..ff9a4f2 100644 --- a/main/ICU.py +++ b/main/ICU.py @@ -1,19 +1,15 @@ -from main.Engine2.Screen import * -from main.Engine2.LoadObject import * -from main.Engine2.Light import * -from main.Engine2.Material import * -from main.Engine2.Axes import * -from main.Engine2.CellAttach import * -from main.Engine2.Settings2 import * -from main.Level.ChunkAttach import * -from main.Level.TreeAttach import * -from main.Level.Chunk import * -from main.Engine2.Cullings.DistanceCulling import * -from main.Level.Shematic import * +from Engine2.Screen import * +from Engine2.LoadObject import * +from Engine2.Light import * +from Engine2.Material import * +from Engine2.Axes import * +from Engine2.CellAttach import * +from Level.ObjectAttach import * +from Engine2.Cullings.DistanceCulling import * +from Level.Shematic import * from time import sleep from datetime import datetime from time import time -from math import sqrt class MultiShaders(Screen): @@ -58,6 +54,7 @@ def __init__(self): self.img_texture = r"Textures\texture.png" self.img_icu = r"Textures\ICU.png" self.img_sun = r"Textures\sun.jpeg" + self.img_cactus = r"Textures\cactus.png" # Loads if ESP: @@ -94,17 +91,16 @@ def __init__(self): self.sun_start = int(time()) # Object Attach - # self.terrain = ChunkAttach(numberx=30, numberz=30, shader=self.mat, texture=self.img_texture) - self.terrain = ChunkAttach(numberx=15, numberz=15) - self.trees = TreeAttach(numberx=15, numberz=15) + self.terrain = ObjectAttach(object_name="chunk", number_x=10, number_z=10) + self.trees = ObjectAttach(object_name="tree", number_x=10, number_z=10) # Cell Attaches cell_start = datetime.now() if ESP: print("Cell Attach started at:" + str(cell_start.now())) - self.world = CellAttach(self.terrain.terrain, shader=self.mat, image=self.img_texture) - self.forest = CellAttach(self.trees.forest, shader=self.mat, image=self.img_texture) + self.world = CellAttach(self.terrain.layer, shader=self.mat, image=self.img_texture) + self.forest = CellAttach(self.trees.layer, shader=self.mat, image=self.img_texture) def initialise(self): # Variables @@ -124,8 +120,8 @@ def camera_init(self): def display(self): # glClearColor(0.5, 0.5 ,0.5, 0.5) # Middle gray - # glClearColor(0.58, 0.85 ,0.94, 0.5) # Sky blue - glClearColor(0, 0 ,0, 0.5) # Sky night + glClearColor(0.58, 0.85, 0.94, 0.5) # Sky blue + # glClearColor(0, 0 ,0, 0.5) # Sky night glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ##### @@ -185,27 +181,6 @@ def display(self): if self.x_counter == 0: self.axes.draw(self.camera, self.light) - # camera_a_position = pygame.Vector3(self.camera.transformation[0, 3], self.camera.transformation[1, 3], self.camera.transformation[2, 3]) - # index = 0 - # for chunk in self.terrain.terrain: - # if self.culling_distance.chunk_in_distance(self.camera, chunk): - # chunk.draw(self.camera, self.light) - # else: - # camera_b_position = pygame.Vector3(self.camera.transformation[0, 3], self.camera.transformation[1, 3], self.camera.transformation[2, 3]) - # move_direction = self.culling_distance.direction_calculator(camera_a_position, camera_b_position) - # if move_direction: - # new_chunk_coordinates = self.culling_distance.coordinates_calculator(self.terrain.terrain[index], move_direction) - # self.terrain.terrain.pop(index) - # shematic_aaa = np.ones(shape=(8, 8)) * 2 - # new_chunk = Chunk(position=new_chunk_coordinates, shematic=shematic_aaa, img=self.img_texture, material=self.mat) - # self.terrain.terrain.append(new_chunk) - # index += 1 - - # glEnable(GL_CULL_FACE) - # glCullFace(GL_BACK) - # self.world.world.draw(self.camera, self.light) - - # glDisable(GL_CULL_FACE) self.world.world.draw(self.camera, self.light) self.forest.world.draw(self.camera, self.light) self.cube0.draw(self.camera, self.light) diff --git a/main/Level/Cactus.py b/main/Level/Cactus.py new file mode 100644 index 0000000..5953a82 --- /dev/null +++ b/main/Level/Cactus.py @@ -0,0 +1,183 @@ +from Engine2.Utils import format_vertices + + +class Cactus: + def __init__(self, position, max_height=4, min_height=0, biome="A", img=None, material=None, shematic=None) -> None: + """ + cactus generator + + Args: + position (pcenter_ygame.Vector3): tree center vertex position + max_height (int): tree maximum height + min_height (int): tree minimum depth + biome (str): tree biome + """ + + self.level_name = "tree1" + self.position = position + self.max_height = max_height + self.min_height = min_height + self.biome = biome + self.image = img + self.material = material + self.texture = img + self.colors = [] + self.normals = None + self.leaf_area = [4, 4] + self.shematic = shematic + + self.vertices, self.triangles, uvs, uvs_ind, normals, normals_ind = self.level_maker(self.position) + self.vertices = format_vertices(self.vertices, self.triangles) + self.vertex_uvs = format_vertices(uvs, uvs_ind) + self.normals = format_vertices(normals, normals_ind) + + for _ in range(len(self.vertices)): + self.colors.append(1) + self.colors.append(1) + self.colors.append(1) + + def level_maker(self, center): + """Tree level maker + + Args: + center (pygame.Vector3): chunk center position + + Sample: + [TLU, TRU] \n + [TLD, TRD] \n + | | \n + [BLU, BRU] \n + [BLD, BRD] \n + """ + + level_vertices = [] + level_triangles = [] + level_uvs = [] + level_uvs_ind = [] + level_normals = [] + level_normals_ind = [] + separator = 0 + uv_counter = 0 + normal_counter = 0 + normals = [(0.0, 0.0, 1.0), (0.0, 0.0, 1.0), (0.0, 0.0, 1.0), (0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (0.0, 1.0, 0.0), + (0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, -1.0), (0.0, 0.0, -1.0), (0.0, 0.0, -1.0), + (0.0, 0.0, -1.0), (0.0, -1.0, 0.0), (0.0, -1.0, 0.0), (0.0, -1.0, 0.0), (0.0, -1.0, 0.0), + (1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (-1.0, 0.0, 0.0), + (-1.0, 0.0, 0.0), (-1.0, 0.0, 0.0), (-1.0, 0.0, 0.0)] + + center_y = int(self.shematic[3][3]) + 1 + + # Tree base + for _ in range(0, self.max_height): + # Top vertices + TLU = (center.x - 1, center_y, center.z - 1) + TLD = (center.x - 1, center_y, center.z + 0) + TRU = (center.x + 0, center_y, center.z - 1) + TRD = (center.x + 0, center_y, center.z + 0) + + # Bottom vertices + BLU = (center.x - 1, center_y - 1, center.z - 1) + BLD = (center.x - 1, center_y - 1, center.z + 0) + BRU = (center.x + 0, center_y - 1, center.z - 1) + BRD = (center.x + 0, center_y - 1, center.z + 0) + + level_vertices.extend([TLU, TLD, TRU, TRD, BLU, BLD, BRU, BRD]) + level_triangles.extend([ + 0 + 8 * separator, 1 + 8 * separator, 2 + 8 * separator, # TRIANGLE 1 + 2 + 8 * separator, 1 + 8 * separator, 3 + 8 * separator, # TRIANGLE 2 + 4 + 8 * separator, 5 + 8 * separator, 6 + 8 * separator, # TRIANGLE 3 + 6 + 8 * separator, 5 + 8 * separator, 7 + 8 * separator, # TRIANGLE 4 + 1 + 8 * separator, 5 + 8 * separator, 3 + 8 * separator, # TRIANGLE 5 + 3 + 8 * separator, 5 + 8 * separator, 7 + 8 * separator, # TRIANGLE 6 + 0 + 8 * separator, 4 + 8 * separator, 2 + 8 * separator, # TRINAGLE 7 + 2 + 8 * separator, 4 + 8 * separator, 6 + 8 * separator, # TRIANGLE 8 + 4 + 8 * separator, 0 + 8 * separator, 5 + 8 * separator, # TRIANGLE 9 + 5 + 8 * separator, 0 + 8 * separator, 1 + 8 * separator, # TRIANGLE 10 + 6 + 8 * separator, 2 + 8 * separator, 7 + 8 * separator, # TRIANGLE 11 + 7 + 8 * separator, 2 + 8 * separator, 3 + 8 * separator, # TRIANGLE 12 + ]) + + separator += 1 + center_y += 1 + + # Texture atlas locations + atlas_length = 1 + atlas_height = 1 + HM_F = 0 # Horizontal Multiplier to first border + HM_L = 1 # Horizontal Multiplier to last border + VM_F = 0 # Vertical Multiplier to first border + VM_L = 1 # Vertical Multiplier to last border + BD = 0.0000000099 # border_deficiency + ONE = 1 + BD + + uvs_face = [ + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L) + ] + + # UV vertices + for i in range(24): + level_uvs.append(uvs_face[i]) + + # UV triangles + level_uvs_ind.extend([ + 20 + 24 * uv_counter, 21 + 24 * uv_counter, 22 + 24 * uv_counter, # TRIANGLE 1 + 22 + 24 * uv_counter, 21 + 24 * uv_counter, 23 + 24 * uv_counter, # TRIANGLE 2 + 4 + 24 * uv_counter, 5 + 24 * uv_counter, 6 + 24 * uv_counter, # TRIANGLE 3 + 6 + 24 * uv_counter, 5 + 24 * uv_counter, 7 + 24 * uv_counter, # TRIANGLE 4 + 8 + 24 * uv_counter, 9 + 24 * uv_counter, 10 + 24 * uv_counter, # TRIANGLE 5 + 10 + 24 * uv_counter, 9 + 24 * uv_counter, 11 + 24 * uv_counter, # TRIANGLE 6 + 16 + 24 * uv_counter, 17 + 24 * uv_counter, 18 + 24 * uv_counter, # TRIANGLE 7 + 18 + 24 * uv_counter, 17 + 24 * uv_counter, 19 + 24 * uv_counter, # TRIANGLE 8 + 0 + 24 * uv_counter, 1 + 24 * uv_counter, 2 + 24 * uv_counter, # TRIANGLE 9 + 2 + 24 * uv_counter, 1 + 24 * uv_counter, 3 + 24 * uv_counter, # TRIANGLE 10 + 12 + 24 * uv_counter, 13 + 24 * uv_counter, 14 + 24 * uv_counter, # TRIANGLE 11 + 14 + 24 * uv_counter, 13 + 24 * uv_counter, 15 + 24 * uv_counter, # TRIANGLE 12 + ]) + + uv_counter += 1 + + # Normals + for i in range(24): + level_normals.append(normals[i]) + + level_normals_ind.extend([ + 0 + 24 * normal_counter, 1 + 24 * normal_counter, 2 + 24 * normal_counter, + 2 + 24 * normal_counter, 1 + 24 * normal_counter, 3 + 24 * normal_counter, + 4 + 24 * normal_counter, 5 + 24 * normal_counter, 6 + 24 * normal_counter, + 6 + 24 * normal_counter, 5 + 24 * normal_counter, 7 + 24 * normal_counter, + 8 + 24 * normal_counter, 9 + 24 * normal_counter, 10 + 24 * normal_counter, + 10 + 24 * normal_counter, 9 + 24 * normal_counter, 11 + 24 * normal_counter, + 12 + 24 * normal_counter, 13 + 24 * normal_counter, 14 + 24 * normal_counter, + 14 + 24 * normal_counter, 13 + 24 * normal_counter, 15 + 24 * normal_counter, + 16 + 24 * normal_counter, 17 + 24 * normal_counter, 18 + 24 * normal_counter, + 18 + 24 * normal_counter, 17 + 24 * normal_counter, 19 + 24 * normal_counter, + 20 + 24 * normal_counter, 21 + 24 * normal_counter, 22 + 24 * normal_counter, + 22 + 24 * normal_counter, 21 + 24 * normal_counter, 23 + 24 * normal_counter + ]) + + normal_counter += 1 + + return level_vertices, level_triangles, level_uvs, level_uvs_ind, level_normals, level_normals_ind diff --git a/main/Level/Chunk.py b/main/Level/Chunk.py index 2f67202..bbac20f 100644 --- a/main/Level/Chunk.py +++ b/main/Level/Chunk.py @@ -1,7 +1,7 @@ import threading -from main.Engine2.Utils import format_vertices -from main.Engine2.Mesh import Mesh -from main.Engine2.Settings2 import * +from Engine2.Utils import format_vertices +from Engine2.Mesh import Mesh +from Engine2.Settings2 import * class Chunk(Mesh): @@ -193,7 +193,7 @@ def level_maker(self, center): for ROW in range(0, self.shematic_shape[0]): # Z for COLUMN in range(0, self.shematic_shape[1]): # X temp = int(self.shematic[COLUMN][ROW]) + 1 - for DEPTH in range(temp-2, temp): # Y + for DEPTH in range(temp-4, temp): # Y self.blocks += 1 if DEPTH <= -5: # SAND @@ -201,22 +201,34 @@ def level_maker(self, center): self.HM_L = 1 self.VM_F = 2 self.VM_L = 3 + # self.HM_F = 15 + # self.HM_L = 16 + # self.VM_F = 15 + # self.VM_L = 16 elif -4 <= DEPTH < 0: # DIRT # dirt = True self.HM_F = 0 self.HM_L = 1 self.VM_F = 1 self.VM_L = 2 + # self.HM_F = 15 + # self.HM_L = 16 + # self.VM_F = 15 + # self.VM_L = 16 elif 0 <= DEPTH < 15: # GRASS self.HM_F = 9 self.HM_L = 10 self.VM_F = 15 self.VM_L = 16 + # self.HM_F = 1 + # self.HM_L = 2 + # self.VM_F = 14 + # self.VM_L = 15 elif DEPTH >= 15: # SNOW - self.HM_F = 15 - self.HM_L = 16 - self.VM_F = 15 - self.VM_L = 16 + self.HM_F = 1 + self.HM_L = 2 + self.VM_F = 14 + self.VM_L = 15 else: print(f"ERROR: Unidentified block detected... ZXY:{ROW}/{COLUMN}/{DEPTH}") diff --git a/main/Level/ChunkAttach.py b/main/Level/ChunkAttach.py deleted file mode 100644 index 5ec2bac..0000000 --- a/main/Level/ChunkAttach.py +++ /dev/null @@ -1,34 +0,0 @@ -from pygame import Vector3 -from main.Level.Chunk import * -from main.Level.Shematic import Shematic -from main.Engine2.Settings2 import * - -class ChunkAttach: - """ - Attach chunks together ! - - Making Trains ! - """ - - def __init__(self, startX=0, startY=0, startZ=0, numberx=1, numberz=1, shader=None, texture=None) -> None: - if ESP: - print("Attaching Chunks...") - self.terrain = [] - self.shader = shader - self.texture = texture - self.sx = startX - self.sy = startY - self.sz = startZ - self.endx = numberx * 8 + 1 - self.endz = numberz * 8 + 1 - self.shematic = Shematic(numberx) - self.sample = self.shematic.locate(0, 0) - - self.load_terrain() - - def load_terrain(self): - if ESP: - print("Building Chunks (Multiple Level.Chunk Callings)...") - for x in range(self.sx, self.endx, 8): - for z in range(self.sz, self.endz, 8): - self.terrain.append(Chunk(Vector3(x, 0, z), shematic=self.shematic.locate(x, z), material=self.shader, - img=self.texture)) diff --git a/main/Level/ObjectAttach.py b/main/Level/ObjectAttach.py new file mode 100644 index 0000000..ea642f2 --- /dev/null +++ b/main/Level/ObjectAttach.py @@ -0,0 +1,75 @@ +from random import randint +from Level.Chunk import * +from Level.Tree import * +from Level.Cactus import * +from Level.Shematic import Shematic +from Engine2.Settings2 import * + + +class ObjectAttach: + """ + Attach objects together ! + """ + + def __init__(self, object_name="chunk", start_x=0, start_y=0, start_z=0, number_x=1, number_z=1, shader=None, + texture=None) -> None: + if ESP: + print("Attaching Objects...") + + self.known_objects = ["chunk", "tree", "cactus"] + self.object_name = object_name + self.layer = [] + self.shader = shader + self.texture = texture + self.sx = start_x + self.sy = start_y + self.sz = start_z + self.end_x = number_x * 8 + 1 + self.end_z = number_z * 8 + 1 + self.shematic = Shematic(number_x) + self.sample = self.shematic.locate(0, 0) + + if self.object_name not in self.known_objects: + if ESP: + print("A binding method is not specified for this object, use force=True to use default method!") + if self.object_name == "chunk": + self.chunk_binding() + elif self.object_name == "tree": + self.tree_binding() + elif object_name == "cactus": + self.cactus_binding() + else: + # Impossible to reach! + pass + + def chunk_binding(self): + if ESP: + print("Building Chunks (Multiple Level.Chunk Callings)...") + for x in range(self.sx, self.end_x, 8): + for z in range(self.sz, self.end_z, 8): + self.layer.append(Chunk(Vector3(x, 0, z), shematic=self.shematic.locate(x, z), material=self.shader, + img=self.texture)) + + def tree_binding(self): + if ESP: + print("Building Trees (Multiple Level.Trees Callings)...") + for x in range(self.sx, self.end_x, 8): + for z in range(self.sz, self.end_z, 8): + y = int(self.shematic.locate(x, z)[3][3]) + if y <= 0 or y >= 15: + continue + else: + if randint(0, 2) in [0, 1]: + self.layer.append(Tree(Vector3(x, 0, z), shematic=self.shematic.locate(x, z))) + + def cactus_binding(self): + if ESP: + print("Building Cactus's (Multiple Leve.Cactus Callings)...") + for x in range(self.sx, self.end_x, 8): + for z in range(self.sz, self.end_z, 8): + y = int(self.shematic.locate(x, z)[3][3]) + if y <= 0 or y >= 15: + continue + else: + if randint(0, 2) in [0, 1]: + self.layer.append(Cactus(Vector3(x, 0, z), shematic=self.shematic.locate(x, z))) diff --git a/main/Level/Tree.py b/main/Level/Tree.py index fcdf36f..2604893 100644 --- a/main/Level/Tree.py +++ b/main/Level/Tree.py @@ -1,4 +1,4 @@ -from main.Engine2.Utils import format_vertices +from Engine2.Utils import format_vertices from pygame import Vector3 @@ -108,7 +108,7 @@ def level_maker(self, center): HM_L = 1 # Horizontal Multiplier to last border VM_F = 8 # Vertical Multiplier to first border VM_L = 9 # Vertical Multiplier to last border - BD = 0.0000000099 # border_deficiency + BD = 0.0000000099 # border_deficiency ONE = 1 + BD uvs_face = [ @@ -177,7 +177,7 @@ def level_maker(self, center): 6:(-2, -3), 7:(-3, -4) } - + # COLUMNS cs = { 0:(4, 3), @@ -189,7 +189,7 @@ def level_maker(self, center): 6:(-2, -3), 7:(-3, -4) } - + # TRIANGLES tr = { 1:(0, 1, 2), @@ -205,7 +205,7 @@ def level_maker(self, center): 11:(6, 0, 4), 12:(4, 0, 2) } - + self.leaf_position = Vector3(center.x + 1.5, center_y, center.z + 1.5) for ROW in range(0, self.leaf_area[0]): for COLUMN in range(0, self.leaf_area[1]): @@ -214,13 +214,13 @@ def level_maker(self, center): TLD = (self.leaf_position.x - cs.get(COLUMN)[0], self.leaf_position.y, self.leaf_position.z - rs.get(ROW)[1]) TRU = (self.leaf_position.x - cs.get(COLUMN)[1], self.leaf_position.y, self.leaf_position.z - rs.get(ROW)[0]) TRD = (self.leaf_position.x - cs.get(COLUMN)[1], self.leaf_position.y, self.leaf_position.z - rs.get(ROW)[1]) - + # Bottom vertices BLU = (self.leaf_position.x - cs.get(COLUMN)[0], self.leaf_position.y - 1, self.leaf_position.z - rs.get(ROW)[0]) BLD = (self.leaf_position.x - cs.get(COLUMN)[0], self.leaf_position.y - 1, self.leaf_position.z - rs.get(ROW)[1]) BRU = (self.leaf_position.x - cs.get(COLUMN)[1], self.leaf_position.y - 1, self.leaf_position.z - rs.get(ROW)[0]) BRD = (self.leaf_position.x - cs.get(COLUMN)[1], self.leaf_position.y - 1, self.leaf_position.z - rs.get(ROW)[1]) - + level_vertices.extend([TLU, TLD, TRU, TRD, BLU, BLD, BRU, BRD]) level_triangles.extend([ 0 + 8 * separator, 1 + 8 * separator, 2 + 8 * separator, # TRIANGLE 1 @@ -236,7 +236,7 @@ def level_maker(self, center): 6 + 8 * separator, 2 + 8 * separator, 7 + 8 * separator, # TRIANGLE 11 7 + 8 * separator, 2 + 8 * separator, 3 + 8 * separator, # TRIANGLE 12 ]) - + separator += 1 # Texture atlas locations @@ -248,18 +248,18 @@ def level_maker(self, center): VM_L = 16 # Vertical Multiplier to last border BD = 0.0000000099 # border_deficiency ONE = 1 + BD - + uvs_face = [ - (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), - (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), - (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), - (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), - (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), - (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), - (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), - (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L) + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_F), + (ONE / atlas_length * HM_L, ONE / atlas_height * VM_F), (ONE / atlas_length * HM_F, ONE / atlas_height * VM_L), (ONE / atlas_length * HM_L, ONE / atlas_height * VM_L) ] - + # UV vertices level_uvs.append(uvs_face[0]) level_uvs.append(uvs_face[1]) @@ -285,7 +285,7 @@ def level_maker(self, center): level_uvs.append(uvs_face[21]) level_uvs.append(uvs_face[22]) level_uvs.append(uvs_face[23]) - + # UV triangles level_uvs_ind.extend([ 20 + 24 * uv_counter, 21 + 24 * uv_counter, 22 + 24 * uv_counter, # TRIANGLE 1 @@ -301,7 +301,7 @@ def level_maker(self, center): 12 + 24 * uv_counter, 13 + 24 * uv_counter, 14 + 24 * uv_counter, # TRIANGLE 11 14 + 24 * uv_counter, 13 + 24 * uv_counter, 15 + 24 * uv_counter, # TRIANGLE 12 ]) - + uv_counter += 1 # Normals diff --git a/main/Level/TreeAttach.py b/main/Level/TreeAttach.py deleted file mode 100644 index 802fd13..0000000 --- a/main/Level/TreeAttach.py +++ /dev/null @@ -1,40 +0,0 @@ -import random -from main.Level.Tree import * -from pygame import Vector3 -from main.Level.Shematic import Shematic -from main.Engine2.Settings2 import * - -class TreeAttach: - """ - Attach Trees together ! - - Making Forests ! - """ - - def __init__(self, startX=0, startY=0, startZ=0, numberx=1, numberz= 1, shader=None, texture=None) -> None: - if ESP: - print("Attaching Trees...") - self.forest = [] - self.shader = shader - self.texture = texture - self.sx = startX - self.sy = startY - self.sz = startZ - self.end = numberx * 8 + 1 - self.end = numberz * 8 + 1 - self.shematic = Shematic(numberx) - - random.seed(100) - self.load_forest() - - - def load_forest(self): - if ESP: - print("Building Trees (Multiple Level.Trees Callings)...") - for x in range(self.sx, self.end, 8): - for z in range(self.sz, self.end, 8): - y = int(self.shematic.locate(x, z)[3][3]) - if y <= 0 or y >= 15: - continue - else: - if random.randint(0, 2) in [0, 1]: - self.forest.append(Tree(Vector3(x, 0, z), shematic=self.shematic.locate(x, z))) diff --git a/main/Textures/cactus.png b/main/Textures/cactus.png new file mode 100644 index 0000000..1dcdb2f Binary files /dev/null and b/main/Textures/cactus.png differ diff --git a/main/test/TestSite.py b/main/test/TestSite.py new file mode 100644 index 0000000..715a6c6 --- /dev/null +++ b/main/test/TestSite.py @@ -0,0 +1,12 @@ +import numpy as np +import pandas as pd +from main.Engine2.Settings2 import * + +class TestSite: + def __init__(self, action="view"): + self.known_actions = ["view", "import"] + + if action not in self.known_actions: + if ESP: + print() +