-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c4bf7f
Showing
4 changed files
with
369 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This repository is licensed under: | ||
|
||
CC0 1.0 Universal | ||
https://creativecommons.org/publicdomain/zero/1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
## <img align="left" width="100px" src="https://user-images.githubusercontent.com/19890545/179967638-6b0e4e7d-7f8c-412a-b87d-47ba8e694477.png" alt="ebitengine-kage-support" /> Ebitengine Kage support for Sublime Text | ||
|
||
Basic syntax and snippet support for the Ebitengine Kage shading language. | ||
|
||
<br> | ||
|
||
Ebitengine adopts an original shading language 'Kage'. This has a compatible syntax with Go, but the details are different. Kage has high portability. Ebitengine uses graphics libraries like OpenGL or Metal and this depends on environments, but Kage is compiled on the fly so that this works equally everywhere. | ||
|
||
### Installation | ||
|
||
[![](https://img.shields.io/badge/get%20it%20from-555555?style=for-the-badge&logo=sublimetext&logoColor=ba9759)![](https://img.shields.io/badge/package%20control-ba9759?style=for-the-badge)](https://packagecontrol.io) | ||
|
||
<details><summary>Manual installation</summary><br> | ||
|
||
To add a package manually, open command palette and type `Package Control: Add Repository`. | ||
|
||
![image](https://user-images.githubusercontent.com/19890545/179971478-0cd10e28-ac31-46c4-8c2d-e40152c45025.png) | ||
|
||
In the dialog that opens below, enter the url of the repository `https://github.com/sedyh/ebitengine-kage-sublime`. | ||
|
||
![image](https://user-images.githubusercontent.com/19890545/179971756-9a4e9909-56ae-4903-9640-e8319a62bf91.png) | ||
|
||
Then open the package installation via `Package Control: Install Package` dialog and find `ebitengine-kage-sublime` package there. | ||
|
||
![image](https://user-images.githubusercontent.com/19890545/179972515-1e443959-7833-4c14-beaf-fd92fd930e86.png) | ||
|
||
![image](https://user-images.githubusercontent.com/19890545/179972097-273131df-0e98-4ce4-b8db-6096cbb82df8.png) | ||
|
||
</details> | ||
|
||
### Other editors | ||
|
||
[![](https://img.shields.io/badge/source-555555?style=for-the-badge&logo=vim&logoColor=60b371)](https://github.com/sedyh/ebitengine-kage-vim)[![](https://img.shields.io/badge/download-60b371?style=for-the-badge)](https://www.vim.org/scripts/script.php?script_id=6021)<br> | ||
[![](https://img.shields.io/badge/source-555555?style=for-the-badge&logo=visualstudiocode&logoColor=72a9d4)](https://github.com/sedyh/ebitengine-kage-vscode)[![](https://img.shields.io/badge/download-72a9d4?style=for-the-badge)](https://marketplace.visualstudio.com/items?itemName=sedyh.ebitengine-kage) | ||
|
||
### Features | ||
|
||
- [Basic syntax highlighting](#basic-syntax-highlighting) | ||
- [Quick start](#quick-start) | ||
- [Short documentation](#short-documentation) | ||
- [List of all built-in functions](#list-of-all-built-in-functions) | ||
|
||
### Basic syntax highlighting | ||
|
||
<a href="#features"><img src="https://user-images.githubusercontent.com/19890545/150034365-6561ab71-5cb4-466f-996c-ae4204ef7c12.png" alt="back" title="back" width="16px"/></a> This plugin provides basic Kage language support for Ebitengine. It includes keywords, types, literals and snippets. | ||
|
||
![feature-syntax](https://user-images.githubusercontent.com/19890545/178739793-e745e6bf-dea6-4454-8d85-9c72ed970967.png) | ||
|
||
### Quick start | ||
|
||
<a href="#features"><img src="https://user-images.githubusercontent.com/19890545/150034365-6561ab71-5cb4-466f-996c-ae4204ef7c12.png" alt="back" title="back" width="16px"/></a> To quickly start writing a shader, you can type "fragment" or "package". | ||
|
||
![feature-quickstart](https://user-images.githubusercontent.com/19890545/178740612-bfdb4bae-1d6e-47bc-9c0b-3dc122fcfdd7.png) | ||
|
||
### Short documentation | ||
|
||
<a href="#features"><img src="https://user-images.githubusercontent.com/19890545/150034365-6561ab71-5cb4-466f-996c-ae4204ef7c12.png" alt="back" title="back" width="16px"/></a> The plugin provides a short help for each feature in Kage. | ||
|
||
![feature-description](https://user-images.githubusercontent.com/19890545/178740945-85d75d86-0af7-4224-8c3a-c684af59500a.png) | ||
|
||
### List of all built-in functions | ||
|
||
<a href="#features"><img src="https://user-images.githubusercontent.com/19890545/150034365-6561ab71-5cb4-466f-996c-ae4204ef7c12.png" alt="back" title="back" width="16px"/></a> You can see a list of all built-in functions by typing "kage". | ||
|
||
![feature-help](https://user-images.githubusercontent.com/19890545/178741240-4df370c2-7b20-409f-9437-a213aa198a2f.png) | ||
|
||
## Known Issues | ||
|
||
The plugin will highlight complex numbers despite the fact that, at the moment, Kage does not support them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
{ | ||
"scope": "source.kage", | ||
"completions": [ | ||
{ | ||
"trigger": "fragment", | ||
"contents": "package main\n\nfunc Fragment(pos vec4, tex vec2, col vec4) vec4 {\n\t$0\n\treturn vec4(0.5, 0.0, 0.0, 1.0)\n}" | ||
}, | ||
{ | ||
"trigger": "vec2", | ||
"contents": "vec2(0, 0)", | ||
"details": "Usage vec2(x, y) or vec2(x)" | ||
}, | ||
{ | ||
"trigger": "vec3", | ||
"contents": "vec3(0, 0, 0)", | ||
"details": "Usage vec3(x, y, z) or vec3(x)" | ||
}, | ||
{ | ||
"trigger": "vec4", | ||
"contents": "vec4(0, 0, 0, 0)", | ||
"details": "Usage vec4(x, y, z, w) or vec4(x)" | ||
}, | ||
{ | ||
"trigger": "mat2", | ||
"contents": "mat2(\n\t0, 0,\n\t0, 0,\n)", | ||
"details": "Usage mat2(a, b, c, d)" | ||
}, | ||
{ | ||
"trigger": "mat3", | ||
"contents": "mat3(\n\t0, 0, 0,\n\t0, 0, 0,\n\t0, 0, 0,\n)", | ||
"details": "Usage mat3(a, b, c, d, e, f, g, h, i)" | ||
}, | ||
{ | ||
"trigger": "mat4", | ||
"contents": "mat4(\n\t0, 0, 0, 0,\n\t0, 0, 0, 0,\n\t0, 0, 0, 0,\n\t0, 0, 0, 0,\n)", | ||
"details": "Usage mat4(a, b, c, d, e, f, g, h, i, j, k, l)" | ||
}, | ||
{ | ||
"trigger": "kage: sin", | ||
"contents": "sin($0)", | ||
"details": "Usage sin(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: cos", | ||
"contents": "cos($0)", | ||
"details": "Usage cos(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: tan", | ||
"contents": "tan($0)", | ||
"details": "Usage tan(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: asin", | ||
"contents": "asin($0)", | ||
"details": "Usage asin(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: acos", | ||
"contents": "acos($0)", | ||
"details": "Usage acos(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: atan", | ||
"contents": "atan($0)", | ||
"details": "Usage atan(y_over_x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: atan2", | ||
"contents": "atan2($0)", | ||
"details": "Usage atan2(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: pow", | ||
"contents": "pow($0)", | ||
"details": "Usage pow(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: exp", | ||
"contents": "exp($0)", | ||
"details": "Usage exp(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: log", | ||
"contents": "log($0)", | ||
"details": "Usage log(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: exp2", | ||
"contents": "exp2($0)", | ||
"details": "Usage exp2(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: log2", | ||
"contents": "log2($0)", | ||
"details": "Usage log2(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: sqrt", | ||
"contents": "sqrt($0)", | ||
"details": "Usage sqrt(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: inversesqrt", | ||
"contents": "inversesqrt($0)", | ||
"details": "Usage inversesqrt(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: abs", | ||
"contents": "abs($0)", | ||
"details": "Usage abs(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: sign", | ||
"contents": "sign($0)", | ||
"details": "Usage sign(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: floor", | ||
"contents": "floor($0)", | ||
"details": "Usage floor(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: ceil", | ||
"contents": "ceil($0)", | ||
"details": "Usage ceil(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: fract", | ||
"contents": "fract($0)", | ||
"details": "Usage fract(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: mod", | ||
"contents": "mod($0)", | ||
"details": "Usage mod(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: min", | ||
"contents": "min($0)", | ||
"details": "Usage min(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: max", | ||
"contents": "max($0)", | ||
"details": "Usage max(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: clamp", | ||
"contents": "clamp($0)", | ||
"details": "Usage clap(x, min, max T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: mix", | ||
"contents": "mix($0)", | ||
"details": "Usage mix(x, y, a T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: step", | ||
"contents": "step($0)", | ||
"details": "Usage step(edge, x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: smoothstep", | ||
"contents": "smoothstep($0)", | ||
"details": "Usage smoothstep(edge0, edge1, x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: length", | ||
"contents": "length($0)", | ||
"details": "Usage length(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: distance", | ||
"contents": "distance($0)", | ||
"details": "Usage distance(p0, p1 T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: dot", | ||
"contents": "dot($0)", | ||
"details": "Usage dot(x, y T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: cross", | ||
"contents": "cross($0)", | ||
"details": "Usage cross(x, y vec3)" | ||
}, | ||
{ | ||
"trigger": "kage: normalize", | ||
"contents": "normalize($0)", | ||
"details": "Usage normalize(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: faceforward", | ||
"contents": "faceforward($0)", | ||
"details": "Usage faceforward(n, i, nref T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: reflect", | ||
"contents": "reflect($0)", | ||
"details": "Usage reflect(i, n T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: refract", | ||
"contents": "refract($0)", | ||
"details": "Usage refract(i, n T, eta float), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: transpose", | ||
"contents": "transpose($0)", | ||
"details": "Usage transpose(x T), T is mat" | ||
}, | ||
{ | ||
"trigger": "kage: dfdx", | ||
"contents": "dfdx($0)", | ||
"details": "Usage dfdx(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: dfdy", | ||
"contents": "dfdy($0)", | ||
"details": "Usage dfdy(x T), T is float or vec" | ||
}, | ||
{ | ||
"trigger": "kage: fwidth", | ||
"contents": "fwidth($0)", | ||
"details": "Usage fwidth(x T), T is float or vec" | ||
} | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
%YAML 1.2 | ||
--- | ||
file_extensions: | ||
- kage | ||
scope: source.kage | ||
|
||
contexts: | ||
main: | ||
- include: keywords | ||
- include: types | ||
- include: builtins | ||
- include: functions | ||
- include: numbers | ||
- include: comments | ||
|
||
keywords: | ||
- match: '\b(package|var|func|if|else|for|return|true|false|nil)\b' | ||
scope: keyword.control.kage | ||
|
||
types: | ||
- match: '\b(bool|int|float|vec2|vec3|vec4|mat2|mat3|mat4)\b' | ||
scope: constant.language.kage | ||
|
||
builtins: | ||
- match: '\b(sin|cos|tan|asin|acos|atan|atan2|pow|exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|min|max|clamp|mix|step|smoothstep|length|distance|dot|bcross|normalize|faceforward|reflect|refract|transpose|dfdx|dfdy|fwidth)\b' | ||
scope: entity.name.tag.kage | ||
|
||
functions: | ||
- match: '(?<=func )([a-zA-Z][a-zA-Z0-9]+)(?=\()' | ||
scope: entity.name.function.kage | ||
- match: '[a-zA-Z][a-zA-Z0-9]+(?=\(.*\))' | ||
scope: support.function.kage | ||
|
||
numbers: | ||
- match: '(((\.\d+|0[xXbBoO][\dbBxXaAbBcCdDeEfF_]*|(?<=[^\w])\d+)\.{0,1}[\dbBxXaAbBcCdDeEfF_]*([eEpP][-+]{0,1}\d+))|((\.\d+|0[xXbBoO][\dbBxXaAbBcCdDeEfF_]*|(?<=[^\w])\d+)\.{0,1}[\dbBxXaAbBcCdDeEfF_]*))i{0,1}' | ||
scope: constant.numeric.kage | ||
|
||
comments: | ||
- match: ^/\* =(\s*.*?)\s*= \*/$\n? | ||
scope: comment.block.kage | ||
captures: | ||
1: meta.toc-list.banner.block.kage | ||
- match: /\* | ||
scope: punctuation.definition.comment.kage | ||
push: | ||
- meta_scope: comment.block.kage | ||
- match: \*/ | ||
scope: punctuation.definition.comment.kage | ||
pop: true | ||
- match: ^\s*(\*)(?!/) | ||
captures: | ||
1: punctuation.definition.comment.kage | ||
- match: \*/(?!\*) | ||
scope: invalid.illegal.stray-comment-end.kage | ||
- match: ^// =(\s*.*?)\s*=\s*$\n? | ||
scope: comment.line.banner.kage | ||
captures: | ||
1: meta.toc-list.banner.line.kage | ||
- match: // | ||
scope: punctuation.definition.comment.kage | ||
push: | ||
- meta_scope: comment.line.double-slash.kage | ||
- match: '(\\)$\n' | ||
captures: | ||
1: punctuation.separator.continuation.kage | ||
- match: \n | ||
pop: true |