Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSL: Improvements #2321

Merged
merged 6 commits into from Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components.json
Expand Up @@ -379,7 +379,7 @@
},
"glsl": {
"title": "GLSL",
"require": "clike",
"require": "c",
"owner": "Golmote"
},
"gml": {
Expand Down
15 changes: 1 addition & 14 deletions components/prism-glsl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-glsl.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions examples/prism-glsl.html
Expand Up @@ -15,18 +15,18 @@ <h2>Vertex shader example</h2>
vec3 specularColor = vec3(1.0,1.0,1.0);

void main(void) {
// compute position
gl_Position = _mvProj * vec4(vertex, 1.0);
localPos = vertex;
// compute light info
vec3 n = normalize(_norm * normal);
vec3 diffuse;
float specular;
float glowingSpecular = 50.0;
getDirectionalLight(n, _dLight, glowingSpecular, diffuse, specular);
vColor = max(diffuse,_ambient.xyz)*materialColor+specular*specularColor+_ambient;
// compute position
gl_Position = _mvProj * vec4(vertex, 1.0);

localPos = vertex;

// compute light info
vec3 n = normalize(_norm * normal);
vec3 diffuse;
float specular;
float glowingSpecular = 50.0;
getDirectionalLight(n, _dLight, glowingSpecular, diffuse, specular);
vColor = max(diffuse,_ambient.xyz)*materialColor+specular*specularColor+_ambient;
}</code></pre>

<h2>Fragment shader example</h2>
Expand All @@ -42,17 +42,17 @@ <h2>Fragment shader example</h2>
varying vec3 localPos;
void main()
{
vec3 color;
vec3 color;
vec3 position, useBrick;


position = localPos / BrickSize.xyz;

if (fract(position.y * 0.5) > 0.5){
position.x += 0.5;
position.z += 0.5;
position.z += 0.5;
}

position = fract(position);

useBrick = step(position, BrickPct.xyz);
Expand All @@ -62,4 +62,4 @@ <h2>Fragment shader example</h2>

gl_FragColor = vec4(color, 1.0);
}
</code></pre>
</code></pre>
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.js
Expand Up @@ -42,7 +42,7 @@
"firestore-security-rules": "clike",
"flow": "javascript",
"ftl": "markup-templating",
"glsl": "clike",
"glsl": "c",
"gml": "clike",
"go": "clike",
"groovy": "clike",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions tests/languages/glsl/keyword_feature.test
Expand Up @@ -89,15 +89,15 @@ uimage1DArray uimage2DArray
imageCubeArray iimageCubeArray uimageCubeArray
image2DMS iimage2DMS uimage2DMS
image2DMSArray iimage2DMSArray uimage2DMSArray
struct
struct;
common
partition
active
asm
class;
union
enum
typedef
enum;
typedef;
template
this
resource
Expand Down Expand Up @@ -220,15 +220,15 @@ using
["keyword", "imageCubeArray"], ["keyword", "iimageCubeArray"], ["keyword", "uimageCubeArray"],
["keyword", "image2DMS"], ["keyword", "iimage2DMS"], ["keyword", "uimage2DMS"],
["keyword", "image2DMSArray"], ["keyword", "iimage2DMSArray"], ["keyword", "uimage2DMSArray"],
["keyword", "struct"],
["keyword", "struct"], ["punctuation", ";"],
["keyword", "common"],
["keyword", "partition"],
["keyword", "active"],
["keyword", "asm"],
["keyword", "class"], ["punctuation", ";"],
["keyword", "union"],
["keyword", "enum"],
["keyword", "typedef"],
["keyword", "enum"], ["punctuation", ";"],
["keyword", "typedef"], ["punctuation", ";"],
["keyword", "template"],
["keyword", "this"],
["keyword", "resource"],
Expand Down Expand Up @@ -260,4 +260,4 @@ using

----------------------------------------------------

Checks for keywords.
Checks for keywords.
74 changes: 74 additions & 0 deletions tests/languages/glsl/macro_feature.test
@@ -0,0 +1,74 @@
#define
#undef
#if
#ifdef
#ifndef
#else
#elif
#endif
#error
#pragma
#extension
#version
#line

----------------------------------------------------

[
["macro", [
"#",
["directive", "define"]
]],
["macro", [
"#",
["directive", "undef"]
]],
["macro", [
"#",
["directive", "if"]
]],
["macro", [
"#",
["directive", "ifdef"]
]],
["macro", [
"#",
["directive", "ifndef"]
]],
["macro", [
"#",
["directive", "else"]
]],
["macro", [
"#",
["directive", "elif"]
]],
["macro", [
"#",
["directive", "endif"]
]],
["macro", [
"#",
["directive", "error"]
]],
["macro", [
"#",
["directive", "pragma"]
]],
["macro", [
"#",
["directive", "extension"]
]],
["macro", [
"#",
["directive", "version"]
]],
["macro", [
"#",
["directive", "line"]
]]
]

----------------------------------------------------

Checks for preprocessor instructions.
35 changes: 0 additions & 35 deletions tests/languages/glsl/preprocessor_feature.test

This file was deleted.