refactoring
This commit is contained in:
9
.gitea/config/gitversion.yml
Normal file
9
.gitea/config/gitversion.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
next-version: 1.0.0
|
||||
mode: ContinuousDeployment
|
||||
assembly-versioning-scheme: MajorMinorPatch
|
||||
assembly-file-versioning-scheme: MajorMinorPatch
|
||||
|
||||
branches:
|
||||
main:
|
||||
regex: ^main$
|
||||
increment: Patch
|
||||
BIN
.gitea/readme/screenshot.png
Normal file
BIN
.gitea/readme/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
34
.gitea/workflows/analyze.yml
Normal file
34
.gitea/workflows/analyze.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Analyze code
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "src**"
|
||||
- "requirements.txt"
|
||||
pull_request:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
paths:
|
||||
- "src**"
|
||||
- "requirements.txt"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze code
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install pylint
|
||||
- name: Analysing the code with pylint
|
||||
run: pylint --exit-zero $(git ls-files 'src/*.py')
|
||||
75
.gitea/workflows/analyze_and_publish.yml
Normal file
75
.gitea/workflows/analyze_and_publish.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
name: Analyze code and publish script
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
paths:
|
||||
- "src**"
|
||||
- "requirements.txt"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze code
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install pylint
|
||||
- name: Analysing the code with pylint
|
||||
run: pylint --exit-zero $(git ls-files 'src/*.py')
|
||||
publish:
|
||||
name: Publish script
|
||||
needs: analyze
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v4.2.0
|
||||
with:
|
||||
versionSpec: 6.4.x
|
||||
- name: Determine version
|
||||
uses: gittools/actions/gitversion/execute@v4.2.0
|
||||
id: gitversion
|
||||
with:
|
||||
configFilePath: ./.gitea/config/gitversion.yml
|
||||
- name: Create package root directory
|
||||
run: |
|
||||
mkdir package
|
||||
mkdir package/3d_renderer
|
||||
cp -r src/* package/3d_renderer/
|
||||
cp requirements.txt package/requirements.txt
|
||||
- name: Create .TAR.GZ archive
|
||||
uses: ksm2/archive-action@v1
|
||||
with:
|
||||
format: "tar.gz"
|
||||
name: 3d_renderer_${{steps.gitversion.outputs.SemVer}}
|
||||
root-directory: "package"
|
||||
- name: Create .ZIP archive
|
||||
uses: ksm2/archive-action@v1
|
||||
with:
|
||||
format: "zip"
|
||||
name: 3d_renderer_${{steps.gitversion.outputs.SemVer}}
|
||||
root-directory: "package"
|
||||
- name: Create Release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: ${{steps.gitversion.outputs.SemVer}}
|
||||
name: ${{steps.gitversion.outputs.SemVer}}
|
||||
files: |-
|
||||
3d_renderer_${{steps.gitversion.outputs.SemVer}}.tar.gz
|
||||
3d_renderer_${{steps.gitversion.outputs.SemVer}}.zip
|
||||
|
||||
64
README.md
64
README.md
@@ -1 +1,63 @@
|
||||
# 3D Renderer
|
||||
<h1 align="center">3D Renderer</h1>
|
||||
|
||||
<h3 align="center"><b>A simple 3D renderer that allows you to move around the scene using the keys.</b></h3>
|
||||
|
||||
<img align="center" src=".gitea/readme/screenshot.png"/>
|
||||
|
||||
<p align="center">3D Renderer was written using Python and PyGame library. This project was part of "Computer Graphics" course at Warsaw University of Technology</p>
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- Create your own scene
|
||||
- Move around the scene using the keys
|
||||
|
||||
## Installation
|
||||
|
||||
Download latest package version from <a href="https://repos.mateuszskoczek.com/MateuszSkoczek/3DRenderer/releases">Releases</a> tab, unpack, install requirements and you good to go
|
||||
|
||||
**Requirements**
|
||||
|
||||
- Python installed
|
||||
- PIP packages:
|
||||
- `pygame`
|
||||
- `numpy`
|
||||
|
||||
You can also use `requirements.txt` file to install PIP dependencies
|
||||
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
python 3d_renderer
|
||||
```
|
||||
|
||||
**Create the scene:**
|
||||
|
||||
You can define your own scene in `main` method of `App` class in `3d_renderer/app.py` file.
|
||||
|
||||
- Create object builder: `obj_builder1 = ObjectBuilder()`
|
||||
- Add as many vertices to the object as you want: `va = obj_builder1.add_vertex(-1, 1, 1)`
|
||||
- Connect vertices to make edges: `obj_builder1.add_vertices_connection(va, vb)`
|
||||
- Build object and add it to the scene: `self.renderer.add_object(obj_builder1.build())`
|
||||
|
||||
**Controls:**
|
||||
|
||||
- <kbd>W</kbd> - move forward
|
||||
- <kbd>S</kbd> - move backward
|
||||
- <kbd>A</kbd> - move left
|
||||
- <kbd>D</kbd> - move right
|
||||
- <kbd>Space</kbd> - move up
|
||||
- <kbd>LShift</kbd> - move down
|
||||
- <kbd>=</kbd> - FOV up
|
||||
- <kbd>-</kbd> - FOV down
|
||||
- <kbd>F</kbd> - Pitch up
|
||||
- <kbd>R</kbd> - Pitch down
|
||||
- <kbd>E</kbd> - Yaw up
|
||||
- <kbd>Q</kbd> - Yaw down
|
||||
- <kbd>C</kbd> - Roll up
|
||||
- <kbd>Z</kbd> - Roll down
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
pygame
|
||||
numpy
|
||||
@@ -1,4 +1,4 @@
|
||||
from src.app import App
|
||||
from app import App
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = App()
|
||||
@@ -1,5 +1,5 @@
|
||||
from src.renderer import Renderer
|
||||
from src.object_builder import ObjectBuilder
|
||||
from renderer import Renderer
|
||||
from object_builder import ObjectBuilder
|
||||
|
||||
class App:
|
||||
renderer : Renderer
|
||||
@@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
import math as mt
|
||||
import src.transformations as tn
|
||||
import transformations as tn
|
||||
|
||||
class Camera:
|
||||
__position: np.ndarray[float]
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
import pygame as pg
|
||||
import os
|
||||
from src.vertex import Vertex
|
||||
from vertex import Vertex
|
||||
|
||||
class Object:
|
||||
vertices: list[Vertex]
|
||||
@@ -1,5 +1,5 @@
|
||||
from src.object import Object
|
||||
from src.vertex import Vertex
|
||||
from object import Object
|
||||
from vertex import Vertex
|
||||
|
||||
class ObjectBuilder:
|
||||
__vertices: list[Vertex]
|
||||
@@ -1,8 +1,8 @@
|
||||
import pygame as pg
|
||||
import numpy as np
|
||||
from math import *
|
||||
from src.camera import Camera
|
||||
from src.object import Object
|
||||
from camera import Camera
|
||||
from object import Object
|
||||
|
||||
class Renderer:
|
||||
__clock: pg.time.Clock
|
||||
Reference in New Issue
Block a user