Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
MatinAfzal committed Aug 2, 2024
2 parents 1e54b60 + 364f7c4 commit be4c5bd
Show file tree
Hide file tree
Showing 26 changed files with 755 additions and 322 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,31 @@

<h3 align="center">An open source implementation of 3D Computer Universe</h3>

I started programming a computer universe based on voxels in February 2024 and I am trying to make it more complete.
This project has a custom built-in 3D rendering engine written using OpenGL
Any programmer can use the codes in this project to build his own world or help improve ICU.
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FMatinAfzal%2F3DICU&count_bg=%2379C83D&title_bg=%23555555&icon=docusign.svg&icon_color=%23E7E7E7&title=Views&edge_flat=false)](https://hits.seeyoufarm.com)

I started programming a computer universe based on voxels in February 2024 and I am trying to make it more complete.
This project has an internal 3D rendering engine that was built by me using OpenGL called FA-Engine.

You can find more information about FA-Engine here: [FAE Repository](https://github.com/MatinAfzal/FloatArtsEngine)

Any programmer can use the codes in this project to build his own world or help improve OpenUniverse.

Developer: [@MatinAfzal](https://github.com/MatinAfzal)

Click [here](https://www.youtube.com/watch?v=u1sz5jymhfI) to watch the YouTube video of the project!

![2](https://github.com/user-attachments/assets/80d340bf-94b9-4515-8e91-b43c219624f1)


## Usage

Open cmd:
```
C:\Windows\system32> cd ./<path>/main
```
```
C:\TheJumonRunner> python OpenUniverse.py
```

![3DICU_Screenshot1](https://github.com/MatinAfzal/3DICU/assets/128434167/9a1a3d19-8475-4d27-9280-13d635cc2bdd)

3 changes: 2 additions & 1 deletion main/Engine2/Axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Axes(Mesh):
World mesh axes x, y, z
"""
def __init__(self, location, material) -> None:
print("Loading Axes...")
if ESP:
print("Loading Axes...")
vertices = WORLD_AXES_VERTICES
colors = WORLD_AXES_COLORS
draw_type = WORLD_AXES_DRAWTYPE
Expand Down
3 changes: 2 additions & 1 deletion main/Engine2/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Camera:
World Camera
"""
def __init__(self, width, height) -> None:
print("Loading Camera...")
if ESP:
print("Loading Camera...")
self.transformation = identity_mat()
self.last_mouse = pygame.math.Vector2(0, 0)
self.mouse_sensitivity_x = CAMERA_MOUSE_SENSITIVITY_X
Expand Down
66 changes: 48 additions & 18 deletions main/Engine2/CellAttach.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from main.Engine2.Mesh import *
from main.Engine2.Settings2 import *
import threading
from .Mesh import *
from .Settings2 import *


class CellAttach:
Expand All @@ -10,7 +11,10 @@ class CellAttach:
"""

def __init__(self, cells: list[object], draw_type=GL_TRIANGLES, shader=None, image=None) -> None:
print("Attaching Cells...")
if ESP:
print("Attaching Cells...")

self.level_name = cells[0].level_name
self.image = image
self.cells = cells

Expand All @@ -23,12 +27,25 @@ def __init__(self, cells: list[object], draw_type=GL_TRIANGLES, shader=None, ima
self.colors = []
self.call_time = 0

self.attach_vertices(self.cells)
self.attach_uvs(self.cells)
self.attach_normals(self.cells)
t1 = threading.Thread(target=self.attach_vertices)
t2 = threading.Thread(target=self.attach_uvs)
t3 = threading.Thread(target=self.attach_normals)

t1.start()
t2.start()
t3.start()

t1.join()
t2.join()
t3.join()

# self.attach_vertices(self.cells)
# self.attach_uvs(self.cells)
# self.attach_normals(self.cells)
self.load_world()

def attach_vertices(self, cells):
def attach_vertices(self):
cells = self.cells
if len(cells) < 2:
print("\n\nERROR: NO ENOUGH CELLS TO ATTACH!\n\n")
return 0
Expand All @@ -38,7 +55,8 @@ def attach_vertices(self, cells):
for instance in cells[2:]:
self.world_formatted_vertices = np.concatenate((self.world_formatted_vertices, instance.vertices))

def attach_uvs(self, cells):
def attach_uvs(self):
cells = self.cells
if len(cells) < 2:
print("ERROR: NO ENOUGH CELLS TO ATTACH!")
return 0
Expand All @@ -48,7 +66,8 @@ def attach_uvs(self, cells):
for instance in cells[2:]:
self.world_formatted_uvs = np.concatenate((self.world_formatted_uvs, instance.vertex_uvs))

def attach_normals(self, cells):
def attach_normals(self):
cells = self.cells
if len(cells) < 2:
print("ERROR: NO ENOUGH CELLS TO ATTACH!")
return 0
Expand All @@ -64,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
)
109 changes: 0 additions & 109 deletions main/Engine2/Cullings/ChunkRenderDistance.py

This file was deleted.

Loading

0 comments on commit be4c5bd

Please sign in to comment.