Skip to content

Commit

Permalink
Add light map filter example
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Karl committed Sep 11, 2017
1 parent 530c92a commit 50d41de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Binary file added examples/images/lightmap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion examples/index.html
Expand Up @@ -96,6 +96,7 @@
.add('fish2', 'images/displacement_fish2.png')
.add('fish3', 'images/displacement_fish3.png')
.add('fish4', 'images/displacement_fish4.png')
.add('lightmap', 'images/lightmap.png')
.load(function(loader, resources) {
init(resources);
app.start();
Expand Down Expand Up @@ -337,6 +338,12 @@
folder.addColor(colorReplaceFilter, 'newColor');
folder.add(colorReplaceFilter, 'epsilon', 0, 1);

var lightmap = resources.lightmap.texture;
var simpleLightmapFilter = new PIXI.filters.SimpleLightmapFilter(lightmap, [0.5, 0.5, 0.5, 0.5]);
simpleLightmapFilter.enabled = false;
folder = gui.addFolder('SimpleLightmapFilter');
folder.add(simpleLightmapFilter, 'enabled').onChange(trackEvent.bind(folder));

// Apply filters
var filterAreaPadding = 4;
var filterArea = new PIXI.Rectangle();
Expand All @@ -358,7 +365,8 @@
tiltshiftFilter,
shockwaveFilter,
bulgepinchFilter,
colorReplaceFilter
colorReplaceFilter,
simpleLightmapFilter
];

window.addEventListener('resize', resize);
Expand Down Expand Up @@ -386,6 +394,9 @@
displacementSprite.width = width;
displacementSprite.height = height;

lightmap.width = width;
lightmap.height = height;

app.renderer.resize(
width,
height
Expand Down

0 comments on commit 50d41de

Please sign in to comment.