Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
df631ee6
Commit
df631ee6
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
threeView edits
parent
5eae1456
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/main.js
+5
-2
5 additions, 2 deletions
js/main.js
js/models/fillGeometry.js
+0
-8
0 additions, 8 deletions
js/models/fillGeometry.js
js/views/threeView.js
+11
-7
11 additions, 7 deletions
js/views/threeView.js
with
16 additions
and
17 deletions
js/main.js
+
5
−
2
View file @
df631ee6
...
...
@@ -8,12 +8,15 @@ $(function(){
three
=
new
ThreeView
();
//init models and views
fillGeometry
=
new
FillGeometry
();
//
init a
singleton
, add to global scope
new
ImportView
({
model
:
window
.
fillGeometry
});
var
fillGeometry
=
new
FillGeometry
();
//singleton
new
ImportView
({
model
:
fillGeometry
});
lattice
=
new
Lattice
();
three
.
setFillGeometry
(
fillGeometry
);
//window.fillGeometry.set({geometry:"stuff"});
setupNavBar
();
...
...
This diff is collapsed.
Click to expand it.
js/models/fillGeometry.js
+
0
−
8
View file @
df631ee6
...
...
@@ -24,17 +24,13 @@ FillGeometry = Backbone.Model.extend({
this
.
on
(
"
change:mesh
"
,
this
.
makeBoundingBoxHelper
);
this
.
on
(
"
change:orientation
"
,
this
.
updateBoundingBox
);
this
.
on
(
"
change:geometry
"
,
this
.
buildNewMesh
);
this
.
on
(
"
change:mesh change:orientation
"
,
this
.
render
);
this
.
buildNewMesh
();
},
buildNewMesh
:
function
(){
if
(
this
.
previous
(
"
mesh
"
))
three
.
scene
.
remove
(
this
.
previous
(
"
mesh
"
));
//remove current mesh from scene
this
.
set
({
orientation
:
this
.
defaults
.
orientation
},
{
silent
:
true
});
//restore defaults
var
mesh
=
new
THREE
.
Mesh
(
this
.
get
(
"
geometry
"
),
this
.
get
(
"
material
"
));
three
.
scene
.
add
(
mesh
);
this
.
set
({
mesh
:
mesh
});
//send new geometry out to workers
...
...
@@ -61,10 +57,6 @@ FillGeometry = Backbone.Model.extend({
this
.
trigger
(
"
change:boundingBoxHelper
"
);
},
render
:
function
(){
three
.
render
();
},
rotate
:
function
(
axis
){
var
orientation
=
this
.
get
(
"
orientation
"
);
var
mesh
=
this
.
get
(
"
mesh
"
);
...
...
This diff is collapsed.
Click to expand it.
js/views/threeView.js
+
11
−
7
View file @
df631ee6
...
...
@@ -4,11 +4,6 @@ ThreeView = Backbone.View.extend({
el
:
"
#threeContainer
"
,
events
:
{
},
camera
:
new
THREE
.
PerspectiveCamera
(
60
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1000
),
scene
:
new
THREE
.
Scene
(),
renderer
:
new
THREE
.
WebGLRenderer
({
antialias
:
false
}),
...
...
@@ -50,7 +45,6 @@ ThreeView = Backbone.View.extend({
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
}
);
for
(
var
i
=
0
;
i
<
500
;
i
++
)
{
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
(
Math
.
random
()
-
0.5
)
*
1000
;
mesh
.
position
.
y
=
(
Math
.
random
()
-
0.5
)
*
1000
;
...
...
@@ -58,10 +52,20 @@ ThreeView = Backbone.View.extend({
mesh
.
updateMatrix
();
mesh
.
matrixAutoUpdate
=
false
;
this
.
scene
.
add
(
mesh
);
}
},
setFillGeometry
:
function
(
fillGeometry
){
var
self
=
this
;
fillGeometry
.
bind
(
"
change:geometry
"
,
function
(){
if
(
fillGeometry
.
previous
(
"
mesh
"
))
self
.
scene
.
remove
(
fillGeometry
.
previous
(
"
mesh
"
));
self
.
render
();
});
this
.
scene
.
add
(
fillGeometry
.
get
(
"
mesh
"
));
fillGeometry
.
bind
(
"
change:mesh change:orientation
"
,
this
.
render
);
this
.
render
();
},
onWindowResize
:
function
(){
this
.
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
this
.
camera
.
updateProjectionMatrix
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment