Skip to content

Commit c78905d

Browse files
author
Nikos M
committed
0.4 support parallel processing/refactor/optimizations
1 parent e7af68c commit c78905d

43 files changed

Lines changed: 1036 additions & 10272 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/MOD3.min.js

Lines changed: 2 additions & 4968 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/mod3.bundle.js

Lines changed: 2 additions & 4968 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/mod3.three.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dependencies

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ SRC =[]
2121

2222
# core
2323
./src/MOD3.js
24-
./src/util/ModConstant.js
24+
25+
./src/math/ModConstant.js
26+
./src/math/XMath.js
27+
./src/math/Range.js
28+
./src/math/Phase.js
29+
./src/math/Point.js
30+
./src/math/Matrix.js
31+
./src/math/Vector3.js
32+
./src/math/Matrix4.js
33+
2534
./src/core/WorkerInterface.js
26-
./src/util/XMath.js
27-
./src/util/Range.js
28-
./src/util/Phase.js
29-
./src/core/Point.js
30-
./src/core/Matrix.js
31-
./src/core/Vector3.js
32-
./src/core/Matrix4.js
3335
./src/core/VertexProxy.js
3436
./src/core/FaceProxy.js
3537
./src/core/MeshProxy.js
3638
./src/core/Modifier.js
37-
./src/plugins/Library3d.js
38-
./src/ModifierStack.js
39+
./src/core/Factory.js
40+
./src/core/ModifierStack.js
3941

4042
# 3rd-party
4143
# https://github.com/josephg/noisejs
@@ -64,16 +66,16 @@ SRC =[]
6466
./src/plugins/J3D/Mesh.js
6567
./src/plugins/J3D/Library.js
6668

67-
# Support for Copperlicht
68-
./src/plugins/Copperlicht/Vertex.js
69-
./src/plugins/Copperlicht/Mesh.js
70-
./src/plugins/Copperlicht/Library.js
71-
7269
# Support for CubicVR.js
7370
./src/plugins/CubicVR/Vertex.js
7471
./src/plugins/CubicVR/Mesh.js
7572
./src/plugins/CubicVR/Library.js
7673

74+
# Support for Copperlicht
75+
./src/plugins/Copperlicht/Vertex.js
76+
./src/plugins/Copperlicht/Mesh.js
77+
./src/plugins/Copperlicht/Library.js
78+
7779
# Support for Pre3D
7880
./src/plugins/Pre3D/Vertex.js
7981
./src/plugins/Pre3D/Mesh.js
@@ -112,24 +114,24 @@ DOC ={}
112114
@ # end block
113115

114116
# Minify the Package (map of lists)
115-
#MINIFY ={}
116-
#
117-
# # Options for Node UglifyJS Compiler (if used, default), (mangle and compress)
118-
# "UGLIFY" =[]
119-
# -m -c
120-
# @ # end block
121-
#
122-
# # Options for Java Closure Compiler (if used)
123-
# "CLOSURE" =[]
124-
# --language_in=ECMASCRIPT5_STRICT
125-
# @ # end block
126-
#
127-
# # Options for Java YUI Compressor Compiler (if used)
128-
# "YUI" =[]
129-
# --preserve-semi
130-
# @ # end block
131-
#
132-
#@ # end block
117+
MINIFY ={}
118+
119+
# Options for Node UglifyJS Compiler (if used, default), (mangle and compress)
120+
"UGLIFY" =[]
121+
-m -c
122+
@ # end block
123+
124+
# Options for Java Closure Compiler (if used)
125+
"CLOSURE" =[]
126+
--language_in=ECMASCRIPT5_STRICT
127+
@ # end block
128+
129+
# Options for Java YUI Compressor Compiler (if used)
130+
"YUI" =[]
131+
--preserve-semi
132+
@ # end block
133+
134+
@ # end block
133135

134136
OUT =
135137
./build/mod3.min.js

dependencies-three

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ SRC =[]
2121

2222
# core
2323
./src/MOD3.js
24-
./src/util/ModConstant.js
24+
25+
./src/math/ModConstant.js
26+
./src/math/XMath.js
27+
./src/math/Range.js
28+
./src/math/Phase.js
29+
./src/math/Point.js
30+
./src/math/Matrix.js
31+
./src/math/Vector3.js
32+
./src/math/Matrix4.js
33+
2534
./src/core/WorkerInterface.js
26-
./src/util/XMath.js
27-
./src/util/Range.js
28-
./src/util/Phase.js
29-
./src/core/Point.js
30-
./src/core/Matrix.js
31-
./src/core/Vector3.js
32-
./src/core/Matrix4.js
3335
./src/core/VertexProxy.js
3436
./src/core/FaceProxy.js
3537
./src/core/MeshProxy.js
3638
./src/core/Modifier.js
37-
./src/plugins/Library3d.js
38-
./src/ModifierStack.js
39+
./src/core/Factory.js
40+
./src/core/ModifierStack.js
3941

4042
# 3rd-party
4143
# https://github.com/josephg/noisejs

examples/Three/Bend.html

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,29 @@
8181

8282
container.addEventListener( 'mousedown', onDocumentMouseDown, false );
8383

