├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── assets ├── level.png ├── light.glsl ├── light.png ├── occlusion_gradient.png ├── occlusion_rims.png ├── occlusion_solid.png └── parcel.json ├── custom_index.html ├── occlusion_masks.psd ├── project.flow ├── screenshot.png └── src ├── DigitalCircleParcelProgress.hx └── Main.hx /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Haxe binaries 2 | bin/ 3 | 4 | # Windows image file caches 5 | Thumbs.db 6 | ehthumbs.db 7 | 8 | # Folder config file 9 | Desktop.ini 10 | 11 | # Recycle Bin used on file shares 12 | $RECYCLE.BIN/ 13 | 14 | # Windows Installer files 15 | *.cab 16 | *.msi 17 | *.msm 18 | *.msp 19 | 20 | # Windows shortcuts 21 | *.lnk 22 | 23 | # ========================= 24 | # Operating System Files 25 | # ========================= 26 | 27 | # OSX 28 | # ========================= 29 | 30 | .DS_Store 31 | .AppleDouble 32 | .LSOverride 33 | 34 | # Thumbnails 35 | ._* 36 | 37 | # Files that might appear on external disk 38 | .Spotlight-V100 39 | .Trashes 40 | 41 | # Directories potentially created on remote AFP share 42 | .AppleDB 43 | .AppleDesktop 44 | Network Trash Folder 45 | Temporary Items 46 | .apdisk 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kenton Hamaluik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LuxeLights 2 | 3 | A simple demo showing how to use render textures and shaders to create a _very basic_ 2D lighting effect (no shadows, no light "clipping"). 4 | 5 | >PLEASE NOTE! This demo was created using an ALPHA version of [Luxe](http://luxeengine.com/). As such, it may very well be obsolete by the time you look at it. It is current and working as of `alpha-2.0`, however the API can and likely will change without any hesitation! You've been warned! 6 | 7 | [Click here to check out a live demo.](http://hamaluik.github.io/LuxeLights/) 8 | 9 | A screenshot of it in action: 10 | 11 |  12 | -------------------------------------------------------------------------------- /assets/level.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/assets/level.png -------------------------------------------------------------------------------- /assets/light.glsl: -------------------------------------------------------------------------------- 1 | // shader taken from: http://www.alcove-games.com/opengl-es-2-tutorials/lightmap-shader-fire-effect-glsl/ 2 | 3 | uniform sampler2D tex0; 4 | uniform sampler2D lightMap; 5 | 6 | varying vec2 tcoord; 7 | varying vec4 color; 8 | uniform vec4 ambientColor; 9 | uniform vec2 resolution; 10 | 11 | void main() { 12 | vec4 diffuseColour = texture2D(tex0, tcoord); 13 | vec2 lightCoord = (gl_FragCoord.xy / resolution.xy); 14 | vec4 light = texture2D(lightMap, lightCoord); 15 | 16 | vec3 ambient = ambientColor.rgb * ambientColor.a; 17 | vec3 intensity = ambient + light.rgb; 18 | vec3 finalColor = diffuseColour.rgb * intensity; 19 | 20 | gl_FragColor = color * vec4(finalColor, diffuseColour.a); 21 | } 22 | -------------------------------------------------------------------------------- /assets/light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/assets/light.png -------------------------------------------------------------------------------- /assets/occlusion_gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/assets/occlusion_gradient.png -------------------------------------------------------------------------------- /assets/occlusion_rims.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/assets/occlusion_rims.png -------------------------------------------------------------------------------- /assets/occlusion_solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/assets/occlusion_solid.png -------------------------------------------------------------------------------- /assets/parcel.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures" : [ 3 | { "id" : "assets/level.png" }, 4 | { "id" : "assets/light.png" }, 5 | { "id" : "assets/occlusion_solid.png" }, 6 | { "id" : "assets/occlusion_rims.png" }, 7 | { "id" : "assets/occlusion_gradient.png" } 8 | ], 9 | "shaders" : [ 10 | { "ps_id":"assets/light.glsl" } 11 | ] 12 | } -------------------------------------------------------------------------------- /custom_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | {{#each project.app.web.libs~}} 16 | 17 | {{/each}} 18 | 19 | 20 | 21 | 22 | 23 |Use the ↑ and ↓ keys to adjust the ambient intensity. Use the mouse to move a local light around the scene. Use 1, 2, and 3 to select solid, rim, and gradient occlusion textures respectively.
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /occlusion_masks.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/occlusion_masks.psd -------------------------------------------------------------------------------- /project.flow: -------------------------------------------------------------------------------- 1 | { 2 | 3 | luxe:{ 4 | window: { 5 | width:960, 6 | height:640, 7 | title:'Lights', 8 | fullscreen:false, 9 | resizable:true, 10 | borderless:false 11 | } 12 | }, 13 | 14 | project : { 15 | name : 'Luxe Lights', 16 | version : '0.0.1', 17 | author : 'FuzzyWuzzie', 18 | 19 | app : { 20 | name : 'LuxeLights', 21 | package : 'com.blazingmammothgames.luxe' 22 | }, 23 | 24 | build : { 25 | dependencies : { 26 | luxe : '*', 27 | } 28 | }, 29 | 30 | files : { 31 | assets : 'assets/', 32 | index : { path:'custom_index.html => index.html', template:'project', not_listed:true } 33 | } 34 | 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/LuxeLights/9359584a2549ebe65d403f7c1f497dd17591a495/screenshot.png -------------------------------------------------------------------------------- /src/DigitalCircleParcelProgress.hx: -------------------------------------------------------------------------------- 1 | package ; 2 | 3 | import luxe.resource.Resource; 4 | import luxe.Parcel; 5 | import luxe.Visual; 6 | import luxe.Color; 7 | import luxe.options.ParcelProgressOptions; 8 | import luxe.Text; 9 | import luxe.Vector; 10 | 11 | class DigitalCircleParcelProgress { 12 | var parcel:Parcel; 13 | 14 | var ticks:Array