• Stars
    star
    1,551
  • Rank 30,167 (Top 0.6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 13 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Shader editor and gallery.

glsl-sandbox

Server development

Setup

  • Fork repository
  • Download repository and create new development branch:
$ git clone [email protected]:<your user>/glsl-sandbox
$ cd glsl-sandbox
$ git checkout -b <feature name>
  • Download and uncompress test data:
$ curl -O https://downloads.zooloo.org/glslsandbox-data.tar.gz
$ tar xvf glslsandbox-data.tar.gz
  • Build server binary needs go compiler:
$ go build ./server/cmd/glslsandbox
$ ./glslsandbox

Template and javascript modifications

The server reloads templates and assets on each query. This eases the development as you can modify the files and changes will take effect reloading the page.

There's only one template that is used for both the gallery (index) and admin page. The file is server/assets/gallery.html and uses go language templates. You can find more information about its syntax here:

Currently the page receives this data:

// galleryEffect has information about each effect displayed in the gallery.
type galleryEffect struct {
	// ID is the effect identifyier.
	ID int
	// Version is the latest effect version.
	Version int
	// Image holds the thumbnail name.
	Image string
	// Hidden tells if the effect has been moderated.
	Hidden bool
}

// galleryData has information about the current gallery page.
type galleryData struct {
	// Effects is an array with all the effects for the page.
	Effects []galleryEffect
	// URL is the path of the gallery. Can be "/" or "/admin".
	URL string
	// Page holds the current page number.
	Page int
	// IsPrevious is true if there is a previous page.
	IsPrevious bool
	// PreviousPage is the previous page number.
	PreviousPage int
	// IsNext is true if there is a next page.
	IsNext bool
	// NextPage is the next page number.
	NextPage int
	// Admin is true when accessing "/admin" path.
	Admin bool
}

This is, galleryData for the page and galleryEffect for each effect. For example, to print all the effect IDs you can use:

<ul>
{{ range .Effects }}
    <li>{{ .ID }}</li>
{{ end }}
<ul>

The following directories are accessible from the server and can be modified if needed:

  • server/assets/css -> /css
  • server/assets/js -> /js

By default the data files are read from ./data. This path can be hanged with the environment variable DATA_PATH. For example:

$ DATA_PATH=/my/data/directory ./glslsandbox

The data directory contains the sqlite database (glslsandbox.db) and the thumbnails (thumbs directory).

More Repositories

1

three.js

JavaScript 3D Library.
JavaScript
102,228
star
2

stats.js

JavaScript Performance Monitor
JavaScript
8,405
star
3

texgen.js

JavaScript Texture Generator
JavaScript
1,771
star
4

frame.js

JavaScript Sequence Editor
JavaScript
987
star
5

htmleditor

Simple editor for messing around.
JavaScript
571
star
6

Hi-ReS-Stats

Performance monitor for Actionscript3 and haXe
Haxe
323
star
7

eventdispatcher.js

JavaScript events for custom objects
JavaScript
306
star
8

system.js

JavaScript object with the user's system information.
JavaScript
204
star
9

harmony

Procedural Drawing Tool
JavaScript
167
star
10

daydream-controller.js

WebBluetooth Daydream Controller
HTML
152
star
11

model-tag

Custom Elements for easily displaying 3D models.
JavaScript
136
star
12

svg-editor

SVG Editor
HTML
117
star
13

3d-file-viewer

3D File Viewer
JavaScript
85
star
14

timer.js

JavaScript timer replacement for audio
JavaScript
60
star
15

sequencer.js

JavaScript Sequencer
JavaScript
58
star
16

clickbait-stopper

Chrome extension that adds line-through to clickbait headlines.
JavaScript
54
star
17

omggif-example

Animated GIF generator example.
JavaScript
53
star
18

ui.js

Javascript UI library
JavaScript
52
star
19

sporel

HTML
48
star
20

webgl-blendfunctions

WebGL Blending Tools
47
star
21

blinkftw

Keeping <blink> alive
JavaScript
43
star
22

mrdoob.github.com

HTML
37
star
23

xrcode

HTML
36
star
24

resonate-2016

JavaScript
32
star
25

webvr-replayer

Chrome Extension for recording and playback of vr sessions. Three.js only at this point.
JavaScript
32
star
26

webar-experiments

Experiments for WebARonARCore/WebARonARKit
JavaScript
31
star
27

13kb-404

JavaScript
28
star
28

webvr-sculpt

JavaScript
24
star
29

rome-gltf

JavaScript
20
star
30

brokenmantra

JavaScript
19
star
31

midemhackday

Music Machine hacked at Midem Hack Day.
JavaScript
19
star
32

mrdoob

13
star
33

code.google.com

ActionScript
12
star
34

webu2016

JavaScript
8
star