Compare commits

..

No commits in common. "70b1bf8932ca1e2be2b3534e3fcdb1f4b74185dd" and "1919712792d894caa2651132b02e3297fd46e651" have entirely different histories.

4 changed files with 47 additions and 36 deletions

BIN
.imgs/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

36
README
View File

@ -1,36 +0,0 @@
+-------------+
| Gravity |
+-------------+
C+OpenGL simulator of mass objects in
space - according to Newton.
FEATURES
[DONE] Object tracing
[DONE] Toggle object tracing
[DONE] Scaling up/down objects
[DONE] Locking camera view to an object
[TODO] File format for importing scenes
[TODO] Collision
INSTALL
Build automation system is cmake. Thus, one
can compile this project much like any other
cmake project.
mkdir build
cd build
cmake ..
make all
./gravity
LICENSE
Gravity is licensed under the GPL-3.0 license.
See the `LICENSE` file for more information.

42
README.md Normal file
View File

@ -0,0 +1,42 @@
<p align="center">
<img src=".imgs/icon.png" width="200"/>
</p>
# Gravity
---
Pet project simulator for interactions between matter built off of OpenGL and C.
Goals and features:
- [x] Law of gravitation
- [x] Object tracing
- [x] Toggle object tracing
- [ ] Grid
- [ ] Toggle Grid
- [x] Scaling up/down objects
- [x] Locking camera view to an object
- [ ] File format for importing scenes
- [ ] Collision
- [ ] Soft-bodies and structures
## Installation
Gravity uses CMake as its build automation system. To download and run gravity, please follow these steps:
- Clone the repository `git clone https://github.com/0xdeadbeer/gravity`
- Create a build directory `mkdir build`
- Go into the build directory `cd build`
- Generate build files `cmake ..`
- Compile project `make all`
- Run `./gravity`
- Enjoy
## Contributions
We highly encourage playing around with the software and contributing to the project.
Before opening a pull request, the contributor is expected to open an issue in which they thoroughly describe the issue (or feature) they're solving (or implementing).
## License
Gravity is licensed under the GPL-3.0 license. See the `LICENSE` file for more information.

View File

@ -445,6 +445,7 @@ int main(int argc, char **argv) {
struct object *a = create_object(100000000.0f, sphere_model);
struct object *b = create_object(100000.0f, sphere_model);
struct object *c = create_object(10000000.0f, sphere_model);
float distance = -500.0f;
vec4 a_pos = {0.0f, 0.0f, distance, 0.0f};
@ -457,11 +458,15 @@ int main(int argc, char **argv) {
// vec4 b_pos = {0.0f, -75.0f, -150.0f, 0.0f};
// glm_vec4_add(b->position, b_pos, b->position);
vec4 c_pos = {-100.0f, -400.0f, distance, 0.0f};
glm_vec4_add(c->position, c_pos, c->position);
float n = 0.05f;
vec3 b_boost = {-70*n, 0.0f, 0.0f};
glm_vec3_add(b->translation_force, b_boost , b->translation_force);
glm_vec3_add(c->translation_force, b_boost , c->translation_force);
// b->scale = 2.0f;
a->scale = 5.0f;