Merge branch 'composer' into 'master'

fix(code): shaderpass



See merge request !21
This commit is contained in:
thinkinggis 2019-03-25 20:23:24 +08:00
commit 4b560b9c13
8 changed files with 6 additions and 80 deletions

View File

@ -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/

View File

View File

@ -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;

View File

@ -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) {