From 2235e86a6bb9fe896779ce409a0f7ef9f5475c78 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Mon, 25 Mar 2019 20:18:35 +0800 Subject: [PATCH 1/2] fix(code): shaderpass --- src/core/engine/composer.js | 2 +- src/layer/render/heatmap/heatmap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/engine/composer.js b/src/core/engine/composer.js index 0f40b99806..df4b1aa65f 100755 --- a/src/core/engine/composer.js +++ b/src/core/engine/composer.js @@ -3,7 +3,7 @@ import * as THREE from '../three'; import CopyShader from './CopyShader'; -import ShaderPass from './ShaderPass'; +import ShaderPass from './shaderpass'; import MaskPass, {ClearMaskPass} from './MaskPass'; /** diff --git a/src/layer/render/heatmap/heatmap.js b/src/layer/render/heatmap/heatmap.js index 732cd89df5..fcd30d8081 100644 --- a/src/layer/render/heatmap/heatmap.js +++ b/src/layer/render/heatmap/heatmap.js @@ -3,7 +3,7 @@ import { createColorRamp } from '../../../geom/buffer/heatmap/heatmap'; import { HeatmapIntensityMaterial, HeatmapColorizeMaterial } from '../../../geom/material/heatmapMateial'; // import Renderpass from '../../../core/engine/renderpass.bak'; import RenderPass from '../../../core/engine/renderpass'; -import ShaderPass from '../../../core/engine/ShaderPass'; +import ShaderPass from '../../../core/engine/shaderpass'; import EffectComposer from '../../../core/engine/EffectComposer'; import * as THREE from '../../../core/three'; From b8517610afccbaac59fcb9e52d25612d776183ab Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Mon, 25 Mar 2019 20:22:22 +0800 Subject: [PATCH 2/2] fix(core): file name --- src/core/engine/composer.js | 6 +- .../engine/{CopyShader.js => copy-shader.js} | 0 .../{EffectComposer.js => effect-composer.js} | 0 src/core/engine/{MaskPass.js => mask-pass.js} | 0 .../engine/{renderpass.js => render-pass.js} | 0 .../engine/{ShaderPass.js => shader-pass.js} | 0 src/core/engine/shaderPass.js | 74 ------------------- src/layer/render/heatmap/heatmap.js | 6 +- 8 files changed, 6 insertions(+), 80 deletions(-) rename src/core/engine/{CopyShader.js => copy-shader.js} (100%) rename src/core/engine/{EffectComposer.js => effect-composer.js} (100%) rename src/core/engine/{MaskPass.js => mask-pass.js} (100%) rename src/core/engine/{renderpass.js => render-pass.js} (100%) rename src/core/engine/{ShaderPass.js => shader-pass.js} (100%) delete mode 100644 src/core/engine/shaderPass.js diff --git a/src/core/engine/composer.js b/src/core/engine/composer.js index df4b1aa65f..0575cfe3f2 100755 --- a/src/core/engine/composer.js +++ b/src/core/engine/composer.js @@ -2,9 +2,9 @@ /* eslint-disable */ import * as THREE from '../three'; -import CopyShader from './CopyShader'; -import ShaderPass from './shaderpass'; -import MaskPass, {ClearMaskPass} from './MaskPass'; +import CopyShader from './copy-shader'; +import ShaderPass from './shader-pass'; +import MaskPass, {ClearMaskPass} from './mask-pass'; /** * @author alteredq / http://alteredqualia.com/ diff --git a/src/core/engine/CopyShader.js b/src/core/engine/copy-shader.js similarity index 100% rename from src/core/engine/CopyShader.js rename to src/core/engine/copy-shader.js diff --git a/src/core/engine/EffectComposer.js b/src/core/engine/effect-composer.js similarity index 100% rename from src/core/engine/EffectComposer.js rename to src/core/engine/effect-composer.js diff --git a/src/core/engine/MaskPass.js b/src/core/engine/mask-pass.js similarity index 100% rename from src/core/engine/MaskPass.js rename to src/core/engine/mask-pass.js diff --git a/src/core/engine/renderpass.js b/src/core/engine/render-pass.js similarity index 100% rename from src/core/engine/renderpass.js rename to src/core/engine/render-pass.js diff --git a/src/core/engine/ShaderPass.js b/src/core/engine/shader-pass.js similarity index 100% rename from src/core/engine/ShaderPass.js rename to src/core/engine/shader-pass.js diff --git a/src/core/engine/shaderPass.js b/src/core/engine/shaderPass.js deleted file mode 100644 index 6e91880e81..0000000000 --- a/src/core/engine/shaderPass.js +++ /dev/null @@ -1,74 +0,0 @@ -// jscs:disable -/* eslint-disable */ - -import * as THREE from '../three'; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -var ShaderPass = function( shader, textureID ) { - - this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse"; - - if ( shader instanceof THREE.ShaderMaterial ) { - - this.uniforms = shader.uniforms; - - this.material = shader; - - } - else if ( shader ) { - - this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); - - this.material = new THREE.ShaderMaterial( { - - defines: shader.defines || {}, - uniforms: this.uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - - } ); - - } - - this.renderToScreen = false; - - this.enabled = true; - this.needsSwap = true; - this.clear = true; - - - this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); - this.scene = new THREE.Scene(); - - this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); - this.scene.add( this.quad ); - -}; - -ShaderPass.prototype = { - - render: function( renderer, writeBuffer, readBuffer, delta ) { - if ( this.uniforms[ this.textureID ] ) { - this.uniforms[ this.textureID ].value = readBuffer.texture; - - } - renderer.autoClear = false; - this.quad.material = this.material; - - if ( this.renderToScreen ) { - renderer.render( this.scene, this.camera ); - - } else { - - renderer.render( this.scene, this.camera, writeBuffer, this.clear ); - - } - renderer.autoClear = true; - } - -}; - -export default ShaderPass; diff --git a/src/layer/render/heatmap/heatmap.js b/src/layer/render/heatmap/heatmap.js index fcd30d8081..b035f38942 100644 --- a/src/layer/render/heatmap/heatmap.js +++ b/src/layer/render/heatmap/heatmap.js @@ -2,9 +2,9 @@ import HeatmapBuffer from '../../../geom/buffer/heatmap/heatmap'; import { createColorRamp } from '../../../geom/buffer/heatmap/heatmap'; import { HeatmapIntensityMaterial, HeatmapColorizeMaterial } from '../../../geom/material/heatmapMateial'; // import Renderpass from '../../../core/engine/renderpass.bak'; -import RenderPass from '../../../core/engine/renderpass'; -import ShaderPass from '../../../core/engine/shaderpass'; -import EffectComposer from '../../../core/engine/EffectComposer'; +import RenderPass from '../../../core/engine/render-pass'; +import ShaderPass from '../../../core/engine/shader-pass'; +import EffectComposer from '../../../core/engine/effect-composer'; import * as THREE from '../../../core/three'; export function drawHeatmap(layer) {