Code Monkey home page Code Monkey logo

3dzavr's Introduction

🚀 3Dzavr - Light C++ Game Engine

MIT License Community Discord Commits Issues Repo size version

About:

3Dzavr is yet another 3D engine for C++ that uses SDL as multimedia framework.

Motivation:

Initially this project was created as a Proof Of Concept in implementing custom CPU render from scratch.
Gradually, 3dzavr became more like a very simple version of big engines like Godot, Unity or Unreal.
Our goal is to create light and easy to use/study/contribute Open Source and free engine, which anyone can access and use in whatever purposes.
But the main goal is to have fun! You are welcome to use and contribute!

Main functionality:

  • Operations with vectors, matrices, triangles etc
  • Projections from 3D on 2D plane, movement and rotation of camera and meshes
  • The custom light component system
  • The system of attachments and hierarchy tree
  • Advanced smooth animations by using Bézier curves for meshes and camera
  • Collision detection (GJK) and resolution (EPA)
  • Resource manager and other useful utils

Installation (Linux):

  1. Update apt packet manager: sudo apt update
  2. Install gcc and c++ compilers: sudo apt install gcc and sudo apt install g++
  3. Install SDL2: sudo apt-get install libsdl2-dev
  4. Install SDL 2 TTF (for working with fonts and text): sudo apt install libfreetype6-dev libsdl2-ttf-dev libsdl2-ttf-2.0-0 -y;
  5. Install libpng library: sudo apt-get install libpng-dev
  6. Install pkg-config: sudo apt-get install -y pkg-config
  7. Clone this repository into the folder you want to work with: git clone https://github.com/vectozavr/3dzavr

If you want to use CLion (recommended)

  1. Install CLion: sudo snap install clion --classic
  2. Build and run the project.

If you don't want to use IDE or you don't want to spend your time on configuring it

  1. Install make: brew install make
  2. Go into the engine folder: cd 3dzavr
  3. Run make utility: cmake .
  4. Compile the project: make
  5. Run the compiled project: ./3dzavr

Installation (MacOS):

  1. Install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  2. Install developer tools: xcode-select --install

  3. Install SDL 2: brew install sdl2

  4. Install SDL 2 TTF (for working with fonts and text): brew install sdl2_ttf

  5. Install libpng library: brew install libpng

  6. Clone this repository into the folder you want to work with: git clone https://github.com/vectozavr/3dzavr

If you want to use CLion (recommended)

  1. Download and Install CLion: brew install clion
  2. Build and run the project.

If you don't want to use IDE or you don't want to spend your time on configuring it

  1. Install make: brew install make
  2. Go into the engine folder: cd 3dzavr
  3. Run make utility: cmake .
  4. Compile the project: make
  5. Run the compiled project: ./3dzavr

Installation (Windows):

TODO: Needs to be written

If you want to use Visual Studio

  1. Download and Install Visual Studio
  2. Follow the tutorial for how to run CMake project in Visual Studio

3dzavr's People

Contributors

nakidai avatar neirokan avatar vectozavr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3dzavr's Issues

Can't build with gcc

On Linux gcc (version 13.2.1 20230801) fails to build 3dzavr with the following output:

[  2%] Building CXX object engine/CMakeFiles/3DZAVR.dir/utils/WorldEditor.cpp.o
/tmp/3dzavr/engine/utils/WorldEditor.cpp:14:1: sorry, unimplemented: non-trivial designated initializers not supported
   14 | };
      | ^
