You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let material = new THREE.MeshPhongMaterial({ color: '#ffff00' });
let material1 = new THREE.MeshPhongMaterial({ color: '#ffffff' });
let material2 = new THREE.MeshPhongMaterial({ color: '#00fff' });
function createPolygon(polygon){
import * as maptalks from 'maptalks-gl';
import {Map} from 'maptalks-gl';
import * as THREE from "three";
import { ThreeLayer } from 'maptalks.three';
let mapJson = {
"jsonVersion": "1.0",
"version": "1.0.0-rc.37",
"extent": {
"xmin": 116.31077070024332,
"ymin": 39.89915188371421,
"xmax": 116.48759952917067,
"ymax": 40.01652811695956
},
"options": {
"spatialReference": {},
"zoomable": true,
"draggable": true,
"center":{
"x": 116.402337,
"y": 39.92069,
},
"zoom": 16,
"bearing": 0,
"pitch": 60,
},
"layers": [
{
"type": "GroupGLLayer",
"id": "group",
"layers": [
{
"type": "TileLayer",
"id": "baseLayer",
"options": {
"urlTemplate":"http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7",
// "urlTemplate": 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
// "subdomains":['a', 'b', 'c', 'd'],
"name": "高德影像",
}
},
{
"type": "GLTFLayer",
"id": "gltfLayer",
"options": {
}
let map = new Map.fromJSON("map", mapJson);
let groupLayer = map.getLayer("group");
let gltfLayer = groupLayer.getLayer("gltfLayer");
var threeLayer = new ThreeLayer('t', {
forceRenderOnMoving: true,
forceRenderOnRotating: true,
animation: true
});
threeLayer.prepareToDraw = function (gl, scene, camera) {
camera.near = 0.0;
camera.far = 10000000;
var light = new THREE.DirectionalLight(0xffffff);
light.position.set(0, -10, 10).normalize();
scene.add(light);
scene.add(new THREE.AmbientLight('#fff', 0.3));
loadTexture();
let coordinates = [
[
[116.402337,39.92069],
[116.405248,39.920815],
[116.405194,39.918975],
[116.401906,39.918795],
[116.402337,39.92069]
]
]
createPolygon(new maptalks.Polygon(coordinates));
createWall(new maptalks.LineString(coordinates[0]));
};
threeLayer.addTo(groupLayer);
let material = new THREE.MeshPhongMaterial({ color: '#ffff00' });
let material1 = new THREE.MeshPhongMaterial({ color: '#ffffff' });
let material2 = new THREE.MeshPhongMaterial({ color: '#00fff' });
function createPolygon(polygon){
}
function createWall(lineString) {
}
function createRoad(lineString) {
}
function loadTexture(){
const textureLoader = new THREE.TextureLoader();
textureLoader.load("./wall.jpg", (texture) => {
texture.needsUpdate = true; //使用贴图时进行更新
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
// texture.repeat.set(0.002, 0.002);
texture.repeat.set(1, 1);
material.map = texture;
material.needsUpdate = true;
});
}
function animation(){
threeLayer._needsUpdate = !threeLayer._needsUpdate;
if (threeLayer._needsUpdate) {
threeLayer.redraw();
}
requestAnimationFrame(animation);
}
The text was updated successfully, but these errors were encountered: