Skip to content

Commit

Permalink
Add macOS/Linux files to release & make background color tunable (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp authored Nov 4, 2021
1 parent 91e117f commit b8e833e
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 35 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,27 @@ jobs:
- uses: actions/checkout@v2
- run: DOCKER_BUILDKIT=1 docker build -o=./bin/ --target=voidstar . --progress=plain
- run: ./bin/voidstar --help
- uses: actions/upload-artifact@v2
with:
name: voidstar_gcc_ubuntu
path: ./bin/voidstar
- uses: Wandalen/[email protected]
with:
command: DOCKER_BUILDKIT=1 docker build -o=. --target=video-gcc . --progress=plain
attempt_limit: 20
attempt_delay: 1000
- run: mv ./bin/voidstar voidstar_gcc_ubuntu
- run: mv ./video.webm voidstar_gcc_ubuntu.webm
- uses: actions/upload-artifact@v2
with:
name: video-gcc_ubuntu
path: ./voidstar_gcc_ubuntu.webm
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
voidstar_gcc_ubuntu
voidstar_gcc_ubuntu.webm
build_on_ubuntu_with_clang:
name: Build on ubuntu with Clang
Expand All @@ -46,11 +62,27 @@ jobs:
- uses: actions/checkout@v2
- run: DOCKER_BUILDKIT=1 docker build -o=./bin/ --target=voidstar-clang . --progress=plain
- run: ./bin/voidstar --help
- uses: actions/upload-artifact@v2
with:
name: voidstar_clang_ubuntu
path: ./bin/voidstar
- uses: Wandalen/[email protected]
with:
command: DOCKER_BUILDKIT=1 docker build -o=. --target=video-clang . --progress=plain
attempt_limit: 20
attempt_delay: 1000
- run: mv ./bin/voidstar voidstar_clang_ubuntu
- run: mv ./video.webm voidstar_clang_ubuntu.webm
- uses: actions/upload-artifact@v2
with:
name: video-clang_ubuntu
path: ./voidstar_clang_ubuntu.webm
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
voidstar_clang_ubuntu
voidstar_clang_ubuntu.webm
build_on_macos:
name: Build on macos
Expand All @@ -62,6 +94,14 @@ jobs:
- uses: actions/checkout@v2
- run: bazelisk build voidstar
- run: ./bazel-bin/voidstar/voidstar --help
- uses: actions/upload-artifact@v2
with:
name: voidstar_macos-latest
path: ./bazel-bin/voidstar/voidstar
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./bazel-bin/voidstar/voidstar

# build_on_windows: FIXME
# name: Build on windows
Expand Down
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VoidStar [![Snap Status](https://build.snapcraft.io/badge/fenollp/voidstar.svg)](https://build.snapcraft.io/user/fenollp/voidstar) [Coverity](https://scan.coverity.com/projects/fenollp-voidstar?tab=overview)
# void*

Browse data using Corti's 2D projector as well as 3D variants.

Expand Down Expand Up @@ -27,8 +27,7 @@ The actual file being represented below [is data/BigPictureBG.tga](http://www.do
## Usage

```shell
bazel build voidstar
./bazel-bin/voidstar/voidstar --move bazel-bin/voidstar/voidstar data/*
voidstar --move bazel-bin/voidstar/voidstar data/*
```

```
Expand Down Expand Up @@ -63,49 +62,47 @@ Usage:
# Use > to slide faster, < to slow down
# SPACE to toggle spinning the shape
# Press O to reset the camera position
# Use B to change background color
# ESC to quit
```

## Installing

### docker

Known to work with
* ubuntu 18.10 + docker 18.09.0

```
docker build -f Dockerfile.dev -t voiddev .
mv your/interesting/files/* data/
./docker-dev.sh
```

### on MacOS

1. Download one of the `osx` files of [the latest release](https://github.com/fenollp/voidstar/releases/latest)
1. Open Terminal.app (you can search for it in Spotlight)
1. Download one of the `macos` files of [the latest release](https://github.com/fenollp/voidstar/releases/latest)
1. Open `Terminal.app` (you can search for it in Spotlight)
1. Type `chmod u+x ` then drag and drop the file you downloaded then press ENTER (now this file can be executed)
1. Now drag and drop your executable then drag a file you want to look at (e.g. `data/dragon.vox`) then press ENTER
* your Terminal command should look like `/Users/you/Downloads/voidstar some_file.xyz`
1. A window should appear. Move your mouse and play with your keyboard's arrows. You should see some colored dots in 3D.

### on any Linux distribution
### Windows

`snap install voidstar`
https://github.com/fenollp/voidstar/issues/2

This relies on [snaps](https://snapcraft.io/docs/core/install).
### with Docker

```shell
DOCKER_BUILDKIT=1 docker build -o=/usr/local/bin https://github.com/voidstarHQ/voidstar.git
```

## Requirements
### on any Linux distribution

* A C++ compiler
* `bazel` that you can use through [bazelisk](https://github.com/bazelbuild/bazelisk)
```shell
snap install voidstar
```

### Windows
This relies on [snaps](https://snapcraft.io/docs/core/install).

https://github.com/fenollp/voidstar/issues/2

### Debian
## Hacking

```shell
sudo apt-get install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev xorg-dev
bazel build voidstar
./bazel-bin/voidstar/voidstar --move bazel-bin/voidstar/voidstar data/*
```

* A C++ compiler
* `bazel` that you can use through [bazelisk](https://github.com/bazelbuild/bazelisk)
10 changes: 5 additions & 5 deletions resolved.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ resolved = [
"rule_class": "@bazel_upgradable//:rule.bzl%upgradable_repository",
"attributes": {
"urls": [
"https://github.com/bazelbuild/rules_cc/archive/f84656686987ce254481cc33efa3b6645d4254c3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/f84656686987ce254481cc33efa3b6645d4254c3.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/426f72132372dfbd3a904d283662faba71bdf393.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/426f72132372dfbd3a904d283662faba71bdf393.tar.gz",
],
"sha256": "a30681f34021a77638b07abcea132d0057aa16d81e76444b4c454c29ae59fac0",
"sha256": "e7df2dc809915dda2b5a6d79ed0b9e673af94b7920399ef40ae183623bbff49d",
"netrc": "",
"auth_patterns": {},
"canonical_id": "",
"strip_prefix": "rules_cc-f84656686987ce254481cc33efa3b6645d4254c3",
"strip_prefix": "rules_cc-426f72132372dfbd3a904d283662faba71bdf393",
"type": "tar.gz",
"patches": [],
"patch_tool": "",
Expand All @@ -409,7 +409,7 @@ resolved = [
"tag": "",
"name": "rules_cc",
},
"output_tree_hash": "400ca6f1331142b6c9922db519cf33d899f9f0c2acd262ac4585d444bf1d0adb",
"output_tree_hash": "bdb911a032f66a3a03b5095825cbb14c6ae41346dc684c910b723556fa8db695",
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: voidstar
version: v1.35.0 # FIXME: 'git'
version: v1.36.0 # FIXME: 'git'
summary: void* casts files onto 2D/3D colored spaces for your mind blowing needs # 79 char long summary
description: |
Usage:
Expand Down
1 change: 1 addition & 0 deletions voidstar/arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static void usage(const char* prgname __unused) {
# Use > to slide faster, < to slow down
# SPACE to toggle spinning the shape
# Press O to reset the camera position
# Use B to change background color
# ESC to quit
)";
Expand Down
17 changes: 14 additions & 3 deletions voidstar/managers/glfw3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,23 @@ void GLFW3Manager::run() {
glfwSetCursorPos(window_, viewport_width_ / 2, viewport_height_ / 2);
}

static constexpr float bgColors[][3] = {
{0, 0, 0}, // black
{1, 0, 0}, // R
{0, 1, 0}, // G
{0, 0, 1}, // B
{0.2f, 0.3f, 0.3f}, // gray
{1, 1, 1}, // white
};
size_t bgi = 0;

double lastTime = glfwGetTime();
while (!glfwWindowShouldClose(window_)) {
// process pending events
events_->update();

// Clear the colorbuffer
glClearColor(0, 0, 0, 1);
// glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClearColor(bgColors[bgi][0], bgColors[bgi][1], bgColors[bgi][2], 1);
if (is3D) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
} else {
Expand Down Expand Up @@ -290,10 +299,12 @@ void GLFW3Manager::run() {
if (is3D)
glfwSetCursorPos(window_, viewport_width_ / 2, viewport_height_ / 2);
if (events_->keyPressed(GLFW_KEY_ESCAPE))
glfwSetWindowShouldClose(window_, GL_TRUE);
glfwSetWindowShouldClose(window_, GLFW_TRUE);
if (events_->keyPressed('F')) ToggleFullscreen();
if (events_->keyPressed('H')) loadPrevFile();
if (events_->keyPressed('L')) loadNextFile();
if (events_->keyPressed('B'))
bgi = (bgi + 1) % (sizeof(bgColors) / sizeof(bgColors[0]));
if (!args_->move_window && args_->exit_at_fin)
glfwSetWindowShouldClose(window_, GLFW_TRUE);
}
Expand Down

0 comments on commit b8e833e

Please sign in to comment.