fix(test):threejs

This commit is contained in:
李正学 2018-11-01 14:31:14 +08:00
commit 7a16585897
7 changed files with 73 additions and 61 deletions

View File

@ -10,8 +10,9 @@ module.exports = {
include: [
'src/**/*.js',
'test/**/*.js',
'node_modules/three/'
'node_modules/three/**/*.js'
],
exclude: [],
exclude: [
'node_modules/@babel/**/*.js'
]
}

View File

@ -26,8 +26,8 @@ const scene = new L7.Scene({
mapStyle: 'light', // 样式URL
center: [ 120.1243238, 30.27331571 ],
pitch: 0,
zoom: 19,
minZoom: 16
zoom: 10,
minZoom: 9
});
window.scene = scene;
scene.image.addImage('bike', './image/Bike.png');
@ -43,11 +43,18 @@ scene.on('load', () => {
})
.size(128.0)
.shape('image:bike')
.color('#0198BD')
.render();
});
$.get('./data/fence.json', data => {
scene.PolygonLayer({
zIndex: 3
})
.source(data)
.shape('fill')
.color('#0198BD')
.style({
stroke: 'rgb(255,255,255)',
strokeWidth: 0,
opacity: 1.0
opacity:0.8
})
.render();
});

View File

@ -2,9 +2,9 @@
* @Author: ThinkGIS
* @Date: 2018-06-08 11:19:06
* @Last Modified by: mikey.zhaopeng
* @Last Modified time: 2018-10-30 11:13:39
* @Last Modified time: 2018-11-01 11:50:43
*/
const Base = require('./base');
import Base from './base';
const Controller = require('./controller/index');
import { aProjectFlat } from '../geo/project';
export default class Source extends Base {

View File

@ -1,41 +1,43 @@
import 'three/src/polyfills.js';
export * from 'three/src/constants.js';
export { Scene } from 'three/src/scenes/Scene.js';
export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js';
export { CanvasTexture } from 'three/src/textures/CanvasTexture.js';
export { Object3D } from 'three/src/core/Object3D.js';
export { Points } from 'three/src/objects/Points.js';
export { LineSegments } from 'three/src/objects/LineSegments.js';
export { Mesh } from 'three/src/objects/Mesh.js';
export { Texture } from 'three/src/textures/Texture.js';
export { DirectionalLight } from 'three/src/lights/DirectionalLight.js';
export { AmbientLight } from 'three/src/lights/AmbientLight.js';
export { WebGLRenderTarget } from 'three/src/renderers/WebGLRenderTarget.js';
export { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js';
export { BufferGeometry } from 'three/src/core/BufferGeometry.js';
export { Raycaster } from 'three/src/core/Raycaster.js';
export { Matrix4 } from 'three/src/math/Matrix4.js';
export { Matrix3 } from 'three/src/math/Matrix3.js';
export { Line } from 'three/src/objects/Line.js';
export { LineLoop } from 'three/src/objects/LineLoop.js';
export { Vector4 } from 'three/src/math/Vector4.js';
export { Vector3 } from 'three/src/math/Vector3.js';
export { Vector2 } from 'three/src/math/Vector2.js';
export { TextureLoader } from 'three/src/loaders/TextureLoader.js';
export { LineDashedMaterial } from 'three/src/materials/LineDashedMaterial.js';
export { ShaderMaterial } from 'three/src/materials/ShaderMaterial.js';
export { PointsMaterial } from 'three/src/materials/PointsMaterial.js';
export { VideoTexture } from 'three/src/textures/VideoTexture.js';
export { DataTexture } from 'three/src/textures/DataTexture.js';
export {
Float64BufferAttribute,
Float32BufferAttribute,
Uint32BufferAttribute,
Int32BufferAttribute,
Uint16BufferAttribute,
Int16BufferAttribute,
Uint8ClampedBufferAttribute,
Uint8BufferAttribute,
Int8BufferAttribute,
BufferAttribute
} from 'three/src/core/BufferAttribute.js';
// import 'three/src/polyfills.js';
// export * from 'three/src/constants.js';
// export { Scene } from 'three/src/scenes/Scene.js';
// export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js';
// export { CanvasTexture } from 'three/src/textures/CanvasTexture.js';
// export { Object3D } from 'three/src/core/Object3D.js';
// export { Points } from 'three/src/objects/Points.js';
// export { LineSegments } from 'three/src/objects/LineSegments.js';
// export { Mesh } from 'three/src/objects/Mesh.js';
// export { Texture } from 'three/src/textures/Texture.js';
// export { DirectionalLight } from 'three/src/lights/DirectionalLight.js';
// export { AmbientLight } from 'three/src/lights/AmbientLight.js';
// export { WebGLRenderTarget } from 'three/src/renderers/WebGLRenderTarget.js';
// export { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js';
// export { BufferGeometry } from 'three/src/core/BufferGeometry.js';
// export { Raycaster } from 'three/src/core/Raycaster.js';
// export { Matrix4 } from 'three/src/math/Matrix4.js';
// export { Matrix3 } from 'three/src/math/Matrix3.js';
// export { Line } from 'three/src/objects/Line.js';
// export { LineLoop } from 'three/src/objects/LineLoop.js';
// export { Vector4 } from 'three/src/math/Vector4.js';
// export { Vector3 } from 'three/src/math/Vector3.js';
// export { Vector2 } from 'three/src/math/Vector2.js';
// export { TextureLoader } from 'three/src/loaders/TextureLoader.js';
// export { LineDashedMaterial } from 'three/src/materials/LineDashedMaterial.js';
// export { ShaderMaterial } from 'three/src/materials/ShaderMaterial.js';
// export { PointsMaterial } from 'three/src/materials/PointsMaterial.js';
// export { VideoTexture } from 'three/src/textures/VideoTexture.js';
// export { DataTexture } from 'three/src/textures/DataTexture.js';
// export {
// Float64BufferAttribute,
// Float32BufferAttribute,
// Uint32BufferAttribute,
// Int32BufferAttribute,
// Uint16BufferAttribute,
// Int16BufferAttribute,
// Uint8ClampedBufferAttribute,
// Uint8BufferAttribute,
// Int8BufferAttribute,
// BufferAttribute
// } from 'three/src/core/BufferAttribute.js';
export * from '../../build/Three.js';

View File

@ -10,11 +10,12 @@ export default class PolygonLayer extends Layer {
}
render() {
this.type = 'polygon';
const { opacity} = this.get('styleOptions');
this.init();
const source = this.layerSource;
const geometry = this.geometry = new THREE.BufferGeometry();
const lineMaterial = new LineMaterial({
u_opacity: 1.0
u_opacity: opacity
}
);
const buffer = this.buffer = new PolygonBuffer({
@ -34,8 +35,9 @@ export default class PolygonLayer extends Layer {
if (this.shape === 'line') {
polygonMesh = new THREE.LineSegments(geometry, lineMaterial);
} else {
const material = new PolygonMaterial({
u_opacity: 1.0
u_opacity: opacity
});
geometry.addAttribute('normal', new THREE.Float32BufferAttribute(attributes.normals, 3));
// geometry.addAttribute('faceUv', new THREE.Float32BufferAttribute(attributes.faceUv, 2));

View File

@ -1,5 +1,5 @@
import { expect } from 'chai';
import { LoadImage } from '../../../src/core/image';
import LoadImage from '../../../src/core/image';
describe('core LoadImage Test', function() {
it('test create', function() {

View File

@ -24,12 +24,12 @@ module.exports = {
}
}
},
// {
// test: /\.glsl$/,
// use: {
// loader: 'glsl-shaders-loader'
// }
// },
{
test: /\.glsl$/,
use: {
loader: 'glsl-shaders-loader'
}
},
{
test: /global\.js$/,
use: {