Skip to content

Commit

Permalink
fix: use setUniform for material showOutline set
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloTheDrunk committed Jan 7, 2025
1 parent d283702 commit c46772f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Converter/convertToTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function setTileFromTiledLayer(tile, tileLayer) {
}

if (__DEBUG__) {
tile.material.showOutline = tileLayer.showOutline || false;
tile.material.setUniform('showOutline', tileLayer.showOutline || false);
}

if (tileLayer.isGlobeLayer) {
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Shader/TileFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void main() {
gl_FragColor.rgb = mix(gl_FragColor.rgb, color.rgb, color.a);
}

#if defined(DEBUG)
#if DEBUG == 1
if (showOutline) {
#pragma unroll_loop
for ( int i = 0; i < NUM_CRS; i ++) {
Expand Down
8 changes: 4 additions & 4 deletions utils/debug/TileDebug.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let selectedNode;
function selectTileAt(view, mouseOrEvt, showInfo = true) {
if (selectedNode) {
selectedNode.material.overlayAlpha = 0;
selectedNode.material.showOutline = view.tileLayer.showOutline;
selectedNode.material.setUniform('showOutline', view.tileLayer.showOutline);
view.notifyChange(selectedNode);
}

Expand All @@ -44,7 +44,7 @@ function selectTileAt(view, mouseOrEvt, showInfo = true) {
console.info(selectedNode);
}
selectedNode.material.overlayAlpha = 0.5;
selectedNode.material.showOutline = true;
selectedNode.material.setUniform('showOutline', true);
view.notifyChange(selectedNode);
}
return selectedNode;
Expand Down Expand Up @@ -79,7 +79,7 @@ export default function createTileDebugUI(datDebugTool, view, layer, debugInstan
layer.showOutline = newValue;

applyToNodeFirstMaterial(view, layer.object3d, layer, (material) => {
material.showOutline = newValue;
material.setUniform('showOutline', newValue);
});
});

Expand Down Expand Up @@ -235,7 +235,7 @@ export default function createTileDebugUI(datDebugTool, view, layer, debugInstan
circle.style.width = `${object.size}px`;
circle.style.height = `${object.size}px`;
circle.innerHTML = `${Math.floor(object.size)} px`;
circle.style.left = `${coords.x - object.size * 0.5}px`;
circle.style.left = `${coords.x - object.size * 0.5}px`;
circle.style.top = `${coords.y - object.size * 0.5}px`;
})
.onComplete(removeAnimationRequester)
Expand Down

0 comments on commit c46772f

Please sign in to comment.