Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/publish.yaml

This file was deleted.

117 changes: 110 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,118 @@
name: tests
run-name: tests
on: [push]
run-name: Python Tests
on:
workflow_call:
push:
branches:
- "**"

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v3
with:
submodules: true
- name: 'Setup Python'
uses: actions/setup-python@v5
with:
python-version: '3.12.3'
- name: Ensure pip is installed
run: python -m ensurepip --upgrade
- name: Upgrade pip and setuptools
run: |
python -m pip install --upgrade pip setuptools
- name: 'Install dependencies'
run: python -m pip install -r requirements.txt

run-unittests:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Run unit tests'
run: tox -e docs
- name: 'Test engine/basic_camera_model/main.py'
run: python engine/basic_camera_model/main.py
- name: 'Test engine/extended_camera_model/main.py'
run: python engine/extended_camera_model/main.py

smoke-tests-linux:
needs: setup
strategy:
fail-fast: false
matrix:
image: ['ubuntu:latest', 'ubuntu:20.04', 'ubuntu:22.04', 'debian:latest', 'archlinux:latest']
python_version: ['3.12']
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
env:
TZ: Europe/Berlin
steps:
- name: 'Install git (Ubuntu, Debian)'
if: ${{ contains(fromJSON('["ubuntu:latest", "ubuntu:20.04", "ubuntu:22.04", "debian:latest"]'), matrix.image) }}
run: apt-get update && apt-get install -y git
- name: 'Install git (Arch)'
if: ${{ contains('archlinux:latest', matrix.image) }}
run: pacman -Syu --noconfirm git
- name: 'Checkout repository'
uses: actions/checkout@v3
with:
submodules: true
- name: 'Setup timezone'
run: ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
- name: 'Install OpenGL dependencies (Ubuntu/Debian)'
if: ${{ contains(matrix.image, 'ubuntu') || contains(matrix.image, 'debian') }}
run: apt-get install -y libgl1-mesa-glx
- name: 'Install OpenGL dependencies (Arch)'
if: ${{ contains(matrix.image, 'archlinux') }}
run: pacman -Syu --noconfirm libglvnd
- name: 'Setup Python'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Ensure pip is installed
run: python -m ensurepip --upgrade
- name: Upgrade pip and setuptools
run: |
python -m pip install --upgrade pip setuptools
- name: 'Install dependencies'
run: python -m pip install -r requirements.txt
- name: 'Run unit tests'
run: tox -e docs
- name: 'Test engine/basic_camera_model/main.py'
run: python engine/basic_camera_model/main.py
- name: 'Test engine/extended_camera_model/main.py'
run: python engine/extended_camera_model/main.py

smoke-tests-macos:
needs: setup
strategy:
fail-fast: false
matrix:
macos_version: ['macos-latest', 'macos-13']
python_version: ['3.12']
runs-on: ${{ matrix.macos_version }}
steps:
- name: 'Checkout repository'
uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
- name: 'Setup Python'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: pip install -r requirements.txt
- run: tox
python-version: ${{ matrix.python_version }}
- name: Ensure pip is installed
run: python -m ensurepip --upgrade
- name: Upgrade pip and setuptools
run: |
python -m pip install --upgrade pip setuptools
- name: 'Install dependencies'
run: python -m pip install -r requirements.txt
- name: 'Run unit tests'
run: tox -e docs
- name: 'Test engine/basic_camera_model/main.py'
run: python engine/basic_camera_model/main.py
- name: 'Test engine/extended_camera_model/main.py'
run: python engine/extended_camera_model/main.py
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from template_project_python import __version__

html_static_path = ['_static']
html_extra_path = ['resources/pipeline']
Expand All @@ -16,4 +15,4 @@
project = "3D Engine Python"
copyright = "2024, Marvin-VW"
author = "Marvin Lorenz"
version = release = __version__
version = release = str(1.4)
11 changes: 5 additions & 6 deletions engine/basic_camera_model/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def DEG_TO_RAD(deg: float) -> float:


if __name__ == "__main__":
print("playground_camera_model started!")

