Skip to content

Commit 7c32869

Browse files
committed
Docs
1 parent 78a36e0 commit 7c32869

File tree

10 files changed

+121
-8350
lines changed

10 files changed

+121
-8350
lines changed

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# name: Docs
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - main
7+
8+
# jobs:
9+
# Docs:
10+
# runs-on: ubuntu-latest
11+
# permissions:
12+
# contents: write
13+
14+
# steps:
15+
# - uses: actions/checkout@v3
16+
17+
# - name: Cancel Previous Runs
18+
# uses: styfle/[email protected]
19+
# with:
20+
# access_token: ${{ secrets.DOCS_TOKEN }}
21+
22+
# - name: Add Submodules
23+
# run: git submodule update --init --recursive
24+
25+
# - name: Install Dependencies
26+
# run: sudo apt install doxygen
27+
28+
# - name: Build Docs
29+
# working-directory: .
30+
# run: |
31+
# cd scripts
32+
# ./doxygen.sh
33+
34+
# - name: Deploy
35+
# uses: peaceiris/actions-gh-pages@v3
36+
# with:
37+
# github_token: ${{ secrets.DOCS_TOKEN }}
38+
# publish_dir: './website'

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs/doxygen/m.css"]
2+
path = docs/doxygen/m.css
3+
url = https://github.com/mosra/m.css.git

.justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ build *build_type='Release':
3030
# Build the project for the web
3131
web *build_type='Release':
3232
@mkdir -p build
33-
@if [ -n "${EM_CACHE-}" ]; then mkdir -p "$EM_CACHE"; fi
33+
@if [ -n "${EM_CACHE-}" ]; then mkdir -p "$EM_CACHE" && mkdir -p "$EM_CACHE/tmp"; fi
3434
@echo "Configuring the build system..."
3535
@cd build && emcmake cmake -S .. -B . -DCMAKE_BUILD_TYPE={{build_type}} -DBUILD_WASM=1
3636
@echo "Building the project..."

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ else()
7777
target_link_libraries(
7878
${PROJECT_NAME} INTERFACE "-framework Metal" "-framework Foundation"
7979
"-framework QuartzCore" "-framework MetalKit")
80-
# add_compile_definitions("__METAL__")
80+
add_compile_definitions("__METAL__")
8181
else()
8282
message(STATUS "Apple Metal not found. Building without Metal support")
8383
endif()

README.md

Lines changed: 36 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
</div>
2121

22-
<a href="https://github.com/Kaweees/kiwigl">
22+
<a href="https://github.com/Kaweees/kiwiGL">
2323
<img alt="C++ Logo" src="assets/img/cpp.svg" align="right" width="150">
2424
</a>
2525

2626
<div align="left">
27-
<h1><em><a href="https://github.com/Kaweees/kiwigl">~kiwigl</a></em></h1>
27+
<h1><em><a href="https://github.com/Kaweees/kiwiGL">~kiwiGL</a></em></h1>
2828
</div>
2929

3030
<!-- ABOUT THE PROJECT -->
@@ -56,7 +56,7 @@ A three-dimensional header-only graphics library written in C++13 and accelerate
5656

5757
### Prerequisites
5858

