mirror of https://gitee.com/antv-l7/antv-l7
feat(layer): style 增加blending 配置项
This commit is contained in:
parent
5a1cfded2d
commit
53f726872a
|
@ -43,7 +43,6 @@ return {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(pointOnCircle(10))
|
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
mapStyle: 'light', // 样式URL
|
mapStyle: 'light', // 样式URL
|
||||||
|
@ -76,7 +75,7 @@ scene.on('loaded', () => {
|
||||||
circleLayer.setData(pointOnCircle(timestamp / 1000));
|
circleLayer.setData(pointOnCircle(timestamp / 1000));
|
||||||
requestAnimationFrame(animateMarker);
|
requestAnimationFrame(animateMarker);
|
||||||
}
|
}
|
||||||
//animateMarker(0);
|
animateMarker(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
const layerText = scene.PointLayer({
|
const layerText = scene.PointLayer({
|
||||||
|
|
|
@ -45,7 +45,8 @@ scene.on('loaded', () => {
|
||||||
.style({
|
.style({
|
||||||
stroke: 'rgb(255,255,255)',
|
stroke: 'rgb(255,255,255)',
|
||||||
strokeWidth: 0,
|
strokeWidth: 0,
|
||||||
opacity: 1.0
|
opacity: 1.0,
|
||||||
|
bending:'additive'
|
||||||
})
|
})
|
||||||
.render();
|
.render();
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
|
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
|
||||||
<script src="./assets/jquery-3.2.1.min.js"></script>
|
<script src="./assets/jquery-3.2.1.min.js"></script>
|
||||||
<script src="./assets/dat.gui.min.js"></script>
|
<script src="./assets/dat.gui.min.js"></script>
|
||||||
<script src=" https://gw.alipayobjects.com/os/antv/pkg/_antv.l7-1.1.10/dist/l7.min.js"></script>
|
<script src="https://gw.alipayobjects.com/os/antv/pkg/_antv.l7-1.2.0-beta.1/build/l7.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var buildLayer =null;
|
var buildLayer =null;
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
|
|
|
@ -43,7 +43,8 @@ export default class Layer extends Base {
|
||||||
strokeWidth: 1.0,
|
strokeWidth: 1.0,
|
||||||
opacity: 1.0,
|
opacity: 1.0,
|
||||||
strokeOpacity: 1.0,
|
strokeOpacity: 1.0,
|
||||||
texture: false
|
texture: false,
|
||||||
|
blending: 'normal'
|
||||||
},
|
},
|
||||||
destroyed: false,
|
destroyed: false,
|
||||||
// 选中时的配置项
|
// 选中时的配置项
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
import * as THREE from '../../core/three';
|
import * as THREE from '../../core/three';
|
||||||
|
const blendingEnum = {
|
||||||
|
normal: 'NormalBlending',
|
||||||
|
additive: 'AdditiveBlending',
|
||||||
|
subtractive: 'SubtractiveBlending'
|
||||||
|
};
|
||||||
export default class Material extends THREE.ShaderMaterial {
|
export default class Material extends THREE.ShaderMaterial {
|
||||||
setUniformsValue(name, value) {
|
setUniformsValue(name, value) {
|
||||||
if (!this.uniforms[name]) { return; }
|
if (!this.uniforms[name]) { return; }
|
||||||
|
@ -26,4 +31,7 @@ export default class Material extends THREE.ShaderMaterial {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setBending(type) {
|
||||||
|
this.blending = THREE[blendingEnum[type]] || THREE.NormalBlending;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default function DrawLine(layerData, layer) {
|
||||||
ANIMATE: false,
|
ANIMATE: false,
|
||||||
DASHLINE: style.lineType === 'dash'
|
DASHLINE: style.lineType === 'dash'
|
||||||
});
|
});
|
||||||
|
lineMaterial.setBending(style.blending);
|
||||||
const lineMesh = new THREE.Mesh(geometry, lineMaterial);
|
const lineMesh = new THREE.Mesh(geometry, lineMaterial);
|
||||||
if (animateOptions.enable) {
|
if (animateOptions.enable) {
|
||||||
layer.scene.startAnimate();
|
layer.scene.startAnimate();
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default function drawCircle(layerData, layer) {
|
||||||
u_stroke_opacity: style.strokeOpacity
|
u_stroke_opacity: style.strokeOpacity
|
||||||
});
|
});
|
||||||
material.depthTest = false;
|
material.depthTest = false;
|
||||||
|
material.setBending(style.blending);
|
||||||
const fillMesh = new THREE.Mesh(geometry, material);
|
const fillMesh = new THREE.Mesh(geometry, material);
|
||||||
aPosition.length = 0;
|
aPosition.length = 0;
|
||||||
aPackedData.length = 0;
|
aPackedData.length = 0;
|
||||||
|
|
|
@ -43,6 +43,7 @@ export default function DrawFill(layerData, layer) {
|
||||||
});
|
});
|
||||||
material.setDefinesvalue('SHAPE', true);
|
material.setDefinesvalue('SHAPE', true);
|
||||||
material.depthTest = false;
|
material.depthTest = false;
|
||||||
|
material.setBending(style.blending);
|
||||||
const fillMesh = new THREE.Mesh(geometry, material);
|
const fillMesh = new THREE.Mesh(geometry, material);
|
||||||
if (style.stroke !== 'none') {
|
if (style.stroke !== 'none') {
|
||||||
// 是否绘制边界
|
// 是否绘制边界
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import * as THREE from '../../../core/three';
|
import * as THREE from '../../../core/three';
|
||||||
import * as PointBuffer from '../../../geom/buffer/point/index';
|
import * as PointBuffer from '../../../geom/buffer/point/index';
|
||||||
import PointMaterial from '../../../geom/material/pointMaterial';
|
import PointMaterial from '../../../geom/material/pointMaterial';
|
||||||
|
|
||||||
export default function DrawNormal(layerData, layer) {
|
export default function DrawNormal(layerData, layer) {
|
||||||
const geometry = new THREE.BufferGeometry();
|
const geometry = new THREE.BufferGeometry();
|
||||||
const style = layer.get('styleOptions');
|
const style = layer.get('styleOptions');
|
||||||
|
@ -20,7 +21,8 @@ export default function DrawNormal(layerData, layer) {
|
||||||
}, {
|
}, {
|
||||||
SHAPE: false,
|
SHAPE: false,
|
||||||
TEXCOORD_0: false
|
TEXCOORD_0: false
|
||||||
});
|
}, style);
|
||||||
|
material.setBending(style.blending);
|
||||||
const strokeMesh = new THREE.Points(geometry, material);
|
const strokeMesh = new THREE.Points(geometry, material);
|
||||||
return strokeMesh;
|
return strokeMesh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue