Skip to content

Commit b0ebf90

Browse files
committed
Value and Documentation
1 parent 1c41a91 commit b0ebf90

File tree

4 files changed

+48
-20
lines changed

4 files changed

+48
-20
lines changed

README.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ A three-dimensional header-only graphics library written in C++13 and accelerate
4949

5050
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.
5151

52-
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.
53-
5452
### Installation
5553

5654
To get a local copy of the project up and running on your machine, follow these simple steps:
@@ -81,12 +79,20 @@ To get a local copy of the project up and running on your machine, follow these
8179
just run <package_name>
8280
```
8381

82+
### Add as a dependency
83+
84+
Add the following line to your `build.zig` file:
85+
86+
```sh
87+
zig fetch --save https://github.com/Kaweees/micrograd
88+
```
89+
8490
## Usage
8591

86-
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:
92+
micrograd is designed to be easy to use. You can include the library in your Zig project by adding the following line to your source files:
8793

88-
```cpp
89-
#include <kiwigl/kiwigl.h>
94+
```zig
95+
const micrograd = @import("micrograd");
9096
```
9197

9298
### Benchmarks
@@ -100,21 +106,6 @@ kiwiGL is capable of rendering 3D scenes with thousands of triangles at interact
100106
| `bunny` | Render a Stanford Bunny with 69451 triangles | 60 FPS |
101107
| `dragon` | Render a Stanford Dragon with 871306 triangles | 60 FPS |
102108

103-
### Conventions
104-
105-
kiwiGL uses the following conventions:
106-
107-
- [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)
108-
- [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
109-
110-
### Keyboard Controls
111-
112-
kiwiGL uses the following keyboard shortcuts:
113-
114-
| Command Keybind | Command Description |
115-
| --------------- | ------------------- |
116-
| <kbd>CTRL</kbd> + <kbd>q</kbd> | Quit the application |
117-
118109
<!-- PROJECT FILE STRUCTURE -->
119110
## Project Structure
120111

build.zig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,21 @@ pub fn build(b: *std.Build) void {
113113
const test_step = b.step("test", "Run unit tests");
114114
test_step.dependOn(&run_lib_unit_tests.step);
115115
test_step.dependOn(&run_exe_unit_tests.step);
116+
117+
// Creates a step for generating documentation
118+
const lib_docs = b.addObject(.{
119+
.name = "micrograd-docs",
120+
.root_module = lib_mod,
121+
});
122+
123+
// Generate documentation and install it to zig-out/docs
124+
const docs = lib_docs.getEmittedDocs();
125+
const install_docs = b.addInstallDirectory(.{
126+
.source_dir = docs,
127+
.install_dir = .prefix,
128+
.install_subdir = "docs",
129+
});
130+
131+
const docs_step = b.step("docs", "Generate and install documentation");
132+
docs_step.dependOn(&install_docs.step);
116133
}

src/engine.zig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! This file provides
2+
3+
const std = @import("std");
4+
const arch = @import("../arch/arch.zig");
5+
6+
/// Represents a Scalar value
7+
pub fn Value(comptime T: type) type {
8+
return struct {
9+
/// Value of the register
10+
value: T,
11+
12+
/// Initialize the Value
13+
pub fn init(value: T) @This() {
14+
return @This(){
15+
.value = value,
16+
};
17+
}
18+
19+
};
20+
}

src/nn.zig

Whitespace-only changes.

0 commit comments

Comments
 (0)