├── settings └── language-glsl.cson ├── README.md ├── package.json ├── sample.glsl ├── snippets └── language-glsl.cson └── grammars └── glsl.cson /settings/language-glsl.cson: -------------------------------------------------------------------------------- 1 | '.source.glsl': 2 | 'editor': 3 | 'commentStart': '// ' 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # language-glsl package 2 | 3 | Adds syntax highlighting and snippets to GLSL files in Atom. 4 | 5 | Originally 6 | [converted](http://atom.io/docs/latest/converting-a-text-mate-bundle) 7 | from [polym0rph](https://github.com/polym0rph)'s 8 | [GLSL TextMate bundle](https://github.com/polym0rph/GLSL.tmbundle). 9 | 10 | Extended to support [glslify](http://github.com/stackgl/glslify) require/export 11 | statements. 12 | 13 | screenshot 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.4", 3 | "name": "language-glsl", 4 | "description": "Atom language support for GLSL", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/hughsk/language-glsl.git" 8 | }, 9 | "license": "MIT", 10 | "bugs": { 11 | "url": "https://github.com/hughsk/language-glsl/issues" 12 | }, 13 | "engines": { 14 | "atom": "*", 15 | "node": "*" 16 | }, 17 | "homepage": "https://github.com/hughsk/language-glsl", 18 | "keywords": [ 19 | "language", 20 | "glsl", 21 | "atom", 22 | "editor", 23 | "syntax" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /sample.glsl: -------------------------------------------------------------------------------- 1 | #ifndef HELLO_WORLD 2 | #define HELLO_WORLD vec3(0.0, 0.0, 0.0) 3 | #else 4 | #define LOREM_IPSUM 5 | #endif 6 | 7 | #pragma GENERIC_PRAGMA 8 | 9 | #pragma glslify: noise = require(glsl-noise) 10 | #pragma glslify: random = require(glsl-random) 11 | 12 | // this is a comment, and you can see the variable "gl_Layer" is NOT highlighted. 13 | 14 | #define PI 3.14159 15 | 16 | float y(float x) { 17 | return sin(x*2.0*PI); 18 | } 19 | 20 | #pragma glslify: export(y) 21 | 22 | void main() { 23 | vec3 a = noise(gl_FragCoord.xy); 24 | vec4 b = a.zyxx; 25 | ivec4 c = ivec4(0); 26 | mat2 d = mat2(1.0); 27 | mat3 e = mat3(a, b, vec3(2.0)); 28 | 29 | b.x = 1.5; 30 | c.y = 190; 31 | 32 | a.xyz = gl_FragCoord.xyz; 33 | 34 | gl_FragColor = vec4(a.rgb, b.a); 35 | } 36 | -------------------------------------------------------------------------------- /snippets/language-glsl.cson: -------------------------------------------------------------------------------- 1 | '.source.glsl': 2 | 'do ... while': 3 | 'prefix': 'do' 4 | 'body': 'do {\n\t${0:/* code */}\n} while(${1:/* condition */});' 5 | 'for ...': 6 | 'prefix': 'for' 7 | 'body': 'for(int ${2:i} = 0; $2 < ${1:count}; $2++)\n{\n\t${0:/* code */}\n}' 8 | 'if ... else': 9 | 'prefix': 'ife' 10 | 'body': 'if(${1:/* condition */})\n{\n\t${2:/* code */}\n}\nelse\n{\n\t${0:/* code */}\n}' 11 | 'if ...': 12 | 'prefix': 'if' 13 | 'body': 'if(${1:/* condition */})\n{\n\t${0:/* code */}\n}' 14 | 'main ...': 15 | 'prefix': 'main' 16 | 'body': 'void main()\n{\n\t${0:/* code */}\n}' 17 | 'method ...': 18 | 'prefix': 'me' 19 | 'body': '${1:void} ${2:method}()\n{\n\t${0:/* code */}\n}' 20 | 'struct': 21 | 'prefix': 'struct' 22 | 'body': 'struct ${1:/* name */} \n{\n\t${0:/* data */}\n};' 23 | 'switch ...': 24 | 'prefix': 'switch' 25 | 'body': 'switch(${1:/* statement */})\n{\n\tcase ${0:/* expression */}:\n\tdefault:\n}' 26 | 'while ...': 27 | 'prefix': 'while' 28 | 'body': 'while (${1:/* condition */})\n{\n\t${0:/* code */}\n}' 29 | -------------------------------------------------------------------------------- /grammars/glsl.cson: -------------------------------------------------------------------------------- 1 | 'fileTypes': [ 2 | 'vs' 3 | 'fs' 4 | 'fx' 5 | 'gs' 6 | 'cs' 7 | 'tc' 8 | 'te' 9 | 'vsh' 10 | 'fsh' 11 | 'gsh' 12 | 'vshader' 13 | 'fshader' 14 | 'gshader' 15 | 'vert' 16 | 'frag' 17 | 'geom' 18 | 'tesc' 19 | 'tese' 20 | 'comp' 21 | 'f.glsl' 22 | 'v.glsl' 23 | 'g.glsl' 24 | 'glsl' 25 | ] 26 | 'foldingStartMarker': '/\\*\\*|\\{\\s*$' 27 | 'foldingStopMarker': '\\*\\*/|^\\s*\\}' 28 | 'name': 'GLSL' 29 | 'patterns': [ 30 | { 31 | 'match': '\\.(x|y|z|w|r|g|b|a){1,4}' 32 | 'name': 'keyword.operator.glsl' 33 | } 34 | { 35 | 'match': '(?