84-
mstack=new MOD3.ModifierStack(MOD3.LibraryThree,cube);
85-
bend=new MOD3.Bend();
86-
bend.setAngle(0);
87-
bend.force=0;
88-
bend.offset=0.5;
89-
bend.switchAxes=true;
90-
bend.constraint=MOD3.ModConstant.LEFT;
91-
mstack.addModifier(bend);
92-
var tobj={angle:Math.PI/4,force:1.2};
84+
mstack = new MOD3.ModifierStack( MOD3.LibraryThree, cube ).worker( true );
85+
86+
bend = new MOD3.Bend( );
87+
bend.setAngle( 0 );
88+
bend.force = 0;
89+
bend.offset = 0.5;
90+
bend.switchAxes = true;
91+
bend.constraint = MOD3.ModConstant.LEFT;
92+
93+
mstack.addModifier( bend );
94+
95+
var tobj = {angle:Math.PI/4,force:1.2};
9396
new TWEEN.Tween(tobj).to({force:-1.2},5000).onUpdate(function(){
9497
bend.setAngle(this.angle);
95-
bend.force=this.force;
96-
mstack.apply();}).start();
98+
bend.force = this.force;
99+
mstack.apply(/*function(){
100+
mstack.mod.update( );
101+
}*/);
102+
}).onComplete(function(){
103+
//console.log('dispose worker thread');
104+
// dispose worker thread
105+
mstack.worker( false );
106+
}).start();
97107
}
98108

99109
function onDocumentMouseDown( event ) {

examples/Three/Bloat.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,20 @@
7979

8080
container.addEventListener( 'mousedown', onDocumentMouseDown, false );
8181

82-
mstack=new MOD3.ModifierStack(MOD3.LibraryThree,cube);
83-
mod=new MOD3.Bloat();
84-
mod.setRadius(0);
85-
mstack.addModifier(mod);
82+
mstack = new MOD3.ModifierStack( MOD3.LibraryThree, cube ).worker( true );
83+
84+
mod = new MOD3.Bloat( );
85+
mod.setRadius( 0 );
86+
mstack.addModifier( mod );
87+
8688
var tobj={radius:0};
8789
new TWEEN.Tween(tobj).to({radius:100},5000).onUpdate(function(){
8890
mod.setRadius(this.radius);
89-
mstack.apply();}).start();
91+
mstack.apply();}).onComplete(function(){
92+
//console.log('dispose worker thread');
93+
// dispose worker thread
94+
mstack.worker( false );
95+
}).start();
9096
}
9197

9298
function onDocumentMouseDown( event ) {

examples/Three/Break.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,21 @@
7979

8080
container.addEventListener( 'mousedown', onDocumentMouseDown, false );
8181

82-
mstack=new MOD3.ModifierStack(MOD3.LibraryThree,cube);
83-
mod=new MOD3.Break(0,0);
84-
mod.angle=Math.PI/4;
85-
mstack.addModifier(mod);
82+
mstack = new MOD3.ModifierStack( MOD3.LibraryThree, cube ).worker( true );
83+
84+
mod = new MOD3.Break( 0,0 );
85+
mod.angle = Math.PI/4;
86+
mstack.addModifier( mod );
87+
8688
var tobj={offset:0,angle:0};
8789
new TWEEN.Tween(tobj).to({offset:0.5,angle:Math.PI/2},5000).onUpdate(function(){
8890
mod.offset=this.offset;
8991
mod.angle=this.angle;
90-
mstack.apply();}).start();
92+
mstack.apply();}).onComplete(function(){
93+
//console.log('dispose worker thread');
94+
// dispose worker thread
95+
mstack.worker( false );
96+
}).start();
9197
}
9298

9399
function onDocumentMouseDown( event ) {

examples/Three/DisplaceMap.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,21 @@
109109
displacemap.style.zIndex = 10;
110110
container.appendChild( displacemap );
111111

112-
mstack=new MOD3.ModifierStack(MOD3.LibraryThree,cube);
113-
mod=new MOD3.DisplaceMap( displaceData.data, displaceData.width, displaceData.height );
112+
mstack = new MOD3.ModifierStack( MOD3.LibraryThree, cube ).worker( true );
113+
114+
mod = new MOD3.DisplaceMap( displaceData.data, displaceData.width, displaceData.height );
114115
mod.offset = 128;
115116
mstack.addModifier( mod );
117+
116118
var tobj={force:-1.5};
117119
new TWEEN.Tween(tobj).to({force:1.5}, 5000).onUpdate(function(){
118-
mod.force=this.force;
119-
mstack.apply();
120-
}).start();
120+
mod.force = this.force;
121+
mstack.apply( );
122+
}).onComplete(function(){
123+
//console.log('dispose worker thread');
124+
// dispose worker thread
125+
mstack.worker( false );
126+
}).start();
121127
}
122128

123129
function onDocumentMouseDown( event ) {

examples/Three/Noise.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,21 @@
7979

8080
container.addEventListener( 'mousedown', onDocumentMouseDown, false );
8181

82-
mstack=new MOD3.ModifierStack(MOD3.LibraryThree,cube);
83-
mod=new MOD3.Noise(20);
82+
mstack = new MOD3.ModifierStack( MOD3.LibraryThree, cube ).worker( true );
83+
84+
mod = new MOD3.Noise( 20 );
8485
mod.constraintAxes(MOD3.ModConstant.X | MOD3.ModConstant.Y);
85-
mstack.addModifier(mod);
86+
mstack.addModifier( mod );
87+
8688
var tobj={force:0};
8789
new TWEEN.Tween(tobj).to({force:200},5000).onUpdate(function(){
8890
//mod.force=this.force;
8991
mstack.apply();
90-
}).start();
92+
}).onComplete(function(){
93+
//console.log('dispose worker thread');
94+
// dispose worker thread
95+
mstack.worker( false );
96+
}).start();
9197
}
9298

9399
function onDocumentMouseDown( event ) {

0 commit comments

Comments
 (0)