mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
1、性能插件从编辑器移动到播放器。
2、法线sea3d加载有bug。
This commit is contained in:
parent
4b8e0304f4
commit
7bd2ffd1df
@ -83,14 +83,6 @@ function Editor(app) {
|
||||
// 编辑器控件
|
||||
this.controls = new THREE.EditorControls(this.camera, this.app.viewport.container.dom);
|
||||
|
||||
// 性能控件
|
||||
this.stats = new Stats();
|
||||
this.stats.dom.style.position = 'absolute';
|
||||
this.stats.dom.style.left = '8px';
|
||||
this.stats.dom.style.top = '8px';
|
||||
this.stats.dom.style.zIndex = 'initial';
|
||||
this.app.viewport.container.dom.appendChild(this.stats.dom);
|
||||
|
||||
// 碰撞检测
|
||||
this.raycaster = new THREE.Raycaster();
|
||||
this.mouse = new THREE.Vector2();
|
||||
|
||||
@ -24,15 +24,11 @@ AnimateEvent.prototype.stop = function () {
|
||||
};
|
||||
|
||||
AnimateEvent.prototype.onAnimate = function () {
|
||||
this.app.editor.stats.begin();
|
||||
|
||||
var deltaTime = this.clock.getDelta();
|
||||
|
||||
this.app.call('animate', this, this.clock, deltaTime);
|
||||
this.app.call('render', this);
|
||||
|
||||
this.app.editor.stats.end();
|
||||
|
||||
if (this.running) {
|
||||
requestAnimationFrame(this.onAnimate.bind(this));
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ SEA3DLoader.prototype.load = function (url, options) {
|
||||
var obj = new THREE.Object3D();
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.require('SEA3D', true).then(() => {
|
||||
this.require('SEA3D').then(() => {
|
||||
var loader = new THREE.SEA3D({
|
||||
autoPlay: true, // Auto play animations
|
||||
container: obj, // Container to add models
|
||||
|
||||
@ -38,7 +38,7 @@ Player.prototype = Object.create(UI.Control.prototype);
|
||||
Player.prototype.constructor = Player;
|
||||
|
||||
Player.prototype.render = function () {
|
||||
(UI.create({
|
||||
var control = UI.create({
|
||||
xtype: 'div',
|
||||
parent: this.parent,
|
||||
id: 'player',
|
||||
@ -47,7 +47,17 @@ Player.prototype.render = function () {
|
||||
style: {
|
||||
display: 'none'
|
||||
}
|
||||
})).render();
|
||||
});
|
||||
|
||||
control.render();
|
||||
|
||||
// 性能控件
|
||||
this.stats = new Stats();
|
||||
this.stats.dom.style.position = 'absolute';
|
||||
this.stats.dom.style.left = '8px';
|
||||
this.stats.dom.style.top = '8px';
|
||||
this.stats.dom.style.zIndex = 'initial';
|
||||
control.dom.appendChild(this.stats.dom);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -156,6 +166,8 @@ Player.prototype.animate = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stats.begin();
|
||||
|
||||
var deltaTime = this.clock.getDelta();
|
||||
|
||||
this.event.update(this.clock, deltaTime);
|
||||
@ -164,6 +176,8 @@ Player.prototype.animate = function () {
|
||||
this.animation.update(this.clock, deltaTime);
|
||||
this.physics.update(this.clock, deltaTime);
|
||||
|
||||
this.stats.end();
|
||||
|
||||
requestAnimationFrame(this.animate.bind(this));
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user