Browse Source

模型

master
lxc 2 years ago
parent
commit
458f6d6122
  1. 23
      editor/js/menus/Menubar.File.js
  2. 7
      editor/js/menus/Menubar.Models.js

23
editor/js/menus/Menubar.File.js

@ -3,7 +3,7 @@ import * as THREE from 'three';
import { zipSync, strToU8 } from 'three/addons/libs/fflate.module.js';
import { UIPanel, UIRow, UIHorizontalRule } from '../libs/ui.js';
import { AddObjectCommand } from '../commands/AddObjectCommand.js';
function MenubarFile( editor ) {
const config = editor.config;
@ -31,12 +31,33 @@ function MenubarFile( editor ) {
if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
editor.clear();
initLight();
}
} );
options.add( option );
function initLight( ) {
const color = 0x222222;
const light = new THREE.AmbientLight(color);
light.name = '环境光源AmbientLight';
editor.execute(new AddObjectCommand(editor, light));
const color1 = 0xffffff;
const intensity = 1;
const directionalLight = new THREE.DirectionalLight(color1, intensity);
directionalLight.name = '平行光源DirectionalLight';
directionalLight.target.name = 'DirectionalLight Target';
directionalLight.position.set(5, 10, 7.5);
editor.execute(new AddObjectCommand(editor, directionalLight));
}
//
options.add( new UIHorizontalRule() );

7
editor/js/menus/Menubar.Models.js

@ -35,6 +35,7 @@ function MenubarModels(editor) {
let i = 0;
// Source code
let option = new UIRow();
@ -59,8 +60,10 @@ function MenubarModels(editor) {
let obj = object.children[0];
obj.name = '视频监控' + i++
obj.userData = { type: "camera", name: "camera" }
debugger
obj.userData = { type: "monitoring", name: "视频监控" }
obj.scale.x=0.08
obj.scale.y = 0.08
obj.scale.z = 0.08
// object.url="url"
editor.execute(new AddObjectCommand(editor, obj));

Loading…
Cancel
Save