342 Commits

Author SHA1 Message Date
=
ae3eb3276f fix change camera height
All checks were successful
Linux arm64 / Build (push) Successful in 5m20s
2024-04-15 18:50:20 +02:00
=
615f68b48b dampen player movements mid-air
All checks were successful
Linux arm64 / Build (push) Successful in 5m4s
2024-04-15 16:56:55 +02:00
=
c7547ffab5 document smoother class, minor nitpicks 2024-04-15 16:42:34 +02:00
Morph01
14610c1f94 map with separate objets
Some checks failed
Linux arm64 / Build (push) Failing after 3m17s
2024-04-14 23:47:24 +02:00
68dfc73ad2 better map
Some checks failed
Linux arm64 / Build (push) Failing after 3m30s
2024-04-14 23:13:59 +02:00
98625523ca use fabs
Some checks failed
Linux arm64 / Build (push) Failing after 3m33s
2024-04-14 23:08:16 +02:00
ee84b290a6 transform aabbs
Some checks failed
Linux arm64 / Build (push) Failing after 3m6s
2024-04-14 23:00:34 +02:00
=
6116ff3e59 oe
Some checks failed
Linux arm64 / Build (push) Failing after 2m54s
2024-04-14 22:39:22 +02:00
=
7d8045918e bon jsp si ca marche
Some checks failed
Linux arm64 / Build (push) Failing after 2m59s
2024-04-14 22:26:02 +02:00
d5bda8ab5d temporary render aabb
All checks were successful
Linux arm64 / Build (push) Successful in 5m20s
2024-04-13 15:37:55 +02:00
8ff74d028f load aabb 2024-04-13 15:37:40 +02:00
6089b144eb refactor Axis
All checks were successful
Linux arm64 / Build (push) Successful in 4m59s
2024-04-13 09:53:58 +02:00
ed3322f256 process model aabb 2024-04-13 09:46:21 +02:00
d13030fbb0 better doc 2024-04-13 09:14:57 +02:00
f78f36ffb2 Merge branch 'main' into physics
All checks were successful
Linux arm64 / Build (push) Successful in 5m5s
2024-04-13 09:02:10 +02:00
43510ea568 fix main menu on kick
All checks were successful
Linux arm64 / Build (push) Successful in 5m4s
2024-04-12 11:15:08 +02:00
9c6c25b17a add default server config
All checks were successful
Linux arm64 / Build (push) Successful in 5m19s
2024-04-12 11:07:23 +02:00
d8a3cb2785 Piou Piou (#48)
Some checks failed
Linux arm64 / Build (push) Has been cancelled
Fix #8

Reviewed-on: #48
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-12 11:06:54 +02:00
27a76519a3 Suppressions d'erreurs Valgrind (#47)
All checks were successful
Linux arm64 / Build (push) Successful in 5m6s
Reviewed-on: #47
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-12 10:54:59 +02:00
85585e157f Meilleur panel admin (#45)
All checks were successful
Linux arm64 / Build (push) Successful in 5m6s
Fix #34

Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com>
Reviewed-on: #45
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-11 17:29:11 +02:00
c2c6f1f033 C'est important la doc (#43)
All checks were successful
Linux arm64 / Build (push) Successful in 4m59s
C'est très long

Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com>
Reviewed-on: #43
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-11 17:17:40 +02:00
07d09332dd Musique de fond (#44)
All checks were successful
Linux arm64 / Build (push) Successful in 5m30s
Fix #7

Reviewed-on: #44
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-11 16:59:07 +02:00
747fa13d3a fix action cache (this time it's actually working)
All checks were successful
Linux arm64 / Build (push) Successful in 5m4s
2024-04-11 16:21:49 +02:00
=
8a35b2390c use axis
All checks were successful
Linux arm64 / Build (push) Successful in 24m41s
2024-04-11 12:53:56 +02:00
=
dc2c74fcb1 almost full doc coverage in Physics.h, improve some functions
Some checks are pending
Linux arm64 / Build (push) Waiting to run
2024-04-11 12:51:43 +02:00
32ca078002 revert non blocking connect
All checks were successful
Linux arm64 / Build (push) Successful in 23m26s
2024-04-11 11:53:30 +02:00
=
bae3d70b3c copium
All checks were successful
Linux arm64 / Build (push) Successful in 23m5s
2024-04-10 17:17:00 +02:00
=
f3d5b4aeab fix windows build 2024-04-10 17:16:50 +02:00
=
1ab0d61890 fix merge 2024-04-10 17:16:37 +02:00
=
2896dbeaf6 Merge branch 'main' into physics
Some checks failed
Linux arm64 / Build (push) Failing after 23m21s
2024-04-10 16:01:38 +02:00
=
0175a1fed0 add ()
All checks were successful
Linux arm64 / Build (push) Successful in 4m55s
2024-04-10 15:32:37 +02:00
=
ce13f6f1ce moooooooonkey 2024-04-10 15:17:40 +02:00
=
69d5547d15 add ToCollision, optimise perspective matrix calculation
Some checks failed
Linux arm64 / Build (push) Failing after 2m19s
2024-04-10 14:55:07 +02:00
1d1a02a7b5 minor architectural changes, Intersection updated
Some checks failed
Linux arm64 / Build (push) Failing after 2m22s
2024-04-10 11:52:35 +02:00
e1efc5065c use leaderboard agin
All checks were successful
Linux arm64 / Build (push) Successful in 23m50s
2024-04-09 20:03:10 +02:00
8795562b42 Fix win (#38)
Some checks failed
Linux arm64 / Build (push) Has been cancelled
Reviewed-on: #38
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-04-09 19:47:46 +02:00
cd7ca3edf0 yes
Some checks failed
Linux arm64 / Build (push) Failing after 2m17s
2024-04-09 12:16:18 +02:00
048812090b fix assimp version
All checks were successful
Linux arm64 / Build (push) Successful in 22m33s
2024-04-09 10:08:43 +02:00
ad71bbbdf7 network: add error status
All checks were successful
Linux arm64 / Build (push) Successful in 6m15s
2024-04-06 12:28:45 +02:00
0bb7d28da8 fix join game freeze 2024-04-06 12:24:52 +02:00
8e13bac9d1 fix: build with glew only on CI
All checks were successful
Linux arm64 / Build (push) Successful in 4m55s
2024-04-03 11:09:20 +02:00
76b3057271 fix Android warnings 2024-04-03 10:59:16 +02:00
df4b1641d5 remove unsed assets
All checks were successful
Linux arm64 / Build (push) Successful in 5m42s
2024-04-02 22:46:09 +02:00
7daf2bae0c don't move player when menu is opened
All checks were successful
Linux arm64 / Build (push) Successful in 5m53s
2024-04-02 22:30:58 +02:00
a7b235da38 Possibilité de changer la cadence de tir (#33)
Some checks failed
Linux arm64 / Build (push) Has been cancelled
ajout d'un changement pour la cadence de tir

Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Reviewed-on: #33
Reviewed-by: Simon Pribylski <sim16.prib@gmail.com>
Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com>
Co-committed-by: Morph01 <thibaut6969delastreet@gmail.com>
2024-04-02 22:25:47 +02:00
e27cc29eb0 Réglage de la gravité (#31)
All checks were successful
Linux arm64 / Build (push) Successful in 5m4s
Fix #6

Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Reviewed-on: #31
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-30 19:38:17 +01:00
d59467dd23 Le laser sort de la main à la première personne (#30)
Some checks are pending
Linux arm64 / Build (push) Waiting to run
Fix #25

Reviewed-on: #30
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-30 19:37:40 +01:00
0ed577bbc2 On sait quand on gagne (#29)
Some checks are pending
Linux arm64 / Build (push) Waiting to run
L'écran de fin est mis à jour correctement selon si la victoire nous appartient ou non.
Le cas d'égalité n'est cependant pas traité ! Seulement un joueur peut gagner à l'état actuel

Reviewed-on: #29
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-30 19:37:08 +01:00
aa29b9d718 use Vec3 for PlayerController members
All checks were successful
Linux arm64 / Build (push) Successful in 4m39s
2024-03-30 11:53:07 +01:00
1cce7fcd35 remove unused variable
All checks were successful
Linux arm64 / Build (push) Successful in 4m38s
2024-03-30 09:55:07 +01:00
9e93c1a1de better trail effect
All checks were successful
Linux arm64 / Build (push) Successful in 4m43s
2024-03-29 09:11:19 +01:00
4119fe37cc fix run dir 2024-03-29 09:11:01 +01:00
0511511702 Update BlitzClient.lua
All checks were successful
Linux arm64 / Build (push) Successful in 4m41s
2024-03-28 22:35:54 +01:00
2484eb5377 Chemtrails (#28)
All checks were successful
Linux arm64 / Build (push) Successful in 4m37s
Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Reviewed-on: #28
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-28 21:42:26 +01:00
61ae530238 fiiiiiiiiiiiiiiix
All checks were successful
Linux arm64 / Build (push) Successful in 5m4s
2024-03-28 21:35:41 +01:00
Morph01
7c90ecfbd3 Refactor ServerGui.cpp: Remove unused variables
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-28 21:33:39 +01:00
6e47fa6996 Add admin window and server duration settings (#27)
Some checks failed
Linux arm64 / Build (push) Failing after 3m33s
Fix #11

Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Reviewed-on: #27
2024-03-28 21:17:24 +01:00
83649ddbab fix linux build
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-28 18:42:40 +01:00
Morph01
83c4599aa3 add finish screen
Some checks failed
Linux arm64 / Build (push) Failing after 2m55s
2024-03-28 18:29:52 +01:00
0247ee3cc1 add delay timer
All checks were successful
Linux arm64 / Build (push) Successful in 4m38s
2024-03-28 17:48:59 +01:00
Morph01
58b401f257 Update types of texture variables
All checks were successful
Linux arm64 / Build (push) Successful in 4m56s
2024-03-28 16:40:41 +01:00
c5b07e2ae6 fix network test for windows
All checks were successful
Linux arm64 / Build (push) Successful in 5m19s
2024-03-28 16:30:51 +01:00
507946a0f4 fix operator- for Vector
All checks were successful
Linux arm64 / Build (push) Successful in 4m41s
2024-03-28 16:14:01 +01:00
f9b79b0d64 Ajout d'états de jeu (#26)
All checks were successful
Linux arm64 / Build (push) Successful in 4m42s
La partie est d'abord en mode "Attente de joueurs"
Lorsque 2 joueurs sont présents, la partie passe en mode "Préparation" et un décompte de 10s commence
La partie passe ensuite en mode "Jeu" pendant 3 min
Pour finir, la partie passe en mode "Fin" pendant 30s pour rebasculer en mode "Jeu" si le nombre de joueurs est toujours suffisant.

Reviewed-on: #26
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-28 15:58:39 +01:00
Morph01
78d68446f2 Fix data type inconsistencies lets cook
All checks were successful
Linux arm64 / Build (push) Successful in 4m39s
2024-03-28 15:32:08 +01:00
255eafa35e fix return type
All checks were successful
Linux arm64 / Build (push) Successful in 4m44s
2024-03-26 20:25:15 +01:00
e254452a6c Meilleure interface (#15)
All checks were successful
Linux arm64 / Build (push) Successful in 4m55s
améliorer l'interface, déplacement de certains boutons etc.

Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
Reviewed-on: #15
Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com>
Co-committed-by: Morph01 <thibaut6969delastreet@gmail.com>
2024-03-26 12:52:07 +01:00
920c2e20b3 Merge pull request 'Merge new features' (#23) from dev into main
All checks were successful
Linux arm64 / Build (push) Successful in 4m46s
Reviewed-on: #23
2024-03-26 12:07:09 +01:00
=
6e6a21ce09 implement bare-bones aabb-aabb intersection
All checks were successful
Linux arm64 / Build (push) Successful in 4m53s
2024-03-26 12:06:15 +01:00
1e1880376d fix merge
All checks were successful
Linux arm64 / Build (push) Successful in 4m52s
2024-03-26 11:47:47 +01:00
de22c89975 Squashed commit of the following:
commit 0adeba26e4
Author: = <=>
Date:   Tue Mar 26 11:35:37 2024 +0100

    minor fix

commit 011d8a573c
Author: = <=>
Date:   Tue Mar 26 11:33:56 2024 +0100

    fix stupid build error

commit 22406ad020
Author: = <=>
Date:   Tue Mar 26 11:25:35 2024 +0100

    yes

commit 4db55a372b
Author: = <=>
Date:   Tue Mar 26 11:13:22 2024 +0100

    csavgfdslgakdf;g

commit 20d176ccb5
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Tue Mar 26 11:07:27 2024 +0100

    add range overlapping check utilities

commit 3863e7907f
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Tue Mar 26 10:24:35 2024 +0100

    better edge case handling

commit 35b7d7bab0
Author: = <=>
Date:   Tue Mar 26 10:19:21 2024 +0100

    I am fucking retarded what the fuck is this stupid brain smoking

commit 6aca413b4f
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Sun Mar 24 18:14:02 2024 +0100

    small refactor

commit ee322e3e7b
Author: AquaEBM@gmail.com <AquaEBM@gmail.com>
Date:   Sun Mar 24 17:40:39 2024 +0100

    improve tests, fix some bugs in Distance, (not working yet)

commit 864a15e4c8
Merge: 7efd821 c1ded40
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Fri Mar 22 19:33:45 2024 +0100

    Squashed commit of the following:

    commit c1ded40cc4
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 17:24:05 2024 +0100

        improve network test

    commit 285bf880ee
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 17:14:43 2024 +0100

        fix warning

    commit 06ff76607d
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 15:45:33 2024 +0100

        add bots

    commit 19229bbe8a
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 14:55:57 2024 +0100

        fix warnings

    commit 2b0930a734
    Author: Morph01 <thibaut6969delastreet@gmail.com>
    Date:   Tue Mar 19 10:43:55 2024 +0100

        hud of blitz (#16)

        Résoudre partiellement #12

        Co-authored-by: Persson-dev <sim16.prib@gmail.com>
        Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
        Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
        Reviewed-on: #16

    commit 84b6acad4c
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Tue Mar 19 10:15:54 2024 +0100

        less spooky light

    commit 9f94d51fc4
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 14 16:36:15 2024 +0100

        Ajout de tests d'intégration (#17)

        Le paquet fournissant OpenGL a été temporairement remplacé par glew

        Reviewed-on: #17
        Co-authored-by: Persson-dev <sim16.prib@gmail.com>
        Co-committed-by: Persson-dev <sim16.prib@gmail.com>

    commit 9951256881
    Author: Simon Pribylski <sim16.prib@gmail.com>
    Date:   Wed Mar 13 20:19:37 2024 +0100

        action: install libsdl via apt

    commit 4a02054648
    Author: Morph01 <145839520+Morph01@users.noreply.github.com>
    Date:   Wed Mar 13 13:53:20 2024 +0100

        compression tests

    commit 19c39312bf
    Author: Morph01 <145839520+Morph01@users.noreply.github.com>
    Date:   Wed Mar 13 13:51:57 2024 +0100

        setup action

    commit d5014b1e8a
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Tue Mar 12 10:26:47 2024 +0100

        Revert "extend Vec3"

        This reverts commit dccfa9c936.

    commit dccfa9c936
    Author: = <=>
    Date:   Tue Mar 12 10:01:00 2024 +0100

        extend Vec3
    Merge branch 'main' into physics

commit 7efd8218ea
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Fri Mar 22 19:28:46 2024 +0100

    moved functions in Maths.h

commit 08db7f84b9
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Fri Mar 22 19:16:48 2024 +0100

    add missing include

commit 7119dea783
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Fri Mar 22 19:15:01 2024 +0100

    merge 'main' branch

    commit c1ded40cc4
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 17:24:05 2024 +0100

        improve network test

    commit 285bf880ee
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 17:14:43 2024 +0100

        fix warning

    commit 06ff76607d
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 15:45:33 2024 +0100

        add bots

    commit 19229bbe8a
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 21 14:55:57 2024 +0100

        fix warnings

    commit 2b0930a734
    Author: Morph01 <thibaut6969delastreet@gmail.com>
    Date:   Tue Mar 19 10:43:55 2024 +0100

        hud of blitz (#16)

        Résoudre partiellement #12

        Co-authored-by: Persson-dev <sim16.prib@gmail.com>
        Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
        Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
        Reviewed-on: #16

    commit 84b6acad4c
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Tue Mar 19 10:15:54 2024 +0100

        less spooky light

    commit 9f94d51fc4
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Thu Mar 14 16:36:15 2024 +0100

        Ajout de tests d'intégration (#17)

        Le paquet fournissant OpenGL a été temporairement remplacé par glew

        Reviewed-on: #17
        Co-authored-by: Persson-dev <sim16.prib@gmail.com>
        Co-committed-by: Persson-dev <sim16.prib@gmail.com>

    commit 9951256881
    Author: Simon Pribylski <sim16.prib@gmail.com>
    Date:   Wed Mar 13 20:19:37 2024 +0100

        action: install libsdl via apt

    commit 4a02054648
    Author: Morph01 <145839520+Morph01@users.noreply.github.com>
    Date:   Wed Mar 13 13:53:20 2024 +0100

        compression tests

    commit 19c39312bf
    Author: Morph01 <145839520+Morph01@users.noreply.github.com>
    Date:   Wed Mar 13 13:51:57 2024 +0100

        setup action

    commit d5014b1e8a
    Author: Persson-dev <sim16.prib@gmail.com>
    Date:   Tue Mar 12 10:26:47 2024 +0100

        Revert "extend Vec3"

        This reverts commit dccfa9c936.

    commit dccfa9c936
    Author: = <=>
    Date:   Tue Mar 12 10:01:00 2024 +0100

        extend Vec3

commit 6e998fc368
Author: AquaEBM@gmail.com <AquaEBM@gmail.com>
Date:   Fri Mar 22 16:41:52 2024 +0100

    change tests

commit 441131a2f5
Author: AquaEBM@gmail.com <AquaEBM@gmail.com>
Date:   Fri Mar 22 16:14:56 2024 +0100

    rename Intersects to distance

commit c875fa1dee
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Fri Mar 22 15:50:32 2024 +0100

    more template

commit 5e4b318d67
Author: AquaEBM@gmail.com <AquaEBM@gmail.com>
Date:   Fri Mar 22 15:26:07 2024 +0100

    inline Reduce_<> functions

commit 076fa7badc
Author: AquaEBM@gmail.com <AquaEBM@gmail.com>
Date:   Fri Mar 22 15:18:39 2024 +0100

    fix compilation error

commit 1091abd034
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Fri Mar 22 14:58:26 2024 +0100

    fix some compilation errors

commit dd9ea3ece8
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Fri Mar 22 12:02:39 2024 +0100

    update intersects, document changes

commit 6226161e31
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Fri Mar 22 09:22:06 2024 +0100

    fix compilation error, add min/max functions for Vec3d

commit 6b32e8878e
Author: AquaEBM <AquaEBM@gmail.com>
Date:   Fri Mar 22 09:18:34 2024 +0100

    fix min/max functions
2024-03-26 11:44:37 +01:00
=
0adeba26e4 minor fix
All checks were successful
Linux arm64 / Build (push) Successful in 4m50s
2024-03-26 11:35:37 +01:00
=
011d8a573c fix stupid build error
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-26 11:33:56 +01:00
=
22406ad020 yes
Some checks failed
Linux arm64 / Build (push) Failing after 2m52s
2024-03-26 11:25:35 +01:00
=
4db55a372b csavgfdslgakdf;g
Some checks failed
Linux arm64 / Build (push) Failing after 2m42s
2024-03-26 11:13:22 +01:00
20d176ccb5 add range overlapping check utilities
Some checks failed
Linux arm64 / Build (push) Failing after 3m10s
2024-03-26 11:07:27 +01:00
3863e7907f better edge case handling 2024-03-26 10:24:35 +01:00
=
35b7d7bab0 I am fucking retarded what the fuck is this stupid brain smoking
All checks were successful
Linux arm64 / Build (push) Successful in 4m47s
2024-03-26 10:19:21 +01:00
7a388bcd62 Add crosshair (#20)
All checks were successful
Linux arm64 / Build (push) Successful in 4m30s
Reviewed-on: #20
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-26 09:11:20 +01:00
d1bb086daf temp intersect
Some checks failed
Linux arm64 / Build (push) Failing after 4m42s
2024-03-26 09:00:47 +01:00
7f5aee9e16 fix merge 2024-03-26 09:00:30 +01:00
1bdf35a4e6 Merge branch 'death' into dev
Some checks failed
Linux arm64 / Build (push) Failing after 2m17s
2024-03-26 08:39:18 +01:00
2bef8801e8 Physique presque finie (#21)
Some checks failed
Linux arm64 / Build (push) Failing after 4m47s
Co-authored-by: = <=>
Co-authored-by: AquaEBM <AquaEBM@gmail.com>
Co-authored-by: AquaEBM@gmail.com <AquaEBM@gmail.com>
Reviewed-on: #21
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-26 08:31:02 +01:00
6aca413b4f small refactor
Some checks failed
Linux arm64 / Build (push) Failing after 5m21s
2024-03-24 18:14:02 +01:00
ee322e3e7b improve tests, fix some bugs in Distance, (not working yet)
Some checks failed
Linux arm64 / Build (push) Failing after 2m28s
2024-03-24 17:43:07 +01:00
864a15e4c8 Squashed commit of the following:
All checks were successful
Linux arm64 / Build (push) Successful in 4m45s
commit c1ded40cc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 17:24:05 2024 +0100

    improve network test

commit 285bf880ee
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 17:14:43 2024 +0100

    fix warning

commit 06ff76607d
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 15:45:33 2024 +0100

    add bots

commit 19229bbe8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 14:55:57 2024 +0100

    fix warnings

commit 2b0930a734
Author: Morph01 <thibaut6969delastreet@gmail.com>
Date:   Tue Mar 19 10:43:55 2024 +0100

    hud of blitz (#16)

    Résoudre partiellement #12

    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
    Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
    Reviewed-on: #16

commit 84b6acad4c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 19 10:15:54 2024 +0100

    less spooky light

commit 9f94d51fc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 14 16:36:15 2024 +0100

    Ajout de tests d'intégration (#17)

    Le paquet fournissant OpenGL a été temporairement remplacé par glew

    Reviewed-on: #17
    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-committed-by: Persson-dev <sim16.prib@gmail.com>

commit 9951256881
Author: Simon Pribylski <sim16.prib@gmail.com>
Date:   Wed Mar 13 20:19:37 2024 +0100

    action: install libsdl via apt

commit 4a02054648
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:53:20 2024 +0100

    compression tests

commit 19c39312bf
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:51:57 2024 +0100

    setup action

commit d5014b1e8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 12 10:26:47 2024 +0100

    Revert "extend Vec3"

    This reverts commit dccfa9c936.

commit dccfa9c936
Author: = <=>
Date:   Tue Mar 12 10:01:00 2024 +0100

    extend Vec3
Merge branch 'main' into physics
2024-03-22 19:33:45 +01:00
7efd8218ea moved functions in Maths.h
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-22 19:28:46 +01:00
08db7f84b9 add missing include
All checks were successful
Linux arm64 / Build (push) Successful in 5m7s
2024-03-22 19:16:48 +01:00
7119dea783 merge 'main' branch
commit c1ded40cc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 17:24:05 2024 +0100

    improve network test

commit 285bf880ee
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 17:14:43 2024 +0100

    fix warning

commit 06ff76607d
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 15:45:33 2024 +0100

    add bots

commit 19229bbe8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 14:55:57 2024 +0100

    fix warnings

commit 2b0930a734
Author: Morph01 <thibaut6969delastreet@gmail.com>
Date:   Tue Mar 19 10:43:55 2024 +0100

    hud of blitz (#16)

    Résoudre partiellement #12

    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
    Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
    Reviewed-on: #16

commit 84b6acad4c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 19 10:15:54 2024 +0100

    less spooky light

commit 9f94d51fc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 14 16:36:15 2024 +0100

    Ajout de tests d'intégration (#17)

    Le paquet fournissant OpenGL a été temporairement remplacé par glew

    Reviewed-on: #17
    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-committed-by: Persson-dev <sim16.prib@gmail.com>

commit 9951256881
Author: Simon Pribylski <sim16.prib@gmail.com>
Date:   Wed Mar 13 20:19:37 2024 +0100

    action: install libsdl via apt

commit 4a02054648
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:53:20 2024 +0100

    compression tests

commit 19c39312bf
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:51:57 2024 +0100

    setup action

commit d5014b1e8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 12 10:26:47 2024 +0100

    Revert "extend Vec3"

    This reverts commit dccfa9c936.

commit dccfa9c936
Author: = <=>
Date:   Tue Mar 12 10:01:00 2024 +0100

    extend Vec3
2024-03-22 19:15:01 +01:00
6e998fc368 change tests
All checks were successful
Linux arm64 / Build (push) Successful in 4m29s
2024-03-22 16:41:52 +01:00
441131a2f5 rename Intersects to distance 2024-03-22 16:14:56 +01:00
c875fa1dee more template
All checks were successful
Linux arm64 / Build (push) Successful in 4m46s
2024-03-22 15:50:32 +01:00
5e4b318d67 inline Reduce_<> functions
All checks were successful
Linux arm64 / Build (push) Successful in 4m34s
2024-03-22 15:26:07 +01:00
076fa7badc fix compilation error
Some checks failed
Linux arm64 / Build (push) Failing after 4m22s
2024-03-22 15:18:39 +01:00
1091abd034 fix some compilation errors
Some checks failed
Linux arm64 / Build (push) Failing after 2m14s
2024-03-22 14:58:26 +01:00
dd9ea3ece8 update intersects, document changes
Some checks failed
Linux arm64 / Build (push) Failing after 2m12s
2024-03-22 12:02:39 +01:00
6226161e31 fix compilation error, add min/max functions for Vec3d
Some checks failed
Linux arm64 / Build (push) Failing after 2m23s
2024-03-22 09:22:06 +01:00
6b32e8878e fix min/max functions
Some checks failed
Linux arm64 / Build (push) Failing after 2m18s
2024-03-22 09:18:34 +01:00
c1ded40cc4 improve network test
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-21 17:24:05 +01:00
285bf880ee fix warning
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-21 17:20:36 +01:00
5492f52806 fix warning
Some checks failed
Linux arm64 / Build (push) Failing after 4m53s
2024-03-21 17:14:43 +01:00
2cbe3f1219 move player on death
Some checks failed
Linux arm64 / Build (push) Failing after 3m53s
2024-03-21 16:46:38 +01:00
fe68b98ba1 update health to client 2024-03-21 16:43:45 +01:00
860ec70829 Squashed commit of the following:
commit 06ff76607d
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 15:45:33 2024 +0100

    add bots

commit 19229bbe8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 21 14:55:57 2024 +0100

    fix warnings

commit 2b0930a734
Author: Morph01 <thibaut6969delastreet@gmail.com>
Date:   Tue Mar 19 10:43:55 2024 +0100

    hud of blitz (#16)

    Résoudre partiellement #12

    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
    Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
    Reviewed-on: #16

commit 84b6acad4c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 19 10:15:54 2024 +0100

    less spooky light

commit 9f94d51fc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 14 16:36:15 2024 +0100

    Ajout de tests d'intégration (#17)

    Le paquet fournissant OpenGL a été temporairement remplacé par glew

    Reviewed-on: #17
    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-committed-by: Persson-dev <sim16.prib@gmail.com>

commit 9951256881
Author: Simon Pribylski <sim16.prib@gmail.com>
Date:   Wed Mar 13 20:19:37 2024 +0100

    action: install libsdl via apt

commit 4a02054648
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:53:20 2024 +0100

    compression tests

commit 19c39312bf
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:51:57 2024 +0100

    setup action

commit d5014b1e8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 12 10:26:47 2024 +0100

    Revert "extend Vec3"

    This reverts commit dccfa9c936.

commit dccfa9c936
Author: = <=>
Date:   Tue Mar 12 10:01:00 2024 +0100

    extend Vec3
2024-03-21 15:51:57 +01:00
06ff76607d add bots
Some checks failed
Linux arm64 / Build (push) Failing after 3m31s
2024-03-21 15:45:33 +01:00
19229bbe8a fix warnings
Some checks failed
Linux arm64 / Build (push) Failing after 11m53s
2024-03-21 14:55:57 +01:00
438bc4a968 remove unused variable
Some checks failed
Linux arm64 / Build (push) Failing after 4m32s
2024-03-21 14:39:18 +01:00
9aa546881a better shoot logging
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-21 14:35:41 +01:00
4db03f2b83 working shoot
Some checks failed
Linux arm64 / Build (push) Has been cancelled
2024-03-21 14:32:03 +01:00
0119d36b5c should work
All checks were successful
Linux arm64 / Build (push) Successful in 5m5s
2024-03-19 13:01:17 +01:00
249d7534a4 Squashed commit of the following:
All checks were successful
Linux arm64 / Build (push) Successful in 4m20s
commit 2b0930a734
Author: Morph01 <thibaut6969delastreet@gmail.com>
Date:   Tue Mar 19 10:43:55 2024 +0100

    hud of blitz (#16)

    Résoudre partiellement #12

    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
    Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
    Reviewed-on: #16

commit 84b6acad4c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 19 10:15:54 2024 +0100

    less spooky light

commit 9f94d51fc4
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Thu Mar 14 16:36:15 2024 +0100

    Ajout de tests d'intégration (#17)

    Le paquet fournissant OpenGL a été temporairement remplacé par glew

    Reviewed-on: #17
    Co-authored-by: Persson-dev <sim16.prib@gmail.com>
    Co-committed-by: Persson-dev <sim16.prib@gmail.com>

commit 9951256881
Author: Simon Pribylski <sim16.prib@gmail.com>
Date:   Wed Mar 13 20:19:37 2024 +0100

    action: install libsdl via apt

commit 4a02054648
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:53:20 2024 +0100

    compression tests

commit 19c39312bf
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Mar 13 13:51:57 2024 +0100

    setup action

commit d5014b1e8a
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Mar 12 10:26:47 2024 +0100

    Revert "extend Vec3"

    This reverts commit dccfa9c936.

commit dccfa9c936
Author: = <=>
Date:   Tue Mar 12 10:01:00 2024 +0100

    extend Vec3
2024-03-19 12:16:23 +01:00
=
abe89d2089 remove debug prints 2024-03-19 12:10:32 +01:00
f070b28d8b revert c_cpp_properties 2024-03-19 12:03:12 +01:00
=
a7f734d22e fix Intersects, add tests 2024-03-19 11:56:29 +01:00
2b0930a734 hud of blitz (#16)
All checks were successful
Linux arm64 / Build (push) Successful in 4m33s
Résoudre partiellement #12

Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
Co-authored-by: Simon Pribylski <sim16.prib@gmail.com>
Reviewed-on: #16
2024-03-19 10:43:55 +01:00
=
abbc4419fa update intersects function 2024-03-19 10:36:43 +01:00
84b6acad4c less spooky light
All checks were successful
Linux arm64 / Build (push) Successful in 4m23s
2024-03-19 10:15:54 +01:00
9f94d51fc4 Ajout de tests d'intégration (#17)
All checks were successful
Linux arm64 / Build (push) Successful in 4m28s
Le paquet fournissant OpenGL a été temporairement remplacé par glew

Reviewed-on: #17
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-14 16:36:15 +01:00
9951256881 action: install libsdl via apt
Some checks failed
Linux arm64 / Build (push) Failing after 54m19s
2024-03-13 20:19:37 +01:00
Morph01
4a02054648 compression tests
Some checks failed
Linux arm64 / Build (push) Failing after 57m27s
2024-03-13 13:53:20 +01:00
Morph01
19c39312bf setup action 2024-03-13 13:51:57 +01:00
86e47601d7 idk 2024-03-12 11:31:04 +01:00
d5014b1e8a Revert "extend Vec3"
This reverts commit dccfa9c936.
2024-03-12 10:26:47 +01:00
=
a3b6d2488f extend Vec3, implement AABB intersection 2024-03-12 10:25:27 +01:00
=
dccfa9c936 extend Vec3 2024-03-12 10:01:00 +01:00
e39fc8aa70 Star Wars (#14)
Reviewed-on: #14
2024-03-12 08:55:49 +01:00
d42f67724d fix error 2024-03-12 08:32:53 +01:00
71bc4dd249 add keybindings (#13)
Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com>
Reviewed-on: #13
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-09 18:37:54 +01:00
2cb5074140 better server logs 2024-03-09 11:01:30 +01:00
269ac16d28 more precise logging 2024-03-08 22:59:50 +01:00
b7926d7a98 pretty log 2024-03-08 22:57:38 +01:00
52da1cf19b explicit server in logs 2024-03-07 23:10:37 +01:00
2da89c8dab xmake: remove global include 2024-03-07 21:12:41 +01:00
88cb433ecf xmake: relative paths 2024-03-07 21:03:23 +01:00
d96b01074e split xmake targets 2024-03-07 20:50:14 +01:00
a1effa05cd remove github ci 2024-03-07 20:14:12 +01:00
7b58117f36 fix warnings 2024-03-07 20:13:05 +01:00
bf8a6458a0 valgrind full info 2024-03-05 12:30:09 +01:00
18ddede8c0 add shoot 2024-03-05 12:29:39 +01:00
d3467418c7 Merge branch 'main' of github.com:Persson-dev/Blitz 2024-03-05 09:01:15 +01:00
d98939cb31 remove useless add_requires 2024-03-05 08:39:24 +01:00
0d039caa0e Merge branch 'weirdshoot' 2024-03-05 08:38:34 +01:00
848f12e58b Vecxuc wrong type 2024-02-27 12:15:35 +01:00
ce249359c6 non copyable classes 2024-02-26 11:27:16 +01:00
9591836074 add valgrind test 2024-01-30 09:14:07 +01:00
7305051062 fix memory warnings 2024-01-30 08:53:26 +01:00
617e1fa95e branchless 2024-01-28 19:09:30 +01:00
73b4539e8d add gun animation 2024-01-28 18:30:16 +01:00
de3ff4326a CooldownTimer to template 2024-01-28 18:29:55 +01:00
51f046f44e fix compile error 2024-01-27 20:12:14 +01:00
3b5208aeba clamp horizonal movement vector norm to 1 (fix diagonal movement speed increase) 2024-01-27 20:10:10 +01:00
a40cd1cd61 change smoothing time const names 2024-01-27 19:11:04 +01:00
1ccf525dd6 fix wrong filter equation 2024-01-27 19:08:56 +01:00
7cf93fa16f add Rotate function 2024-01-27 18:34:14 +01:00
b345d6eb49 fixed-alpha movement smoothing 2024-01-27 17:54:26 +01:00
a7dbf69a4a oooo? 2024-01-27 17:48:37 +01:00
d57195cef2 fix gun model 2024-01-27 17:42:49 +01:00
b6eae6575e fix contructor def 2024-01-27 17:29:54 +01:00
f7d471d3ad format + fix compiling 2024-01-27 17:29:22 +01:00
956aae9b83 first fix attempt 2024-01-27 17:22:54 +01:00
bb86e96884 fix more bugs 2024-01-27 17:00:00 +01:00
22e19c7a97 fix ldflags typo and other compile errors 2024-01-27 16:54:07 +01:00
a71a5ea2bc smoothing test 2024-01-27 16:40:59 +01:00
6450354d0f fix Android inputs 2024-01-27 13:31:00 +01:00
e350f23c4e refactor PlayerController 2024-01-27 13:19:48 +01:00
9ada85f5e6 fix light bug 2024-01-27 13:17:31 +01:00
7496c25669 make mouse grabbing restrict input reaction 2024-01-27 13:09:41 +01:00
a75e4669c0 minor renaming, chage jump height 2024-01-27 13:04:50 +01:00
667f997338 small PlayerController refactor 2024-01-25 23:48:53 +01:00
e86a1b578e install package locally 2024-01-25 23:38:45 +01:00
39ce24935d xmake.lua msg 2024-01-25 23:38:34 +01:00
9e5fd829a5 use doccomments for field docs 2024-01-25 19:51:32 +01:00
2b4ae457cb implement simple jumping 2024-01-25 19:50:48 +01:00
dfc2170ec8 first attempt at jump 2024-01-25 19:06:12 +01:00
1066b15612 indent xmake.lua 2024-01-23 08:47:16 +01:00
0eea01a5b9 FPS mode in game 2024-01-21 14:23:01 +01:00
b9204db9c0 Squashed commit of the handgun branch:
commit cb02631040e0d4ccac5ce844d9c429715d768181
Author: Morph01 <145839520+Morph01@users.noreply.github.com>
Date:   Wed Jan 17 22:14:13 2024 +0100

    position et rotation finger gun

commit 1f1c6f0721963f6ca7d85b8edbc48c1467ab43ba
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Wed Jan 17 18:41:25 2024 +0100

    colors

commit 19e6e99c5d9111d8944c40f5043368ba55abc0f5
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Wed Jan 17 18:35:17 2024 +0100

    fix rotation

commit acc444d45f8bb2d43efde92ff518b674ca998f4b
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Wed Jan 17 18:23:20 2024 +0100

    handgun adjust menu

Co-authored-by: Morph01 <145839520+Morph01@users.noreply.github.com>
2024-01-18 16:02:02 +01:00
d5ccd8a3fa refactor player pos update code 2024-01-18 15:41:38 +01:00
ef5e274ef9 add PlayerController class 2024-01-18 15:08:56 +01:00
f237158fb4 temp show mouse again 2024-01-18 15:06:57 +01:00
Morph01
d1e70745eb Finger Gun model v2 small 2024-01-17 17:36:23 +01:00
Morph01
b368922f9f Finger Gun model v1 2024-01-17 17:12:21 +01:00
195a337df9 hide mouse in game 2024-01-12 19:51:58 +01:00
Simon Pribylski
bde4292d9e fix MSVC build 2024-01-11 17:45:45 -08:00
502de9e778 simplify xmake.lua 2024-01-03 17:41:31 +01:00
8ec1ea139e Merge branch 'glbinding' 2024-01-03 17:35:42 +01:00
11a85a6ef4 Ignore clangd cache 2024-01-02 19:23:49 +01:00
1e09572491 use glbinding instead of glew 2024-01-02 19:22:31 +01:00
a692c35f3a fix shaders for Android 2023-12-20 20:29:44 +01:00
ea95ab94e8 spookier light 2023-12-20 19:18:43 +01:00
810d5e0906 assert shader compilation with blitz_debug_assert 2023-12-20 19:05:48 +01:00
a1e8207bbb add blitz_debug_assert 2023-12-20 19:05:21 +01:00
b9296bf9a4 fix shaders for Android 2023-12-20 19:01:05 +01:00
cba7b0c3f7 shader compile assertion 2023-12-20 18:51:40 +01:00
17d55b5ffa crash program if shader does not compile 2023-12-20 13:38:05 +01:00
01efad9308 rework shaders code 2023-12-20 13:32:54 +01:00
bf4f31a6b0 attach camera to player 2023-12-18 20:31:23 +01:00
Simon Pribylski
b94b28d717 Github: add macOs action (#2)
* Create macos.yml

* Fix macos.yml

* remove anonymous namespace identifier

* forgot one ...

* fix macos build

* add tests for macos.yml

* macOS action trigger only on main or PR
2023-12-18 18:05:41 +01:00
Simon Pribylski
bd46fc5894 Add Windows action (#1)
* Create windows.yml

* Fix windows.yml

* add tests for windows.yml

* remove Windows arm action

* Windows action trigger only on main and PR
2023-12-18 18:00:29 +01:00
9d74a5288f unregister handler on delete (again) 2023-12-15 20:01:14 +01:00
1f53fc9015 doc: Test.h 2023-12-15 19:56:23 +01:00
55e5f679ab gui: add leave game button 2023-12-15 19:34:33 +01:00
2dd3e15bdf unregister handler on delete 2023-12-15 19:33:44 +01:00
Simon Pribylski
f567143b05 fix typo 2023-12-15 18:07:59 -08:00
de0195d05f doc: tests work on release too 2023-12-15 19:05:44 +01:00
652987b236 test: allow to build in release 2023-12-15 19:05:04 +01:00
fe7baa99b0 test: Vector.h 2023-12-12 20:22:17 +01:00
0a2059d14a set xmake minimum version to 2.8.5 2023-12-12 20:18:32 +01:00
83f48886fc doc: add tests 2023-12-12 20:00:31 +01:00
7cf29bca45 add test framework 2023-12-12 20:00:14 +01:00
a767e9744e fix Vector operators 2023-12-12 19:59:47 +01:00
0a61e24e84 doc: KeepAlivePacket.h 2023-12-11 19:28:54 +01:00
3718bc644e doc: PlayerJoinPacket.h 2023-12-11 19:16:01 +01:00
edb4bf6984 doc: Defines.h 2023-12-11 19:04:38 +01:00
ecff4c9f64 doc: PacketType 2023-12-11 18:48:50 +01:00
09f603f4fb add doxygen dark mode toogle 2023-12-11 17:41:38 +01:00
c416efc294 format html files 2023-12-11 16:47:46 +01:00
cf6ce6bae7 allow custom doxygen html 2023-12-11 16:44:52 +01:00
81386e7407 add network namespace doc 2023-12-11 00:20:09 +01:00
6c31a45719 minor fix for doc 2023-12-10 23:45:26 +01:00
10aacd361d refactor project 2023-12-10 23:41:50 +01:00
da62b98345 add network doc 2023-12-10 23:31:04 +01:00
3c64df12ec remove useless include 2023-12-10 23:27:38 +01:00
4bad9b6041 remove useless tcp function 2023-12-10 22:36:53 +01:00
b279d7b4b3 fix doc link 2023-12-10 22:31:04 +01:00
a564898445 remove useless tcp code 2023-12-10 22:10:07 +01:00
a7fe7caacc better doxyfile 2023-12-10 21:51:56 +01:00
1760241d15 change xmake link 2023-12-10 21:51:33 +01:00
a1bd852deb update doxygen mainpage 2023-12-10 19:24:53 +01:00
e9a5786524 update the README for doxygen 2023-12-10 18:29:44 +01:00
ddf5634b10 better doxygen style 2023-12-10 17:48:45 +01:00
f98f5a5ee4 Update README 2023-12-09 21:22:53 +01:00
7a58d35a08 remove whitespace 2023-12-09 21:20:43 +01:00
7da1ae5848 remove repetitive Display::Destroy call 2023-12-09 20:37:25 +01:00
d9f5678077 fix Windows networking 2023-12-09 20:13:07 +01:00
Simon Pribylski
2a9b087769 make Blitz lib static for Windows 2023-12-09 18:21:24 -08:00
Simon Pribylski
f92a5663d6 add dirty windows xmake.lua fix 2023-12-09 17:58:55 -08:00
44b31e7c58 refactor networking code 2023-12-09 18:36:23 +01:00
d640170d2c fix small warning 2023-12-09 18:26:04 +01:00
Simon Pribylski
f995b2e6b4 fix msvc imgui link error 2023-12-09 17:13:19 -08:00
a45b5dae3b change chat fade time to 2s 2023-11-28 11:14:07 +01:00
c39340f4de fix chat not closing properly 2023-11-28 11:11:14 +01:00
54cbfc2c33 adjust menu heights 2023-11-28 11:05:15 +01:00
0390f165dd display fps in right corner 2023-11-28 10:55:49 +01:00
d873d635cc feat: show settings during game 2023-11-28 10:52:24 +01:00
4f2c815a87 spooky light 2023-11-20 13:46:22 +01:00
Morph01
32c049f7f4 new map model, fix player model, ajust eyeHeight 2023-11-18 18:42:45 +01:00
53ae5d2e4f remove broken map 2023-11-18 17:17:07 +01:00
3846512c84 rework ModelLoader 2023-11-18 17:15:29 +01:00
fea0cb6b0d remove useless shader code 2023-11-18 17:12:44 +01:00
ce78a28d21 add ambient lighting 2023-11-18 17:12:19 +01:00
Morph01
f31bede304 broken fbx map 2023-11-17 13:56:57 +01:00
62767a04aa add skycolor 2023-11-16 22:48:08 +01:00
aa4abba135 fixing Android build 2023-11-16 22:32:16 +01:00
0ff0279772 rework PacketFactory
Applying @AquaEBM suggestion

Co-Authored-By: AquaEBM <79016373+aquaebm@users.noreply.github.com>
2023-11-16 22:24:39 +01:00
0ca47817d9 fix cam sensitivity 2023-11-15 18:42:03 +01:00
4519bd3fcb fixing loading model bug
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2023-11-14 14:11:01 +01:00
9115d3bfea update Android shaders 2023-11-10 22:47:30 +01:00
087d12091b more assets debugging 2023-11-10 22:26:59 +01:00
fe63734ef1 use AssetsManager for textures 2023-11-10 22:16:41 +01:00
c6fb45be2f fix Android build 2023-11-10 22:15:22 +01:00
179f5112ea force sdl version 2023-11-10 22:14:41 +01:00
d4bbfcf030 update AssetsManager 2023-11-10 20:05:03 +01:00
711502650f add texture support 2023-11-10 09:19:53 +01:00
7edb7f1f02 resize texture image 2023-11-10 09:16:36 +01:00
Morph01
ac3aab4a36 texture of the ground 2023-11-09 21:43:45 +01:00
Morph01
dfe65025a5 ajusted eyeHeight 2023-11-09 21:36:32 +01:00
Morph01
ded2153c2b human model and map with texture 2023-11-09 21:33:06 +01:00
f82324d819 feat: save settings 2023-11-09 21:28:25 +01:00
a9a0b50bc0 add json dep 2023-11-09 19:59:17 +01:00
86518ecc22 add InputManager 2023-11-09 19:50:08 +01:00
07e6d3bbe5 revert light player direction 2023-11-09 18:36:56 +01:00
dbe37b4eec add face culling 2023-11-09 18:35:41 +01:00
1cff3b6880 add antialiasing 2023-11-09 16:53:40 +01:00
fddb48d6ab add basic lighting 2023-11-09 16:36:50 +01:00
e9c1de0e0d add normal loading (+fix weird bug) 2023-11-09 16:23:19 +01:00
6514372b92 Disable face culling
This should be reenabled at some point !
2023-11-09 13:07:14 +01:00
Simon Pribylski
fe18004939 Update README.md
Fix typo
2023-11-08 23:51:06 +01:00
5198b47db3 fix Windows build 2023-11-05 14:48:50 +01:00
168d7c72fc use AssetsManager to load font 2023-11-04 19:59:21 +01:00
ec45885525 add AssetsManager 2023-11-04 19:44:01 +01:00
24cbc81cab improve Android support 2023-11-04 19:18:47 +01:00
Simon Pribylski
acbc20ed75 fix README typo 2023-11-04 17:18:52 +01:00
Simon Pribylski
8aab96cd72 indent correctly 2023-11-04 17:18:13 +01:00
Simon Pribylski
3f73f6ddf9 Indent README 2023-11-04 17:17:27 +01:00
cf99d08e7f update README 2023-11-04 17:16:00 +01:00
3fc3d52e10 update Protocol doc 2023-11-04 16:48:40 +01:00
c132234b0b rework VarInt 2023-11-04 16:43:11 +01:00
0951ca2587 remove useless include 2023-11-04 16:34:37 +01:00
f55ec17747 fix map 2023-11-04 13:21:10 +01:00
445ea3f616 render map 2023-11-04 13:16:09 +01:00
89fd026b71 fix Android build 2023-11-04 12:38:52 +01:00
9634f2737b use of VarLong for Packet size 2023-11-02 23:43:50 +01:00
3a1b2d277c refactor VarInt 2023-11-02 23:43:15 +01:00
26bde206cb remove useless function 2023-11-02 23:04:45 +01:00
041281ac61 use of VarInt 2023-11-02 22:53:46 +01:00
23ddc9e292 refactor 2023-11-02 22:53:18 +01:00
a285a61ff9 add VarInt 2023-11-02 22:52:52 +01:00
1173cf4087 remove useless function 2023-11-02 22:25:40 +01:00
8d6db5036e remove DataBuffer ToString 2023-11-02 22:06:48 +01:00
539001aad4 move REMOVE_COPY in hix own file 2023-11-02 21:37:34 +01:00
d8b781e619 explicit constructor 2023-11-02 21:35:30 +01:00
c08a28cedd add gui support for Android 2023-11-02 13:37:03 +01:00
527d43742d opengl includes for Android 2023-11-02 13:36:34 +01:00
82d562a4fc fix compiling for Android 2023-11-02 13:35:47 +01:00
90e411d747 ignore src directory for doc 2023-11-02 13:13:14 +01:00
Morph01
abb46e278b Merge branch 'main' of https://github.com/Persson-dev/Blitz 2023-10-31 10:36:36 +01:00
Morph01
956dca7ef8 add an empty map 2023-10-31 10:36:26 +01:00
f72aa2e959 don't render own player model 2023-10-27 00:47:41 +02:00
0aa4963972 moved PlayerID def 2023-10-27 00:46:51 +02:00
87b68750d5 document Protocol.h 2023-10-22 14:56:25 +02:00
0c156db744 remove more useless includes 2023-10-22 13:48:01 +02:00
1069b5319d add basic doc 2023-10-22 13:47:40 +02:00
69b2d4e568 remove useless includes 2023-10-22 13:36:43 +02:00
5a99281428 moved vectors in their own file 2023-10-22 13:03:54 +02:00
889743480a small refactor 2023-10-22 12:48:54 +02:00
99f25f932b interpolate player movement 2023-10-22 12:45:00 +02:00
1d94c5f61a add * vect operator 2023-10-22 12:42:51 +02:00
335fb87382 remove useless paramters 2023-10-21 12:59:58 +02:00
fbed05f55a add compile flag for Android 2023-10-21 11:20:48 +02:00
9c94d2e36e sync player rotation 2023-10-19 18:00:19 +02:00
fdd2e34756 use of matricies to translate 2023-10-19 17:45:43 +02:00
f0d85c2c90 render players + sync 2023-10-19 17:23:34 +02:00
2d523693eb fix typo 2023-10-19 16:39:27 +02:00
52a338e3b5 better network sync 2023-10-19 16:36:17 +02:00
fa030d1ea5 add face culling 2023-10-19 16:23:30 +02:00
585c092e3a player position sync 2023-10-19 15:49:20 +02:00
14b390f2c4 add player pos packet 2023-10-19 15:14:26 +02:00
67f987d02c add line 2023-10-19 14:39:44 +02:00
40d6224204 refactor chat 2023-10-19 14:37:20 +02:00
ff0c2c3e02 don't move cam in chat 2023-10-19 14:22:10 +02:00
3b7398599d readd include path 2023-10-19 13:11:27 +02:00
4ed38ad4e4 camera better timings 2023-10-19 13:08:43 +02:00
1dd2637b07 move load model function 2023-10-19 12:42:00 +02:00
3d1dfd77d9 optimize bug fix 2023-10-19 12:29:36 +02:00
227c98bcf9 render player model 2023-10-18 21:04:05 +02:00
7d913589de FIXING THE BUG 2023-10-18 21:01:33 +02:00
bc01621fe3 small cam correction 2023-10-18 20:57:25 +02:00
Morph01
cd1710b0a3 add human model 2023-10-18 20:49:44 +02:00
b6d1fbe1f2 basic camera movement 2023-10-18 19:21:59 +02:00
cc9db304b8 fixing critical bug 2023-10-18 19:01:22 +02:00
764ee2db98 less vscode config 2023-10-18 17:17:46 +02:00
200 changed files with 12654 additions and 1618 deletions

View File

@@ -0,0 +1,46 @@
name: Linux arm64
run-name: Build And Test
on: [push]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Install deps
run : |
apt update
apt install -y libsdl2-dev libassimp-dev libglew-dev
- name: Check out repository code
uses: actions/checkout@v3
- name: Prepare XMake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: '.xmake-cache'
actions-cache-key: 'ubuntu'
- name: Calc deps hash
uses: seepine/hash-files@v1
id: get-hash
with:
patterns: |
**/xmake.lua
**/xmake/*.lua
- name: Packages cache
uses: actions/cache@v4
with:
path: ~/.xmake
key: ${{ runner.os }}-${{ steps.get-hash.outputs.hash }}
- name: XMake config
run: xmake f -p linux -y --root
- name: Build
run: xmake --root
- name: Test
run: xmake test --root

9
.gitignore vendored
View File

@@ -9,4 +9,11 @@ build/
.vscode
# IMGay
imgui.ini
imgui.ini
# Blitz settings
assets/settings.json
# Vim Cache
.cache
compile_commands.json

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "doxygen/doxygen-awesome-css"]
path = doxygen/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git

View File

@@ -1,18 +1,13 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/include",
"${workspaceFolder}/libs/imgui"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-clang-x64",
"compileCommands": ".vscode/compile_commands.json"
}
],
"version": 4
"configurations": [
{
"name": "Blitz",
"cppStandard": "c++17",
"includePath": [
"include"
],
"compileCommands": ".vscode/compile_commands.json"
}
],
"version": 4
}

7
.vscode/launch.json vendored
View File

@@ -2,6 +2,13 @@
// Xmake debug
"version": "0.2.0",
"configurations": [
{
"type": "xmake",
"request": "launch",
"name": "debug intersects test",
"target": "test_intersects",
"cwd": "",
},
{
"type": "xmake",
"request": "launch",

View File

@@ -1 +1,88 @@
# Blitz
# Blitz 🎮
Fast FPS written in C++
# Prerequisites 🛠️
You will need a recent compiler supporting c++17 and [xmake](https://xmake.io) (version 2.8.5 or higher).
xmake should download all the dependencies for you.
# Client 💻
## Build ⚙️
```
xmake [BlitzClient]
```
## Run 🏃
```
xmake run [BlitzClient]
```
# Server 🗄
## Build ⚙️
```
xmake build BlitzServer
```
## Run 🏃
```
xmake run BlitzServer [-P port]
```
# Debug 🏗️
Switch to debug mode
```
xmake f -m debug
```
Switch to release mode
```
xmake f -m release
```
Run with debugger
```
xmake run -d # Client
xmake run -d BlitzServer # Server
```
# Testing 🧐
Run tests :
```
xmake test
```
Run tests with verbose :
```
xmake test -v
```
# Generate docs 📖
First, clone the submodule for the enhanced css :
```
git submodule update --init
```
Then, refresh the doc :
```
xmake doxygen
```
# Visual Studio Code integration 🎛
Generate `compile_commands.json` :
```
xmake project -k compile_commands
```
Alternatively, you can install the [XMake extension](https://marketplace.visualstudio.com/items?itemName=tboox.xmake-vscode) for VsCode.

BIN
assets/base_deambu.glb Normal file

Binary file not shown.

BIN
assets/carrelage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

BIN
assets/crosshair.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
assets/cube.glb Normal file

Binary file not shown.

454
assets/fingergun.obj Normal file
View File

@@ -0,0 +1,454 @@
# Blender 4.0.2
# www.blender.org
mtllib fingergun.mtl
o Cube
v 0.28522 -0.306557 -0.869022
v 0.322362 -0.317165 -0.761062
v 0.343467 -0.302403 -0.885416
v 0.368924 -0.313485 -0.773896
v 0.290013 -0.112715 -0.788332
v 0.323476 -0.173525 -0.715829
v 0.352603 -0.107768 -0.805584
v 0.370039 -0.169845 -0.728663
v 0.313472 -0.282474 -0.98082
v 0.305899 -0.094307 -0.966123
v 0.25069 -0.288091 -0.963829
v 0.248265 -0.098863 -0.950236
v 0.315042 -0.255677 -0.741247
v 0.353448 -0.222605 -0.866318
v 0.376243 -0.25084 -0.758116
v 0.275133 -0.228795 -0.844732
v 0.306822 -0.188042 -0.997506
v 0.242783 -0.193417 -0.979751
v 0.328963 -0.094936 -0.887948
v 0.26606 -0.099642 -0.870998
v 0.256312 -0.29401 -0.929786
v 0.325556 -0.290373 -0.95117
v 0.331511 -0.201707 -0.945538
v 0.249474 -0.208163 -0.925103
v 0.3156 -0.212794 -0.726928
v 0.356824 -0.163947 -0.837251
v 0.306541 -0.136889 -0.988441
v 0.376801 -0.207956 -0.743797
v 0.278508 -0.170136 -0.815665
v 0.24314 -0.1419 -0.970965
v 0.334727 -0.146782 -0.918122
v 0.253545 -0.153198 -0.895745
v 0.376243 -0.285911 -0.768173
v 0.274555 -0.274639 -0.858509
v 0.244437 -0.249179 -0.968971
v 0.315042 -0.290748 -0.751303
v 0.353299 -0.268056 -0.87989
v 0.312528 -0.243154 -0.9863
v 0.246945 -0.259562 -0.929467
v 0.333607 -0.251364 -0.952175
v 0.285002 -0.111885 -1.0476
v 0.284624 -0.075309 -1.03848
v 0.240924 -0.078763 -1.02644
v 0.241302 -0.115339 -1.03555
v 0.265142 -0.095745 -1.09905
v 0.26471 -0.06569 -1.092
v 0.231536 -0.068311 -1.08285
v 0.231968 -0.098367 -1.0899
v 0.245138 -0.079879 -1.14484
v 0.244853 -0.060082 -1.1402
v 0.223002 -0.061809 -1.13417
v 0.223287 -0.081606 -1.13882
v 0.238589 -0.126121 -1.04304
v 0.238302 -0.156446 -1.05277
v 0.282403 -0.152961 -1.06493
v 0.282689 -0.122635 -1.05519
v 0.224842 -0.104653 -1.10809
v 0.224605 -0.129737 -1.11614
v 0.259885 -0.126949 -1.12586
v 0.260122 -0.101865 -1.11781
v 0.212474 -0.08638 -1.1635
v 0.212291 -0.105749 -1.16971
v 0.239533 -0.103596 -1.17722
v 0.239716 -0.084227 -1.17101
v 0.245255 -0.211794 -0.937667
v 0.23564 -0.203772 -0.970252
v 0.239644 -0.243118 -0.967006
v 0.247582 -0.250332 -0.938814
v 0.20904 -0.218297 -0.924812
v 0.199926 -0.212656 -0.95554
v 0.202827 -0.242012 -0.953432
v 0.211233 -0.248682 -0.925568
v 0.23797 -0.250875 -0.931151
v 0.227883 -0.243486 -0.96328
v 0.22403 -0.205538 -0.966375
v 0.235306 -0.213245 -0.930024
v 0.228892 -0.223387 -0.888623
v 0.230462 -0.247719 -0.889906
v 0.247651 -0.24687 -0.894579
v 0.246456 -0.221472 -0.89286
v 0.239437 -0.222641 -0.868515
v 0.241043 -0.247531 -0.869827
v 0.256136 -0.245131 -0.875942
v 0.256357 -0.221304 -0.873179
v 0.211074 -0.263639 -0.953702
v 0.213693 -0.287969 -0.951236
v 0.220098 -0.290426 -0.927654
v 0.217767 -0.267981 -0.929448
v 0.244401 -0.260805 -0.898326
v 0.246352 -0.279833 -0.896941
v 0.22605 -0.263629 -0.895257
v 0.227699 -0.279716 -0.894086
v 0.244023 -0.258082 -0.877504
v 0.245361 -0.271127 -0.876555
v 0.231216 -0.259837 -0.875381
v 0.232387 -0.271258 -0.87455
v 0.242235 -0.234909 -0.865645
v 0.25077 -0.246182 -0.869083
v 0.249798 -0.221958 -0.8673
v 0.258332 -0.233231 -0.870738
v 0.250591 -0.234249 -0.867948
v 0.340336 -0.064822 -0.814251
v 0.289619 -0.068389 -0.800918
v 0.27575 -0.028073 -0.848984
v 0.323192 -0.025853 -0.859801
v 0.347259 -0.086137 -0.809994
v 0.288925 -0.090417 -0.7944
v 0.323713 -0.063998 -0.876764
v 0.271488 -0.066639 -0.864561
v 0.30779 -0.003466 -0.90206
v 0.269355 -0.005186 -0.893491
v 0.305922 -0.036948 -0.917187
v 0.267487 -0.038668 -0.908618
v 0.290951 0.010285 -0.945364
v 0.264889 0.009062 -0.939487
v 0.289769 -0.012563 -0.955362
v 0.263707 -0.013786 -0.949485
v 0.389423 -0.241181 -0.511183
v 0.42824 -0.238113 -0.521883
v 0.390542 -0.278589 -0.508273
v 0.434238 -0.348579 -0.541377
v 0.42824 -0.370001 -0.559701
v 0.389423 -0.373069 -0.549002
v 0.390542 -0.352032 -0.529332
v 0.390542 -0.318275 -0.519653
v 0.434238 -0.275136 -0.520317
v 0.434238 -0.314821 -0.531697
v 0.616718 -0.481384 0.244553
v 0.655534 -0.478316 0.233854
v 0.617836 -0.518792 0.247464
v 0.661532 -0.588782 0.21436
v 0.655534 -0.610204 0.196036
v 0.616718 -0.613272 0.206735
v 0.617836 -0.592235 0.226404
v 0.617836 -0.558478 0.236084
v 0.661532 -0.515339 0.23542
v 0.661532 -0.555025 0.22404
vn -0.0693 0.9972 0.0269
vn 0.9795 0.1687 -0.1100
vn 0.1060 0.7854 0.6098
vn 0.9604 0.1984 -0.1956
vn 0.0434 -0.9929 -0.1105
vn -0.8879 -0.3691 0.2745
vn -0.9967 0.0312 0.0753
vn 0.0064 -0.9769 -0.2137
vn -0.9784 0.0912 0.1858
vn 0.8684 -0.1187 -0.4815
vn 0.9200 0.1044 -0.3777
vn -0.9872 -0.0075 0.1595
vn -0.2347 -0.2040 -0.9504
vn -0.9357 -0.1073 0.3360
vn 0.9709 0.0660 -0.2301
vn 0.9798 0.0546 -0.1923
vn -0.9451 -0.0305 0.3255
vn 0.9660 0.0680 -0.2495
vn 0.9317 -0.2088 -0.2973
vn -0.9522 0.0661 0.2984
vn 0.0031 -0.9814 -0.1918
vn 0.2293 0.2657 0.9364
vn -0.9558 -0.0825 0.2822
vn 0.9496 0.2172 -0.2261
vn -0.9345 -0.2676 0.2347
vn -0.9114 0.0193 0.4112
vn 0.9246 0.2310 -0.3028
vn -0.9916 -0.0052 0.1295
vn -0.0507 -0.8928 -0.4476
vn 0.9804 0.0441 -0.1921
vn 0.9662 0.0724 -0.2475
vn -0.8929 -0.3210 0.3158
vn 0.9471 -0.2199 -0.2338
vn -0.2380 -0.1521 -0.9593
vn -0.0758 -0.9889 -0.1279
vn 0.8868 0.0460 -0.4598
vn -0.9364 -0.0930 0.3384
vn 0.9710 0.0651 -0.2302
vn 0.9384 0.0922 -0.3330
vn -0.0060 0.9668 0.2556
vn -0.0315 -0.9247 -0.3794
vn 0.9551 0.1199 -0.2708
vn -0.0139 -0.9467 -0.3219
vn -0.0064 -0.9548 -0.2971
vn -0.0263 0.9821 0.1863
vn -0.9867 -0.0495 0.1545
vn -0.2753 0.2158 -0.9368
vn -0.0418 0.9903 0.1324
vn -0.9862 -0.0511 0.1575
vn 0.9240 0.0999 -0.3690
vn 0.0107 0.9502 0.3113
vn 0.9467 0.0724 -0.3140
vn -0.9982 -0.0057 0.0600
vn -0.0179 0.9765 0.2149
vn -0.0382 -0.9153 -0.4010
vn -0.0324 -0.9235 -0.3822
vn 0.9461 0.0908 -0.3108
vn -0.9804 -0.0518 0.1901
vn -0.2755 0.2962 -0.9145
vn 0.9396 0.0966 -0.3284
vn -0.9782 -0.0550 0.2002
vn 0.0106 0.9503 0.3110
vn -0.1254 -0.9738 -0.1895
vn -0.6568 -0.1481 -0.7394
vn -0.7727 0.5638 0.2916
vn -0.9713 -0.2191 0.0929
vn -0.9596 -0.0757 0.2710
vn -0.3749 -0.1088 -0.9207
vn -0.0133 -0.9972 0.0739
vn -0.1558 0.9587 0.2381
vn -0.0228 0.9732 0.2290
vn 0.6151 0.0168 0.7883
vn -0.2986 -0.1081 -0.9482
vn -0.0725 -0.9741 -0.2141
vn -0.8802 -0.0814 0.4676
vn -0.8777 -0.0780 0.4729
vn 0.9610 0.0709 -0.2674
vn -0.1065 0.9694 0.2210
vn 0.0508 0.0974 0.9940
vn 0.8971 0.0564 -0.4382
vn 0.1038 -0.9946 -0.0036
vn -0.0866 0.9960 0.0233
vn -0.9643 -0.0790 0.2528
vn 0.9671 0.2076 0.1470
vn -0.2769 0.9267 0.2540
vn -0.3354 -0.1588 -0.9286
vn 0.0602 -0.9190 0.3896
vn -0.2317 0.9724 -0.0259
vn -0.0314 -0.9363 0.3497
vn -0.9663 -0.0810 0.2445
vn 0.1512 0.0872 0.9846
vn 0.9947 0.1023 0.0047
vn -0.1663 0.9766 -0.1368
vn -0.9610 -0.0793 0.2649
vn 0.1076 -0.2146 0.9707
vn 0.5991 -0.2528 0.7597
vn 0.5042 0.1209 0.8551
vn 0.1072 0.7759 0.6216
vn 0.9524 0.1729 -0.2510
vn -0.9908 0.0279 0.1323
vn -0.9608 0.0375 0.2747
vn -0.9580 0.0734 0.2771
vn -0.2526 0.2577 -0.9326
vn 0.9434 0.2219 -0.2465
vn 0.2349 0.2579 0.9372
vn -0.9951 0.0098 0.0989
vn 0.0606 0.8911 0.4497
vn 0.9440 0.1199 -0.3073
vn -0.0806 -0.8446 -0.5293
vn -0.2194 0.4006 -0.8896
vn 0.0223 0.9555 0.2943
vn -0.0760 -0.8547 -0.5136
vn 0.9376 0.0981 -0.3337
vn 0.0075 0.9536 0.3008
vn 0.9613 0.0760 -0.2650
vn -0.0075 -0.9536 -0.3008
vn 0.9560 -0.0171 -0.2929
vn -0.9502 -0.0859 0.2995
vn -0.9502 -0.0868 0.2994
vn 0.0106 0.9504 0.3108
vn 0.0057 -0.9665 -0.2566
vn -0.9431 0.0480 0.3290
vn 0.9511 -0.1186 -0.2851
vn 0.2462 -0.6689 0.7014
vn 0.2756 -0.2650 0.9240
vn 0.2587 0.0826 0.9624
vn -0.9613 -0.0760 0.2650
vn -0.9574 -0.1683 0.2345
vn -0.9582 -0.0064 0.2861
vn 0.9593 0.1452 -0.2424
vt 0.625000 0.250000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.929303
vt 0.625000 0.929303
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.375000 0.000000
vt 0.375000 0.250000
vt 0.375000 0.500000
vt 0.625000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.375000 0.449616
vt 0.625000 0.449616
vt 0.625000 0.320697
vt 0.625000 0.800385
vt 0.625000 0.800384
vt 0.625000 0.929303
vt 0.625000 0.858607
vt 0.625000 0.858607
vt 0.625000 0.929303
vt 0.625000 0.449616
vt 0.625000 0.391393
vt 0.675385 0.500000
vt 0.733607 0.500000
vt 0.733607 0.750000
vt 0.675384 0.750000
vt 0.375000 0.320697
vt 0.375000 0.391393
vt 0.375000 0.800384
vt 0.375000 0.858607
vt 0.625000 0.250000
vt 0.804303 0.750000
vt 0.804303 0.500000
vt 0.875000 0.500000
vt 0.875000 0.750000
vt 0.625000 0.420504
vt 0.625000 1.000000
vt 0.625000 0.250000
vt 0.324616 0.500000
vt 0.324616 0.750000
vt 0.195697 0.500000
vt 0.266393 0.500000
vt 0.266393 0.750000
vt 0.195697 0.750000
vt 0.125000 0.500000
vt 0.125000 0.750000
s 0
usemtl Material
f 20/1/1 19/2/1 10/2/1 12/3/1
f 28/4/2 26/5/2 7/6/2 8/7/2
f 8/8/3 7/2/3 5/3/3 6/9/3
f 28/4/4 8/7/4 119/7/4 126/4/4
f 2/10/5 1/11/5 3/12/5 4/13/5
f 36/14/6 34/15/6 1/11/6 2/10/6
f 30/16/7 12/3/7 43/3/7 44/16/7
f 22/12/8 21/11/8 11/11/8 9/12/8
f 32/16/9 20/1/9 12/3/9 30/16/9
f 40/17/10 22/12/10 9/12/10 38/18/10
f 31/19/11 23/20/11 17/21/11 27/22/11
f 39/23/12 24/24/12 65/24/12 68/23/12
f 35/25/13 18/26/13 17/27/13 38/28/13
f 25/29/14 29/16/14 16/24/14 13/30/14
f 33/31/15 15/32/15 127/32/15 121/31/15
f 33/31/16 37/17/16 14/21/16 15/32/16
f 34/15/17 16/24/17 24/24/17 39/23/17
f 26/5/18 14/21/18 23/20/18 31/19/18
f 37/17/19 3/12/19 22/12/19 40/17/19
f 29/16/20 5/3/20 20/1/20 32/16/20
f 3/12/21 1/11/21 21/11/21 22/12/21
f 107/33/22 106/2/22 102/2/22 103/3/22
f 16/24/23 29/16/23 32/16/23 24/24/23
f 7/6/24 26/5/24 31/19/24 19/6/24
f 36/14/25 2/10/25 123/10/25 124/14/25
f 6/9/26 5/3/26 29/16/26 25/29/26
f 19/6/27 31/19/27 27/22/27 10/6/27
f 24/24/28 32/16/28 30/16/28 18/24/28
f 17/27/29 18/26/29 54/26/29 55/27/29
f 15/32/30 14/21/30 26/5/30 28/4/30
f 14/21/31 37/17/31 40/17/31 23/20/31
f 1/11/32 34/15/32 39/23/32 21/11/32
f 4/13/33 3/12/33 37/17/33 33/31/33
f 11/11/34 35/25/34 38/28/34 9/12/34
f 11/11/35 21/11/35 87/11/35 86/11/35
f 23/20/36 40/17/36 38/18/36 17/21/36
f 13/30/37 16/24/37 34/15/37 36/14/37
f 15/32/38 28/4/38 126/4/38 127/32/38
f 42/6/39 41/22/39 45/22/39 46/6/39
f 12/3/40 10/2/40 42/2/40 43/3/40
f 27/34/41 30/35/41 44/35/41 41/34/41
f 10/6/42 27/22/42 41/22/42 42/6/42
f 45/34/43 48/35/43 52/35/43 49/34/43
f 41/34/44 44/35/44 48/35/44 45/34/44
f 43/3/45 42/2/45 46/2/45 47/3/45
f 44/16/46 43/3/46 47/3/46 48/16/46
f 52/35/47 51/36/47 50/37/47 49/34/47
f 47/3/48 46/2/48 50/2/48 51/3/48
f 48/16/49 47/3/49 51/3/49 52/16/49
f 46/6/50 45/22/50 49/22/50 50/6/50
f 53/35/51 56/34/51 60/34/51 57/35/51
f 27/22/52 17/21/52 55/21/52 56/22/52
f 18/24/53 30/16/53 53/16/53 54/24/53
f 30/35/54 27/34/54 56/34/54 53/35/54
f 59/27/55 58/26/55 62/26/55 63/27/55
f 55/27/56 54/26/56 58/26/56 59/27/56
f 56/22/57 55/21/57 59/21/57 60/22/57
f 54/24/58 53/16/58 57/16/58 58/24/58
f 62/26/59 61/35/59 64/34/59 63/27/59
f 60/22/60 59/21/60 63/21/60 64/22/60
f 58/24/61 57/16/61 61/16/61 62/24/61
f 57/35/62 60/34/62 64/34/62 61/35/62
f 74/15/63 73/23/63 72/23/63 71/15/63
f 18/26/64 35/25/64 67/25/64 66/26/64
f 24/24/65 18/24/65 66/24/65 65/24/65
f 35/15/66 39/23/66 68/23/66 67/15/66
f 72/23/67 69/24/67 70/24/67 71/15/67
f 75/26/68 74/25/68 71/25/68 70/26/68
f 72/23/69 73/23/69 79/23/69 78/23/69
f 76/24/70 75/24/70 70/24/70 69/24/70
f 65/24/71 66/24/71 75/24/71 76/24/71
f 68/23/72 65/24/72 76/24/72 73/23/72
f 66/26/73 67/25/73 74/25/73 75/26/73
f 67/15/74 68/23/74 73/23/74 74/15/74
f 77/24/75 78/23/75 82/23/75 97/38/75 81/24/75
f 69/24/76 72/23/76 78/23/76 77/24/76
f 73/23/77 76/24/77 80/24/77 79/23/77
f 76/24/78 69/24/78 77/24/78 80/24/78
f 101/38/79 99/24/79 81/24/79 97/38/79
f 79/23/80 80/24/80 84/24/80 100/38/80 83/23/80
f 78/23/81 79/23/81 83/23/81 98/23/81 82/23/81
f 80/24/82 77/24/82 81/24/82 99/24/82 84/24/82
f 87/11/83 88/23/83 85/15/83 86/11/83
f 21/11/84 39/23/84 89/23/84 90/11/84
f 39/23/85 35/15/85 85/15/85 88/23/85
f 35/25/86 11/11/86 86/11/86 85/25/86
f 92/11/87 90/11/87 94/11/87 96/11/87
f 39/23/88 88/23/88 91/23/88 89/23/88
f 87/11/89 21/11/89 90/11/89 92/11/89
f 88/23/90 87/11/90 92/11/90 91/23/90
f 94/11/91 93/23/91 95/23/91 96/11/91
f 90/11/92 89/23/92 93/23/92 94/11/92
f 89/23/93 91/23/93 95/23/93 93/23/93
f 91/23/94 92/11/94 96/11/94 95/23/94
f 98/23/95 101/38/95 97/38/95 82/23/95
f 83/23/96 100/38/96 101/38/96 98/23/96
f 100/38/97 84/24/97 99/24/97 101/38/97
f 103/3/98 102/2/98 105/2/98 104/1/98
f 106/39/99 108/6/99 105/6/99 102/6/99
f 109/40/100 104/1/100 111/1/100 113/40/100
f 109/40/101 107/33/101 103/3/101 104/1/101
f 20/1/102 5/3/102 107/33/102 109/40/102
f 19/2/103 20/1/103 109/40/103 108/2/103
f 7/6/104 19/6/104 108/6/104 106/39/104
f 5/3/105 7/2/105 106/2/105 107/33/105
f 113/40/106 111/1/106 115/1/106 117/40/106
f 104/1/107 105/2/107 110/2/107 111/1/107
f 105/6/108 108/6/108 112/6/108 110/6/108
f 108/2/109 109/40/109 113/40/109 112/2/109
f 116/2/110 117/40/110 115/1/110 114/2/110
f 111/1/111 110/2/111 114/2/111 115/1/111
f 112/2/112 113/40/112 117/40/112 116/2/112
f 110/6/113 112/6/113 116/6/113 114/6/113
f 119/8/114 118/9/114 128/9/114 129/8/114
f 121/31/115 127/32/115 137/32/115 131/31/115
f 123/10/116 122/13/116 132/13/116 133/10/116
f 122/13/117 121/31/117 131/31/117 132/13/117
f 13/30/118 36/14/118 124/14/118 125/30/118
f 25/29/119 13/30/119 125/30/119 120/29/119
f 8/8/120 6/9/120 118/9/120 119/8/120
f 2/10/121 4/13/121 122/13/121 123/10/121
f 6/9/122 25/29/122 120/29/122 118/9/122
f 4/13/123 33/31/123 121/31/123 122/13/123
f 134/41/124 133/10/124 132/13/124 131/42/124
f 130/43/125 135/44/125 137/45/125 136/46/125
f 128/47/126 130/43/126 136/46/126 129/48/126
f 135/44/125 134/41/125 131/42/125 137/45/125
f 120/29/127 125/30/127 135/30/127 130/29/127
f 125/30/127 124/14/127 134/14/127 135/30/127
f 124/14/128 123/10/128 133/10/128 134/14/128
f 118/9/129 120/29/129 130/29/129 128/9/129
f 126/4/130 119/7/130 129/7/130 136/4/130
f 127/32/115 126/4/115 136/4/115 137/32/115

BIN
assets/fingergun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

612
assets/human.obj Normal file
View File

@@ -0,0 +1,612 @@
# Blender 3.6.4
# www.blender.org
mtllib human.mtl
o Cube
v 0.000000 1.096552 0.046445
v 0.000000 0.889451 0.075384
v 0.000000 1.115286 -0.108617
v 0.000000 0.869687 -0.104453
v -0.180548 1.111717 -0.017414
v -0.111752 0.883886 0.021620
v -0.185078 1.107266 -0.078906
v -0.119727 0.880731 -0.089652
v -0.113113 0.901238 0.004425
v -0.119191 0.863347 -0.060317
v 0.000000 0.586646 0.082459
v 0.000000 0.680490 -0.100339
v -0.138114 0.663711 0.049467
v -0.138587 0.663308 -0.075376
v -0.128084 0.703346 0.048918
v -0.138936 0.663857 -0.074824
v 0.000000 0.586646 0.082459
v 0.000000 0.680490 -0.100339
v -0.138114 0.663711 0.049467
v -0.138587 0.663308 -0.075376
v -0.138936 0.663857 -0.074824
v 0.000000 0.633606 0.062970
v 0.000000 0.680489 -0.091701
v -0.138114 0.663711 0.049467
v -0.138587 0.663308 -0.075376
v -0.138936 0.663857 -0.074824
v 0.000000 0.593050 0.063683
v 0.000000 0.677601 -0.092874
v -0.138114 0.663711 0.049467
v -0.138587 0.663308 -0.075376
v -0.138936 0.663857 -0.074824
v -0.069100 0.324785 0.031864
v -0.069974 0.349583 -0.105590
v -0.178168 0.333615 0.001983
v -0.176367 0.332529 -0.079971
v -0.176661 0.332851 -0.079619
v -0.078182 0.060565 -0.038352
v -0.100391 0.066316 -0.116765
v -0.161400 0.061971 -0.059044
v -0.154590 0.057629 -0.103715
v -0.154739 0.057792 -0.103535
v 0.000000 1.008557 0.072589
v -0.141948 1.013588 -0.077902
v 0.000000 0.962634 -0.106029
v -0.142827 1.021350 -0.002643
v -0.207545 1.041885 -0.083794
v -0.193677 1.102421 -0.079812
v -0.188428 1.103945 -0.018320
v -0.208865 1.048599 -0.008441
v -0.141948 1.013588 -0.077902
v -0.142827 1.021350 -0.002643
v -0.207545 1.041885 -0.083794
v -0.208865 1.048599 -0.008441
v -0.235837 0.598081 -0.011834
v -0.238964 0.602158 0.027134
v -0.272812 0.599277 -0.016077
v -0.275955 0.602764 0.022947
v -0.248917 0.533886 -0.005790
v -0.250356 0.537962 0.033178
v -0.265930 0.535082 -0.010034
v -0.267377 0.538568 0.028991
v -0.251597 0.852753 -0.055310
v -0.198231 0.836037 -0.050122
v -0.200071 0.842224 0.009630
v -0.253697 0.858088 0.004520
v -0.081324 0.011252 -0.048924
v -0.103533 0.017003 -0.127338
v -0.164542 0.012658 -0.069616
v -0.157732 0.008315 -0.114287
v -0.157881 0.008479 -0.114108
v -0.099701 0.028161 0.049506
v -0.154886 0.035284 0.046596
v -0.096329 0.004370 0.044705
v -0.164542 0.012658 0.030254
v -0.165478 0.195079 -0.091843
v -0.144114 0.077886 -0.060395
v -0.103904 0.081048 -0.098625
v -0.090656 0.076731 -0.047003
v -0.165700 0.195321 -0.091577
v -0.160220 0.126557 -0.097556
v -0.157480 0.092175 -0.100546
v -0.158850 0.109366 -0.099051
v 0.000000 1.162288 -0.069621
v -0.042130 1.159910 -0.042350
v 0.000000 1.163101 0.001170
v -0.041746 1.160373 -0.012683
v 0.000000 1.218953 -0.082666
v -0.054340 1.216575 -0.055394
v 0.000000 1.203799 0.005752
v -0.053956 1.217038 -0.025727
v 0.000000 1.265359 -0.105607
v -0.055992 1.262981 -0.078336
v -0.056859 1.263444 -0.026306
v 0.000000 1.324387 -0.095129
v -0.048669 1.313749 -0.071148
v 0.000000 1.329979 -0.010151
v -0.048314 1.315816 -0.019151
v -0.044592 1.234672 0.013774
v 0.000000 1.236440 0.022752
v -0.046473 1.264750 0.013399
v 0.000000 1.266518 0.022377
v -0.047524 1.291874 0.015141
v 0.000000 1.307387 0.019786
v -0.045451 1.198253 -0.045035
v -0.044363 1.199189 -0.035255
v 0.000000 1.199480 -0.067041
v 0.000000 1.198633 -0.039855
v -0.123594 0.736939 0.058421
v -0.118219 0.758177 0.058127
v 0.000000 0.711181 0.072811
v -0.124034 0.737017 -0.065871
v -0.123847 0.736723 -0.066167
v 0.000000 0.737698 -0.107365
v -0.119073 0.864514 -0.058899
v -0.119191 0.863347 -0.060317
v -0.119073 0.864514 -0.058899
v 0.180548 1.111717 -0.017414
v 0.111752 0.883886 0.021620
v 0.185078 1.107266 -0.078906
v 0.119727 0.880731 -0.089652
v 0.113113 0.901238 0.004425
v 0.119191 0.863347 -0.060317
v 0.138114 0.663711 0.049467
v 0.138587 0.663308 -0.075376
v 0.128084 0.703346 0.048918
v 0.138936 0.663857 -0.074824
v 0.138114 0.663711 0.049467
v 0.138587 0.663308 -0.075376
v 0.138936 0.663857 -0.074824
v 0.138114 0.663711 0.049467
v 0.138587 0.663308 -0.075376
v 0.138936 0.663857 -0.074824
v 0.138114 0.663711 0.049467
v 0.138587 0.663308 -0.075376
v 0.138936 0.663857 -0.074824
v 0.069100 0.324785 0.031864
v 0.069974 0.349583 -0.105590
v 0.178168 0.333615 0.001983
v 0.176367 0.332529 -0.079971
v 0.176661 0.332851 -0.079619
v 0.078182 0.060565 -0.038352
v 0.100391 0.066316 -0.116765
v 0.161400 0.061971 -0.059044
v 0.154590 0.057629 -0.103715
v 0.154739 0.057792 -0.103535
v 0.141948 1.013588 -0.077902
v 0.142827 1.021350 -0.002643
v 0.207545 1.041885 -0.083794
v 0.193677 1.102421 -0.079812
v 0.188428 1.103945 -0.018320
v 0.208865 1.048599 -0.008441
v 0.141948 1.013588 -0.077902
v 0.142827 1.021350 -0.002643
v 0.207545 1.041885 -0.083794
v 0.208865 1.048599 -0.008441
v 0.235837 0.598081 -0.011834
v 0.238964 0.602158 0.027134
v 0.272812 0.599277 -0.016077
v 0.275955 0.602764 0.022947
v 0.248917 0.533886 -0.005790
v 0.250356 0.537962 0.033178
v 0.265930 0.535082 -0.010034
v 0.267377 0.538568 0.028991
v 0.251597 0.852753 -0.055310
v 0.198231 0.836037 -0.050122
v 0.200071 0.842224 0.009630
v 0.253697 0.858088 0.004520
v 0.081324 0.011252 -0.048924
v 0.103533 0.017003 -0.127338
v 0.164542 0.012658 -0.069616
v 0.157732 0.008315 -0.114287
v 0.157881 0.008479 -0.114108
v 0.099701 0.028161 0.049506
v 0.154886 0.035284 0.046596
v 0.096329 0.004370 0.044705
v 0.164542 0.012658 0.030254
v 0.165478 0.195079 -0.091843
v 0.144114 0.077886 -0.060395
v 0.103904 0.081048 -0.098625
v 0.090656 0.076731 -0.047003
v 0.165700 0.195321 -0.091577
v 0.160220 0.126557 -0.097556
v 0.157480 0.092175 -0.100546
v 0.158850 0.109366 -0.099051
v 0.042130 1.159910 -0.042350
v 0.041746 1.160373 -0.012683
v 0.054340 1.216575 -0.055394
v 0.053956 1.217038 -0.025727
v 0.055992 1.262981 -0.078336
v 0.056859 1.263444 -0.026306
v 0.048669 1.313749 -0.071148
v 0.048314 1.315816 -0.019151
v 0.044592 1.234672 0.013774
v 0.046473 1.264750 0.013399
v 0.047524 1.291874 0.015141
v 0.045451 1.198253 -0.045035
v 0.044363 1.199189 -0.035255
v 0.123594 0.736939 0.058421
v 0.118219 0.758177 0.058127
v 0.124034 0.737017 -0.065871
v 0.123847 0.736723 -0.066167
v 0.119073 0.864514 -0.058899
v 0.119191 0.863347 -0.060317
v 0.119073 0.864514 -0.058899
vn -0.0000 0.3474 0.9377
vn -0.0000 0.6149 0.7886
vn -0.4110 0.6925 0.5929
vn -0.4320 0.7175 0.5464
vn -0.0000 -0.0003 -1.0000
vn -0.4191 0.5177 -0.7458
vn -0.3645 0.6539 -0.6630
vn -0.0000 0.3983 -0.9172
vn -0.6186 0.4665 -0.6322
vn -0.6252 0.5101 0.5906
vn -0.8604 0.2027 0.4676
vn -0.4420 0.8027 0.4004
vn -0.0000 0.8362 0.5484
vn -0.0000 0.0586 0.9983
vn -0.9877 0.0416 -0.1505
vn -0.9616 0.2180 -0.1664
vn -0.5097 0.5588 0.6542
vn -0.0000 0.0881 0.9961
vn -0.0000 0.7046 -0.7096
vn -0.0000 1.0000 -0.0000
vn 0.0307 0.9995 -0.0000
vn -0.3101 0.8961 -0.3175
vn -0.8450 0.4761 -0.2434
vn -0.9912 0.1128 -0.0693
vn -0.0000 -0.0138 -0.9999
vn -0.5899 0.0904 -0.8024
vn 0.0024 0.9430 -0.3328
vn -0.0530 0.9976 0.0439
vn 0.8147 -0.5718 0.0958
vn -0.0000 0.7793 -0.6266
vn 0.1907 -0.2058 0.9598
vn 0.2826 0.1425 -0.9486
vn 0.4249 -0.5707 -0.7027
vn -0.0088 0.9652 -0.2615
vn -0.5228 0.5757 -0.6286
vn -0.7857 0.0343 -0.6176
vn -0.7675 0.0673 -0.6375
vn -0.3728 0.8745 -0.3101
vn -0.4913 0.4473 0.7473
vn -0.7768 -0.0183 -0.6294
vn -0.7324 0.1168 -0.6707
vn -0.9076 0.3512 0.2302
vn -0.6250 0.0208 0.7803
vn -0.7855 -0.0935 0.6118
vn 0.5856 -0.0775 -0.8069
vn 0.5796 -0.2771 0.7663
vn -0.6304 -0.4047 -0.6625
vn -0.6562 0.1979 -0.7282
vn -0.7442 0.0494 -0.6662
vn 0.6276 0.2792 0.7268
vn 0.8159 0.5308 0.2294
vn 0.4741 0.2089 -0.8553
vn 0.7393 0.2500 -0.6252
vn -0.7704 -0.0060 -0.6375
vn -0.9047 -0.0229 0.4254
vn -0.0000 0.0799 0.9968
vn -0.6755 -0.0692 -0.7341
vn -0.0000 -0.0232 -0.9997
vn -0.2838 0.8657 -0.4122
vn -0.3393 0.8667 0.3657
vn -0.3718 0.8498 -0.3735
vn -0.3839 0.8664 0.3193
vn 0.6971 -0.2700 -0.6641
vn 0.7610 -0.2061 -0.6151
vn -0.6774 -0.1085 -0.7275
vn -0.6868 -0.0003 -0.7269
vn 0.4602 0.7430 -0.4860
vn 0.3826 0.7883 0.4820
vn -0.7861 0.0431 0.6165
vn -0.6088 -0.5555 0.5664
vn 0.4413 -0.5512 0.7081
vn 0.6370 -0.0566 0.7687
vn 0.6275 -0.0968 0.7726
vn -0.7511 0.1648 0.6393
vn -0.5008 -0.6210 -0.6030
vn 0.5382 -0.7171 -0.4429
vn -0.7709 -0.6324 -0.0756
vn 0.3871 -0.4729 -0.7916
vn 0.7385 -0.6708 -0.0681
vn 0.4595 0.2915 0.8390
vn 0.4668 -0.7203 0.5131
vn -0.5133 0.3853 0.7668
vn -0.7382 -0.5785 0.3470
vn -0.8419 -0.3694 0.3934
vn -0.8355 -0.4752 0.2760
vn -0.8065 -0.4050 -0.4306
vn -0.8282 -0.3596 -0.4299
vn -0.6220 0.5978 -0.5058
vn -0.0000 0.4750 -0.8800
vn -0.0000 -0.8236 0.5672
vn -0.0000 -0.3557 0.9346
vn -0.6195 -0.3078 0.7221
vn -0.0000 -0.5241 -0.8517
vn -0.0000 -0.3802 -0.9249
vn -0.0000 -0.2207 0.9753
vn -0.9946 0.0314 0.0993
vn -0.7148 0.6699 0.2008
vn -0.7088 0.5820 -0.3985
vn -0.8127 -0.0671 -0.5788
vn -0.0000 -0.1189 -0.9929
vn -0.0000 0.9539 0.3001
vn -0.0000 0.7097 -0.7045
vn -0.6498 0.3028 0.6972
vn -0.0000 0.5110 0.8596
vn -0.0000 0.0083 1.0000
vn -0.6999 0.0109 0.7142
vn -0.9231 0.3828 0.0375
vn -0.9990 0.0257 -0.0356
vn 0.4320 0.7175 0.5464
vn 0.4110 0.6925 0.5929
vn 0.3645 0.6539 -0.6630
vn 0.4191 0.5177 -0.7458
vn 0.6252 0.5101 0.5906
vn 0.6186 0.4665 -0.6322
vn 0.8604 0.2027 0.4676
vn 0.4420 0.8027 0.4004
vn 0.9877 0.0416 -0.1505
vn 0.9616 0.2180 -0.1664
vn 0.5097 0.5588 0.6542
vn 0.3101 0.8961 -0.3175
vn -0.0307 0.9995 -0.0000
vn 0.8450 0.4761 -0.2434
vn 0.9912 0.1128 -0.0693
vn 0.5899 0.0904 -0.8024
vn -0.0024 0.9430 -0.3328
vn 0.0530 0.9976 0.0439
vn 0.0088 0.9652 -0.2615
vn 0.5228 0.5757 -0.6286
vn 0.3728 0.8745 -0.3101
vn 0.7675 0.0673 -0.6375
vn 0.7857 0.0343 -0.6176
vn 0.4913 0.4473 0.7473
vn 0.7855 -0.0935 0.6118
vn 0.6250 0.0208 0.7803
vn 0.9076 0.3512 0.2302
vn 0.7325 0.1168 -0.6707
vn 0.7768 -0.0183 -0.6294
vn -0.5856 -0.0775 -0.8069
vn -0.5796 -0.2771 0.7663
vn 0.7442 0.0494 -0.6662
vn 0.6562 0.1979 -0.7282
vn 0.6304 -0.4047 -0.6625
vn -0.6276 0.2792 0.7268
vn -0.7393 0.2500 -0.6252
vn -0.4741 0.2089 -0.8553
vn -0.8159 0.5308 0.2294
vn 0.7704 -0.0060 -0.6375
vn 0.9047 -0.0229 0.4254
vn 0.6755 -0.0692 -0.7341
vn 0.2838 0.8657 -0.4122
vn 0.3393 0.8667 0.3657
vn 0.3839 0.8664 0.3193
vn 0.3718 0.8498 -0.3735
vn -0.6971 -0.2700 -0.6641
vn 0.6868 -0.0003 -0.7269
vn 0.6774 -0.1085 -0.7275
vn -0.7610 -0.2061 -0.6151
vn -0.4602 0.7430 -0.4860
vn -0.3826 0.7883 0.4820
vn 0.7861 0.0431 0.6165
vn -0.6370 -0.0566 0.7687
vn -0.4413 -0.5512 0.7081
vn 0.6088 -0.5555 0.5664
vn -0.6275 -0.0968 0.7726
vn 0.7511 0.1648 0.6393
vn -0.5382 -0.7171 -0.4429
vn 0.5008 -0.6210 -0.6030
vn 0.7709 -0.6324 -0.0756
vn -0.7385 -0.6708 -0.0681
vn -0.3871 -0.4729 -0.7916
vn -0.4668 -0.7203 0.5131
vn -0.4595 0.2915 0.8390
vn 0.5133 0.3853 0.7668
vn 0.7382 -0.5785 0.3470
vn 0.8419 -0.3694 0.3934
vn 0.8282 -0.3596 -0.4299
vn 0.8065 -0.4050 -0.4306
vn 0.8355 -0.4752 0.2760
vn 0.6220 0.5978 -0.5058
vn 0.6195 -0.3078 0.7221
vn 0.9946 0.0314 0.0993
vn 0.8127 -0.0671 -0.5788
vn 0.7088 0.5820 -0.3985
vn 0.7148 0.6699 0.2008
vn 0.6498 0.3028 0.6972
vn 0.6999 0.0109 0.7142
vn 0.9231 0.3828 0.0375
vn 0.9990 0.0257 -0.0356
vt 0.625000 0.533594
vt 0.625000 0.250000
vt 0.469613 0.750000
vt 0.469613 1.089323
vt 0.625000 1.089323
vt 0.625000 0.750000
vt 0.964323 0.750000
vt 0.964323 0.500000
vt 0.375000 0.250000
vt 0.375000 0.500000
vt 0.000000 0.000000
vt 0.469613 0.250000
vt 0.469613 0.500000
vt 0.375000 0.750000
vt 0.375000 1.089323
vt 0.375000 0.000000
vt 0.375000 1.090001
vt 0.375000 0.247735
vt 0.375000 0.250000
vt 0.375000 0.500000
vt 0.369133 -0.068032
vt 0.469613 0.000000
vt 0.375000 1.125950
vt 0.625000 0.000000
vt 0.469613 0.250000
vt 0.469613 0.250000
vt 0.035677 0.500000
vt 0.035677 0.750000
vt 0.964323 0.750000
s 1
usemtl Material
f 1/1/1 85/1/2 86/2/3 5/2/4
f 44/3/5 43/4/6 7/5/7 3/6/8
f 7/7/7 47/7/9 48/8/10 5/8/4
f 108/9/11 13/9/12 11/10/13 110/10/14
f 109/11/15 15/11/16 13/11/12 108/11/11
f 45/12/17 42/13/18 1/1/1 5/2/4
f 12/14/19 18/14/20 20/15/21 14/15/22
f 13/9/12 15/9/16 16/16/23 14/16/22
f 111/11/24 16/11/23 15/11/16 109/11/15
f 113/14/25 12/14/19 14/15/22 112/15/26
f 112/11/26 14/11/22 16/11/23 111/11/24
f 19/9/27 24/9/28 22/10/29 17/10/30
f 14/16/22 20/16/21 19/9/27 13/9/12
f 14/16/22 20/16/21 21/16/20 16/16/23
f 13/9/12 19/9/27 17/10/30 11/10/13
f 22/11/29 27/11/31 28/11/32 23/11/33
f 20/15/21 25/15/34 26/17/20 21/17/20
f 18/14/20 23/14/33 25/15/34 20/15/21
f 20/18/21 25/18/34 24/9/28 19/9/27
f 30/16/35 35/16/36 36/16/37 31/16/38
f 24/11/28 29/11/39 27/11/31 22/11/29
f 25/16/34 30/16/35 31/16/38 26/16/20
f 23/14/33 28/14/32 30/15/35 25/15/34
f 25/11/34 30/11/35 29/11/39 24/11/28
f 35/16/36 75/16/40 40/16/41 39/9/42 76/19/43 34/9/44
f 28/14/32 33/14/45 35/15/36 30/15/35
f 30/16/35 35/16/36 34/9/44 29/9/39
f 27/11/31 32/11/46 33/11/45 28/11/32
f 29/9/39 34/9/44 32/10/46 27/10/31
f 40/16/41 69/16/47 70/16/48 41/16/49
f 78/11/50 37/11/51 38/11/52 77/11/53
f 76/19/43 39/9/42 37/10/51 78/20/50
f 35/16/36 75/16/40 40/16/41 41/16/49 81/16/54 82/16/54 80/16/54 79/16/54 36/16/37
f 33/14/45 77/14/53 38/14/52 40/15/41 75/15/40 35/15/36
f 6/9/55 2/10/56 42/13/18 45/12/17
f 8/21/57 6/9/55 45/12/17 43/22/6
f 4/14/58 8/23/57 43/4/6 44/3/5
f 46/22/59 49/12/60 48/2/10 47/24/9
f 43/4/6 46/4/59 47/5/9 7/5/7
f 46/22/59 52/22/61 53/12/62 49/12/60
f 5/2/4 48/2/10 49/12/60 45/12/17
f 63/4/63 54/4/64 56/4/65 62/4/66
f 43/4/6 50/4/67 52/4/61 46/4/59
f 45/12/17 51/12/68 50/22/67 43/22/6
f 49/12/60 53/12/62 51/12/68 45/12/17
f 57/12/69 61/12/70 59/12/71 55/12/72
f 64/25/73 55/12/72 54/22/64 63/22/63
f 65/26/74 57/12/69 55/12/72 64/25/73
f 62/22/66 56/22/65 57/12/69 65/26/74
f 59/12/71 61/12/70 60/22/75 58/22/76
f 56/22/65 60/22/75 61/12/70 57/12/69
f 54/4/64 58/4/76 60/4/75 56/4/65
f 55/12/72 59/12/71 58/22/76 54/22/64
f 52/22/61 62/22/66 65/26/74 53/12/62
f 53/12/62 65/26/74 64/25/73 51/12/68
f 51/12/68 64/25/73 63/22/63 50/22/67
f 50/4/67 63/4/63 62/4/66 52/4/61
f 68/27/77 69/28/47 67/14/78 66/10/79
f 38/14/52 67/14/78 69/15/47 40/15/41
f 40/16/41 69/16/47 68/9/77 39/9/42
f 37/11/51 66/11/79 67/11/78 38/11/52
f 37/11/51 71/11/80 73/11/81 66/11/79
f 72/9/82 74/9/83 73/10/81 71/10/80
f 66/10/79 73/10/81 74/27/83 68/27/77
f 39/9/42 72/9/82 71/10/80 37/10/51
f 68/9/77 74/9/83 72/9/82 39/9/42
f 34/9/44 76/19/43 78/20/50 32/10/46
f 32/11/46 78/11/50 77/11/53 33/11/45
f 105/8/84 90/8/85 88/7/86 104/29/87
f 7/5/7 84/5/88 83/6/89 3/6/8
f 5/8/4 86/8/3 84/7/88 7/7/7
f 89/1/90 99/1/91 98/2/92 90/2/85
f 104/5/87 88/5/86 87/6/93 106/6/94
f 107/1/95 89/1/90 90/2/85 105/2/84
f 93/8/96 97/8/97 95/7/98 92/7/99
f 90/8/85 93/8/96 92/7/99 88/7/86
f 88/5/86 92/5/99 91/6/100 87/6/93
f 96/1/101 94/6/102 95/7/98 97/8/97
f 92/5/99 95/5/98 94/6/102 91/6/100
f 97/8/97 102/8/103 103/1/104 96/1/101
f 99/1/91 101/1/105 100/2/106 98/2/92
f 101/1/105 103/1/104 102/2/103 100/2/106
f 90/8/85 98/8/92 100/8/106 93/8/96
f 93/8/96 100/8/106 102/8/103 97/8/97
f 85/1/2 107/1/95 105/2/84 86/2/3
f 84/5/88 104/5/87 106/6/94 83/6/89
f 86/8/3 105/8/84 104/29/87 84/7/88
f 8/11/57 112/11/26 111/11/24 10/11/107
f 4/14/58 113/14/25 112/15/26 8/23/57
f 10/11/107 111/11/24 109/11/15 9/11/108
f 9/11/108 109/11/15 108/11/11 6/11/55
f 6/9/55 108/9/11 110/10/14 2/10/56
f 10/11/107 114/11/20 116/11/20 115/11/20
f 1/1/1 117/2/109 186/2/110 85/1/2
f 44/3/5 3/6/8 119/5/111 146/4/112
f 119/7/111 117/8/109 150/8/113 149/7/114
f 198/9/115 110/10/14 11/10/13 123/9/116
f 199/11/117 198/11/115 123/11/116 125/11/118
f 147/12/119 117/2/109 1/1/1 42/13/18
f 12/14/19 124/15/120 128/15/121 18/14/20
f 123/9/116 124/16/120 126/16/122 125/9/118
f 200/11/123 199/11/117 125/11/118 126/11/122
f 113/14/25 201/15/124 124/15/120 12/14/19
f 201/11/124 200/11/123 126/11/122 124/11/120
f 127/9/125 17/10/30 22/10/29 130/9/126
f 124/16/120 123/9/116 127/9/125 128/16/121
f 124/16/120 126/16/122 129/16/20 128/16/121
f 123/9/116 11/10/13 17/10/30 127/9/125
f 128/15/121 129/17/20 132/17/20 131/15/127
f 18/14/20 128/15/121 131/15/127 23/14/33
f 128/18/121 127/9/125 130/9/126 131/18/127
f 134/16/128 135/16/129 140/16/130 139/16/131
f 130/11/126 22/11/29 27/11/31 133/11/132
f 131/16/127 132/16/20 135/16/129 134/16/128
f 23/14/33 131/15/127 134/15/128 28/14/32
f 131/11/127 130/11/126 133/11/132 134/11/128
f 139/16/131 138/9/133 178/19/134 143/9/135 144/16/136 177/16/137
f 28/14/32 134/15/128 139/15/131 137/14/138
f 134/16/128 133/9/132 138/9/133 139/16/131
f 27/11/31 28/11/32 137/11/138 136/11/139
f 133/9/132 27/10/31 136/10/139 138/9/133
f 144/16/136 145/16/140 172/16/141 171/16/142
f 180/11/143 179/11/144 142/11/145 141/11/146
f 178/19/134 180/20/143 141/10/146 143/9/135
f 139/16/131 140/16/130 181/16/147 182/16/147 184/16/147 183/16/147 145/16/140 144/16/136 177/16/137
f 137/14/138 139/15/131 177/15/137 144/15/136 142/14/145 179/14/144
f 118/9/148 147/12/119 42/13/18 2/10/56
f 120/21/149 146/22/112 147/12/119 118/9/148
f 4/14/58 44/3/5 146/4/112 120/23/149
f 148/22/150 149/24/114 150/2/113 151/12/151
f 146/4/112 119/5/111 149/5/114 148/4/150
f 148/22/150 151/12/151 155/12/152 154/22/153
f 117/2/109 147/12/119 151/12/151 150/2/113
f 165/4/154 164/4/155 158/4/156 156/4/157
f 146/4/112 148/4/150 154/4/153 152/4/158
f 147/12/119 146/22/112 152/22/158 153/12/159
f 151/12/151 147/12/119 153/12/159 155/12/152
f 159/12/160 157/12/161 161/12/162 163/12/163
f 166/25/164 165/22/154 156/22/157 157/12/161
f 167/26/165 166/25/164 157/12/161 159/12/160
f 164/22/155 167/26/165 159/12/160 158/22/156
f 161/12/162 160/22/166 162/22/167 163/12/163
f 158/22/156 159/12/160 163/12/163 162/22/167
f 156/4/157 158/4/156 162/4/167 160/4/166
f 157/12/161 156/22/157 160/22/166 161/12/162
f 154/22/153 155/12/152 167/26/165 164/22/155
f 155/12/152 153/12/159 166/25/164 167/26/165
f 153/12/159 152/22/158 165/22/154 166/25/164
f 152/4/158 154/4/153 164/4/155 165/4/154
f 170/27/168 168/10/169 169/14/170 171/28/142
f 142/14/145 144/15/136 171/15/142 169/14/170
f 144/16/136 143/9/135 170/9/168 171/16/142
f 141/11/146 142/11/145 169/11/170 168/11/169
f 141/11/146 168/11/169 175/11/171 173/11/172
f 174/9/173 173/10/172 175/10/171 176/9/174
f 168/10/169 170/27/168 176/27/174 175/10/171
f 143/9/135 141/10/146 173/10/172 174/9/173
f 170/9/168 143/9/135 174/9/173 176/9/174
f 138/9/133 136/10/139 180/20/143 178/19/134
f 136/11/139 137/11/138 179/11/144 180/11/143
f 197/8/175 196/29/176 187/7/177 188/8/178
f 119/5/111 3/6/8 83/6/89 185/5/179
f 117/8/109 119/7/111 185/7/179 186/8/110
f 89/1/90 188/2/178 193/2/180 99/1/91
f 196/5/176 106/6/94 87/6/93 187/5/177
f 107/1/95 197/2/175 188/2/178 89/1/90
f 190/8/181 189/7/182 191/7/183 192/8/184
f 188/8/178 187/7/177 189/7/182 190/8/181
f 187/5/177 87/6/93 91/6/100 189/5/182
f 96/1/101 192/8/184 191/7/183 94/6/102
f 189/5/182 91/6/100 94/6/102 191/5/183
f 192/8/184 96/1/101 103/1/104 195/8/185
f 99/1/91 193/2/180 194/2/186 101/1/105
f 101/1/105 194/2/186 195/2/185 103/1/104
f 188/8/178 190/8/181 194/8/186 193/8/180
f 190/8/181 192/8/184 195/8/185 194/8/186
f 85/1/2 186/2/110 197/2/175 107/1/95
f 185/5/179 83/6/89 106/6/94 196/5/176
f 186/8/110 185/7/179 196/29/176 197/8/175
f 120/11/149 122/11/187 200/11/123 201/11/124
f 4/14/58 120/23/149 201/15/124 113/14/25
f 122/11/187 121/11/188 199/11/117 200/11/123
f 121/11/188 118/11/148 198/11/115 199/11/117
f 118/9/148 2/10/56 110/10/14 198/9/115
f 122/11/187 203/11/20 204/11/20 202/11/20

BIN
assets/jp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
assets/laser.wav Normal file

Binary file not shown.

View File

@@ -1,40 +0,0 @@
# Blender 3.6.4
# www.blender.org
mtllib untitled.mtl
o Cube
v 1.000000 3.829521 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 3.829521 1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 3.829521 -1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 3.829521 1.000000
v -1.000000 -1.000000 1.000000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vt 0.625000 0.500000
vt 0.875000 0.500000
vt 0.875000 0.750000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.125000 0.500000
vt 0.375000 0.500000
vt 0.125000 0.750000
s 0
usemtl Material
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/4/2 7/6/2 8/7/2
f 8/8/3 7/9/3 5/10/3 6/11/3
f 6/12/4 2/13/4 4/5/4 8/14/4
f 2/13/5 1/1/5 3/4/5 4/5/5
f 6/11/6 5/10/6 1/1/6 2/13/6

BIN
assets/sessionD.wav Normal file

Binary file not shown.

BIN
assets/sol.glb Normal file

Binary file not shown.

2737
doxyfile Normal file

File diff suppressed because it is too large Load Diff

21
doxygen/footer.html Normal file
View File

@@ -0,0 +1,21 @@
<!-- HTML footer for doxygen 1.9.1-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby <a href="https://www.doxygen.org/index.html"><img class="footer"
src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen" /></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer" />
<address class="footer"><small>
$generatedby&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg"
width="104" height="31" alt="doxygen" /></a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>

66
doxygen/header.html Normal file
View File

@@ -0,0 +1,66 @@
<!-- HTML header for doxygen 1.9.1-->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta name="generator" content="Doxygen $doxygenversion" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--BEGIN PROJECT_NAME-->
<title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
<script type="text/javascript" src="$relpath^doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo" /></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF-->
<div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

5
doxygen/stylesheet.css Normal file
View File

@@ -0,0 +1,5 @@
/* The standard CSS for doxygen 1.9.1 */
body, table, div, p, dl {
font: 400 14px/22px Roboto,sans-serif;
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include <cstdint>
namespace blitz {
#define REMOVE_COPY(className) \
className(const className&) = delete; \
className& operator=(const className&) = delete
} // namespace blitz

View File

@@ -1,13 +1,23 @@
#pragma once
/**
* \file DataBuffer.h
* \brief File containing the blitz::DataBuffer class
*/
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <string>
#include <vector>
namespace blitz {
/**
* \class DataBuffer
* \brief Class used to manipulate memory
*/
class DataBuffer {
private:
typedef std::vector<std::uint8_t> Data;
@@ -30,38 +40,50 @@ class DataBuffer {
DataBuffer& operator=(const DataBuffer& other);
DataBuffer& operator=(DataBuffer&& other);
/**
* \brief Append data to the buffer
*/
template <typename T>
void Append(const T& data) {
std::size_t size = sizeof(data);
std::size_t end_pos = m_Buffer.size();
m_Buffer.resize(m_Buffer.size() + size);
memcpy(&m_Buffer[end_pos], &data, size);
std::memcpy(&m_Buffer[end_pos], &data, size);
}
/**
* \brief Append data to the buffer
*/
template <typename T>
DataBuffer& operator<<(const T& data) {
Append(data);
return *this;
}
/**
* \brief Append a string to the buffer
* \warning Don't use it for binary data !
* \param str The string to append
*/
DataBuffer& operator<<(const std::string& str) {
// including null character
std::size_t strlen = str.length() + 1;
std::size_t strlen = str.length() + 1; // including null character
Resize(GetSize() + strlen);
std::memcpy(m_Buffer.data() + GetSize() - strlen, str.data(), strlen);
return *this;
}
DataBuffer& operator<<(DataBuffer& data) {
m_Buffer.insert(m_Buffer.end(), data.begin(), data.end());
return *this;
}
/**
* \brief Append data to the buffer from another const buffer
* \param data The buffer to append
*/
DataBuffer& operator<<(const DataBuffer& data) {
m_Buffer.insert(m_Buffer.end(), data.begin(), data.end());
return *this;
}
/**
* \brief Read some data from the buffer and assign to desired variable
*/
template <typename T>
DataBuffer& operator>>(T& data) {
assert(m_ReadOffset + sizeof(T) <= GetSize());
@@ -70,6 +92,10 @@ class DataBuffer {
return *this;
}
/**
* \brief Read some data from the buffer and assign to the new buffer
* \param data The buffer to assign
*/
DataBuffer& operator>>(DataBuffer& data) {
data.Resize(GetSize() - m_ReadOffset);
std::copy(m_Buffer.begin() + static_cast<difference_type>(m_ReadOffset), m_Buffer.end(), data.begin());
@@ -77,6 +103,11 @@ class DataBuffer {
return *this;
}
/**
* \brief Read a string from the buffer
* \param str The string to assign in the new buffer
* \warning Don't use it for binary data !
*/
DataBuffer& operator>>(std::string& str) {
std::size_t stringSize =
strlen(reinterpret_cast<const char*>(m_Buffer.data()) + m_ReadOffset) + 1; // including null character
@@ -87,30 +118,55 @@ class DataBuffer {
return *this;
}
/**
* \brief Write some data to the buffer
* \param buffer The buffer to write
* \param amount The amount of data to write
*/
void WriteSome(const char* buffer, std::size_t amount) {
std::size_t end_pos = m_Buffer.size();
m_Buffer.resize(m_Buffer.size() + amount);
memcpy(m_Buffer.data() + end_pos, buffer, amount);
std::memcpy(m_Buffer.data() + end_pos, buffer, amount);
}
/**
* \brief Write some data to the buffer
* \param buffer The buffer to write
* \param amount The amount of data to write
*/
void WriteSome(const std::uint8_t* buffer, std::size_t amount) {
std::size_t end_pos = m_Buffer.size();
m_Buffer.resize(m_Buffer.size() + amount);
memcpy(m_Buffer.data() + end_pos, buffer, amount);
std::memcpy(m_Buffer.data() + end_pos, buffer, amount);
}
/**
* \brief Read some data from the buffer
* \param buffer The buffer to Read
* \param amount The amount of data from the buffer
*/
void ReadSome(char* buffer, std::size_t amount) {
assert(m_ReadOffset + amount <= GetSize());
std::copy_n(m_Buffer.begin() + static_cast<difference_type>(m_ReadOffset), amount, buffer);
m_ReadOffset += amount;
}
/**
* \brief Read some data from the buffer
* \param buffer The buffer to Read
* \param amount The amount of data from the buffer
*/
void ReadSome(std::uint8_t* buffer, std::size_t amount) {
assert(m_ReadOffset + amount <= GetSize());
std::copy_n(m_Buffer.begin() + static_cast<difference_type>(m_ReadOffset), amount, buffer);
m_ReadOffset += amount;
}
/**
* \brief Read some data from the buffer
* \param buffer The buffer to Read
* \param amount The amount of data from the buffer
*/
void ReadSome(DataBuffer& buffer, std::size_t amount) {
assert(m_ReadOffset + amount <= GetSize());
buffer.Resize(amount);
@@ -118,61 +174,113 @@ class DataBuffer {
m_ReadOffset += amount;
}
void ReadSome(std::string& buffer, std::size_t amount) {
assert(m_ReadOffset + amount <= GetSize());
buffer.resize(amount);
std::copy_n(m_Buffer.begin() + static_cast<difference_type>(m_ReadOffset), amount, buffer.begin());
m_ReadOffset += amount;
}
/**
* \brief Resize the buffer
* \param size The new size of the buffer
*/
void Resize(std::size_t size) {
m_Buffer.resize(size);
}
/**
* \brief Reserve some space in the buffer
* \param amount The amount of space to reserve
*/
void Reserve(std::size_t amount) {
m_Buffer.reserve(amount);
}
void erase(iterator it) {
m_Buffer.erase(it);
}
/**
* \brief Clear the buffer
*/
void Clear() {
m_Buffer.clear();
m_ReadOffset = 0;
}
/**
* \brief When the buffer has been read entirely
*/
bool IsFinished() const {
return m_ReadOffset >= m_Buffer.size();
}
/**
* \brief Get the buffer data
*/
std::uint8_t* data() {
return m_Buffer.data();
}
/**
* \brief Get the buffer data
*/
const std::uint8_t* data() const {
return m_Buffer.data();
}
/**
* \brief Get the read offset
*/
std::size_t GetReadOffset() const {
return m_ReadOffset;
}
/**
* \brief Set the read offset
* \param pos The new read offset
*/
void SetReadOffset(std::size_t pos);
/**
* \brief Get the size of the buffer
*/
std::size_t GetSize() const;
std::string ToString() const;
/**
* \brief Get the remaining size of the buffer
*/
std::size_t GetRemaining() const;
/**
* \brief Read a file into the buffer
* \param fileName The name of the file to read
*/
bool ReadFile(const std::string& fileName);
/**
* \brief Write a file into the buffer
* \param fileName The name of the file to write to
*/
bool WriteFile(const std::string& fileName) const;
/**
* \brief Allocate the buffer on the heap
* \warning Don't forget to free the data !
*/
std::uint8_t* HeapAllocatedData() const {
std::uint8_t* newBuffer = new std::uint8_t[GetSize()];
std::memcpy(newBuffer, data(), GetSize());
return newBuffer;
}
/**
* \brief Operator == to compare two DataBuffer
*/
bool operator==(const DataBuffer& other) const {
return m_Buffer == other.m_Buffer;
}
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
bool ReadFile(const std::string& fileName);
bool WriteFile(const std::string& fileName);
};
/**
* \brief Operator << to write a DataBuffer to an ostream
*/
std::ostream& operator<<(std::ostream& os, const DataBuffer& buffer);
} // namespace blitz

View File

@@ -0,0 +1,32 @@
#pragma once
/**
* \file Defines.h
* \brief File containing constants and typedefs
*/
#include <cstdint>
namespace blitz {
namespace game {
/**
* \typedef PlayerID
* \brief Represents the identifier of a Player
*/
typedef std::uint8_t PlayerID;
/**
* \enum GameState
* \brief The states of the game
*/
enum GameState : std::uint8_t {
gsNone = 0, /**< Default state */
gsWaiting, /**< Waiting state if the number of players is less than 2 */
gsPreparing, /**< Preparing state until the game start */
gsGame, /**< Game state during the players can shoot and kill ... */
gsEnd, /**< End state of the game : show the winner of the game and the leaderboard*/
};
} // namespace game
} // namespace blitz

View File

@@ -0,0 +1,25 @@
#pragma once
/**
* \file NonCopyable.h
* \brief File containing the blitz::NonCopyable class
*/
namespace blitz {
/**
* \class NonCopyable
* \brief Class used to make a class non copyable
* \note Inherit from this class privately to make a class non copyable
*/
class NonCopyable {
public:
NonCopyable(const NonCopyable&) = delete;
NonCopyable& operator=(const NonCopyable&) = delete;
protected:
NonCopyable() {}
~NonCopyable() {}
};
} // namespace blitz

View File

@@ -0,0 +1,40 @@
#pragma once
namespace blitz {
/**
* \struct An exponential moving average smoother, or one pole lowpass filter
* smoothes incoming data by attenutating sharp/sudden changes
*/
class EMASmoother {
private:
float Alpha;
float GetAlpha();
void SetAlpha(float alpha);
public:
/**
* \brief the current output value of the smoother
*/
float Current;
EMASmoother();
/**
* \brief behaves like `Tick(target, 1.0f)` but optimised
*/
void TickUnitT(float target);
/**
* \brief feed in the next value to the filter, and update `Current` accordingly
* \param target the value in question
* \param delta the time that has passed sinced the last value has been provided
*/
void Tick(float target, float delta);
/**
* \brief set the amount of time it should take to reacha certain value, the higher this is
* the "smoother the output signal"
*/
void SetSmoothingTime(float t);
};
} // namespace blitz

View File

@@ -0,0 +1,58 @@
#pragma once
/**
* \file VarInt.h
* \brief File containing the blitz::VarInt class
*/
#include <cstddef>
#include <cstdint>
namespace blitz {
class DataBuffer;
/**
* \class VarInt
* \brief Variable-length format such that smaller numbers use fewer bytes.
*/
class VarInt {
private:
std::uint64_t m_Value;
public:
VarInt() : m_Value(0) {}
/**
* \brief Construct a variable integer from a value
* \param value The value of the variable integer
*/
VarInt(std::uint64_t value) : m_Value(value) {}
/**
* \brief Get the value of the variable integer
*/
std::uint64_t GetValue() const {
return m_Value;
}
/**
* \brief Get the length of the serialized variable integer
*/
std::size_t GetSerializedLength() const;
/**
* \brief Serialize the variable integer
* \param out The buffer to write the serialized variable integer to
* \param var The variable integer to serialize
*/
friend DataBuffer& operator<<(DataBuffer& out, const VarInt& var);
/**
* \brief Deserialize the variable integer
* \param in The buffer to read the serialized variable integer from
* \param var The variable integer to deserialize
*/
friend DataBuffer& operator>>(DataBuffer& in, VarInt& var);
};
} // namespace blitz

View File

@@ -1,30 +1,150 @@
#pragma once
/**
* \file Game.h
* \brief File containing the blitz::game::Game class
*/
#include "Player.h"
#include "blitz/game/Listeners.h"
#include "blitz/game/World.h"
#include "blitz/misc/ObjectNotifier.h"
#include "blitz/misc/Time.h"
#include <map>
#include <memory>
namespace blitz {
namespace game {
/**
* \typedef PlayerMap
* \brief A map of players
*/
typedef std::map<PlayerID, Player> PlayerMap;
class Game {
private:
/**
* \brief The game configuration
* \struct GameConfig
*/
struct GameConfig {
/**
* \brief The gravity applied to players
*/
float Gravity;
/**
* \brief The firing rate of the shoot in RPM (round per minute)
*/
int FiringRate;
};
/**
* \class Game
* \brief Class representing a game
*/
class Game : public utils::ObjectNotifier<GameListener> {
protected:
PlayerMap m_Players;
GameState m_GameState;
utils::Timer m_GameTimer;
GameConfig m_Config;
std::unique_ptr<World> m_World;
public:
Game() {}
/** \brief Default constructor */
Game() : m_GameState(gsNone) {}
/**
* \brief Update the game with a delta time
* \param delta The time elapsed since the last update in milliseconds
*/
virtual void Tick(std::uint64_t delta) = 0;
/**
* \brief Get a player by its identifier
* \param id The identifier of the player
* \return The player if found, nullptr otherwise
*/
Player* GetPlayerById(PlayerID id);
/**
* \brief Get a player by its identifier (const version)
* \param id The identifier of the player
* \return The player if found, nullptr otherwise
*/
const Player* GetPlayerById(PlayerID id) const;
/**
* \brief Get the players
* \return The map of players
*/
PlayerMap& GetPlayers() {
return m_Players;
}
/**
* \brief Get the players (const version)
* \return The map of players
*/
const PlayerMap& GetPlayers() const {
return m_Players;
}
/**
* \brief Get the game state
* \return The game state
*/
GameState GetGameState() const {
return m_GameState;
}
/**
* \brief Set the game state
* \return The game state
*/
virtual void UpdateGameState(GameState newGameState, std::uint64_t timeRemaining);
/**
* \brief Load the game configuration
* \param config The game configuration to load
*/
void LoadConfig(const GameConfig& config) {
m_Config = config;
}
/**
* \brief Get the game configuration
* \return The game configuration
*/
const game::GameConfig& GetGameConfig() const {
return m_Config;
}
/**
* \brief Add a player to the game
* \param player The identifier of the player
* \param name The name of the player
*/
virtual void AddPlayer(PlayerID player, const std::string& name);
/**
* \brief Remove a player from the game
* \param player The identifier of the player
*/
virtual void RemovePlayer(PlayerID player);
/**
* \brief Get the remaining time of the game
* \return The remaining time of the game in milliseconds
*/
std::uint64_t GetGameStateRemainingTime() const {
return m_GameTimer.GetTimeRemaining();
}
/**
* \return The world associated with this game
*/
const World* GetWorld() const {
return m_World.get();
}
};

View File

@@ -0,0 +1,49 @@
#pragma once
/**
* \file LeaderBoard.h
* \brief File containing the blitz::game::LeaderBoard class
*/
#include "blitz/game/Player.h"
#include <vector>
namespace blitz {
namespace game {
/**
* \class LeaderBoard
* \brief The leaderboard of the game
*/
class LeaderBoard {
private:
std::vector<Player*> m_Players;
public:
/**
* \brief Add a player to the leaderboard
* \param player The player to add
*/
void AddPlayer(Player* player);
/**
* \brief Remove a player from the leaderboard
* \param player The player to remove
*/
void RemovePlayer(PlayerID player);
/**
* \brief Update the leaderboard
*/
void Update();
/**
* \brief Get the players in the leaderboard ordered by kills
* \return The players
*/
const std::vector<Player*>& GetPlayers() const {
return m_Players;
}
};
} // namespace game
} // namespace blitz

View File

@@ -0,0 +1,43 @@
#pragma once
#include "blitz/common/Defines.h"
#include "blitz/maths/Vector.h"
#include <vector>
namespace blitz {
namespace protocol {
struct ColoredPart;
typedef std::vector<ColoredPart> ColoredText;
} // namespace protocol
namespace game {
class PlayerInputListener {
public:
virtual void OnLocalPlayerJump() {}
virtual void OnLocalPlayerShoot(const Vec3f& position, float yaw, float pitch) {}
};
class GameListener {
public:
virtual void OnPlayerJoin(game::PlayerID player) {}
virtual void OnPlayerLeave(game::PlayerID player) {}
virtual void OnGameStateUpdate(game::GameState newState) {}
};
class ClientListener {
public:
virtual void OnTextChatReceived(const protocol::ColoredText& text) {}
virtual void OnSpectatorChange(game::PlayerID player) {}
virtual void OnPlayerShoot(PlayerID player, const Vec3f& position, float yaw, float pitch) {}
virtual void OnClientPlayerJoin() {}
virtual void OnGameConfigUpdate() {}
virtual void OnGameJoin() {}
virtual void OnGameLeave() {}
};
} // namespace game
} // namespace blitz

View File

@@ -1,32 +1,238 @@
#pragma once
/**
* \file Player.h
* \brief File containing the blitz::game::Player class
*/
#include "blitz/common/Defines.h"
#include "blitz/maths/Vector.h"
#include "blitz/maths/Physics.h"
#include <cstdint>
#include <string>
namespace blitz {
namespace game {
typedef std::uint8_t PlayerID;
/**
* \struct PlayerStats
* \brief The statistics of a player
*/
struct PlayerStats {
/**
* \brief The number of deaths
*/
std::uint16_t m_Deaths;
/**
* \brief The number of kills
*/
std::uint16_t m_Kills;
/**
* \brief The number of shots
*/
std::uint32_t m_ShootCount;
/**
* \brief The number of successful shots
*/
std::uint32_t m_ShootSuccessCount;
};
/**
* \class Player
* \brief The player of the game
*/
class Player {
private:
maths::AABB m_Hitbox;
PlayerID m_ID;
std::string m_Name;
Vec3f m_Position;
Vec3f m_Velocity;
float m_Yaw;
float m_Pitch;
float m_HP;
bool m_IsBot;
PlayerStats m_Stats{};
public:
Player(PlayerID id) : m_ID(id) {}
/**
* \brief Default constructor
* \param id The ID of the player
*/
Player(PlayerID id) : m_ID(id), m_Yaw(0), m_Pitch(0), m_HP(100), m_IsBot(false) {}
/**
* \brief Get the ID of the player
* \return The ID of the player
*/
PlayerID GetID() const {
return m_ID;
}
/**
* \brief Get the name of the player
* \return The name of the player
*/
const std::string& GetName() const {
return m_Name;
}
/**
* \brief Set the name of the player
* \param name The name of the player
*/
void SetName(const std::string& name) {
m_Name = name;
}
/**
* \brief Get the player's hitbox
*/
maths::AABB GetHitBox() const {
return m_Hitbox + m_Position;
}
/**
* \brief Sets the player's hitbox
*/
void SetHitBoxSize(const maths::AABB& aabb) {
m_Hitbox = aabb;
}
/**
* \brief Get the position of the player
* \return The position of the player
*/
const Vec3f& GetPosition() const {
return m_Position;
}
/**
* \brief Set the position of the player
* \param newPos The new position of the player
*/
void SetPosition(const Vec3f& newPos) {
m_Position = newPos;
}
/**
* \brief Add a position to the player
* \param dPos The position to add
*/
void AddPosition(const Vec3f& dPos) {
m_Position += dPos;
}
/**
* \brief Get the velocity of the player
* \return The velocity of the player
*/
const Vec3f& GetVelocity() const {
return m_Velocity;
}
/**
* \brief Set the velocity of the player
* \param newVelocity The new velocity of the player
*/
void SetVelocity(const Vec3f& newVelocity) {
m_Velocity = newVelocity;
}
/**
* \brief Get the yaw of the player
* \return The yaw of the player in radians
*/
float GetYaw() const {
return m_Yaw;
}
/**
* \brief Set the yaw of the player
* \param yaw The yaw of the player in radians
*/
void SetYaw(float yaw) {
m_Yaw = yaw;
}
/**
* \brief Add a yaw to the player
* \param dYaw The yaw to add in radians
*/
void AddYaw(float dYaw) {
m_Yaw += dYaw;
}
/**
* \brief Get the pitch of the player
* \return The pitch of the player in radians
*/
float GetPitch() const {
return m_Pitch;
}
/**
* \brief Set the pitch of the player
* \param pitch The pitch of the player in radians
*/
void SetPitch(float pitch) {
m_Pitch = pitch;
}
/**
* \brief Add a pitch to the player
* \param dPitch The pitch to add in radians
*/
void AddPitch(float dPitch) {
m_Pitch += dPitch;
}
/**
* \brief Get the HP of the player
* \return The HP of the player
*/
float GetHP() const {
return m_HP;
}
/**
* \brief Set the HP of the player
* \param hp The HP of the player
*/
void SetHP(float hp) {
m_HP = hp;
}
/**
* \brief When the player is a bot
* \return True if the player is a bot
*/
bool IsBot() const {
return m_IsBot;
}
/**
* \brief Set the player as a bot
*/
void SetBot() {
m_IsBot = true;
}
/**
* \brief Get the statistics of the player (const version)
* \return The statistics of the player
*/
const PlayerStats& GetStats() const {
return m_Stats;
}
/**
* \brief Get the statistics of the player
* \return The statistics of the player
*/
PlayerStats& GetStats() {
return m_Stats;
}
};

View File

@@ -0,0 +1,27 @@
#pragma once
#include "blitz/game/Listeners.h"
#include "blitz/maths/Physics.h"
#include <vector>
namespace blitz {
namespace game {
class Game;
class World {
protected:
Game* m_Game;
std::vector<maths::AABB> m_AABBs;
public:
World(Game* game);
virtual ~World();
const std::vector<maths::AABB>& GetAABBs() const {
return m_AABBs;
}
};
} // namespace game
} // namespace blitz

433
include/blitz/maths/Maths.h Normal file
View File

@@ -0,0 +1,433 @@
#pragma once
/**
* \file Maths.h
* \brief File containing mathematical functions and constants
*/
#include "blitz/maths/Vector.h"
#include <cmath>
namespace blitz {
namespace maths {
static constexpr float PI = 3.141592653f;
/**
* \return the amount of overlap between the ranges [a1 ; b1] and [a2 ; b2]
*/
template <typename T>
T RangesOverlap(T& a1, T& b1, T& a2, T& b2) {
return std::min(std::max(a1, b1), std::max(a2, b2)) - std::max(std::min(a1, b1), std::min(a2, b2));
}
/**
* \return whether the ranges [a1 ; b1] and [a2 ; b2] overlap
*/
template <typename T>
bool RangesOverlapping(T& a1, T& b1, T& a2, T& b2) {
return RangesOverlap(a1, a2, b1, b2) >= 0;
}
//////////////////////////////////////////////////////////////////
// Vectors //
//////////////////////////////////////////////////////////////////
/**
* \brief Returns the length of the vector
* \return the length of the vector
*/
template <typename T>
T Length(const Vec3<T>& vect) {
return std::sqrt(vect.x * vect.x + vect.y * vect.y + vect.z * vect.z);
}
/**
* \brief Normalizes the vector
* \return the normalized vector
*/
template <typename T>
Vec3<T> Normalize(const Vec3<T>& vect) {
T length = Length(vect);
return {vect.x / length, vect.y / length, vect.z / length};
}
/**
* \brief Normalizes the vector
* \return the normalized vector
*/
template <typename T>
Vec4<T> Normalize(const Vec4<T>& vect) {
T length = std::sqrt(vect.x * vect.x + vect.y * vect.y + vect.z * vect.z + vect.w * vect.w);
return {vect.x / length, vect.y / length, vect.z / length, vect.w / length};
}
/**
* \brief Returns the dot product of the two vectors
* \return the dot product of the two vectors
*/
template <typename T>
T Dot(const Vec3<T>& vect, const Vec3<T>& other) {
return vect.x * other.x + vect.y * other.y + vect.z * other.z;
}
/**
* \brief Returns the cross product of the two vectors
* \return the cross product of the two vectors
*/
template <typename T>
Vec3<T> Cross(const Vec3<T>& vect, const Vec3<T>& other) {
return {
vect.y * other.z - vect.z * other.y,
vect.z * other.x - vect.x * other.z,
vect.x * other.y - vect.y * other.x,
};
}
/**
* \brief Returns the dot product of the two vectors
* \return the dot product of the two vectors
*/
template <typename T>
T Dot(const Vec4<T>& vect, const Vec4<T>& other) {
return vect.x * other.x + vect.y * other.y + vect.z * other.z + vect.w * other.w;
}
/**
* \brief Returns the distance between the two vectors
* \return the distance between the two vectors
*/
template <typename T>
T Distance(const Vec3<T>& vect, const Vec3<T>& other) {
return Length(vect - other);
}
/**
* \brief Returns the minimum of the three coordinates of the vector
* \return the minimum between the three coordinates of the vector
*/
template <typename T>
T ReduceMin(const Vec3<T>& vect) {
return std::min(std::min(vect.x, vect.y), vect.z);
}
/**
* \brief Returns the maximum of the three coordinates of the vector
* \return the maximum between the three coordinates of the vector
*/
template <typename T>
T ReduceMax(const Vec3<T>& vect) {
return std::max(std::max(vect.x, vect.y), vect.z);
}
/**
* \brief Returns the (signed) minimal coordinate of the vector
* \param v a vector
* \return the (signed) minimal coordinate of the vector
*/
inline float ReduceFMinF(const Vec3f& v) {
return std::fminf(std::fminf(v.x, v.y), v.z);
}
inline Vec3f FmaF(const Vec3f& v, const Vec3f& a, const Vec3f& b) {
return {
std::fmaf(v.x, a.x, b.x),
std::fmaf(v.y, a.y, b.y),
std::fmaf(v.z, a.z, b.z),
};
}
inline Vec3d Fma(const Vec3d& v, const Vec3d& a, const Vec3d& b) {
return {
std::fma(v.x, a.x, b.x),
std::fma(v.y, a.y, b.y),
std::fma(v.z, a.z, b.z),
};
}
/**
* \brief Returns the (signed) maximal coordinate of the vector
* \param v a vector
* \return the (signed) maximal coordinate of the vector
*/
inline float ReduceFMaxF(const Vec3f& v) {
return std::fmaxf(std::fmaxf(v.x, v.y), v.z);
}
/**
* \brief returns the (signed) minimal coordinate of the vector
* \param v a vector
* \return the (signed) minimal coordinate of the vector
*/
inline double ReduceFMin(const Vec3d& v) {
return std::fmin(std::fmin(v.x, v.y), v.z);
}
/**
* \brief returns the (signed) maximal coordinate of the vector
* \param v a vector
* \return the (signed) maximal coordinate of the vector
*/
inline double ReduceFMax(const Vec3d& v) {
return std::fmax(std::fmax(v.x, v.y), v.z);
}
/**
* \brief returns the coordinate-wise minimum of the given vectors, where a coordinate in the returned vector is NAN iff any of the two
* compared ones are NAN
* \tparam T
* \param self a vector
* \param other an other vector
* \return the coordinate-wise minimum of the given vectors, where a coordinate in the returned vector is NAN iff any of the two
* compared ones are NAN
*/
template <typename T>
constexpr Vec3<T> Min(const Vec3<T>& self, const Vec3<T>& other) {
return {
std::min(self.x, other.x),
std::min(self.y, other.y),
std::min(self.z, other.z),
};
}
/**
* @brief returns the coordinate-wise minimum of the given vectors,
* where a coordinate in the returned vector is NAN iff both of the two compared ones are NAN
*
* @tparam T
* @param self
* @param other
* @return constexpr Vec3f
*/
constexpr Vec3f FMinF(const Vec3f& self, const Vec3f& other) {
return {
std::fminf(self.x, other.x),
std::fminf(self.y, other.y),
std::fminf(self.z, other.z),
};
}
/**
* @brief returns the coordinate-wise maximum of the given vectors,
* where a coordinate in the returned vector is NAN iff any of the two compared ones are NAN
*
* @tparam T
* @param self
* @param other
* @return constexpr Vec3
*/
template <typename T>
constexpr Vec3<T> Max(const Vec3<T>& self, const Vec3<T>& other) {
return {
std::max(self.x, other.x),
std::max(self.y, other.y),
std::max(self.z, other.z),
};
}
/**
* @brief returns the coordinate-wise maximum of the given vectors,
* where a coordinate in the returned vector is NAN iff both of the two compared ones are NAN
*
* @tparam T
* @param self
* @param other
* @return constexpr Vec3
*/
constexpr Vec3f FMaxF(const Vec3f& self, const Vec3f& other) {
return {
std::fmaxf(self.x, other.x),
std::fmaxf(self.y, other.y),
std::fmaxf(self.z, other.z),
};
}
/**
* @brief lane-wise copysign
*/
constexpr Vec3f CopysignF(const Vec3f& v, const Vec3f& signs) {
return {
std::copysignf(v.x, signs.x),
std::copysignf(v.y, signs.y),
std::copysignf(v.z, signs.z),
};
}
/**
* @brief lane-wise copysign
*/
constexpr Vec3d Copysign(const Vec3d& v, const Vec3d& signs) {
return {
std::copysign(v.x, signs.x),
std::copysign(v.y, signs.y),
std::copysign(v.z, signs.z),
};
}
//////////////////////////////////////////////////////////////////
// Matrices //
//////////////////////////////////////////////////////////////////
/**
* \brief Returns the dot product of the matrix and the vector
* \return the dot product of the matrix and the vector
*/
template <typename T>
Vec4<T> Dot(const Mat4<T>& mat, const Vec4<T>& vect) {
return {mat.x0 * vect.x + mat.x1 * vect.y + mat.x2 * vect.z + mat.x3 * vect.w,
mat.y0 * vect.x + mat.y1 * vect.y + mat.y2 * vect.z + mat.y3 * vect.w,
mat.z0 * vect.x + mat.z1 * vect.y + mat.z2 * vect.z + mat.z3 * vect.w,
mat.w0 * vect.x + mat.w1 * vect.y + mat.w2 * vect.z + mat.w3 * vect.w};
}
/**
* \brief Returns the dot product of the matrix and an other matrix
* \return the dot product of the matrix and the other matrix
*/
template <typename T>
Mat4<T> Dot(const Mat4<T>& mat, const Mat4<T>& other) {
Mat4<T> result{};
for (std::size_t i = 0; i < Mat4<T>::MATRIX_SIZE; i++) {
for (std::size_t j = 0; j < Mat4<T>::MATRIX_SIZE; j++) {
for (std::size_t k = 0; k < Mat4<T>::MATRIX_SIZE; k++) {
result.at(i, j) += mat.at(i, k) * other.at(k, j);
}
}
}
return result;
}
/**
* \brief Returns the identity matrix
* \return the identity matrix
*/
template <typename T>
Mat4<T> Identity() {
Mat4<T> result{};
result.x0 = static_cast<T>(1);
result.y1 = static_cast<T>(1);
result.z2 = static_cast<T>(1);
result.w3 = static_cast<T>(1);
return result;
}
/**
* \brief Returns the transposed matrix
* \return the transposed matrix
*/
template <typename T>
Mat4<T> Transpose(const Mat4<T>& mat) {
Mat4<T> result;
result.x1 = mat.y0;
result.x2 = mat.z0;
result.x3 = mat.w0;
result.y0 = mat.x1;
result.y2 = mat.z1;
result.y3 = mat.w1;
result.z0 = mat.x2;
result.z1 = mat.y2;
result.z3 = mat.w2;
result.w0 = mat.x3;
result.w1 = mat.y3;
result.w2 = mat.z3;
result.x0 = mat.x0;
result.y1 = mat.y1;
result.z2 = mat.z2;
result.w3 = mat.w3;
return result;
}
/**
* \brief Returns the perspective matrix
* \param fovY The field of view in the y direction
* \param aspectRatio The aspect ratio of the screen
* \param zNear The near clipping plane
* \param zFar The far clipping plane
* \return the perspective matrix
*/
Mat4f Perspective(float fovY, float aspectRatio, float zNear, float zFar);
/**
* \brief Returns the look matrix
* \param eyePos The position of the camera
* \param front The front vector of the camera
* \param up The up vector of the camera
* \return the look matrix
*/
Mat4f Look(const Vec3f& eyePos, const Vec3f& front, const Vec3f& up);
/**
* \brief Returns the inverse of the matrix
* \return the inverse of the matrix
*/
Mat4f Inverse(const Mat4f& mat);
/**
* \brief Returns the translation matrix
* \param translation The translation vector
* \return the translation matrix
*/
Mat4f Translate(const Vec3f& translation);
/**
* \brief Returns the scale matrix
* \param axisFactor The scaling factor for each axis
* \return the scale matrix
*/
Mat4f Scale(const Vec3f& axisFactor);
/**
* \brief Returns the rotation matrix around the x axis
* \param angle The angle of rotation
* \return the rotation matrix
*/
Mat4f RotateX(float angle);
/**
* \brief Returns the rotation matrix around the y axis
* \param angle The angle of rotation
* \return the rotation matrix
*/
Mat4f RotateY(float angle);
/**
* \brief Returns the rotation matrix around the z axis
* \param angle The angle of rotation
* \return the rotation matrix
*/
Mat4f RotateZ(float angle);
/**
* \brief Returns the rotation matrix
* \param angles The angles of rotation
* \return the rotation matrix
*/
Mat4f Rotate(const Vec3f& angles);
/**
* \brief Returns the rotation matrix
* \param angle The angle of rotation
* \param axis The axis of rotation
* \return the rotation matrix
*/
Mat4f Rotate(float angle, Vec3f axis);
/**
* \brief Returns the unit vector correspond to the yaw and pitch
* \param yaw Angle in radians
* \param pitch Angle in radians
*/
Vec3f GetDirectionVectorFromRotation(float yaw, float pitch);
} // namespace maths
} // namespace blitz

View File

@@ -0,0 +1,149 @@
#pragma once
/**
* \file Physics.h
* \brief Physics logic
*/
#include "blitz/maths/Maths.h"
#include <optional>
namespace blitz {
namespace maths {
/**
* \enum Axis
* \brief represents an axis in 3-dimensional space
*/
enum Axis : std::size_t { aX = 0, aY, aZ };
/**
* \brief encodes the movement an entity must perform, in an environment containing other
* entitis it may collide with
*/
struct CollisionData {
/**
* \brief the effective movement the entity can/should perform, immediately
*/
Vec3f delta;
/**
* \brief the direction of "slide" along a side of a bounding
* box, this is 0 if no collisions occured
*/
Vec3f slide;
};
/**
* \struct IntersectionData
* \brief Intermediate data encoding an intersection between a Ray/AABB and an AABB
*/
struct IntersectionData {
/**
* \brief by how much to translate before intersecting with the AABB
*/
float distance;
/**
* \brief the axis along which the collision happens, used to solve sliding requirements
*/
Axis axis;
/**
* \brief Returns the movements that the entity must perform. It is advised to make sure
* `0.0f <= distance <= 1.0f` as this would return incoherent data
* \pre `0.0f <= distance <= 1.0f`
* \param dir
* \return
*/
CollisionData ToCollision(const Vec3f& dir) const;
};
/**
* \struct AABB
* \brief an Axis Aligned Bounding Box, see wikipedia for more
*/
struct AABB {
Vec3f from;
Vec3f to;
/**
* \return A vector representing the center of mass of the box
*/
inline Vec3f Center() const;
/**
* \return The same box but all the coordinates in `from` are less than their
* counterparts in `to`.
*/
AABB Direct() const;
/**
* \brief Enlarges this box along each axis by the length of the box along said axis
* \param with
* \return The new, big, box
*
*/
AABB Enlarge(const AABB& with) const;
AABB operator+(const Vec3f& offset) const;
AABB operator+=(const Vec3f& offset);
/**
* \brief checks if this box overlaps with another one
* \param aabb
* \return whether this box overlaps with another one
*/
bool OverlapsWith(const AABB& aabb) const;
/**
* \brief Given this box is to be offset by some vector colinear to dir,
* this function behave exactly like Ray::Intersection
* \param aabb
* \param dir
* \return
*/
std::optional<IntersectionData> Intersection(const AABB& aabb, const Vec3f& dir) const;
};
/**
* \struct Ray
* \brief represents a (half-)line
*/
struct Ray {
/**
* \brief the origin/start/initial point of the line
*/
Vec3f origin;
/**
* \brief the direction of the line
*/
Vec3f direction;
/**
* \brief Note that t isn't necessarily positive
* \param t
* \return `origin` + `direction` * `t`
*/
Vec3f operator()(float t) const;
/**
* \brief Is essentially Intersection(aabb).distance >= 0.0f
* \returns `true` if the half-line `ray` _strictly_ intersects with `aabb`,
* and `false` if it _strictly_ doesn't intersect.
* Note that if it only intersects with corners, edges, or sides of the box,
* or if any coordinate in `ray` is `NAN` or `inf` or if any coordinate in
* `aabb` is `NAN` the result is unspecified.
*/
bool Intersects(const AABB& aabb) const;
/**
* \brief The `distance` field of the returned value is smallest number t
* (in absolute value), if it exists, such that `ray(t)` is in `aabb`. otherwise
* a quiet `NaN` is returned. The `axis` field is the axis to along
* which `ray` intersects/collides with `aabb`
*/
std::optional<IntersectionData> Intersection(const AABB& aabb) const;
};
} // namespace maths
} // namespace blitz

View File

@@ -0,0 +1,341 @@
#pragma once
/**
* \file Vector.h
* \brief File containing the Vector structs and 4x4 matrix
*/
#include <algorithm>
#include <cstddef>
namespace blitz {
//////////////////////////////////////////////////////////////////
// Vector //
//////////////////////////////////////////////////////////////////
template <typename T>
struct Vec2 {
union {
T x;
T r;
};
union {
T y;
T g;
};
constexpr Vec2(T X = 0, T Y = 0) : x(X), y(Y) {}
};
template <typename T>
struct Vec3 {
union {
T x;
T r;
};
union {
T y;
T g;
};
union {
T z;
T b;
};
constexpr Vec3(T X = 0, T Y = 0, T Z = 0) : x(X), y(Y), z(Z) {}
static Vec3 splat(T val) {
return Vec3(val, val, val);
}
const T* data() const {
return reinterpret_cast<const T*>(this);
}
T* data() {
return reinterpret_cast<T*>(this);
}
const T& at(std::size_t index) const {
return data()[index];
}
T& at(std::size_t index) {
return data()[index];
}
const T& operator[](std::size_t index) const {
return at(index);
}
T& operator[](std::size_t index) {
return at(index);
}
};
template <typename T>
struct Vec4 {
union {
T x;
T r;
};
union {
T y;
T g;
};
union {
T z;
T b;
};
union {
T w;
T a;
};
constexpr Vec4(Vec3<T> vec, T W = 1) : x(vec.x), y(vec.y), z(vec.z), w(W) {}
constexpr Vec4(T X = 0, T Y = 0, T Z = 0, T W = 0) : x(X), y(Y), z(Z), w(W) {}
};
using Vec2uc = Vec2<unsigned char>;
using Vec2i = Vec2<int>;
using Vec2u = Vec2<unsigned int>;
using Vec2f = Vec2<float>;
using Vec2d = Vec2<double>;
using Vec3uc = Vec3<unsigned char>;
using Vec3i = Vec3<int>;
using Vec3u = Vec3<unsigned int>;
using Vec3f = Vec3<float>;
using Vec3d = Vec3<double>;
using Vec4uc = Vec4<unsigned char>;
using Vec4i = Vec4<int>;
using Vec4u = Vec4<unsigned int>;
using Vec4f = Vec4<float>;
using Vec4d = Vec4<double>;
using Color = Vec3uc;
// Vec2
template <typename T>
constexpr bool operator==(const Vec2<T>& vec2, const Vec2<T>& other) {
return vec2.x == other.x && vec2.y == other.y;
}
template <typename T>
constexpr Vec2<T> operator+(const Vec2<T>& vect, const Vec2<T>& other) {
return {vect.x + other.x, vect.y + other.y};
}
template <typename T>
Vec2<T>& operator+=(Vec2<T>& vect, const Vec2<T>& other) {
vect = vect + other;
return vect;
}
template <typename T>
constexpr Vec2<T> operator-(const Vec2<T>& vect) {
return {-vect.x, -vect.y};
}
template <typename T>
constexpr Vec2<T> operator-(const Vec2<T>& vect, const Vec2<T>& other) {
return {vect.x - other.x, vect.y - other.y};
}
template <typename T>
Vec2<T>& operator-=(Vec2<T>& vect, const Vec2<T>& other) {
vect = vect - other;
return vect;
}
template <typename T>
constexpr Vec2<T> operator*(const Vec2<T>& vect, T mult) {
return {vect.x * mult, vect.y * mult};
}
template <typename T>
constexpr Vec2<T> operator*(T mult, const Vec2<T>& vect) {
return vect * mult;
}
// Vec3
template <typename T>
constexpr bool operator==(const Vec3<T>& vec3, const Vec3<T>& other) {
return vec3.x == other.x && vec3.y == other.y && vec3.z == other.z;
}
template <typename T>
constexpr Vec3<T> operator-(const Vec3<T>& vect) {
return {-vect.x, -vect.y, -vect.z};
}
template <typename T>
constexpr Vec3<T> operator+(const Vec3<T>& vect, const Vec3<T>& other) {
return {vect.x + other.x, vect.y + other.y, vect.z + other.z};
}
template <typename T>
Vec3<T>& operator+=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect + other;
return vect;
}
template <typename T>
constexpr Vec3<T> operator-(const Vec3<T>& vect, const Vec3<T>& other) {
return {vect.x - other.x, vect.y - other.y, vect.z - other.z};
}
template <typename T>
Vec3<T>& operator-=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect - other;
return vect;
}
template <typename T>
constexpr Vec3<T> operator*(const Vec3<T>& vect, T mult) {
return {vect.x * mult, vect.y * mult, vect.z * mult};
}
template <typename T>
constexpr Vec3<T> operator*(T mult, const Vec3<T>& vect) {
return vect * mult;
}
template <typename T>
constexpr Vec3<T> operator*=(const Vec3<T>& vect, T mult) {
vect = vect * mult;
return vect;
}
template <typename T>
constexpr Vec3<T> operator*=(T mult, const Vec3<T>& vect) {
vect = vect * mult;
return vect;
}
template <typename T>
constexpr Vec3<T> operator*(const Vec3<T>& vect, const Vec3<T>& other) {
return {vect.x * other.x, vect.y * other.y, vect.z * other.z};
}
template <typename T>
Vec3<T>& operator*=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect * other;
return vect;
}
template <typename T>
constexpr Vec3<T> operator/(const Vec3<T>& vect, const Vec3<T>& other) {
return {vect.x / other.x, vect.y / other.y, vect.z / other.z};
}
template <typename T>
Vec3<T>& operator/=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect / other;
return vect;
}
// Vec4
template <typename T>
constexpr bool operator==(const Vec4<T>& vec4, const Vec4<T>& other) {
return vec4.x == other.x && vec4.y == other.y && vec4.z == other.z && vec4.w == other.w;
}
template <typename T>
constexpr Vec4<T> operator-(const Vec4<T>& vect) {
return {-vect.x, -vect.y, -vect.z, -vect.w};
}
template <typename T>
constexpr Vec4<T> operator+(const Vec4<T>& vect, const Vec4<T>& other) {
return {vect.x + other.x, vect.y + other.y, vect.z + other.z, vect.w + other.w};
}
template <typename T>
Vec4<T>& operator+=(Vec4<T>& vect, const Vec4<T>& other) {
vect = vect + other;
return vect;
}
template <typename T>
constexpr Vec4<T> operator-(const Vec4<T>& vect, const Vec4<T>& other) {
return {vect.x - other.x, vect.y - other.y, vect.z - other.z, vect.w - other.w};
}
template <typename T>
Vec4<T>& operator-=(Vec4<T>& vect, const Vec4<T>& other) {
vect = vect - other;
return vect;
}
template <typename T>
constexpr Vec4<T> operator*(const Vec4<T>& vect, T mult) {
return {vect.x * mult, vect.y * mult, vect.z * mult, vect.w * mult};
}
template <typename T>
constexpr Vec4<T> operator*(T mult, const Vec4<T>& vect) {
return vect * mult;
}
//////////////////////////////////////////////////////////////////
// Matrix //
//////////////////////////////////////////////////////////////////
template <typename T>
struct Mat4 {
static const std::size_t MATRIX_SIZE = 4;
T x0, x1, x2, x3;
T y0, y1, y2, y3;
T z0, z1, z2, z3;
T w0, w1, w2, w3;
T operator[](std::size_t offset) const {
return reinterpret_cast<const T*>(this)[offset];
}
T& operator[](std::size_t offset) {
return reinterpret_cast<T*>(this)[offset];
}
T* data() {
return reinterpret_cast<T*>(this);
}
const T* data() const {
return reinterpret_cast<const T*>(this);
}
T at(std::size_t row, std::size_t column) const {
return operator[](row * MATRIX_SIZE + column);
}
T& at(std::size_t row, std::size_t column) {
return operator[](row * MATRIX_SIZE + column);
}
};
typedef Mat4<float> Mat4f;
typedef Mat4<int> Mat4i;
typedef Mat4<double> Mat4d;
template <typename T>
bool operator==(const Mat4<T>& mat, const Mat4<T>& other) {
return mat.x0 == other.x0 && mat.y0 == other.y0 && mat.z0 == other.z0 && mat.w0 == other.w0 && mat.x1 == other.x1 &&
mat.y1 == other.y1 && mat.z1 == other.z1 && mat.w1 == other.w1 && mat.x2 == other.x2 && mat.y2 == other.y2 &&
mat.z2 == other.z2 && mat.w2 == other.w2 && mat.x3 == other.x3 && mat.y3 == other.y3 && mat.z3 == other.z3 &&
mat.w3 == other.w3;
}
} // namespace blitz

View File

@@ -1,13 +1,36 @@
#pragma once
#include "DataBuffer.h"
/**
* \file Compression.h
* \brief File containing compress utilities
*/
#include "blitz/common/DataBuffer.h"
#include <cstdint>
namespace blitz {
namespace utils {
/**
* \brief Compress some data
* \param buffer the data to compress
* \return the compressed data
*/
DataBuffer Compress(const DataBuffer& buffer);
/**
* \brief Reads the packet lenght and uncompress it
* \param buffer the data to uncompress
* \return the uncompressed data
*/
DataBuffer Decompress(DataBuffer& buffer);
/**
* \brief Uncompress some data
* \param buffer the data to uncompress
* \param packetLength lenght of data
* \return the uncompressed data
*/
DataBuffer Decompress(DataBuffer& buffer, std::uint64_t packetLength);
} // namespace utils

View File

@@ -1,63 +1,88 @@
#pragma once
/**
* \file Easing.h
* \brief File containing mathematical functions and constants
*/
namespace blitz {
namespace utils {
/* Sine functions */
/**
* \brief Sine functions
*/
float EaseInSine(float x);
float EaseOutSine(float x);
float EaseInOutSine(float x);
/* Cubic functions */
/**
* \brief Cubic functions
*/
float EaseInCubic(float x);
float EaseOutCubic(float x);
float EaseInOutCubic(float x);
/* Quint functions */
/**
* \brief Quint functions
*/
float EaseInQuint(float x);
float EaseOutQuint(float x);
float EaseInOutQuint(float x);
/* Circ functions */
/**
* \brief Circ functions
*/
float EaseInCirc(float x);
float EaseOutCirc(float x);
float EaseInOutCirc(float x);
/* Elastic functions */
/**
* \brief Elastic functions
*/
float EaseInElastic(float x);
float EaseOutElastic(float x);
float EaseInOutElastic(float x);
/* Quad functions */
/**
* \brief Quad functions
*/
float EaseInQuad(float x);
float EaseOutQuad(float x);
float EaseInOutQuad(float x);
/* Quart functions */
/**
* \brief Quart functions
*/
float EaseInQuart(float x);
float EaseOutQuart(float x);
float EaseInOutQuart(float x);
/* Expo functions */
/**
* \brief Expo functions
*/
float EaseInExpo(float x);
float EaseOutExpo(float x);
float EaseInOutExpo(float x);
/* Back functions */
/**
* \brief Back functions
*/
float EaseInBack(float x);
float EaseOutBack(float x);
float EaseInOutBack(float x);
/* Bounce functions */
/**
* \brief Bounce functions
*/
float EaseInBounce(float x);
float EaseOutBounce(float x);

View File

@@ -1,5 +1,10 @@
#pragma once
/**
* \file Format.h
* \brief This file contains the definition of the `Format` function.
*/
#include <memory>
#include <stdexcept>
#include <string>
@@ -7,6 +12,17 @@
namespace blitz {
namespace utils {
/**
* \brief Formats a string using a format string and variadic arguments.
*
* This function takes a format string and a variable number of arguments and returns a formatted string.
* The format string can contain placeholders that will be replaced by the corresponding arguments.
*
* \param format The format string.
* \param args The variadic arguments to be formatted.
* \return The formatted string.
* \throws std::runtime_error if an error occurs during formatting.
*/
template <typename... Args>
std::string Format(const std::string& format, Args... args) {
int size = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'

View File

@@ -1,13 +1,32 @@
#pragma once
/**
* \file Log.h
* \brief File defining log functions
*/
#include <string>
namespace blitz {
namespace utils {
void LOG(const std::string& msg); // Normal
void LOGD(const std::string& msg); // Normal en mode debug
void LOGE(const std::string& err); // Normal erreur
/**
* \brief Logs a normal message.
* \param msg The message to be logged.
*/
void LOG(const std::string& msg);
/**
* \brief Logs a normal message in debug mode.
* \param msg The message to be logged.
*/
void LOGD(const std::string& msg);
/**
* \brief Logs an error message.
* \param err The error message to be logged.
*/
void LOGE(const std::string& err);
} // namespace utils
} // namespace blitz

View File

@@ -1,348 +0,0 @@
#pragma once
#include <cmath>
namespace blitz {
static constexpr float PI = 3.141592653f;
template <typename T>
struct Vec2 {
union {
T x;
T r;
};
union {
T y;
T g;
};
constexpr Vec2(T X = 0, T Y = 0) : x(X), y(Y) {}
};
template <typename T>
inline bool operator==(const Vec2<T>& vec2, const Vec2<T>& other) {
return vec2.x == other.x && vec2.y == other.y;
}
template <typename T>
struct Vec3 {
union {
T x;
T r;
};
union {
T y;
T g;
};
union {
T z;
T b;
};
constexpr Vec3(T X = 0, T Y = 0, T Z = 0) : x(X), y(Y), z(Z) {}
};
template <typename T>
inline bool operator==(const Vec3<T>& vec3, const Vec3<T>& other) {
return vec3.x == other.x && vec3.y == other.y && vec3.z == other.z;
}
template <typename T>
struct Vec4 {
union {
T x;
T r;
};
union {
T y;
T g;
};
union {
T z;
T b;
};
union {
T w;
T a;
};
constexpr Vec4(Vec3<T> vec, T W = 1) : x(vec.x), y(vec.y), z(vec.z), w(W) {}
constexpr Vec4(T X = 0, T Y = 0, T Z = 0, T W = 0) : x(X), y(Y), z(Z), w(W) {}
};
template <typename T>
inline bool operator==(const Vec4<T>& vec4, const Vec4<T>& other) {
return vec4.x == other.x && vec4.y == other.y && vec4.z == other.z && vec4.w = other.w;
}
using Vec2uc = Vec2<unsigned int>;
using Vec2i = Vec2<int>;
using Vec2u = Vec2<unsigned int>;
using Vec2f = Vec2<float>;
using Vec2d = Vec2<double>;
using Vec3uc = Vec3<unsigned int>;
using Vec3i = Vec3<int>;
using Vec3u = Vec3<unsigned int>;
using Vec3f = Vec3<float>;
using Vec3d = Vec3<double>;
using Vec4uc = Vec4<unsigned int>;
using Vec4i = Vec4<int>;
using Vec4u = Vec4<unsigned int>;
using Vec4f = Vec4<float>;
using Vec4d = Vec4<double>;
using Color = Vec3<unsigned char>;
template <typename T>
struct Mat4 {
static const std::size_t MATRIX_SIZE = 4;
T x0, x1, x2, x3;
T y0, y1, y2, y3;
T z0, z1, z2, z3;
T w0, w1, w2, w3;
T operator[](std::size_t offset) const {
return reinterpret_cast<const T*>(this)[offset];
}
T& operator[](std::size_t offset) {
return reinterpret_cast<T*>(this)[offset];
}
T* data() {
return reinterpret_cast<T*>(this);
}
const T* data() const {
return reinterpret_cast<const T*>(this);
}
T at(std::size_t row, std::size_t column) const {
return operator[](row* MATRIX_SIZE + column);
}
T& at(std::size_t row, std::size_t column) {
return operator[](row* MATRIX_SIZE + column);
}
};
typedef Mat4<float> Mat4f;
typedef Mat4<int> Mat4i;
typedef Mat4<double> Mat4d;
template <typename T>
inline bool operator==(const Mat4<T>& mat, const Mat4<T>& other) {
return mat.x0 == other.x0 && mat.y0 == other.y0 && mat.z0 == other.z0 && mat.w0 == other.w0 && mat.x1 == other.x1 &&
mat.y1 == other.y1 && mat.z1 == other.z1 && mat.w1 == other.w1 && mat.x2 == other.x2 && mat.y2 == other.y2 &&
mat.z2 == other.z2 && mat.w2 == other.w2 && mat.x3 == other.x3 && mat.y3 == other.y3 && mat.z3 == other.z3 &&
mat.w3 == other.w3;
}
//////////////////////////////////////////////////////////////////
// Operators //
//////////////////////////////////////////////////////////////////
template <typename T>
Vec2<T> operator+(const Vec2<T>& vect, const Vec2<T>& other) {
return {vect.x + other.x, vect.y + other.y};
}
template <typename T>
void operator+=(Vec2<T>& vect, const Vec2<T>& other) {
vect = vect + other;
}
template <typename T>
Vec2<T> operator-(const Vec2<T>& vect) {
return {-vect.x, -vect.y};
}
template <typename T>
Vec2<T> operator-(const Vec2<T>& vect, const Vec2<T>& other) {
return vect + (-other);
}
template <typename T>
void operator-=(Vec2<T>& vect, const Vec2<T>& other) {
vect = vect - other;
}
template <typename T>
Vec3<T> operator-(const Vec3<T>& vect) {
return {-vect.x, -vect.y, -vect.z};
}
template <typename T>
Vec3<T> operator+(const Vec3<T>& vect, const Vec3<T>& other) {
return {vect.x + other.x, vect.y + other.y, vect.z + other.y};
}
template <typename T>
void operator+=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect + other;
}
template <typename T>
Vec3<T> operator-(const Vec3<T>& vect, const Vec3<T>& other) {
return vect + (-other);
}
template <typename T>
void operator-=(Vec3<T>& vect, const Vec3<T>& other) {
vect = vect - other;
}
template <typename T>
Vec4<T> operator-(const Vec4<T>& vect) {
return {-vect.x, -vect.y, -vect.z, -vect.w};
}
template <typename T>
Vec4<T> operator+(const Vec4<T>& vect, const Vec4<T>& other) {
return {vect.x + other.x, vect.y + other.y, vect.z + other.y, vect.w + other.w};
}
template <typename T>
Vec4<T> operator+=(Vec4<T>& vect, const Vec4<T>& other) {
vect = vect + other;
}
template <typename T>
Vec4<T> operator-(const Vec4<T>& vect, const Vec4<T>& other) {
return vect + (-other);
}
template <typename T>
Vec4<T> operator-=(Vec4<T>& vect, const Vec4<T>& other) {
vect = vect - other;
}
//////////////////////////////////////////////////////////////////
// Vectors //
//////////////////////////////////////////////////////////////////
namespace maths {
template <typename T>
T Length(const Vec3<T>& vect) {
return std::sqrt(vect.x * vect.x + vect.y * vect.y + vect.z * vect.z);
}
template <typename T>
Vec3<T> Normalize(const Vec3<T>& vect) {
T length = Length(vect);
return {vect.x / length, vect.y / length, vect.z / length};
}
template <typename T>
Vec4<T> Normalize(const Vec4<T>& vect) {
T length = std::sqrt(vect.x * vect.x + vect.y * vect.y + vect.z * vect.z + vect.w * vect.w);
return {vect.x / length, vect.y / length, vect.z / length, vect.w / length};
}
template <typename T>
T Dot(const Vec3<T>& vect, const Vec3<T>& other) {
return vect.x * other.x + vect.y * other.y + vect.z * other.z;
}
template <typename T>
Vec3<T> Cross(const Vec3<T>& vect, const Vec3<T>& other) {
return {
vect.y * other.z - vect.z * other.y,
vect.z * other.x - vect.x * other.z,
vect.x * other.y - vect.y * other.x,
};
}
template <typename T>
T Dot(const Vec4<T>& vect, const Vec4<T>& other) {
return vect.x * other.x + vect.y * other.y + vect.z * other.z + vect.w * other.w;
}
template <typename T>
T Distance(const Vec3<T>& vect, const Vec3<T>& other) {
return Length(vect - other);
}
//////////////////////////////////////////////////////////////////
// Matricies //
//////////////////////////////////////////////////////////////////
template <typename T>
Vec4<T> Dot(const Mat4<T>& mat, const Vec4<T>& vect) {
return {mat.x0 * vect.x + mat.x1 * vect.y + mat.x2 * vect.z + mat.x3 * vect.w,
mat.y0 * vect.x + mat.y1 * vect.y + mat.y2 * vect.z + mat.y3 * vect.w,
mat.z0 * vect.x + mat.z1 * vect.y + mat.z2 * vect.z + mat.z3 * vect.w,
mat.w0 * vect.x + mat.w1 * vect.y + mat.w2 * vect.z + mat.w3 * vect.w};
}
template <typename T>
Mat4<T> Dot(const Mat4<T>& mat, const Mat4<T>& other) {
Mat4<T> result{};
for (std::size_t i = 0; i < Mat4<T>::MATRIX_SIZE; i++) {
for (std::size_t j = 0; j < Mat4<T>::MATRIX_SIZE; j++) {
for (std::size_t k = 0; k < Mat4<T>::MATRIX_SIZE; k++) {
result.at(i, j) += mat.at(i, k) * other.at(k, j);
}
}
}
return result;
}
template <typename T>
Mat4<T> Identity() {
Mat4<T> result{};
result.x0 = static_cast<T>(1);
result.y1 = static_cast<T>(1);
result.z2 = static_cast<T>(1);
result.w3 = static_cast<T>(1);
return result;
}
template <typename T>
Mat4<T> Transpose(const Mat4<T>& mat) {
Mat4<T> result;
result.x1 = mat.y0;
result.x2 = mat.z0;
result.x3 = mat.w0;
result.y0 = mat.x1;
result.y2 = mat.z1;
result.y3 = mat.w1;
result.z0 = mat.x2;
result.z1 = mat.y2;
result.z3 = mat.w2;
result.w0 = mat.x3;
result.w1 = mat.y3;
result.w2 = mat.z3;
result.x0 = mat.x0;
result.y1 = mat.y1;
result.z2 = mat.z2;
result.w3 = mat.w3;
return result;
}
Mat4f Perspective(float fovY, float aspectRatio, float zNear, float zFar);
Mat4f Look(const Vec3f& eyePos, const Vec3f& front, const Vec3f& up);
Mat4f Inverse(const Mat4f& mat);
} // namespace maths
} // namespace blitz

View File

@@ -1,5 +1,10 @@
#pragma once
/**
* \file ObjectNotifier.h
* \brief File containing the blitz::ObjectNotifier class
*/
#include <algorithm>
#include <functional>
#include <vector>
@@ -7,16 +12,26 @@
namespace blitz {
namespace utils {
/**
* \class ObjectNotifier
* \brief Class used to notify listeners
*/
template <typename Listener>
class ObjectNotifier {
protected:
std::vector<Listener*> m_Listeners;
public:
/**
* \brief Binds a listener to notify later
*/
void BindListener(Listener* listener) {
m_Listeners.push_back(listener);
}
/**
* \brief Unbinds a listener (in case the listener is destroyed for example)
*/
void UnbindListener(Listener* listener) {
auto iter = std::find(m_Listeners.begin(), m_Listeners.end(), listener);
@@ -26,8 +41,11 @@ class ObjectNotifier {
m_Listeners.erase(iter);
}
/**
* \brief Notify listeners that were bound
*/
template <typename Func, typename... Args>
void NotifyListeners(Func function, Args... args) {
void NotifyListeners(Func function, Args... args) const {
for (Listener* listener : m_Listeners)
std::bind(function, listener, args...)();
}

View File

@@ -0,0 +1,36 @@
#pragma once
/**
* \file PrettyLog.h
* \brief File defining log functions with colors
*/
#include "blitz/maths/Vector.h"
#include <string>
namespace blitz {
namespace utils {
namespace TextColor {
const static Vec3uc AQUA = {0, 255, 255};
const static Vec3uc BLUE = {0, 0, 255};
const static Vec3uc GREEN = {0, 255, 0};
const static Vec3uc PURPLE = {255, 0, 255};
const static Vec3uc RED = {255, 0, 0};
const static Vec3uc WHITE = {255, 255, 255};
const static Vec3uc YELLOW = {255, 255, 0};
} // namespace TextColor
/**
* \brief Returns the color code for a given color.
*/
std::string GetTextColor(Vec3uc color);
/**
* \brief Returns the color code for the reset color.
*/
std::string GetTextColorReset();
} // namespace utils
} // namespace blitz

View File

@@ -1,10 +1,21 @@
#pragma once
/**
* \file Random.h
* \brief Defines functions for generating random numbers.
*/
#include <random>
namespace blitz {
namespace utils {
/**
* \brief Returns a random integer between min and max.
* \param min The minimum value.
* \param max The maximum value.
* \return A random integer between min and max.
*/
template <typename NumberType>
NumberType GetRandomInt(NumberType min, NumberType max) {
std::random_device randomDevice;
@@ -13,6 +24,12 @@ NumberType GetRandomInt(NumberType min, NumberType max) {
return distrib(generator);
}
/**
* \brief Returns a random real number between min and max.
* \param min The minimum value.
* \param max The maximum value.
* \return A random real number between min and max.
*/
template <typename NumberType>
NumberType GetRandomReal(NumberType min, NumberType max) {
std::random_device randomDevice;

69
include/blitz/misc/Test.h Normal file
View File

@@ -0,0 +1,69 @@
#pragma once
/**
* \file Test.h
* \brief File containing unit testing utilities
*/
#include <cstdlib>
namespace blitz {
namespace utils {
/**
* \def BLITZ_TEST_SUCCESSFUL
* \brief Used in tests to indicate that a test was successful
*/
#define BLITZ_TEST_SUCCESSFUL 0
/**
* \def BLITZ_TEST_FAILED
* \brief Used in tests to indicate that a test failed
*/
#define BLITZ_TEST_FAILED 1
#ifndef __FUNCTION_NAME__
#ifdef _WIN32
#define __FUNCTION_NAME__ __FUNCTION__
#else
#define __FUNCTION_NAME__ __PRETTY_FUNCTION__
#endif
#endif
/**
* \def blitz_test_assert
* \param ... The expression to evaluate
* \brief Evaluates the expression and exits the program if not valid.
* \note It works like a basic assert() but also in release mode
*/
#define blitz_test_assert(...) \
if (!static_cast<bool>(__VA_ARGS__)) { \
blitz::utils::LOGAssert(#__VA_ARGS__, __FILE__, __LINE__, __FUNCTION_NAME__); \
std::exit(BLITZ_TEST_FAILED); \
}
/**
* \def blitz_debug_assert
* \param ... The expression to execute
* \brief Assertion without checks in release mode
* \note The expression is always executed. However, in release, no checks are made !
*/
#ifdef NDEBUG
#define blitz_debug_assert(...) __VA_ARGS__
#else
#define blitz_debug_assert blitz_test_assert
#endif
/**
* \brief Prints an error message associated with a failed assertion
* \param expression The expression that was tested
* \param file The file in which the assertion failed
* \param line The line in the file in which the assertion failed
* \param function The function in which the assertion failed
*/
void LOGAssert(const char* expression, const char* file, int line, const char* function);
} // namespace utils
} // namespace blitz

View File

@@ -1,10 +1,19 @@
#pragma once
/**
* \file TickCounter.h
* \brief File containing the blitz::utils::TickCounter class
*/
#include <cstdint>
namespace blitz {
namespace utils {
/**
* \class TickCounter
* \brief Class used to count ticks
*/
class TickCounter {
private:
float m_TPS;
@@ -14,19 +23,42 @@ class TickCounter {
int m_TargetTPS;
public:
/**
* \brief Constructor
* \param tps The target ticks per second
*/
TickCounter(int tps) : m_TargetTPS(tps) {}
/**
* \brief Reset the tick counter
*/
void Reset();
bool Update(); // return true when tps is updated
/**
* \brief Update the tick counter
* \return True if the tick counter has been updated
*/
bool Update();
/**
* \brief Get the ticks per second
* \return The ticks per second
*/
float GetTPS() const {
return m_TPS;
}
/**
* \brief Get the milliseconds per tick
* \return The milliseconds per tick
*/
float GetMSPT() const {
return m_MSPT;
}
/**
* \brief Set the ticks per second
* \param mspt The ticks per second
*/
void SetMSPT(float mspt) {
m_MSPT = mspt;
}

View File

@@ -1,16 +1,30 @@
#pragma once
/**
* \file Time.h
* \brief File containing the blitz::utils::AutoTimer, blitz::utils::Timer, blitz::utils::CooldownTimer and blitz::utils::DelayTimer
* classes
*/
#include <algorithm>
#include <cstdint>
#include <functional>
namespace blitz {
namespace utils {
/**
* \brief Get current time
* \return Time elapsed since epoch in milliseconds
*/
std::uint64_t GetTime();
typedef std::function<void()> TimerExecFunction;
// utililty class to call a function at regular period of time
/**
* \class AutoTimer
* \brief Calls a function at regular period of time
*/
class AutoTimer {
private:
std::uint64_t m_Interval;
@@ -20,79 +34,245 @@ class AutoTimer {
std::uint64_t m_InternalTime = 0;
public:
/**
* \brief Default constructor
*/
AutoTimer() : m_Interval(0), m_Function(nullptr) {}
/**
* \param interval Time between each function call in milliseconds
*/
AutoTimer(std::uint64_t interval) : m_Interval(interval), m_Function(nullptr) {}
/**
* \param interval Time between each function call in milliseconds
* \param callback The function to call peridocally
*/
AutoTimer(std::uint64_t interval, TimerExecFunction callback) : m_Interval(interval), m_Function(callback) {}
/**
* \brief Updates the timer
*/
void Update();
/**
* \brief Updates the timer with the desired time step
* \param delta The time step in milliseconds
*/
void Update(std::uint64_t delta);
/**
* \brief Resets the internal cooldown
*/
void Reset();
/**
* \brief Sets a new interval
* \param newInterval the new interval in milliseconds
*/
void SetInterval(std::uint64_t newInterval) {
m_Interval = newInterval;
}
/**
* \return The interval between each callback in milliseconds
*/
std::uint64_t GetInterval() const {
return m_Interval;
}
/**
* \brief Set a new callback function
* \param newCallback The function to call
*/
void SetCallbackFunction(TimerExecFunction newCallback) {
m_Function = newCallback;
}
/**
* \return The callback function
*/
TimerExecFunction GetCallbackFunction() const {
return m_Function;
}
};
// utililty class to trigger update at regular period of time
/**
* \class Timer
* \brief Utililty class to trigger update at regular period of time
*/
class Timer {
private:
std::uint64_t m_Interval; // in millis
std::uint64_t m_InternalTime = 0;
public:
/**
* \brief Default constructor
*/
Timer() : m_Interval(0) {}
/**
* \brief Construct a Timer with the desired interval
* \param interval The interval between each update in milliseconds
*/
Timer(std::uint64_t interval) : m_Interval(interval) {}
/**
* \brief Updates the timer
* \param delta The time step in milliseconds
* \return true every interval milliseconds
*/
bool Update(std::uint64_t delta);
/**
* \brief Resets the timer to its original state
*/
void Reset();
/**
* \return The time remaing before the next Update() call will return true (in milliseconds)
*/
std::uint64_t GetTimeRemaining() const {
return m_Interval - m_InternalTime;
}
/**
* \return The time elapsed since the previous Update() call returned true (in milliseconds)
*/
std::uint64_t GetTimeElapsed() const {
return m_InternalTime;
}
/**
* \brief Set a new value for the interval
* \param newInterval the new interval to set
*/
void SetInterval(std::uint64_t newInterval) {
m_Interval = newInterval;
}
/**
* \return The interval between each successful Update()
*/
std::uint64_t GetInterval() const {
return m_Interval;
}
};
// utililty class to trigger update at regular period of time with a cooldown
/**
* \class CooldownTimer
* \brief Class to trigger update at regular period of time with a cooldown
*/
template <typename T>
class CooldownTimer {
private:
std::uint64_t m_Cooldown; // in millis
std::uint64_t m_CooldownTime;
T m_Cooldown;
T m_CooldownTime;
public:
/**
* \brief Default constructor
*/
CooldownTimer() : m_Cooldown(0), m_CooldownTime(0) {}
CooldownTimer(std::uint64_t cooldown) : m_Cooldown(0), m_CooldownTime(cooldown) {}
bool Update(std::uint64_t delta);
/**
* \param cooldown The cooldown before Update() returns true again
*/
CooldownTimer(T cooldown) : m_Cooldown(0), m_CooldownTime(cooldown) {}
void ApplyCooldown();
/**
* \brief Update the timer
* \param delta the time step
*/
bool Update(T delta) {
if (m_Cooldown > 0) {
m_Cooldown = std::max<T>(static_cast<T>(0), static_cast<T>(m_Cooldown - delta));
}
return m_Cooldown == 0;
}
void Reset();
/**
* \brief Apply a cooldown for the timer
*/
void ApplyCooldown() {
m_Cooldown = m_CooldownTime;
}
void SetCooldown(std::uint64_t newCooldown) {
/**
* \brief Reset the cooldown. Update() will return true immediatly afterward.
*/
void Reset() {
m_Cooldown = 0;
}
/**
* \brief Change the timer cooldown
* \param newCooldown the new cooldown
*/
void SetCooldown(T newCooldown) {
m_CooldownTime = newCooldown;
}
std::uint64_t GetCooldown() const {
/**
* \return The cooldown of the timer
*/
T GetCooldown() const {
return m_CooldownTime;
}
};
/**
* \class DelayTimer
* \brief class to trigger an update after a period of time
*/
template <typename T>
class DelayTimer {
private:
T m_DelayTime;
T m_InternalTime;
public:
/**
* \brief Default constructor
*/
DelayTimer() : m_DelayTime(0), m_InternalTime(0) {}
/**
* \param delay The delay to set
*/
DelayTimer(T delay) : m_DelayTime(delay), m_InternalTime(delay) {}
/**
* \brief Returns true whether the delay has been passed.
*/
bool Update(T delta) {
m_InternalTime = std::max<T>(static_cast<T>(0), static_cast<T>(m_InternalTime - delta));
return m_InternalTime == 0;
}
/**
* \brief Resets the timer. Update() will immediatly return true
*/
void Reset() {
m_InternalTime = m_DelayTime;
}
/**
* \brief Changes the delay of the timer
* \param newDelay the new delay
*/
void SetDelay(T newDelay) {
m_DelayTime = newDelay;
}
/**
* \return the delay of the timer
*/
T GetDelay() const {
return m_DelayTime;
}
};
} // namespace utils
} // namespace blitz

View File

@@ -1,5 +1,10 @@
#pragma once
/**
* \file Connexion.h
* \brief File containing the blitz::network::Connexion class
*/
#include "TCPSocket.h"
#include "blitz/protocol/PacketDispatcher.h"
#include "blitz/protocol/PacketHandler.h"
@@ -7,7 +12,11 @@
namespace blitz {
namespace network {
class Connexion : public protocol::PacketHandler {
/**
* \class Connexion
* \brief Represents a network connexion
*/
class Connexion : public protocol::PacketHandler, private NonCopyable {
protected:
protocol::PacketDispatcher m_Dispatcher;
@@ -15,24 +24,54 @@ class Connexion : public protocol::PacketHandler {
TCPSocket m_Socket;
public:
/**
* \brief Constructs with an empty socket
*/
Connexion(protocol::PacketDispatcher* dispatcher);
/**
* \brief Constructs with an already connected socket
*/
Connexion(protocol::PacketDispatcher* dispatcher, TCPSocket& socket);
/**
* \brief Move constructor
*/
Connexion(Connexion&& move);
/**
* \brief Default destructor
*/
virtual ~Connexion();
/**
* \brief Reads socket and process a Packet, if any
*/
virtual bool UpdateSocket();
/**
* \brief Closes the connexion
*/
void CloseConnection();
virtual bool Connect(const std::string& address, std::uint16_t port);
/**
* \brief Tries to connect the socket at the specified address and port
* \return Whether this action was succesfull
*/
bool Connect(const std::string& address, std::uint16_t port);
/**
* \brief Returns the TCPSocket::Status of the internal socket
*/
TCPSocket::Status GetSocketStatus() const {
return m_Socket.GetStatus();
}
/**
* \brief Sends the protocol::Packet over the network to the remote
* \param packet The protocol::Packet to send
*/
void SendPacket(const protocol::Packet* packet);
REMOVE_COPY(Connexion);
};
} // namespace network

View File

@@ -1,51 +0,0 @@
#pragma once
#include <string>
#include <vector>
namespace blitz {
namespace network {
/* IPv4 address */
class IPAddress {
private:
std::uint32_t m_Address;
bool m_Valid;
public:
/* Create an invalid address */
IPAddress() noexcept;
/* Initialize by string IP */
IPAddress(const std::string& str);
/* Initialize by octets */
IPAddress(std::uint8_t octet1, std::uint8_t octet2, std::uint8_t octet3, std::uint8_t octet4) noexcept;
/* Get the specific octet. 1-4 */
std::uint8_t GetOctet(std::uint8_t num) const;
/* Set the specific octet. 1-4 */
void SetOctet(std::uint8_t num, std::uint8_t value);
/* Make sure the IP is valid. It will be invalid if the host wasn't found. */
bool IsValid() const noexcept {
return m_Valid;
}
std::string ToString() const;
static IPAddress LocalAddress();
bool operator==(const IPAddress& right);
bool operator!=(const IPAddress& right);
bool operator==(bool b);
};
typedef std::vector<IPAddress> IPAddresses;
std::ostream& operator<<(std::ostream& os, const IPAddress& addr);
std::wostream& operator<<(std::wostream& os, const IPAddress& addr);
} // namespace network
} // namespace blitz

View File

@@ -1,25 +1,36 @@
#pragma once
#ifdef _WIN32
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#endif
/**
* \file Network.h
* \brief File containing the blitz::network::NetworkInitializer class
*/
#include "IPAddress.h"
#include "TCPSocket.h"
namespace blitz {
/**
* \namespace blitz::network
* \brief Namespace containing all classes related to networking
*/
namespace network {
class Dns {
/**
* \class NetworkInitializer
* \brief Class used to initialize the network (only does something on Windows).
* \note This class is meant to be created only once in your program. \n
* The easiest thing to do is to create an instance of this class at the top of your **main.cpp**.
*/
class NetworkInitializer : private NonCopyable {
public:
static IPAddresses Resolve(const std::string& host);
/**
* \brief Creates the networking context
*/
NetworkInitializer();
/**
* \brief Destroys the networking context
*/
~NetworkInitializer();
};
} // namespace network

View File

@@ -1,36 +1,84 @@
#pragma once
/**
* \file TCPListener.h
* \brief File containing the blitz::network::TCPListener class
*/
#include "TCPSocket.h"
#include "blitz/Defines.h"
namespace blitz {
namespace network {
class TCPListener {
int m_Handle;
/**
* \class TCPListener
* \brief Cross platform abstraction of a TCP socket server
*/
class TCPListener : private NonCopyable {
private:
SocketHandle m_Handle;
std::uint16_t m_Port;
int m_MaxConnections;
public:
/**
* \brief Default constructor
*/
TCPListener();
/**
* \brief Default destructor
*/
~TCPListener();
bool Listen(std::uint16_t port, int maxConnections);
/**
* \brief Starts listening for guests to connect
* \param port The port to listen to
* \param maxConnexions The maximum amount of connexion that can happen at the same time. \n
* Every other guests will be kicked if this amount is reached.
* \return Whether this action was succesfull
*/
bool Listen(std::uint16_t port, int maxConnexions);
/**
* \brief Tries to accept an incoming request to connect
* \param newSocket the empty socket to put the result to
* \return true if a new connexion was accepted
*/
bool Accept(TCPSocket& newSocket);
/**
* \brief Destroys the socket
*/
void Destroy();
/**
* \brief Closes transmissions
* \return true if this action was succesfull
*/
bool Close();
/**
* \brief Allows to set the socket in non blocking/blocking mode
* \param block If set to true, every call to Read will wait until the socket receives something
* \return true if the operation was successful
*/
bool SetBlocking(bool blocking);
/**
* \brief Getter of the m_Port member
* \return The port which the socket listen to
*/
std::uint16_t GetListeningPort() const {
return m_Port;
}
/**
* \brief Getter of the m_MaxConnections member
* \return The maximum amount of connexions that can happen at the same time.
*/
int GetMaximumConnections() const {
return m_MaxConnections;
}
REMOVE_COPY(TCPListener);
};
} // namespace network

View File

@@ -1,13 +1,7 @@
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "IPAddress.h"
#include "blitz/Defines.h"
#include "blitz/misc/DataBuffer.h"
#include "blitz/common/DataBuffer.h"
#include "blitz/common/NonCopyable.h"
#ifdef _WIN32
#include <winsock2.h>
@@ -28,60 +22,146 @@
#define INVALID_SOCKET -1
#endif
/**
* \file TCPSocket.h
* \brief File containing the blitz::network::TCPSocket class
*/
namespace blitz {
namespace network {
class IPAddress;
/**
* \typedef SocketHandle
* \brief Represents a native socket
*/
typedef int SocketHandle;
class TCPSocket {
/**
* \class TCPSocket
* \brief Cross platform abstraction of a TCP socket
*/
class TCPSocket : private NonCopyable {
public:
enum class Status { Connected, Disconnected, Error };
/**
* \enum Status
* \brief Describes the state of a socket
*/
enum class Status {
/** The socket is connected */
Connected,
/** The socket is not connected */
Disconnected,
/** Something bad happened */
Error,
};
private:
bool m_Blocking;
Status m_Status;
SocketHandle m_Handle;
IPAddress m_RemoteIP;
std::uint16_t m_Port;
sockaddr m_RemoteAddr;
public:
/**
* \brief Default constructor
*/
TCPSocket();
TCPSocket(TCPSocket&&);
/**
* \brief Default destructor
*/
virtual ~TCPSocket();
/**
* \brief Move constructor
*/
TCPSocket(TCPSocket&&);
/**
* \brief Sets the TCPSocket::Status of the socket
* \param status The TCPSocket::Status to apply
*/
void SetStatus(Status status);
/**
* \brief Allows to set the socket in non blocking/blocking mode
* \param block If set to true, every call to Read will wait until the socket receives something
* \return true if the operation was successful
*/
bool SetBlocking(bool block);
bool IsBlocking() const noexcept;
Status GetStatus() const noexcept;
SocketHandle GetHandle() const noexcept;
/**
* \brief Checks if the socket is in blocking mode
* \return Whether the socket is in blocking mode
*/
bool IsBlocking() const;
bool Connect(const std::string& ip, std::uint16_t port);
bool Connect(const IPAddress& address, std::uint16_t port);
/**
* \brief Getter of the m_Status member
* \return The TCPSocket::Status of this socket
*/
Status GetStatus() const;
/**
* \brief Tries to connect to the host at the given port
* \param host The host to connect to. Can be a hostname or an ip address.
* \param port The port to connect to.
* \return Whether this action was successfull
*/
bool Connect(const std::string& host, std::uint16_t port);
/**
* \brief Disconnects the socket from the remote
* \note Does nothing if the socket is not connected. \n
* This function is also called by the destructor.
*/
void Disconnect();
std::size_t Send(const std::string& data);
/**
* \brief Sends some data
* \param buffer The data to send
* \note Simply returns 0 if the socket is not connected
* \return The amount of data sent. It should be the size of the buffer in theory.
*/
std::size_t Send(DataBuffer& buffer);
std::size_t Send(const uint8_t* data, std::size_t size);
/**
* \brief Sends some data
* \param data The data to send
* \param size The amount of data to send
* \note Simply returns 0 if the socket is not connected
* \return The amount of data sent. It should be equal to the size param in theory
*/
std::size_t Send(const std::uint8_t* data, std::size_t size);
/**
* \brief Reads some data
* \param amount The amount of data to read
* \return The buffer containing the data that have been received
* \note If no data is available, an empty DataBuffer is returned
*/
DataBuffer Receive(std::size_t amount);
/**
* \brief Reads some data
* \param buffer The buffer to write into
* \param amount The amount of data to read
* \return The amount of data read
* \note If no data is available, 0 is returned
*/
std::size_t Receive(DataBuffer& buffer, std::size_t amount);
REMOVE_COPY(TCPSocket);
friend class TCPListener;
};
/**
* \brief Compress the data and send it to the socket
* \param data The data to send
* \param socket The socket to send to
*/
void SendPacket(const DataBuffer& data, network::TCPSocket& socket);
typedef std::shared_ptr<TCPSocket> SocketPtr;
} // namespace network
} // namespace blitz

View File

@@ -1,31 +1,56 @@
#pragma once
/**
* \file PacketDispatcher.h
* \brief File containing the blitz::protocol::PacketDispatcher class
*/
#include "blitz/common/NonCopyable.h"
#include "blitz/protocol/Protocol.h"
#include <map>
#include <vector>
namespace blitz {
namespace protocol {
class PacketHandler;
class PacketDispatcher {
/**
* \class PacketDispatcher
* \brief Class used to dispatch packets
*/
class PacketDispatcher : private NonCopyable {
private:
std::map<PacketType, std::vector<PacketHandler*>> m_Handlers;
public:
PacketDispatcher() = default;
/**
* \brief Constructor
*/
PacketDispatcher() {}
PacketDispatcher(const PacketDispatcher& rhs) = delete;
PacketDispatcher& operator=(const PacketDispatcher& rhs) = delete;
PacketDispatcher(PacketDispatcher&& rhs) = delete;
PacketDispatcher& operator=(PacketDispatcher&& rhs) = delete;
void Dispatch(const PacketPtr& packet);
/**
* \brief Dispatch a packet
* \param packet The packet to dispatch
*/
void Dispatch(const Packet* packet);
/**
* \brief Register a packet handler
* \param type The packet type
* \param handler The packet handler
*/
void RegisterHandler(PacketType type, PacketHandler* handler);
/**
* \brief Unregister a packet handler
* \param type The packet type
* \param handler The packet handler
*/
void UnregisterHandler(PacketType type, PacketHandler* handler);
/**
* \brief Unregister a packet handler
* \param handler The packet handler
*/
void UnregisterHandler(PacketHandler* handler);
};

View File

@@ -1,13 +1,22 @@
#pragma once
/**
* \file PacketFactory.h
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
namespace PacketFactory {
PacketPtr CreatePacket(PacketType type, DataBuffer& buffer);
/**
* \brief Creates a packet from a buffer.
* \param buffer The buffer containing the packet data.
* \return The created packet.
*/
const Packet* CreatePacket(PacketType type, DataBuffer& buffer);
}
} // namespace PacketFactory
} // namespace protocol
} // namespace blitz

View File

@@ -1,5 +1,10 @@
#pragma once
/**
* \file PacketHandler.h
* \brief File containing the blitz::protocol::PacketHandler class
*/
#include "blitz/protocol/PacketsForward.h"
#include "blitz/protocol/Protocol.h"
@@ -8,14 +13,26 @@ namespace protocol {
class PacketDispatcher;
/**
* \class PacketHandler
* \brief Class used to handle packets
*/
class PacketHandler {
private:
PacketDispatcher* m_Dispatcher;
public:
/**
* \brief Constructor
* \param dispatcher The packet dispatcher
*/
PacketHandler(PacketDispatcher* dispatcher) : m_Dispatcher(dispatcher) {}
virtual ~PacketHandler() {}
/**
* \brief Get the packet dispatcher
* \return The packet dispatcher
*/
PacketDispatcher* GetDispatcher() {
return m_Dispatcher;
}
@@ -28,7 +45,13 @@ class PacketHandler {
virtual void HandlePacket(const PlayerLeavePacket* packet) {}
virtual void HandlePacket(const PlayerListPacket* packet) {}
virtual void HandlePacket(const PlayerLoginPacket* packet) {}
virtual void HandlePacket(const PlayerPositionAndRotationPacket* packet) {}
virtual void HandlePacket(const PlayerShootPacket* packet) {}
virtual void HandlePacket(const PlayerStatsPacket* packet) {}
virtual void HandlePacket(const ServerConfigPacket* packet) {}
virtual void HandlePacket(const ServerTpsPacket* packet) {}
virtual void HandlePacket(const UpdateGameStatePacket* packet) {}
virtual void HandlePacket(const UpdateHealthPacket* packet) {}
};
} // namespace protocol

View File

@@ -1,9 +1,15 @@
#include "packets/ChatPacket.h"
#include "packets/ConnectionInfoPacket.h"
#include "packets/ConnexionInfoPacket.h"
#include "packets/DisconnectPacket.h"
#include "packets/KeepAlivePacket.h"
#include "packets/PlayerJoinPacket.h"
#include "packets/PlayerLeavePacket.h"
#include "packets/PlayerListPacket.h"
#include "packets/PlayerLoginPacket.h"
#include "packets/ServerTpsPacket.h"
#include "packets/PlayerPositionAndRotationPacket.h"
#include "packets/PlayerShootPacket.h"
#include "packets/PlayerStatsPacket.h"
#include "packets/ServerConfigPacket.h"
#include "packets/ServerTpsPacket.h"
#include "packets/UpdateGameStatePacket.h"
#include "packets/UpdateHealthPacket.h"

View File

@@ -11,7 +11,13 @@ class PlayerJoinPacket;
class PlayerLeavePacket;
class PlayerListPacket;
class PlayerLoginPacket;
class PlayerPositionAndRotationPacket;
class PlayerShootPacket;
class PlayerStatsPacket;
class ServerConfigPacket;
class ServerTpsPacket;
class UpdateGameStatePacket;
class UpdateHealthPacket;
} // namespace protocol
} // namespace blitz

View File

@@ -1,66 +1,103 @@
#pragma once
#include "blitz/misc/DataBuffer.h"
/**
* \file Protocol.h
* \brief File containing the blitz::protocol::Protocol class
*/
#include <memory>
#include "blitz/common/DataBuffer.h"
namespace blitz {
namespace protocol {
class PacketHandler;
/////////////////////////////////////////////
// Packet Structure //
/////////////////////////////////////////////
// /// //
// PacketID /// PacketData //
// /// //
/////////////////////////////////////////////
// /// //
// 1 byte /// varying size //
// /// //
/////////////////////////////////////////////
/**
* \enum PacketType
* \brief Map the packets name to their ID
*/
enum class PacketType : std::uint8_t {
// client --> server
PlayerLogin = 0,
PlayerLogin = 0, /**< Corresponds to PlayerLoginPacket */
UpdateHealth, /**< Corresponds to UpdateHealthPacket */
// client <-- server
ConnectionInfo,
PlayerJoin,
PlayerLeave,
PlayerList,
ServerTps,
ConnexionInfo, /**< Corresponds to ConnexionInfoPacket */
PlayerJoin, /**< Corresponds to PlayerJoinPacket */
PlayerLeave, /**< Corresponds to PlayerLeavePacket */
PlayerList, /**< Corresponds to PlayerListPacket */
PlayerStats, /**< Corresponds to PlayerStatsPacket */
ServerConfig, /**< Corresponds to ServerConfigPacket*/
ServerTps, /**< Corresponds to ServerTpsPacket */
UpdateGameState, /**< Corresponds to UpdateGameStatePacket */
// client <--> server
KeepAlive,
Disconnect,
Chat,
KeepAlive, /**< Corresponds to KeepAlivePacket */
Disconnect, /**< Corresponds to DisconnectPacket */
Chat, /**< Corresponds to ChatPacket */
PlayerPositionAndRotation, /**< Corresponds to PlayerPositionAndRotationPacket */
PlayerShoot, /**< Corresponds to PlayerShootPacket */
PACKET_COUNT
};
/**
* \class Packet
* \brief Represents a network packet <br/>
* %Packet data structure :
*| Field Name | Field Type | Notes |
*|---------------------|---------------|-------------------------------|
*| Length | Long | Length of whole Packet |
*| Uncompressed Length | VarInt | Length of Packet ID + Data |
*| Packet ID | Byte | Represents the #PacketType |
*| Data | Byte Array | Depends on the packet ID |
*/
class Packet {
public:
Packet() {}
virtual ~Packet() {}
/**
* \brief Serialize the Packet into a DataBuffer to be sent over the network
* \param packetID Set to false if you don't want to write the Packet ID for some reason
* \returns A DataBuffer filled with the serialized Packet
*/
virtual DataBuffer Serialize(bool packetID = true) const = 0;
/**
* \brief Deserialize the DataBuffer into a Packet to be read by the client/server
* \param data The DataBuffer containing the data from the network
*/
virtual void Deserialize(DataBuffer& data) = 0;
/**
* \brief Dispatches the Packet
* \param handler The class to dispatch the Packet to
*/
virtual void Dispatch(PacketHandler* handler) const = 0;
/**
* \brief Writes the Packet ID into a buffer
* \param data The DataBuffer to write to
* \param packetID If set to false, this function does nothing
*/
void WritePacketID(DataBuffer& data, bool packetID) const;
/**
* \returns The type of the Packet
*/
virtual PacketType GetType() const = 0;
/**
* \returns The Packet ID corresponding to the PacketType of this Packet
*/
std::uint8_t GetID() const {
return static_cast<std::uint8_t>(GetType());
}
};
typedef std::unique_ptr<Packet> PacketPtr;
} // namespace protocol
} // namespace blitz

View File

@@ -1,26 +1,64 @@
#pragma once
#include "blitz/misc/Maths.h"
/**
* \file ChatPacket.h
* \brief File containing the blitz::protocol::ChatPacket class
*/
#include "blitz/maths/Vector.h"
#include "blitz/protocol/Protocol.h"
#include <vector>
namespace blitz {
namespace protocol {
/**
* \struct ColoredPart
* \brief Represents a part of a chat message with a specific color.
*/
struct ColoredPart {
/**
* \brief The color of the part.
*/
Vec4f color;
/**
* \brief The text of the part.
*/
std::string text;
};
typedef std::vector<ColoredPart> ColoredText;
/**
* \class ChatPacket
* \brief Packet for sending chat messages.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::Chat |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_Message | ColoredText | The message sent in the chat |
*/
class ChatPacket : public Packet {
private:
ColoredText m_Message;
public:
/**
* \brief Default constructor.
*/
ChatPacket() {}
/**
* \brief Constructor.
* \param msg The message to send.
*/
ChatPacket(const std::string& msg) : m_Message(ColorizeText(msg)) {}
/**
* \brief Constructor.
* \param msg The message to send.
*/
ChatPacket(const ColoredText& msg) : m_Message(msg) {}
virtual ~ChatPacket() {}
@@ -28,17 +66,30 @@ class ChatPacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the message.
* \return The message.
*/
const ColoredText& GetMessage() const {
return m_Message;
}
static std::string GetTextColor(Vec3uc color);
static ColoredText ColorizeText(const std::string& text);
static std::string GetColoredTextString(const ColoredText& text);
virtual PacketType GetType() const {
return PacketType::Chat;
}
/**
* \brief Get the text color.
*/
static std::string GetTextColor(Vec3uc color);
/**
* \brief Colorize a text.
*/
static ColoredText ColorizeText(const std::string& text);
/**
* \brief Get the colored text string.
*/
static std::string GetColoredTextString(const ColoredText& text);
};
const static Vec3uc AQUA = {0, 255, 255};

View File

@@ -1,31 +0,0 @@
#pragma once
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
class ConnexionInfoPacket : public Packet {
private:
std::uint8_t m_ConnectionID;
public:
ConnexionInfoPacket() {}
ConnexionInfoPacket(std::uint8_t connectionID) : m_ConnectionID(connectionID) {}
virtual ~ConnexionInfoPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
std::uint8_t GetConnectionID() const {
return m_ConnectionID;
}
virtual PacketType GetType() const {
return PacketType::ConnectionInfo;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,59 @@
#pragma once
/**
* \file ConnexionInfoPacket.h
* \brief File containing the blitz::protocol::ConnexionInfoPacket class
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class ConnexionInfoPacket
* \brief Packet for sending connection information.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::ConnexionInfo |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_ConnectionID | std::uint8_t | The connection ID |
*/
class ConnexionInfoPacket : public Packet {
private:
std::uint8_t m_ConnectionID;
public:
/**
* \brief Default constructor.
*/
ConnexionInfoPacket() {}
/**
* \brief Constructor.
* \param connectionID The ID of the connection.
*/
ConnexionInfoPacket(std::uint8_t connectionID) : m_ConnectionID(connectionID) {}
virtual ~ConnexionInfoPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the connection ID.
* \return The connection ID.
*/
std::uint8_t GetConnectionID() const {
return m_ConnectionID;
}
virtual PacketType GetType() const {
return PacketType::ConnexionInfo;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -1,15 +1,39 @@
#pragma once
/**
* \file DisconnectPacket.h
* \brief File containing the blitz::protocol::DisconnectPacket class
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class DisconnectPacket
* \brief Packet for disconnecting from the server.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::Disconnect |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_Reason | std::string | The reason for disconnection |
*/
class DisconnectPacket : public Packet {
private:
std::string m_Reason; // only when sent from server
public:
/**
* \brief Default constructor.
*/
DisconnectPacket() {}
/**
* \brief Constructor.
* \param reason The reason for disconnection.
*/
DisconnectPacket(std::string reason) : m_Reason(reason) {}
virtual ~DisconnectPacket() {}
@@ -17,6 +41,10 @@ class DisconnectPacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the reason for disconnection.
* \return The reason for disconnection.
*/
const std::string& GetReason() const {
return m_Reason;
}

View File

@@ -1,13 +1,33 @@
#pragma once
/**
* \file KeepAlivePacket.h
* \brief File containing the blitz::protocol::KeepAlivePacket class
*/
#include "blitz/common/VarInt.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class KeepAlivePacket
* \brief Packet sent to measure the health of a connexion. \n
* The client must respond with the same alive ID. Else, the connexion will be closed. \n
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::KeepAlive |
*
* | Field Name | Field Type | Notes |
* |--------------------|---------------|---------------------------------------------------------------------------|
* | Keep Alive ID | VarInt | The server generates a random ID, the client must respond with the same |
*
*/
class KeepAlivePacket : public Packet {
private:
std::uint64_t m_AliveID;
VarInt m_AliveID;
public:
KeepAlivePacket() {}
@@ -18,8 +38,12 @@ class KeepAlivePacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Getter of the alive ID
* \return The alive ID
*/
std::uint64_t GetAliveID() const {
return m_AliveID;
return m_AliveID.GetValue();
}
virtual PacketType GetType() const {

View File

@@ -1,28 +1,56 @@
#pragma once
/**
* \file PlayerJoinPacket.h
* \brief File containing the blitz::protocol::PlayerJoinPacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerJoinPacket
* \brief Packet sent when a new player joins the game
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerJoin |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | Player ID | game::PlayerID | Id of the player who joined |
* | Player Name | std::string | Name of the player who joined |
*
*/
class PlayerJoinPacket : public Packet {
private:
std::uint8_t m_PlayerID;
game::PlayerID m_PlayerID;
std::string m_PlayerName;
public:
PlayerJoinPacket() {}
PlayerJoinPacket(std::uint8_t playerID, const std::string& playerName) : m_PlayerID(playerID), m_PlayerName(playerName) {}
PlayerJoinPacket(game::PlayerID playerID, const std::string& playerName) : m_PlayerID(playerID), m_PlayerName(playerName) {}
virtual ~PlayerJoinPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
std::uint8_t GetPlayerID() const {
/**
* \brief Getter of the player id
* \return The ID of the player
*/
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}
/**
* \brief Getter of the player name
* \return The name of the player
*/
const std::string& GetPlayerName() const {
return m_PlayerName;
}

View File

@@ -1,24 +1,53 @@
#pragma once
/**
* \file PlayerLeavePacket.h
* \brief File containing the blitz::protocol::PlayerLeavePacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerLeavePacket
* \brief Packet for when a player leaves the game.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerLeave|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_PlayerID | PlayerID |The ID of the player that left |
*/
class PlayerLeavePacket : public Packet {
private:
std::uint8_t m_PlayerID;
game::PlayerID m_PlayerID;
public:
/**
* \brief Default constructor.
*/
PlayerLeavePacket() {}
PlayerLeavePacket(std::uint8_t playerID) : m_PlayerID(playerID) {}
/**
* \brief Constructor.
* \param playerID The ID of the player that left.
*/
PlayerLeavePacket(game::PlayerID playerID) : m_PlayerID(playerID) {}
virtual ~PlayerLeavePacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
std::uint8_t GetPlayerID() const {
/**
* \brief Get the ID of the player that left.
* \return The ID of the player that left.
*/
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}

View File

@@ -1,5 +1,10 @@
#pragma once
/**
* \file PlayerListPacket.h
* \brief File containing the blitz::protocol::PlayerListPacket class
*/
#include <map>
#include "blitz/protocol/Protocol.h"
@@ -7,18 +12,34 @@
namespace blitz {
namespace protocol {
/**
* \struct PlayerInfo
* \brief Represents information about a player.
*/
struct PlayerInfo {
std::string name;
};
typedef std::map<std::uint8_t, PlayerInfo> PlayerList;
/**
* \class PlayerListPacket
* \brief Packet for sending the list of players.
* \todo PACKET STRUCTURE
*/
class PlayerListPacket : public Packet {
private:
PlayerList m_Players;
public:
/**
* \brief Default constructor.
*/
PlayerListPacket() {}
/**
* \brief Constructor.
* \param players The list of players.
*/
PlayerListPacket(const PlayerList& players) : m_Players(players) {}
virtual ~PlayerListPacket() {}
@@ -26,6 +47,11 @@ class PlayerListPacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the list of players.
* \return The list of players.
*/
const PlayerList& GetPlayers() const {
return m_Players;
}

View File

@@ -1,16 +1,40 @@
#pragma once
/**
* \file PlayerLoginPacket.h
* \brief File containing the blitz::protocol::PlayerLoginPacket class
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerLoginPacket
* \brief Packet for when a player logs in.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerLogin|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|----------------------------------|
* | Player Name | std::string | Name of the player that logged in|
*/
class PlayerLoginPacket : public Packet {
private:
std::string m_PlayerName;
public:
/**
* \brief Default constructor.
*/
PlayerLoginPacket() {}
/**
* \brief Constructor.
* \param playerName The name of the player that logged in.
*/
PlayerLoginPacket(std::string playerName) : m_PlayerName(playerName) {}
virtual ~PlayerLoginPacket() {}
@@ -18,13 +42,17 @@ class PlayerLoginPacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
virtual PacketType GetType() const {
return PacketType::PlayerLogin;
}
/**
* \brief Get the name of the player that logged in.
* \return The name of the player that logged in.
*/
const std::string& GetPlayerName() const {
return m_PlayerName;
}
virtual PacketType GetType() const {
return PacketType::PlayerLogin;
}
};
} // namespace protocol

View File

@@ -0,0 +1,94 @@
#pragma once
/**
* \file PlayerPositionAndRotationPacket.h
* \brief File containing the blitz::protocol::PlayerPositionAndRotationPacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/maths/Vector.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerPositionAndRotationPacket
* \brief Packet for sending a player's position and rotation.
* %Packet structure :
* | PacketType |
* |--------------------------------|
* | PacketType::PlayerPositionAndRotation |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|----------------------------------|
* | Player ID | PlayerID | Id of the player who moved |
* | Position | Vec3f | Position of the player |
* | Yaw | float | Yaw of the player |
* | Pitch | float | Pitch of the player |
*/
class PlayerPositionAndRotationPacket : public Packet {
private:
game::PlayerID m_Player; // only used when sent to client
Vec3f m_Position;
float m_Yaw, m_Pitch;
public:
/**
* \brief Default constructor.
*/
PlayerPositionAndRotationPacket() {}
/**
* \brief Constructor.
* \param position The position of the player.
* \param yaw The yaw of the player.
* \param pitch The pitch of the player.
* \param player The ID of the player.
*/
PlayerPositionAndRotationPacket(const Vec3f& position, float yaw, float pitch, game::PlayerID player = 0) :
m_Player(player), m_Position(position), m_Yaw(yaw), m_Pitch(pitch) {}
virtual ~PlayerPositionAndRotationPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the position of the player.
* \return The position of the player.
*/
const Vec3f& GetPosition() const {
return m_Position;
}
/**
* \brief Get the yaw of the player.
* \return The yaw of the player.
*/
float GetYaw() const {
return m_Yaw;
}
/**
* \brief Get the pitch of the player.
* \return The pitch of the player.
*/
float GetPitch() const {
return m_Pitch;
}
/**
* \brief Get the ID of the player.
* \return The ID of the player.
*/
game::PlayerID GetPlayer() const {
return m_Player;
}
virtual PacketType GetType() const {
return PacketType::PlayerPositionAndRotation;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,93 @@
#pragma once
/**
* \file PlayerShootPacket.h
* \brief File containing the blitz::protocol::PlayerShootPacket class
*/
#include "blitz/game/Player.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerShootPacket
* \brief Packet for when a player shoots.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerShoot|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|----------------------------------|
* | Player ID | PlayerID | The ID of the player that shot |
* | Position | Vec3f | Position of the player |
* | Yaw | float | Yaw of the player |
* | Pitch | float | Pitch of the player |
*/
class PlayerShootPacket : public Packet {
private:
game::PlayerID m_Player; // only used when sent to client
Vec3f m_Position;
float m_Yaw, m_Pitch;
public:
/**
* \brief Default constructor.
*/
PlayerShootPacket() {}
/**
* \brief Constructor.
* \param position The position of the player.
* \param yaw The yaw of the player.
* \param pitch The pitch of the player.
* \param player The ID of the player.
*/
PlayerShootPacket(Vec3f position, float yaw, float pitch, game::PlayerID player = 0) :
m_Player(player), m_Position(position), m_Yaw(yaw), m_Pitch(pitch) {}
virtual ~PlayerShootPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the position of the player.
* \return The position of the player.
*/
const Vec3f& GetPosition() const {
return m_Position;
}
/**
* \brief Get the yaw of the player.
* \return The yaw of the player.
*/
float GetYaw() const {
return m_Yaw;
}
/**
* \brief Get the pitch of the player.
* \return The pitch of the player.
*/
float GetPitch() const {
return m_Pitch;
}
/**
* \brief Get the ID of the player.
* \return The ID of the player.
*/
game::PlayerID GetPlayer() const {
return m_Player;
}
virtual PacketType GetType() const {
return PacketType::PlayerShoot;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,72 @@
#pragma once
/**
* \file PlayerStatsPacket.h
* \brief File containing the blitz::protocol::PlayerStatsPacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/game/Player.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerStatsPacket
* \brief Packet for sending player stats.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerStats|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | Player ID | PlayerID | Id of the player |
* | Player Stats | PlayerStats | Stats of the player |
*/
class PlayerStatsPacket : public Packet {
private:
game::PlayerID m_PlayerID;
game::PlayerStats m_PlayerStats;
public:
/**
* \brief Default constructor.
*/
PlayerStatsPacket() {}
/**
* \brief Constructor.
* \param playerID The ID of the player.
* \param stats The stats of the player.
*/
PlayerStatsPacket(game::PlayerID playerID, const game::PlayerStats& stats) : m_PlayerID(playerID), m_PlayerStats(stats) {}
virtual ~PlayerStatsPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Getter of the player id
* \return The ID of the player
*/
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}
/**
* \brief Getter of the player stats
* \return The stats of the player
*/
const game::PlayerStats& GetPlayerStats() const {
return m_PlayerStats;
}
virtual PacketType GetType() const {
return PacketType::PlayerStats;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,60 @@
#pragma once
/**
* \file ServerConfigPacket.h
* \brief File containing the blitz::protocol::ServerConfigPacket class
*/
#include "blitz/game/Game.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class ServerConfigPacket
* \brief Packet for sending the server configuration.
* %Packet structure :
* | PacketType |
* |-------------------------|
* | PacketType::ServerConfig|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | Game Config | GameConfig | The game configuration |
*/
class ServerConfigPacket : public Packet {
private:
game::GameConfig m_GameConfig;
public:
/**
* \brief Default constructor.
*/
ServerConfigPacket() {}
/**
* \brief Constructor.
* \param GameConfig The game configuration.
*/
ServerConfigPacket(const game::GameConfig& GameConfig) : m_GameConfig(GameConfig) {}
virtual ~ServerConfigPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Getter of the game configuration
* \return The game configuration
*/
game::GameConfig GetGameConfig() const {
return m_GameConfig;
}
virtual PacketType GetType() const {
return PacketType::ServerConfig;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -1,17 +1,45 @@
#pragma once
/**
* \file ServerTpsPacket.h
* \brief File containing the blitz::protocol::ServerTpsPacket class
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class ServerTpsPacket
* \brief Packet for sending server TPS (Tick per second) and MSPT (Milliseconds per tick).
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::ServerTps |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | Tps | float | Server TPS |
* | Mspt | float | Server MSPT |
* | PacketSendTime | uint64_t | Time the packet was sent |
*/
class ServerTpsPacket : public Packet {
private:
float m_TPS;
float m_MSPT;
std::uint64_t m_PacketSendTime; // used to calculate ping
public:
/**
* \brief Default constructor.
*/
ServerTpsPacket() {}
/**
* \brief Constructor.
* \param tps The server TPS.
* \param mspt The server MSPT.
* \param sendTime The time the packet was sent.
*/
ServerTpsPacket(float tps, float mspt, std::uint64_t sendTime) : m_TPS(tps), m_MSPT(mspt), m_PacketSendTime(sendTime) {}
virtual ~ServerTpsPacket() {}
@@ -19,14 +47,27 @@ class ServerTpsPacket : public Packet {
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the server TPS.
* \return The server TPS.
*/
float GetTPS() const {
return m_TPS;
}
/**
* \brief Get the server MSPT.
* \return The server MSPT.
*/
float GetMSPT() const {
return m_MSPT;
}
/**
* \brief Get the time the packet was sent.
* \return The time the packet was sent.
* \todo Calculate ping.
*/
std::uint64_t GetPacketSendTime() const {
return m_PacketSendTime;
}

View File

@@ -0,0 +1,72 @@
#pragma once
/**
* \file UpdateGameStatePacket.h
* \brief File containing the blitz::protocol::UpdateGameStatePacket class
*/
#include "blitz/game/Game.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class UpdateGameStatePacket
* \brief Packet for updating the game state.
* %Packet structure :
* | PacketType |
* |-----------------------------|
* | PacketType::UpdateGameState |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|----------------------------------------------|
* | Game State | GameState | The new game state |
* | Time Remaining | std::uint64_t | The time remaining in the current game state |
*/
class UpdateGameStatePacket : public Packet {
private:
game::GameState m_GameState;
std::uint64_t m_TimeRemaining;
public:
/**
* \brief Default constructor.
*/
UpdateGameStatePacket() {}
/**
* \brief Constructor.
* \param a_GameState The new game state.
* \param a_TimeRemaining The time remaining in the current game state.
*/
UpdateGameStatePacket(game::GameState a_GameState, std::uint64_t a_TimeRemaining = 0) :
m_GameState(a_GameState), m_TimeRemaining(a_TimeRemaining) {}
virtual ~UpdateGameStatePacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the new game state.
* \return The new game state.
*/
game::GameState GetGameState() const {
return m_GameState;
}
/**
* \brief Get the time remaining in the current game state.
* \return The time remaining in the current game state.
*/
std::uint64_t GetTimeRemaining() const {
return m_TimeRemaining;
}
virtual PacketType GetType() const {
return PacketType::UpdateGameState;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,59 @@
#pragma once
/**
* \file UpdateHealthPacket.h
* \brief File containing the blitz::protocol::UpdateHealthPacket class
*/
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class UpdateHealthPacket
* \brief Packet for updating the health of a player.
* %Packet structure :
* | PacketType |
* |--------------------------|
* | PacketType::UpdateHealth |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_NewHealth | float | The new health value |
*/
class UpdateHealthPacket : public Packet {
private:
float m_NewHealth;
public:
/**
* \brief Default constructor.
*/
UpdateHealthPacket() {}
/**
* \brief Constructor.
* \param newHealth The new health value.
*/
UpdateHealthPacket(float newHealth) : m_NewHealth(newHealth) {}
virtual ~UpdateHealthPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the new health value.
* \return The new health value.
*/
float GetNewHealth() const {
return m_NewHealth;
}
virtual PacketType GetType() const {
return PacketType::UpdateHealth;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -0,0 +1,13 @@
#pragma once
#include "blitz/common/DataBuffer.h"
namespace blitz {
namespace utils {
namespace AssetsManager {
DataBuffer GetAsset(const std::string& fileName);
} // namespace AssetsManager
} // namespace utils
} // namespace blitz

View File

@@ -1,31 +1,38 @@
#pragma once
#include "blitz/common/Defines.h"
#include "blitz/game/Listeners.h"
#include "blitz/misc/ObjectNotifier.h"
#include "blitz/misc/Time.h"
#include "blitz/protocol/packets/ChatPacket.h"
#include "client/config/BlitzConfig.h"
#include <cstdint>
#include <memory>
#include <string>
namespace blitz {
static const int PlayerUpdatePosRate = 50;
namespace client {
class ClientConnexion;
class ClientGame;
} // namespace client
namespace server {
class Server;
} // namespace server
class ChatListener {
public:
virtual void OnTextChatReceived(const protocol::ColoredText& text) {}
};
// Singleton
class Client : public utils::ObjectNotifier<ChatListener> {
class Client : public utils::ObjectNotifier<game::ClientListener>, public game::PlayerInputListener {
private:
std::unique_ptr<server::Server> m_Server;
std::unique_ptr<client::ClientConnexion> m_Connexion;
std::unique_ptr<client::ClientGame> m_Game;
utils::Timer m_UpdatePosTimer{PlayerUpdatePosRate};
BlitzConfig m_Config;
public:
Client();
@@ -38,8 +45,37 @@ class Client : public utils::ObjectNotifier<ChatListener> {
bool JoinGame(const std::string& pseudo, const std::string& address, std::uint16_t port);
bool CreateGame(std::uint16_t port, const std::string& pseudo);
void Disconnect();
void SendChatText(const std::string& text);
void ChatTextReceived(const protocol::ColoredText& text);
void SendPlayerPosAndLook(const Vec3f& position, float yaw, float pitch);
virtual void OnLocalPlayerShoot(const Vec3f& position, float yaw, float pitch) override;
game::PlayerID GetPlayerID() const;
client::ClientGame* GetGame() {
return m_Game.get();
}
BlitzConfig* GetConfig() {
return &m_Config;
}
bool IsAdmin() const;
server::Server* GetServer() {
return m_Server.get();
}
void UpdateServerConfig();
private:
void Reset();
void UpdatePosition(std::uint64_t delta);
};
} // namespace blitz

View File

@@ -1,7 +1,7 @@
#pragma once
#include "blitz/common/Defines.h"
#include "blitz/network/Connexion.h"
#include "blitz/protocol/PacketsForward.h"
namespace blitz {
@@ -12,15 +12,23 @@ namespace client {
class ClientConnexion : public network::Connexion {
private:
Client* m_Client;
std::string m_PlayerName;
game::PlayerID m_PlayerID;
public:
ClientConnexion(Client* client);
virtual ~ClientConnexion();
virtual void HandlePacket(const protocol::DisconnectPacket* packet) override;
virtual void HandlePacket(const protocol::KeepAlivePacket* packet) override;
virtual void HandlePacket(const protocol::ChatPacket* packet) override;
virtual void HandlePacket(const protocol::ConnexionInfoPacket* packet) override;
virtual bool Connect(const std::string& pseudo, const std::string& address, std::uint16_t port);
bool Connect(const std::string& pseudo, const std::string& address, std::uint16_t port);
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}
private:
void Login(const std::string& pseudo);

View File

@@ -0,0 +1,25 @@
#pragma once
#include "blitz/common/DataBuffer.h"
#include "blitz/common/NonCopyable.h"
#include "blitz/maths/Vector.h"
#include "client/audio/AudioLoader.h"
namespace blitz {
namespace audio {
class AudioBuffer : private NonCopyable {
private:
unsigned int m_ID;
public:
AudioBuffer(AudioData&& audioData);
~AudioBuffer();
unsigned int GetID() const {
return m_ID;
}
};
} // namespace audio
} // namespace blitz

View File

@@ -0,0 +1,21 @@
#pragma once
#include "blitz/common/NonCopyable.h"
#include "blitz/maths/Vector.h"
namespace blitz {
namespace audio {
class AudioListener : private NonCopyable {
public:
AudioListener();
~AudioListener();
void SetGain(float a_Gain);
void SetPosition(const Vec3f& a_Position);
void SetVelocity(const Vec3f& a_Velocity);
void SetOrientation(const Vec3f& a_Orientation, const Vec3f& a_Up);
};
} // namespace audio
} // namespace blitz

View File

@@ -0,0 +1,24 @@
#pragma once
#include "blitz/common/DataBuffer.h"
namespace blitz {
namespace audio {
enum AudioFormat { afMono8 = 0, afMono16, afStereo8, afStereo16 };
struct AudioData {
DataBuffer m_Buffer;
AudioFormat m_Format;
std::uint32_t m_Frequency;
};
namespace AudioLoader {
// files should be 8 or 16 bits wav
AudioData LoadAudioFile(const std::string& filePath);
}; // namespace AudioLoader
} // namespace audio
} // namespace blitz

View File

@@ -0,0 +1,56 @@
#pragma once
#include "blitz/game/Listeners.h"
#include "client/audio/AudioListener.h"
#include "client/audio/AudioSource.h"
#include <map>
namespace blitz {
class Client;
namespace game {
class Player;
} // namespace game
namespace audio {
struct PlayerSound {
AudioSourcePtr m_Laser;
};
class AudioManager : public game::ClientListener, public game::GameListener {
private:
Client* m_Client;
game::Player* m_Player;
AudioListener m_Listener;
AudioSourcePtr m_MenuMusic;
AudioBufferPtr m_LaserSound;
std::map<game::PlayerID, PlayerSound> m_PlayerSources;
public:
AudioManager(Client* client);
~AudioManager();
virtual void OnGameJoin() override;
virtual void OnGameLeave() override;
virtual void OnClientPlayerJoin() override;
virtual void OnPlayerShoot(game::PlayerID player, const Vec3f& position, float yaw, float pitch) override;
virtual void OnPlayerJoin(game::PlayerID player) override;
virtual void OnPlayerLeave(game::PlayerID player) override;
void SetGlobalVolume(float volume);
void Update();
private:
void InitSounds();
AudioSourcePtr InitSourceFromFile(const std::string& fileName);
AudioSourcePtr InitSourceFromBuffer(const AudioBufferPtr& buffer);
AudioBufferPtr InitBufferFromFile(const std::string& fileName);
};
} // namespace audio
} // namespace blitz

View File

@@ -0,0 +1,43 @@
#pragma once
#include "blitz/common/NonCopyable.h"
#include "blitz/maths/Vector.h"
#include "client/audio/AudioBuffer.h"
#include <memory>
namespace blitz {
namespace audio {
typedef std::shared_ptr<AudioBuffer> AudioBufferPtr;
class AudioSource : NonCopyable {
private:
unsigned int m_ID;
AudioBufferPtr m_Buffer;
public:
enum SourceState { ssInitial = 0, ssPlaying, ssPaused, ssStopped };
AudioSource();
~AudioSource();
void SetGain(float a_Gain);
void SetPitch(float a_Pitch);
void SetPosition(const Vec3f& a_Position);
void SetDirection(const Vec3f& a_Direction);
void SetVelocity(const Vec3f& a_Velocity);
void SetLooping(bool a_Looping);
void SetRelative(bool a_Relative);
void SetBuffer(const AudioBufferPtr& a_Buffer);
SourceState GetSourceState() const;
void Play();
void Pause();
void Stop();
};
typedef std::unique_ptr<AudioSource> AudioSourcePtr;
} // namespace audio
} // namespace blitz

View File

@@ -0,0 +1,118 @@
#pragma once
/**
* \file BlitzConfig.h
* \brief File containing the blitz::BlitzConfig class
*/
#include "blitz/game/Game.h"
#include <array>
#include <string>
namespace blitz {
/**
* \enum KeyAction
* \brief Enum containing the key actions
*/
enum KeyAction {
kaAvancer = 0,
kaReculer,
kaDroite,
kaGauche,
kaFenetreAdmin,
kaMax,
};
typedef std::array<int, kaMax> Keybinds;
/**
* \class BlitzConfig
* \brief Class used to manage the Blitz configuration
*/
class BlitzConfig {
private:
std::array<char, 20> m_Pseudo;
game::GameConfig m_ServerConfig;
bool m_VSync;
bool m_DisplayFps;
Keybinds m_Keybinds{};
float m_MouseSpeed;
public:
/**
* \brief Default constructor
*/
BlitzConfig();
~BlitzConfig();
std::array<char, 20>& GetPseudo() {
return m_Pseudo;
}
/**
* \brief Return whether VSync is enabled
*/
bool IsVSyncEnabled() const {
return m_VSync;
}
/**
* \brief Set whether VSync is enabled
*/
void SetVSync(bool vsync) {
m_VSync = vsync;
}
/**
* \brief Return whether the FPS display is enabled
*/
bool IsFPSDisplayEnabled() const {
return m_DisplayFps;
}
/**
* \brief Set whether the FPS display is enabled
*/
void SetFPSDisplay(bool display) {
m_DisplayFps = display;
}
/**
* \brief Get the keybinds
* \return The keybinds
*/
Keybinds& GetKeys() {
return m_Keybinds;
}
/**
* \brief Get the mouse speed
* \return The mouse speed
*/
float GetMouseSpeed() const {
return m_MouseSpeed;
}
/**
* \brief Set the mouse speed
*/
void SetMouseSpeed(float MouseSpeed) {
m_MouseSpeed = MouseSpeed;
}
/**
* \brief Get the server configuration
* \return The server configuration
*/
game::GameConfig& GetServerConfig() {
return m_ServerConfig;
}
private:
void LoadConfig();
void LoadDefaultConfig();
void SaveConfig();
};
} // namespace blitz

View File

@@ -0,0 +1,115 @@
#pragma once
/**
* \file Display.h
* \brief File containing the blitz::Display class
*/
#include "client/display/InputManager.h"
#include "client/display/PlayerController.h"
#include <memory>
#include <string>
class SDL_Window;
namespace blitz {
class Client;
namespace gui {
class BlitzGui;
} // namespace gui
/**
* \class Display
* \brief Class used to manage the display
*/
class Display {
private:
SDL_Window* m_Window;
void* m_GL_Context;
int m_WindowWidth;
int m_WindowHeight;
float m_AspectRatio;
std::string m_WindowName;
bool m_ShouldClose;
bool m_FullScreen;
Client* m_Client;
input::InputManager& m_InputManager;
std::unique_ptr<gui::BlitzGui> m_BlitzGui;
input::PlayerController m_PlayerController;
public:
/**
* \brief Constructor
* \param width The width of the window
* \param height The height of the window
* \param windowName The name of the window
* \param client The client
* \param inputManager The InputManager
*/
Display(int width, int height, const std::string& windowName, Client* client, input::InputManager& inputManager);
~Display();
/**
* \brief Return whether the display has been created
*/
bool Create();
/**
* \brief Poll the events
* \note This function should be called at the beginning of the main loop
*/
void PollEvents();
/**
* \brief Update the display
* \note Swap the buffers
*/
void Update();
/**
* \brief Render the display (ImGui)
*/
void Render();
/**
* \brief Destroy the display (Not your mother's display)
*/
void Destroy();
/**
* \brief Return whether the display should be closed
*/
bool IsCloseRequested();
/**
* \brief Return widht/height ratio
*/
float GetAspectRatio();
/**
* \brief Return the window width
*/
int GetWindowWidth();
/**
* \brief Return the window height
*/
int GetWindowHeight();
/**
* \brief Return the player controller
*/
input::PlayerController& GetPlayerController() {
return m_PlayerController;
}
private:
void InitImGui();
};
} // namespace blitz

View File

@@ -0,0 +1,30 @@
#pragma once
#include "blitz/misc/ObjectNotifier.h"
#include <SDL2/SDL_events.h>
#include <functional>
namespace blitz {
namespace input {
class InputListener {
public:
virtual void OnKeyDown(int imguiKey) {}
virtual void OnMouseMove(int deltaX, int deltaY) {}
};
class InputManager : public utils::ObjectNotifier<InputListener> {
private:
bool m_MouseInputGrabbed;
public:
InputManager() : m_MouseInputGrabbed(false) {}
virtual ~InputManager() {}
void ProcessEvent(SDL_Event& event) const;
void GrabMouse(bool grabInput);
bool MouseGrabbed() const;
};
} // namespace input
} // namespace blitz

View File

@@ -0,0 +1,72 @@
#pragma once
/**
* \file PlayerController.h
* \brief File containing the blitz::input::PlayerController class.
*/
#include "blitz/common/Smoothing.h"
#include "blitz/game/Listeners.h"
#include "blitz/misc/ObjectNotifier.h"
#include "blitz/misc/Time.h"
#include "client/display/InputManager.h"
namespace blitz {
class Client;
namespace game {
class Player;
} // namespace game
namespace input {
/**
* \brief Class that handles player input and sends it to the client.
* \details This class is responsible for handling player input and sending it to the server.
* It also handles the player's velocity and position.
*/
class PlayerController : public utils::ObjectNotifier<game::PlayerInputListener>, game::ClientListener, InputListener {
private:
game::Player* m_Player;
Client* m_Client;
input::InputManager& m_InputManager;
utils::CooldownTimer<float> m_ShootTimer{1.0f};
EMASmoother m_DxSmoother;
EMASmoother m_DySmoother;
// current (target) velocity
Vec3f m_Velocity;
/// maximum x-axis velocity
Vec3f m_MaxVelocity;
/// this is reset when the player touches the ground
bool m_OnGround;
public:
/**
* \brief Default constructor
*/
PlayerController(Client* client, input::InputManager& inputManager);
virtual ~PlayerController();
/**
* \brief Update things like player position and velocity.
*/
void Update(float delta);
virtual void OnGameConfigUpdate() override;
virtual void OnClientPlayerJoin() override;
virtual void OnGameLeave() override;
virtual void OnMouseMove(int, int) override;
private:
void UpdateShootTimer(int bpm);
void UpdatePosition(float delta);
void ApplyForce(const Vec3f& f, float delta);
void ApplyGravity(float delta);
};
} // namespace input
} // namespace blitz

View File

@@ -0,0 +1,47 @@
#pragma once
#include "blitz/game/Game.h"
#include "blitz/game/LeaderBoard.h"
#include "blitz/protocol/PacketHandler.h"
#include <vector>
namespace blitz {
class Client;
namespace client {
class ClientGame : public game::Game, public protocol::PacketHandler {
private:
Client* m_Client;
game::LeaderBoard m_LeaderBoard;
public:
ClientGame(Client* client, protocol::PacketDispatcher* dispatcher);
virtual ~ClientGame();
void Tick(std::uint64_t delta) override;
virtual void HandlePacket(const protocol::PlayerJoinPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerLeavePacket* packet) override;
virtual void HandlePacket(const protocol::PlayerListPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerPositionAndRotationPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerShootPacket* packet) override;
virtual void HandlePacket(const protocol::UpdateHealthPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerStatsPacket* packet) override;
virtual void HandlePacket(const protocol::UpdateGameStatePacket* packet) override;
virtual void HandlePacket(const protocol::ServerConfigPacket* packet) override;
virtual void AddPlayer(game::PlayerID player, const std::string& name) override;
virtual void RemovePlayer(game::PlayerID player) override;
const game::LeaderBoard& GetLeaderBoard() const {
return m_LeaderBoard;
}
private:
void RegisterHandlers();
};
} // namespace client
} // namespace blitz

View File

@@ -0,0 +1,20 @@
#pragma once
#include "blitz/game/World.h"
namespace blitz {
namespace client {
class ClientGame;
class ClientWorld : public game::World {
public:
ClientWorld(ClientGame* game);
virtual ~ClientWorld() {}
private:
void LoadAABBs();
};
} // namespace client
} // namespace blitz

View File

@@ -1,6 +1,7 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
namespace blitz {
@@ -13,7 +14,7 @@ class BlitzGui : public GuiWidget {
enum SubMenu { Main = 0 };
public:
BlitzGui(Client* client);
BlitzGui(Client* client, input::InputManager& inputManager);
virtual void Render() override;

View File

@@ -1,6 +1,5 @@
#pragma once
#include "blitz/misc/Maths.h"
#include "blitz/protocol/packets/ChatPacket.h"
#include <string>

View File

@@ -1,6 +1,7 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
namespace blitz {
@@ -9,8 +10,11 @@ class Client;
namespace gui {
class CreateGameMenu : public GuiWidget {
private:
input::InputManager& m_InputManager;
public:
CreateGameMenu(GuiWidget* parent, Client* client) : GuiWidget(parent, client) {}
CreateGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
virtual void Render() override;
};

View File

@@ -0,0 +1,19 @@
#pragma once
#include "GuiWidget.h"
namespace blitz {
namespace gui {
class CrossHair : public GuiWidget {
private:
std::uint64_t m_CrossHairTexture;
public:
CrossHair(Client* client);
virtual void Render() override;
};
} // namespace gui
} // namespace blitz

View File

@@ -2,6 +2,7 @@
#include "GuiWidget.h"
#include "client/Client.h"
#include "client/display/InputManager.h"
#include <string>
#include <vector>
@@ -9,21 +10,27 @@ namespace blitz {
namespace gui {
class GameChatGui : public GuiWidget, ChatListener {
class GameChatGui : public GuiWidget, game::ClientListener {
private:
char InputBuf[256];
std::vector<protocol::ColoredText> m_Lines;
std::vector<protocol::ColoredText> m_TempLines;
bool m_FocusRequested = false;
int HistoryPos; // -1: new line, 0..History.Size-1 browsing history.
bool ScrollToBottom = false;
bool AutoScroll = true;
float m_ChatDisplay = 0;
input::InputManager& m_InputManager;
void Draw(const char* title, bool* p_open);
void DrawMini(const char* title, bool* p_open);
public:
GameChatGui(GuiWidget* parent, Client* client);
virtual void OnTextChatReceived(const protocol::ColoredText& text);
GameChatGui(GuiWidget* parent, Client* client, input::InputManager& inputManager);
virtual ~GameChatGui();
virtual void OnTextChatReceived(const protocol::ColoredText& text) override;
virtual void Render() override;
};

View File

@@ -3,7 +3,7 @@
#include <memory>
#include <vector>
#include "blitz/Defines.h"
#include "blitz/common/Defines.h"
namespace blitz {

33
include/client/gui/Hud.h Normal file
View File

@@ -0,0 +1,33 @@
#pragma once
#include "GuiWidget.h"
#include "client/Client.h"
namespace blitz {
class Client;
namespace game {
class Player;
} // namespace game
namespace gui {
class Hud : public GuiWidget {
private:
std::uint64_t m_GunTexture;
std::uint64_t m_JPTexture;
utils::DelayTimer<float> m_Timer{5.0f};
public:
Hud(GuiWidget* parent, Client* client);
virtual void Render() override;
private:
std::string FormatString();
void Draw(const char* title, bool* p_open);
void DrawFinishScreen(bool win);
void RenderTime(float, float);
};
} // namespace gui
} // namespace blitz

View File

@@ -1,6 +1,7 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
namespace blitz {
@@ -9,8 +10,11 @@ class Client;
namespace gui {
class JoinGameMenu : public GuiWidget {
private:
input::InputManager& m_InputManager;
public:
JoinGameMenu(GuiWidget* parent, Client* client) : GuiWidget(parent, client) {}
JoinGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
virtual void Render() override;
};

View File

@@ -0,0 +1,22 @@
#pragma once
#include "GuiWidget.h"
#include "client/Client.h"
namespace blitz {
namespace gui {
class LeaderBoardGui : public GuiWidget {
private:
void Draw(const char* title, bool* p_open);
utils::DelayTimer<float> m_Timer{5.0f};
public:
LeaderBoardGui(GuiWidget* parent, Client* client);
~LeaderBoardGui();
virtual void Render() override;
};
} // namespace gui
} // namespace blitz

View File

@@ -1,19 +1,29 @@
#pragma once
#include "GuiWidget.h"
#include "blitz/game/Listeners.h"
namespace blitz {
class Client;
namespace input {
class InputManager;
} // namespace input
namespace gui {
class MainMenu : public GuiWidget {
class MainMenu : public GuiWidget, public game::ClientListener {
private:
enum SubMenu { CREATE_MENU = 0, JOIN_MENU, OPTION_MENU };
input::InputManager& m_InputManager;
public:
MainMenu(Client* client);
MainMenu(Client* client, input::InputManager& inputManager);
virtual ~MainMenu();
virtual void OnGameLeave() override;
virtual void Render() override;
};

View File

@@ -1,6 +1,11 @@
#pragma once
#include "GuiWidget.h"
#include "blitz/misc/Time.h"
#include "client/config/BlitzConfig.h"
#include "client/display/InputManager.h"
#include <array>
#include <string>
namespace blitz {
@@ -8,11 +13,28 @@ class Client;
namespace gui {
class OptionsMenu : public GuiWidget {
class OptionsMenu : public GuiWidget, public input::InputListener {
private:
bool m_ShowFPS;
bool m_VSync;
bool m_IsKeyPopupOpen;
bool m_KeyPopupShouldClose;
utils::Timer m_Timer{100};
KeyAction m_CurrentAction;
input::InputManager& m_InputManager;
public:
OptionsMenu(GuiWidget* parent, Client* client);
OptionsMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
virtual ~OptionsMenu();
virtual void Render() override;
virtual void OnKeyDown(int key) override;
private:
std::string GetKeyActionCodeName(KeyAction);
void HotkeyBindingButton();
void HotkeyBindingPopUp();
};
} // namespace gui

Some files were not shown because too many files have changed in this diff Show More