59-
Before attempting to build this project, make sure you have [Simple DirectMedia Layer (SDL 2)](https://wiki.libsdl.org/SDL2/Installation), [GNU Make](https://www.gnu.org/software/make/), and [CMake](https://cmake.org) installed on your machine.
59+
Before attempting to build this project, make sure you have [Nix](https://nixos.org/download.html) with [Flake](https://nixos.wiki/wiki/Flakes) support installed on your machine.
6060

6161
Additionally, if you wish to utilize the GPU acceleration features, you will need to have [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) or [Apple Metal](https://developer.apple.com/metal/cpp/) installed on your machine.
6262

@@ -67,89 +67,57 @@ To get a local copy of the project up and running on your machine, follow these
6767
1. Clone the project repository
6868

6969
```sh
70-
git clone https://github.com/Kaweees/kiwigl.git
71-
cd kiwigl
70+
git clone https://github.com/Kaweees/kiwiGL.git
71+
cd kiwiGL
7272
```
7373

74-
2. Create a fresh build directory and navigate to it
74+
2. Install the project dependencies
7575

7676
```sh
77-
rm -rf build
78-
mkdir build
79-
cd build
77+
nix-shell
8078
```
8179

82-
3. Generate build files using CMake
80+
3. Build the project
8381

8482
```sh
85-
cmake -S .. -B . -DCMAKE_BUILD_TYPE=Debug
83+
just build
8684
```
8785

88-
4. Build the entire project
86+
4. Run the project
8987

9088
```sh
91-
cmake --build .
89+
just run <package_name>
9290
```
9391

94-
### Building and Running Tests
95-
96-
1. Build only the tests
97-
98-
```sh
99-
cmake --build . --target tests
100-
```
101-
102-
2. Run all tests
103-
104-
```sh
105-
ctest --output-on-failure
106-
```
107-
108-
3. Run a specific test suite
109-
110-
```sh
111-
./tests/test_suite_name
112-
```
113-
114-
### Building and Running Examples
115-
116-
1. Build only the examples
117-
118-
```sh
119-
cmake --build . --target examples
120-
```
121-
122-
2. Run a specific example
92+
## Usage
12393

124-
```sh
125-
./examples/example_name
126-
```
94+
kiwiGL is designed to be easy to use. You can include the library in your C++ project by adding the following line to your source files:
12795

128-
## Usage
96+
```cpp
97+
#include <kiwigl/kiwigl.h>
98+
```
12999

130-
<!--
131100
### Benchmarks
132101

133-
Kiwigl is capable of rendering 3D scenes with thousands of triangles at interactive frame rates. The following benchmarks were conducted on a 2019 MacBook Pro with a 2.3 GHz 8-Core Intel Core i9 processor and 16 GB of RAM.
102+
kiwiGL is capable of rendering 3D scenes with thousands of triangles at interactive frame rates. The following benchmarks were conducted on a 2019 MacBook Pro with a 2.3 GHz 8-Core Intel Core i9 processor and 16 GB of RAM.
134103

135104
| Benchmark | Description | Result |
136105
| --------- | ----------- | ------ |
137106
| `cube` | Render a cube with 12 triangles | 60 FPS |
138107
| `sphere` | Render a sphere with 960 triangles | 60 FPS |
139108
| `bunny` | Render a Stanford Bunny with 69451 triangles | 60 FPS |
140109
| `dragon` | Render a Stanford Dragon with 871306 triangles | 60 FPS |
141-
-->
142110

143-
### Convention
111+
### Conventions
144112

145-
Kiwigl uses the following conventions:
113+
kiwiGL uses the following conventions:
146114

147115
- [left-handed coordinate system](https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/geometry/coordinate-systems.html#:~:text=The%20differentiation%20between%20left%2Dhanded,a%20right%2Dhand%20coordinate%20system)
148116
- [counter-clockwise winding order](https://learnwebgl.brown37.net/model_data/model_volume.html#:~:text=Winding%20Order%20for%20a%20triangle,the%20front%20of%20the%20triangle.) for triangle vertices
149117

150118
### Keyboard Controls
151119

152-
Kiwigl uses the following keyboard shortcuts:
120+
kiwiGL uses the following keyboard shortcuts:
153121

154122
| Command Keybind | Command Description |
155123
| --------------- | ------------------- |
@@ -159,29 +127,30 @@ Kiwigl uses the following keyboard shortcuts:
159127
## Project Structure
160128

161129
```sh
162-
graphics/
163-
├── .github/ - GitHub Actions CI/CD workflows
164-
├── include/ - project header files
165-
├── src/ - project source files
166-
│ └── main.c - Entry point, main function
167-
├── CMakeLists.txt - CMake build script
168-
├── LICENSE - project license
169-
└── README.md - you are here
130+
kiwiGL/
131+
├── .github/ # GitHub Actions CI/CD workflows
132+
├── include/ # project header files
133+
│ └── kiwiGL/ # Header files for the kiwiGL library
134+
├── src/ # project source files
135+
│ └── ... # Entry point, main function
136+
├── CMakeLists.txt # CMake build script
137+
├── LICENSE # project license
138+
└── README.md # you are here
170139
```
171140

172141
## License
173142

174-
The source code for kiwigl is distributed under the terms of the GNU General Public License v3.0, as I firmly believe that collaborating on free and open-source software fosters innovations that mutually and equitably beneficial to both collaborators and users alike. See [`LICENSE`](./LICENSE) for details and more information.
143+
The source code for [Kaweees/kiwiGL](https://github.com/Kaweees/kiwiGL) is distributed under the terms of the GNU General Public License v3.0, as I firmly believe that collaborating on free and open-source software fosters innovations that mutually and equitably beneficial to both collaborators and users alike. See [`LICENSE`](./LICENSE) for details and more information.
175144

176145
<!-- MARKDOWN LINKS & IMAGES -->
177146
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
178147

179-
[contributors-shield]: https://img.shields.io/github/contributors/Kaweees/kiwigl.svg?style=for-the-badge
180-
[contributors-url]: https://github.com/Kaweees/kiwigl/graphs/contributors
181-
[forks-shield]: https://img.shields.io/github/forks/Kaweees/kiwigl.svg?style=for-the-badge
182-
[forks-url]: https://github.com/Kaweees/kiwigl/network/members
183-
[stars-shield]: https://img.shields.io/github/stars/Kaweees/kiwigl.svg?style=for-the-badge
184-
[stars-url]: https://github.com/Kaweees/kiwigl/stargazers
148+
[contributors-shield]: https://img.shields.io/github/contributors/Kaweees/kiwiGL.svg?style=for-the-badge
149+
[contributors-url]: https://github.com/Kaweees/kiwiGL/graphs/contributors
150+
[forks-shield]: https://img.shields.io/github/forks/Kaweees/kiwiGL.svg?style=for-the-badge
151+
[forks-url]: https://github.com/Kaweees/kiwiGL/network/members
152+
[stars-shield]: https://img.shields.io/github/stars/Kaweees/kiwiGL.svg?style=for-the-badge
153+
[stars-url]: https://github.com/Kaweees/kiwiGL/stargazers
185154

186155
<!-- MARKDOWN SHIELD BAGDES & LINKS -->
187156
<!-- https://github.com/Ileriayo/markdown-badges -->

docs/doxygen/m.css

Submodule m.css added at 6838b94

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# RaidZeroLib Docs Index
2+
3+
![Caption](images/templogo.png "Caption")

include/kiwigl/graphics/display.hpp

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,14 @@ class Display {
5252
std::unique_ptr<FrameBuffer> frameBuffer;
5353
Mesh mesh;
5454
std::vector<Triangle> projectedTriangles;
55-
Face* d_faces;
56-
Vector3D* d_vertices;
57-
Triangle* d_projectedTriangles;
5855

5956
Vector3D camera;
6057
Vector3D rotation;
6158
Vector3D rotationSpeed;
6259
public:
6360
#ifndef BENCHMARK_MODE
6461
// Constructor to initialize memory
65-
Display(const std::string& title, const Vector3D& cameraPosition = Vector3D(0, 0, -5),
62+
Display(const std::string& title, bool fullscreen = false, const Vector3D& cameraPosition = Vector3D(0, 0, -5),
6663
const Vector3D& cameraRotation = Vector3D(0, 0, 0)) {
6764
#else
6865
Display(uint32_t numOfFrames, const Vector3D& cameraPosition = Vector3D(0, 0, -5),
@@ -73,7 +70,7 @@ class Display {
7370
rotation = cameraRotation;
7471
rotationSpeed = Vector3D(0, 0, 0);
7572
#ifndef BENCHMARK_MODE
76-
fullScreen = true;
73+
fullScreen = fullscreen;
7774
keyPressed = SDLK_UNKNOWN;
7875
prevTime = SDL_GetTicks();
7976
// Initialize SDL with only the required subsystems
@@ -95,12 +92,11 @@ class Display {
9592
// Initialize the frame buffer
9693
frameBuffer = std::make_unique<FrameBuffer>(displayMode.w, displayMode.h);
9794

98-
// Initialize the CUDA device pointers
99-
d_faces = nullptr;
100-
d_vertices = nullptr;
101-
d_projectedTriangles = nullptr;
102-
10395
#ifdef __CUDA__
96+
// Initialize the CUDA device pointers
97+
Face* d_faces = nullptr;
98+
Vector3D* d_vertices = nullptr;
99+
Triangle* d_projectedTriangles = nullptr;
104100
InitalizeCuda();
105101
#elif __METAL__
106102
InitalizeMetal();
@@ -137,21 +133,22 @@ class Display {
137133

138134
// Destructor to free memory
139135
~Display() {
140-
// Free the frame buffer
141-
frameBuffer.reset();
142-
143-
// Free the window
144136
#ifndef BENCHMARK_MODE
145-
SDL_DestroyWindow(window);
146-
window = nullptr;
147-
148-
// Free the renderer
149-
SDL_DestroyRenderer(renderer);
150-
151137
// Free the texture
152-
SDL_DestroyTexture(texture);
153-
texture = nullptr;
154-
138+
if (texture != nullptr) {
139+
SDL_DestroyTexture(texture);
140+
texture = nullptr;
141+
}
142+
// Free the renderer
143+
if (renderer != nullptr) {
144+
SDL_DestroyRenderer(renderer);
145+
renderer = nullptr;
146+
}
147+
// Free the window
148+
if (window != nullptr) {
149+
SDL_DestroyWindow(window);
150+
window = nullptr;
151+
}
155152
// Quit SDL subsystems
156153
SDL_Quit();
157154
#endif

public/index.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
padding: 0%;
1010
width: 100%;
1111
height: 100%;
12+
overflow: hidden;
1213
}
1314
.container {
14-
width: 100%;
15-
height: 100%;
15+
width: 100vw;
16+
height: 100vh;
1617
display: flex;
1718
justify-content: center;
1819
align-items: center;
@@ -21,9 +22,22 @@
2122
</head>
2223
<body>
2324
<div class="container">
24-
<canvas id="_canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
25+
<canvas
26+
id="_canvas"
27+
oncontextmenu="event.preventDefault()"
28+
tabindex="-1"
29+
></canvas>
2530
</div>
26-
<script src="web.js"></script> <!-- Script Name -->
31+
<script
32+
type="text/javascript"
33+
data-href="https://github.com/Kaweees/kiwiGL"
34+
data-target="_blank"
35+
src="https://unpkg.com/github-corners/dist/embed.min.js"
36+
></script>
37+
<script
38+
type="text/javascript"
39+
src="web.js"
40+
></script> <!-- Script Name -->
2741
<script type='text/javascript'>
2842
let Module;
2943
Main({

0 commit comments

Comments
 (0)