diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rwxr-xr-x | cpprender | bin | 752992 -> 0 bytes | |||
-rw-r--r-- | makefile | 10 | ||||
-rw-r--r-- | model/model.obj (renamed from rus3.obj) | 0 | ||||
-rw-r--r-- | model/modelTexture.png (renamed from rusImage.png) | bin | 15722325 -> 15722325 bytes | |||
-rw-r--r-- | object_files/Bitmap.o | bin | 28400 -> 0 bytes | |||
-rw-r--r-- | object_files/Matrix4f.o | bin | 24088 -> 0 bytes | |||
-rw-r--r-- | object_files/ObjModel.o | bin | 503240 -> 0 bytes | |||
-rw-r--r-- | object_files/Render.o | bin | 114864 -> 0 bytes | |||
-rw-r--r-- | object_files/Vector4f.o | bin | 18672 -> 0 bytes | |||
-rw-r--r-- | object_files/Vertice.o | bin | 21152 -> 0 bytes | |||
-rw-r--r-- | object_files/main.o | bin | 300928 -> 0 bytes | |||
-rw-r--r-- | shots/1.png | bin | 89280 -> 0 bytes | |||
-rw-r--r-- | shots/2.png | bin | 108103 -> 0 bytes | |||
-rw-r--r-- | shots/3.png | bin | 113863 -> 0 bytes | |||
-rw-r--r-- | shots/4.png | bin | 110057 -> 0 bytes | |||
-rw-r--r-- | src/Bitmap.cpp (renamed from source/Bitmap.cpp) | 0 | ||||
-rw-r--r-- | src/Bitmap.h (renamed from source/Bitmap.h) | 0 | ||||
-rw-r--r-- | src/Matrix4f.cpp (renamed from source/Matrix4f.cpp) | 0 | ||||
-rw-r--r-- | src/Matrix4f.h (renamed from source/Matrix4f.h) | 0 | ||||
-rw-r--r-- | src/ObjModel.cpp (renamed from source/ObjModel.cpp) | 0 | ||||
-rw-r--r-- | src/ObjModel.h (renamed from source/ObjModel.h) | 0 | ||||
-rw-r--r-- | src/Render.cpp (renamed from source/Render.cpp) | 0 | ||||
-rw-r--r-- | src/Render.h (renamed from source/Render.h) | 0 | ||||
-rw-r--r-- | src/Vector4f.cpp (renamed from source/Vector4f.cpp) | 0 | ||||
-rw-r--r-- | src/Vector4f.h (renamed from source/Vector4f.h) | 0 | ||||
-rw-r--r-- | src/Vertice.cpp (renamed from source/Vertice.cpp) | 0 | ||||
-rw-r--r-- | src/Vertice.h (renamed from source/Vertice.h) | 0 | ||||
-rw-r--r-- | src/main.cpp (renamed from source/main.cpp) | 4 |
31 files changed, 17 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3536de4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +erender diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..657700e --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +NAME=erender +CXXFLAGS=-g -Wall +LIBS=-lsfml-graphics -lsfml-window -lsfml-system +CXX=g++ + +build: src/* + $(CXX) $(CXXFLAGS) src/* -o $(NAME) $(LIBS) + +run: erender + ./erender @@ -1,6 +1,4 @@ -## Current issues -* Z-Buffer doesn't work (probably for some stupid reason, but it gives me a serious headache) -![alt text](https://github.com/MatejaMaric/erender/blob/master/shots/1.png "Shot 1") -![alt text](https://github.com/MatejaMaric/erender/blob/master/shots/2.png "Shot 2") -![alt text](https://github.com/MatejaMaric/erender/blob/master/shots/3.png "Shot 3") -![alt text](https://github.com/MatejaMaric/erender/blob/master/shots/4.png "Shot 4") +Inspired by [thebennybox's 3D Software Rendering](https://www.youtube.com/playlist?list=PLEETnX-uPtBUbVOok816vTl1K9vV1GgH5) series but made using C++ and [SFML](https://www.sfml-dev.org/). +It also implements the barycentric rendering technique instead of the scanline technique. + +To compile this program you need to install `libsfml-dev` package and run `make`. diff --git a/cpprender b/cpprender Binary files differdeleted file mode 100755 index 7988d27..0000000 --- a/cpprender +++ /dev/null diff --git a/makefile b/makefile deleted file mode 100644 index 6d3ac12..0000000 --- a/makefile +++ /dev/null @@ -1,10 +0,0 @@ -cpprender: source/* -#cd object_files - g++ -g -c source/* -#cd .. - mv *\.o object_files/ - g++ object_files/* -o cpprender -lsfml-graphics -lsfml-window -lsfml-system - rm source/*gch - -run: cpprender - ./cpprender diff --git a/rus3.obj b/model/model.obj index d9281df..d9281df 100644 --- a/rus3.obj +++ b/model/model.obj diff --git a/rusImage.png b/model/modelTexture.png Binary files differindex fde2cba..fde2cba 100644 --- a/rusImage.png +++ b/model/modelTexture.png diff --git a/object_files/Bitmap.o b/object_files/Bitmap.o Binary files differdeleted file mode 100644 index 428869c..0000000 --- a/object_files/Bitmap.o +++ /dev/null diff --git a/object_files/Matrix4f.o b/object_files/Matrix4f.o Binary files differdeleted file mode 100644 index ab7f9a3..0000000 --- a/object_files/Matrix4f.o +++ /dev/null diff --git a/object_files/ObjModel.o b/object_files/ObjModel.o Binary files differdeleted file mode 100644 index 418e7e6..0000000 --- a/object_files/ObjModel.o +++ /dev/null diff --git a/object_files/Render.o b/object_files/Render.o Binary files differdeleted file mode 100644 index ca35980..0000000 --- a/object_files/Render.o +++ /dev/null diff --git a/object_files/Vector4f.o b/object_files/Vector4f.o Binary files differdeleted file mode 100644 index bbea830..0000000 --- a/object_files/Vector4f.o +++ /dev/null diff --git a/object_files/Vertice.o b/object_files/Vertice.o Binary files differdeleted file mode 100644 index 3123ff1..0000000 --- a/object_files/Vertice.o +++ /dev/null diff --git a/object_files/main.o b/object_files/main.o Binary files differdeleted file mode 100644 index 060c9a4..0000000 --- a/object_files/main.o +++ /dev/null diff --git a/shots/1.png b/shots/1.png Binary files differdeleted file mode 100644 index 914b872..0000000 --- a/shots/1.png +++ /dev/null diff --git a/shots/2.png b/shots/2.png Binary files differdeleted file mode 100644 index e92788a..0000000 --- a/shots/2.png +++ /dev/null diff --git a/shots/3.png b/shots/3.png Binary files differdeleted file mode 100644 index 738e3af..0000000 --- a/shots/3.png +++ /dev/null diff --git a/shots/4.png b/shots/4.png Binary files differdeleted file mode 100644 index e28f899..0000000 --- a/shots/4.png +++ /dev/null diff --git a/source/Bitmap.cpp b/src/Bitmap.cpp index 363145f..363145f 100644 --- a/source/Bitmap.cpp +++ b/src/Bitmap.cpp diff --git a/source/Bitmap.h b/src/Bitmap.h index c4064ad..c4064ad 100644 --- a/source/Bitmap.h +++ b/src/Bitmap.h diff --git a/source/Matrix4f.cpp b/src/Matrix4f.cpp index 2cf2d9a..2cf2d9a 100644 --- a/source/Matrix4f.cpp +++ b/src/Matrix4f.cpp diff --git a/source/Matrix4f.h b/src/Matrix4f.h index 85946c0..85946c0 100644 --- a/source/Matrix4f.h +++ b/src/Matrix4f.h diff --git a/source/ObjModel.cpp b/src/ObjModel.cpp index f23cfc3..f23cfc3 100644 --- a/source/ObjModel.cpp +++ b/src/ObjModel.cpp diff --git a/source/ObjModel.h b/src/ObjModel.h index 9f66867..9f66867 100644 --- a/source/ObjModel.h +++ b/src/ObjModel.h diff --git a/source/Render.cpp b/src/Render.cpp index 7aabc43..7aabc43 100644 --- a/source/Render.cpp +++ b/src/Render.cpp diff --git a/source/Render.h b/src/Render.h index 386cbcb..386cbcb 100644 --- a/source/Render.h +++ b/src/Render.h diff --git a/source/Vector4f.cpp b/src/Vector4f.cpp index 506dc22..506dc22 100644 --- a/source/Vector4f.cpp +++ b/src/Vector4f.cpp diff --git a/source/Vector4f.h b/src/Vector4f.h index ee1846a..ee1846a 100644 --- a/source/Vector4f.h +++ b/src/Vector4f.h diff --git a/source/Vertice.cpp b/src/Vertice.cpp index 022c477..022c477 100644 --- a/source/Vertice.cpp +++ b/src/Vertice.cpp diff --git a/source/Vertice.h b/src/Vertice.h index c4a591b..c4a591b 100644 --- a/source/Vertice.h +++ b/src/Vertice.h diff --git a/source/main.cpp b/src/main.cpp index 977d8ae..94a8b30 100644 --- a/source/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ int main() Render render(width, height);
sf::Image image;
- image.loadFromFile("rusImage.png");
+ image.loadFromFile("model/modelTexture.png");
Bitmap map(image.getSize().x, image.getSize().y);
const sf::Uint8* pp = image.getPixelsPtr();
for (int i = 0; i < image.getSize().x * image.getSize().y * 4; i += 4) {
@@ -42,7 +42,7 @@ int main() }
std::chrono::high_resolution_clock::time_point time1 = std::chrono::high_resolution_clock::now();
- ObjModel vehicle("rus3.obj");
+ ObjModel vehicle("model/model.obj");
std::chrono::high_resolution_clock::time_point time2 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> speed = std::chrono::duration_cast<std::chrono::duration<double>>(time2 - time1);
std::cout << "Model loading time: " << speed.count() << "s\n";
|