mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-02-01 16:08:17 +00:00
删除光源和透视相机事件。
This commit is contained in:
parent
65848bb62d
commit
2f34f5306a
@ -32,14 +32,7 @@ import AddTorusKnotEvent from './menu/add/AddTorusKnotEvent';
|
||||
import AddTeaportEvent from './menu/add/AddTeaportEvent';
|
||||
import AddLatheEvent from './menu/add/AddLatheEvent';
|
||||
import AddSpriteEvent from './menu/add/AddSpriteEvent';
|
||||
import AddPointLightEvent from './menu/add/AddPointLightEvent';
|
||||
import AddSpotLightEvent from './menu/add/AddSpotLightEvent';
|
||||
import AddDirectionalLightEvent from './menu/add/AddDirectionalLightEvent';
|
||||
import AddHemisphereLightEvent from './menu/add/AddHemisphereLightEvent';
|
||||
import AddAmbientLightEvent from './menu/add/AddAmbientLightEvent';
|
||||
import AddRectAreaLightEvent from './menu/add/AddRectAreaLightEvent';
|
||||
import AddTextEvent from './menu/add/AddTextEvent';
|
||||
import AddPerspectiveCameraEvent from './menu/add/AddPerspectiveCameraEvent';
|
||||
|
||||
import ExportGeometryEvent from './menu/asset/ExportGeometryEvent';
|
||||
import ExportObjectEvent from './menu/asset/ExportObjectEvent';
|
||||
@ -108,14 +101,7 @@ function EventDispatcher(app) {
|
||||
new AddTeaportEvent(this.app),
|
||||
new AddLatheEvent(this.app),
|
||||
new AddSpriteEvent(this.app),
|
||||
new AddPointLightEvent(this.app),
|
||||
new AddSpotLightEvent(this.app),
|
||||
new AddDirectionalLightEvent(this.app),
|
||||
new AddHemisphereLightEvent(this.app),
|
||||
new AddAmbientLightEvent(this.app),
|
||||
new AddRectAreaLightEvent(this.app),
|
||||
new AddTextEvent(this.app),
|
||||
new AddPerspectiveCameraEvent(this.app),
|
||||
|
||||
new ExportGeometryEvent(this.app),
|
||||
new ExportObjectEvent(this.app),
|
||||
|
||||
@ -39,14 +39,6 @@ var EventList = [
|
||||
'mAddTeaport', // 添加茶壶
|
||||
'mAddLathe', // 添加花瓶
|
||||
'mAddSprite', // 添加精灵
|
||||
'mAddPointLight', // 添加点光源
|
||||
'mAddSpotLight', // 添加聚光灯
|
||||
'mAddDirectionalLight', // 添加平行光源
|
||||
'mAddHemisphereLight', // 添加半球光
|
||||
'mAddAmbientLight', // 添加环境光
|
||||
'mAddRectAreaLight', // 添加矩形光
|
||||
'mAddText', // 添加文本
|
||||
'mAddPerspectiveCamera', // 添加透视相机
|
||||
|
||||
'mExportGeometry', // 导出几何体
|
||||
'mExportObject', // 导出物体
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加环境光事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddAmbientLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddAmbientLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddAmbientLightEvent.prototype.constructor = AddAmbientLightEvent;
|
||||
|
||||
AddAmbientLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddAmbientLight.' + this.id, function () {
|
||||
_this.onAddAmbientLightEvent();
|
||||
});
|
||||
};
|
||||
|
||||
AddAmbientLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddAmbientLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddAmbientLightEvent.prototype.onAddAmbientLightEvent = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var color = 0xaaaaaa;
|
||||
|
||||
var light = new THREE.AmbientLight(color);
|
||||
light.name = '环境光' + ID++;
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddAmbientLightEvent;
|
||||
@ -1,45 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加平行光源事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddDirectionalLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddDirectionalLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddDirectionalLightEvent.prototype.constructor = AddDirectionalLightEvent;
|
||||
|
||||
AddDirectionalLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddDirectionalLight.' + this.id, function () {
|
||||
_this.onAddDirectionalLight();
|
||||
});
|
||||
};
|
||||
|
||||
AddDirectionalLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddDirectionalLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddDirectionalLightEvent.prototype.onAddDirectionalLight = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var color = 0xffffff;
|
||||
var intensity = 1;
|
||||
|
||||
var light = new THREE.DirectionalLight(color, intensity);
|
||||
light.name = '平行光' + ID;
|
||||
light.target.name = 'DirectionalLight ' + (ID++) + ' Target';
|
||||
light.castShadow = true;
|
||||
|
||||
light.position.set(5, 10, 7.5);
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddDirectionalLightEvent;
|
||||
@ -1,44 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加半球光事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddHemisphereLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddHemisphereLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddHemisphereLightEvent.prototype.constructor = AddHemisphereLightEvent;
|
||||
|
||||
AddHemisphereLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddHemisphereLight.' + this.id, function () {
|
||||
_this.onAddHemisphereLight();
|
||||
});
|
||||
};
|
||||
|
||||
AddHemisphereLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddHemisphereLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddHemisphereLightEvent.prototype.onAddHemisphereLight = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var skyColor = 0x00aaff;
|
||||
var groundColor = 0xffaa00;
|
||||
var intensity = 1;
|
||||
|
||||
var light = new THREE.HemisphereLight(skyColor, groundColor, intensity);
|
||||
light.name = '半球光' + ID++;
|
||||
|
||||
light.position.set(0, 10, 0);
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddHemisphereLightEvent;
|
||||
@ -1,38 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加透视相机事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddPerspectiveCameraEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddPerspectiveCameraEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddPerspectiveCameraEvent.prototype.constructor = AddPerspectiveCameraEvent;
|
||||
|
||||
AddPerspectiveCameraEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddPerspectiveCamera.' + this.id, function () {
|
||||
_this.onAddPerspectiveCamera();
|
||||
});
|
||||
};
|
||||
|
||||
AddPerspectiveCameraEvent.prototype.stop = function () {
|
||||
this.app.on('mAddPerspectiveCamera.' + this.id, null);
|
||||
};
|
||||
|
||||
AddPerspectiveCameraEvent.prototype.onAddPerspectiveCamera = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var camera = new THREE.PerspectiveCamera(50, 1, 1, 10000);
|
||||
camera.name = '透视相机' + ID++;
|
||||
|
||||
editor.execute(new AddObjectCommand(camera));
|
||||
};
|
||||
|
||||
export default AddPerspectiveCameraEvent;
|
||||
@ -1,45 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
import PointLight from '../../../object/light/PointLight';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加点光源事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddPointLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddPointLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddPointLightEvent.prototype.constructor = AddPointLightEvent;
|
||||
|
||||
AddPointLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddPointLight.' + this.id, function () {
|
||||
_this.onAddPointLight();
|
||||
});
|
||||
};
|
||||
|
||||
AddPointLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddPointLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddPointLightEvent.prototype.onAddPointLight = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var color = 0xffffff;
|
||||
var intensity = 1;
|
||||
var distance = 0;
|
||||
|
||||
var light = new PointLight(color, intensity, distance);
|
||||
light.name = '点光源' + ID++;
|
||||
light.position.y = 5;
|
||||
light.castShadow = true;
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddPointLightEvent;
|
||||
@ -1,45 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加矩形光事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddRectAreaLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddRectAreaLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddRectAreaLightEvent.prototype.constructor = AddRectAreaLightEvent;
|
||||
|
||||
AddRectAreaLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddRectAreaLight.' + this.id, function () {
|
||||
_this.onAddHemisphereLight();
|
||||
});
|
||||
};
|
||||
|
||||
AddRectAreaLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddRectAreaLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddRectAreaLightEvent.prototype.onAddHemisphereLight = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var color = 0xffffff;
|
||||
var intensity = 1;
|
||||
var width = 20;
|
||||
var height = 10;
|
||||
|
||||
var light = new THREE.RectAreaLight(color, intensity, width, height);
|
||||
light.name = '矩形光' + ID++;
|
||||
|
||||
light.position.set(0, 6, 0);
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddRectAreaLightEvent;
|
||||
@ -1,49 +0,0 @@
|
||||
import MenuEvent from '../MenuEvent';
|
||||
import AddObjectCommand from '../../../command/AddObjectCommand';
|
||||
|
||||
var ID = 1;
|
||||
|
||||
/**
|
||||
* 添加聚光灯事件
|
||||
* @author tengge / https://github.com/tengge1
|
||||
* @param {*} app
|
||||
*/
|
||||
function AddSpotLightEvent(app) {
|
||||
MenuEvent.call(this, app);
|
||||
}
|
||||
|
||||
AddSpotLightEvent.prototype = Object.create(MenuEvent.prototype);
|
||||
AddSpotLightEvent.prototype.constructor = AddSpotLightEvent;
|
||||
|
||||
AddSpotLightEvent.prototype.start = function () {
|
||||
var _this = this;
|
||||
this.app.on('mAddSpotLight.' + this.id, function () {
|
||||
_this.onAddSpotLight();
|
||||
});
|
||||
};
|
||||
|
||||
AddSpotLightEvent.prototype.stop = function () {
|
||||
this.app.on('mAddSpotLight.' + this.id, null);
|
||||
};
|
||||
|
||||
AddSpotLightEvent.prototype.onAddSpotLight = function () {
|
||||
var editor = this.app.editor;
|
||||
|
||||
var color = 0xffffff;
|
||||
var intensity = 1;
|
||||
var distance = 0;
|
||||
var angle = Math.PI * 0.1;
|
||||
var penumbra = 0;
|
||||
|
||||
var light = new THREE.SpotLight(color, intensity, distance, angle, penumbra);
|
||||
|
||||
light.name = '聚光灯' + ID;
|
||||
light.target.name = 'SpotLight ' + (ID++) + ' Target';
|
||||
light.castShadow = true;
|
||||
|
||||
light.position.set(5, 10, 7.5);
|
||||
|
||||
editor.execute(new AddObjectCommand(light));
|
||||
};
|
||||
|
||||
export default AddSpotLightEvent;
|
||||
Loading…
x
Reference in New Issue
Block a user