/tmp/3dzavr/engine/utils/WorldEditor.cpp:14:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
   25 | };
      | ^
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp:25:1: sorry, unimplemented: non-trivial designated initializers not supported
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::objectTree(const std::shared_ptr<Object>&)’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:189:39: error: taking address of temporary array
  189 |         mu_layout_row(ctx, 1, (int[]) { 200 }, 0);
      |                                       ^~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:200:47: error: taking address of temporary array
  200 |                 mu_layout_row(ctx, 1, (int[]) { 200 }, 0);
      |                                               ^~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::transformMatrixEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:225:39: error: taking address of temporary array
  225 |         mu_layout_row(ctx, 3, (int[]) {60, 60, 60}, 0);
      |                                       ^~~~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:237:47: error: taking address of temporary array
  237 |                 mu_layout_row(ctx, 2, (int[]) {70, 150}, 0);
      |                                               ^~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:249:47: error: taking address of temporary array
  249 |                 mu_layout_row(ctx, 2, (int[]) {70, 150}, 0);
      |                                               ^~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:263:47: error: taking address of temporary array
  263 |                 mu_layout_row(ctx, 2, (int[]) {70, 150}, 0);
      |                                               ^~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:276:39: error: taking address of temporary array
  276 |         mu_layout_row(ctx, 1, (int[]) {120}, 0);
      |                                       ^~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::triangleMeshEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:311:43: error: taking address of temporary array
  311 |             mu_layout_row(ctx, 2, (int[]) { 46, -1 }, 0);
      |                                           ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:321:39: error: taking address of temporary array
  321 |         mu_layout_row(ctx, 2, (int[]) {100, 130}, 0);
      |                                       ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::lineMeshEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:352:39: error: taking address of temporary array
  352 |         mu_layout_row(ctx, 2, (int[]) { 46, -1 }, 0);
      |                                       ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::lightSourceEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:382:39: error: taking address of temporary array
  382 |         mu_layout_row(ctx, 2, (int[]) {70, 150}, 0);
      |                                       ^~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:394:39: error: taking address of temporary array
  394 |         mu_layout_row(ctx, 2, (int[]) { 46, -1 }, 0);
      |                                       ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:409:43: error: taking address of temporary array
  409 |             mu_layout_row(ctx, 2, (int[]) {100, 100}, 0);
      |                                           ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::rigidObjectEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:440:39: error: taking address of temporary array
  440 |         mu_layout_row(ctx, 2, (int[]) {100, 100}, 0);
      |                                       ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:454:47: error: taking address of temporary array
  454 |                 mu_layout_row(ctx, 2, (int[]) { 30, -1 }, 0);
      |                                               ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp:469:47: error: taking address of temporary array
  469 |                 mu_layout_row(ctx, 2, (int[]) { 30, -1 }, 0);
      |                                               ^~~~~~~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::objectEditor()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:496:39: error: taking address of temporary array
  496 |         mu_layout_row(ctx, 1, (int[]) {120}, 0);
      |                                       ^~~~~
/tmp/3dzavr/engine/utils/WorldEditor.cpp: In member function ‘void WorldEditor::renderSettings()’:
/tmp/3dzavr/engine/utils/WorldEditor.cpp:522:43: error: taking address of temporary array
  522 |             mu_layout_row(ctx, 2, (int[]) { 70, 150 }, 0);
      |                                           ^~~~~~~~~~~
make[2]: *** [engine/CMakeFiles/3DZAVR.dir/build.make:468: engine/CMakeFiles/3DZAVR.dir/utils/WorldEditor.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: engine/CMakeFiles/3DZAVR.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

So clang must be used for building 3dzavr now. It can be set with this command:

cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" ..

проблемы при сборке под debian 11

In file included from /home/hype/3dzavr/engine/network/ClientUDP.cpp:5:
/home/hype/3dzavr/engine/network/ClientUDP.h:15:59: error: incomplete type ‘std::numeric_limits’ used in nested name specifier
15 | double _lastBroadcast = -std::numeric_limits::max();
| ^~~
make[2]: *** [CMakeFiles/3dzavr.dir/build.make:468: CMakeFiles/3dzavr.dir/engine/network/ClientUDP.cpp.o] Ошибка 1
make[2]: *** Ожидание завершения заданий…
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/3dzavr.dir/all] Ошибка 2
make: *** [Makefile:91: all] Ошибка 2

Painter's algorithm problem

For now I use average z of triangle to sort them in correct order:

double z1 = t1[0].z + t1[1].z + t1[2].z;
double z2 = t2[0].z + t2[1].z + t2[2].z;
return z1 > z2;

where t1 and t2 - two triangles to compare.

But anyway we have glitches when some triangles wrongly overlap other triangles.
Example:

1

Still maintaining?

Wanted to ask if something is planned for this? Like Texturing and Lighting and other file formats like .glb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.