camera_model = CameraModel(0.00452, 0.00254, 0.004, 1280, 720, 1280/2, 720/2)
camera_model = CameraModel(0.00452, 0.00339, 0.004, 640*2, 480*2, 640, 480)

W_T_V = create_homogeneous_transformation_matrix(0, 0, 0, 0, 0, 0)
V_T_C = create_homogeneous_transformation_matrix(0, 0, 0, 0, 0, 0)
Expand Down Expand Up @@ -102,14 +101,14 @@ def nothing(x):

cv.setTrackbarPos("X", "camera settings", 10000)
cv.setTrackbarPos("Y", "camera settings", 10000)
cv.setTrackbarPos("Z", "camera settings", 11000)
cv.setTrackbarPos("Z", "camera settings", 5000)
cv.setTrackbarPos("Roll", "camera settings", 0)
cv.setTrackbarPos("Pitch", "camera settings", 180)
cv.setTrackbarPos("Pitch", "camera settings", 1800)
cv.setTrackbarPos("Yaw", "camera settings", 0)

cv.setTrackbarPos("X", "cube settings", 14000)
cv.setTrackbarPos("X", "cube settings", 10000)
cv.setTrackbarPos("Y", "cube settings", 10000)
cv.setTrackbarPos("Z", "cube settings", 11000)
cv.setTrackbarPos("Z", "cube settings", 10000)
cv.setTrackbarPos("Roll", "cube settings", 0)
cv.setTrackbarPos("Pitch", "cube settings", 0)
cv.setTrackbarPos("Yaw", "cube settings", 0)
Expand Down
2 changes: 0 additions & 2 deletions engine/basic_camera_model/requirements.txt

This file was deleted.

5 changes: 4 additions & 1 deletion engine/basic_camera_model/utils/fps_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ def update(self) -> None:
timestamp = time.time()
delta_time = timestamp - self.last_timestamp
self.last_timestamp = timestamp
self.fps = 1.0 / delta_time
try:
self.fps = 1.0 / delta_time
except:
self.fps = 0
self.fps_history.append(self.fps)
if len(self.fps_history) > self.filter_window_size:
self.fps_history.pop(0)
Expand Down
8 changes: 2 additions & 6 deletions engine/extended_camera_model/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Engine:

def __init__(self):

self.camera_model = CameraModel(0.00452, 0.00254, 0.004, 1280, 720, 1280/2, 720/2)
self.camera_model = CameraModel(0.00452, 0.00339, 0.004, 640, 480, 640/2, 480/2)
self.window = Window()
self.clipping_space = Clipping_Space()
self.fps_counter = FpsCounter(60)
Expand Down Expand Up @@ -48,7 +48,6 @@ def main(self):

while True:

self.window.handle_movement()
self.fps_counter.update()
self.camera_model.reset_camera_image()

Expand All @@ -68,7 +67,7 @@ def main(self):

if self.is_triangle_facing_camera(triangle.normal, triangle.centroids, camera_vector_world) < 0.0:

light_direction = (1, -0.5, -0.8)
light_direction = (0.5, -2.0, 0.5)
triangle.ilm = Color.intensity(light_direction, triangle.normal)
triangle.color = Color.adjust_bgr_intensity(Color.ALICE_BLUE, triangle.ilm)

Expand All @@ -81,9 +80,6 @@ def main(self):
shadow_points_camera = self.camera_model.world_transform(shadow_points, self.C_T_V)
self.camera_model.draw_poly(shadow_points_camera)

print(shadow_points_camera)


clipped_triangles = []
clipped_triangles.extend(self.clipping_space.cube_in_space(sorted_list))

Expand Down
2 changes: 0 additions & 2 deletions engine/extended_camera_model/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion engine/extended_camera_model/utils/vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def normal(triangle, scale = 0.5):
def get_shadow(triangles, light_vec):

shadow_points = []
plane_normal = np.array([0, 0, 1])
plane_normal = np.array([0, 1, 0])

for triangle in triangles:
for point in triangle.world_points:
Expand Down
Loading
Loading