Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
任建锋
yt
Commits
3466b741
Commit
3466b741
authored
Jul 04, 2018
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
public scene ...
parent
6b4db8fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
3 deletions
+154
-3
package_20180704192946.json
.history/package_20180704192946.json
+14
-0
SceneManager_20180704192909.ts
.history/src/manager/SceneManager_20180704192909.ts
+135
-0
SceneManager.js
dist/manager/SceneManager.js
+1
-1
package.json
package.json
+1
-1
SceneManager.ts
src/manager/SceneManager.ts
+3
-1
No files found.
.history/package_20180704192946.json
0 → 100644
View file @
3466b741
{
"name"
:
"yt"
,
"version"
:
"1.0.12"
,
"description"
:
"基于Babylonjs的3D框架"
,
"main"
:
"./dist/index.js"
,
"types"
:
"./types/index.d.ts"
,
"scripts"
:
{
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"tc"
:
"git+ssh://git@gitlab2.dui88.com:clq/tc.git#1.0"
}
}
\ No newline at end of file
.history/src/manager/SceneManager_20180704192909.ts
0 → 100644
View file @
3466b741
export
class
SceneManager
{
public
stage
;
public
scene
:
BABYLON
.
Scene
;
public
canvas
;
public
engine
;
private
static
instance
:
SceneManager
;
public
static
get
ins
():
SceneManager
{
if
(
!
this
.
instance
)
{
this
.
instance
=
new
SceneManager
();
}
return
this
.
instance
;
}
constructor
(){
this
.
canvas
=
document
.
querySelector
(
"#renderCanvas"
);
// this.engine = new BABYLON.Engine(this.canvas, true);
this
.
engine
=
new
BABYLON
.
Engine
(
this
.
canvas
,
true
,
{
deterministicLockstep
:
true
,
lockstepMaxSteps
:
2
});
var
createScene
=
function
(){
{
var
scene
=
new
BABYLON
.
Scene
(
this
.
engine
);
//下面的代码是为了设置微信上面的touch事件兼容
var
n
=
scene
.
_onPointerUp
,
o
=
scene
.
_onPointerDown
,
r
=
scene
.
_onPointerMove
,
a
=
BABYLON
.
Tools
.
GetPointerPrefix
();
this
.
canvas
.
removeEventListener
(
a
+
"move"
,
r
),
this
.
canvas
.
removeEventListener
(
a
+
"down"
,
o
),
window
.
removeEventListener
(
a
+
"up"
,
n
),
scene
.
_onPointerUp
=
function
(
e
)
{
void
0
!==
e
.
pointerId
&&
n
(
e
)
}
,
scene
.
_onPointerDown
=
function
(
e
)
{
void
0
!==
e
.
pointerId
&&
o
(
e
)
}
,
scene
.
_onPointerMove
=
function
(
e
)
{
void
0
!==
e
.
pointerId
&&
r
(
e
)
}
,
this
.
canvas
.
addEventListener
(
a
+
"move"
,
scene
.
_onPointerMove
,
!
1
),
this
.
canvas
.
addEventListener
(
a
+
"down"
,
scene
.
_onPointerDown
,
!
1
),
window
.
addEventListener
(
a
+
"up"
,
scene
.
_onPointerUp
,
!
1
);
//下面的代码是为了设置微信上面的touch事件兼容
var
camera
=
new
BABYLON
.
FreeCamera
(
"baseCamera"
,
new
BABYLON
.
Vector3
(
0
,
0
,
0
),
scene
);
this
.
engine
.
setHardwareScalingLevel
(
0.6
)
return
scene
;
}
}.
bind
(
this
)
this
.
scene
=
createScene
();
this
.
engine
.
runRenderLoop
(
function
()
{
this
.
scene
.
render
();
TWEEN
.
update
();
}.
bind
(
this
));
window
.
addEventListener
(
"resize"
,
function
()
{
this
.
engine
.
resize
();
}.
bind
(
this
));
}
/* public get stage(): any {
return this._stage;
}*/
/* public get scene(): BABYLON.Scene {
return this._scene;
}
public get canvas(): any {
return this._canvas;
}
public get engine(): any {
return this._engine;
} */
public
change
(
display
){
/* console.log(display)
var i;
for(i in display){
console.log(display[i])
}*/
/* for(var l of SceneManager.ins.scene.meshes){
l.dispose()
} */
SceneManager
.
ins
.
scene
.
meshes
=
[]
/*var j;
for(j in SceneManager.ins.stage){
console.log(SceneManager.ins.stage[j])
if( SceneManager.ins.stage[j]){
if(SceneManager.ins.stage[j].getChildMeshes){
SceneManager.ins.stage[j].getChildMeshes(false,(child)=>{
child.dispose();
});
}
if( SceneManager.ins.stage[j].dispose){
SceneManager.ins.stage[j].dispose()
}
}
}*/
SceneManager
.
ins
.
stage
=
display
;
}
/* public change(module){
// console.log(this._stage._children)
if(this.stage._children){
this.stage._children.forEach(function (child) {
this.stage.removeChild(child)
child.dispose()
}.bind(this))
}
this.stage.addChild(module)
// console.log( this._scene)
}*/
}
\ No newline at end of file
dist/manager/SceneManager.js
View file @
3466b741
...
@@ -6,7 +6,7 @@ var SceneManager = /** @class */ (function () {
...
@@ -6,7 +6,7 @@ var SceneManager = /** @class */ (function () {
// this.engine = new BABYLON.Engine(this.canvas, true);
// this.engine = new BABYLON.Engine(this.canvas, true);
this
.
engine
=
new
BABYLON
.
Engine
(
this
.
canvas
,
true
,
{
this
.
engine
=
new
BABYLON
.
Engine
(
this
.
canvas
,
true
,
{
deterministicLockstep
:
true
,
deterministicLockstep
:
true
,
lockstepMaxSteps
:
0
lockstepMaxSteps
:
2
});
});
var
createScene
=
function
()
{
var
createScene
=
function
()
{
{
{
...
...
package.json
View file @
3466b741
{
{
"name"
:
"yt"
,
"name"
:
"yt"
,
"version"
:
"1.0.1
1
"
,
"version"
:
"1.0.1
2
"
,
"description"
:
"基于Babylonjs的3D框架"
,
"description"
:
"基于Babylonjs的3D框架"
,
"main"
:
"./dist/index.js"
,
"main"
:
"./dist/index.js"
,
"types"
:
"./types/index.d.ts"
,
"types"
:
"./types/index.d.ts"
,
...
...
src/manager/SceneManager.ts
View file @
3466b741
...
@@ -21,10 +21,12 @@ export class SceneManager{
...
@@ -21,10 +21,12 @@ export class SceneManager{
// this.engine = new BABYLON.Engine(this.canvas, true);
// this.engine = new BABYLON.Engine(this.canvas, true);
this
.
engine
=
new
BABYLON
.
Engine
(
this
.
canvas
,
true
,
{
this
.
engine
=
new
BABYLON
.
Engine
(
this
.
canvas
,
true
,
{
deterministicLockstep
:
true
,
deterministicLockstep
:
true
,
lockstepMaxSteps
:
4
lockstepMaxSteps
:
2
});
});
var
createScene
=
function
(){
var
createScene
=
function
(){
{
{
var
scene
=
new
BABYLON
.
Scene
(
this
.
engine
);
var
scene
=
new
BABYLON
.
Scene
(
this
.
engine
);
//下面的代码是为了设置微信上面的touch事件兼容
//下面的代码是为了设置微信上面的touch事件兼容
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment