Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
29d65126
Commit
29d65126
authored
Sep 14, 2015
by
Amanda Ghassaei
Browse files
starting to add nucleotides
parent
d11ee567
Changes
6
Show whitespace changes
Inline
Side-by-side
js/cells/GIKCell.js
View file @
29d65126
...
...
@@ -41,8 +41,14 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
callback
(
parts
);
});
}
else
if
(
lattice
.
get
(
"
partType
"
)
==
"
dnaStraight
"
)
{
require
([
'
gikPartLowPoly
'
],
function
(
PartSubclass
){
parts
.
push
(
new
PartSubclass
(
self
.
index
.
x
,
self
));
require
([
'
dnaStraightPart
'
],
function
(
PartSubclass
){
for
(
var
i
=
0
;
i
<
16
;
i
++
){
parts
.
push
(
new
PartSubclass
(
self
.
index
.
x
,
self
,
{
vertIndex
:
i
,
isBridge
:
false
}));
}
parts
.
push
(
new
PartSubclass
(
self
.
index
.
x
,
self
,
{
isBridge
:
true
}));
callback
(
parts
);
});
}
...
...
js/main.js
View file @
29d65126
...
...
@@ -108,6 +108,7 @@ require.config({
kennyTeqHighResPart
:
'
parts/KennyTeqHighResPart
'
,
samTeqPart
:
'
parts/SamTeqPart
'
,
legoPart
:
'
parts/LegoPart
'
,
dnaStraightPart
:
'
parts/DNAStraightPart
'
,
//materials
materials
:
'
materials/DMAMaterials
'
,
...
...
@@ -212,7 +213,8 @@ require.config({
gikEndPartLowPolySTL
:
'
assets/stls/parts/GIKEndPartLowPoly.stl
'
,
kennyTeqPartSTL
:
'
assets/stls/parts/KennyTeqPart.stl
'
,
kennyTeqPartHighResSTL
:
'
assets/stls/parts/KennyTeqPartHighRes.stl
'
,
samTeqPartSTL
:
'
assets/stls/parts/SamTeqPart.stl
'
samTeqPartSTL
:
'
assets/stls/parts/SamTeqPart.stl
'
,
legoBrickSTL
:
'
assets/stls/parts/legoBrick1x1.stl
'
},
...
...
js/parts/DMAPart.js
View file @
29d65126
...
...
@@ -6,7 +6,7 @@
define
([
'
underscore
'
,
'
three
'
],
function
(
_
,
THREE
){
function
DMAPart
(
index
,
parent
)
{
function
DMAPart
(
index
,
parent
,
options
)
{
this
.
parentCell
=
parent
;
this
.
index
=
index
;
this
.
mesh
=
this
.
_buildMesh
();
...
...
js/parts/DNAStraightPart.js
0 → 100644
View file @
29d65126
/**
* Created by aghassaei on 9/14/15.
*/
define
([
'
underscore
'
,
'
stlLoader
'
,
'
gikPart
'
],
function
(
_
,
THREE
,
GIKPart
){
var
zScale
=
1
/
8
;
var
unitGeo
=
new
THREE
.
BoxGeometry
(
0.2
,
0.2
,
zScale
);
var
bridgeGeo
=
new
THREE
.
BoxGeometry
(
0.3
,
0.4
,
zScale
);
var
bridgeMaterial
=
new
THREE
.
MeshLambertMaterial
({
color
:
'
#000000
'
});
var
nuclMaterials
=
{
a
:
new
THREE
.
MeshLambertMaterial
({
color
:
"
#cc00cc
"
}),
t
:
new
THREE
.
MeshLambertMaterial
({
color
:
"
#ff6600
"
}),
c
:
new
THREE
.
MeshLambertMaterial
({
color
:
"
#66ffff
"
}),
g
:
new
THREE
.
MeshLambertMaterial
({
color
:
"
#00ff33
"
})
};
function
DNAStraightPart
(
index
,
parent
,
options
){
this
.
_isBridge
=
options
.
isBridge
;
if
(
!
this
.
_isBridge
){
this
.
_vertIndex
=
options
.
vertIndex
;
if
(
!
options
.
nuclType
)
this
.
_nuclType
=
this
.
_randomNucleotide
();
else
this
.
_nuclType
=
options
.
nuclType
;
}
GIKPart
.
call
(
this
,
index
,
parent
,
options
);
}
DNAStraightPart
.
prototype
=
Object
.
create
(
GIKPart
.
prototype
);
DNAStraightPart
.
prototype
.
_randomNucleotide
=
function
(){
var
rand
=
Math
.
random
();
if
(
rand
<
0.25
)
return
'
a
'
;
if
(
rand
<
0.5
)
return
'
t
'
;
if
(
rand
<
0.75
)
return
'
c
'
;
return
'
g
'
;
};
DNAStraightPart
.
prototype
.
_getGeometry
=
function
(){
if
(
this
.
_isBridge
)
return
bridgeGeo
;
return
unitGeo
;
};
DNAStraightPart
.
prototype
.
getMaterial
=
function
(
returnTHREEObject
){
if
(
returnTHREEObject
)
{
if
(
this
.
_isBridge
)
return
bridgeMaterial
;
return
nuclMaterials
[
this
.
_nuclType
];
}
return
GIKPart
.
prototype
.
getMaterial
.
call
(
this
,
returnTHREEObject
);
};
DNAStraightPart
.
prototype
.
_translatePart
=
function
(
mesh
){
if
(
this
.
_isBridge
){
mesh
.
translateX
(
0.15
+
0.2
);
mesh
.
translateZ
(
this
.
parentCell
.
zScale
()
/
2
-
zScale
/
2
);
return
mesh
;
}
var
xOffset
=
0.1
;
var
yOffset
=
-
0.1
;
if
(
this
.
index
==
1
)
{
xOffset
=
-
0.1
;
yOffset
=
0.1
;
}
mesh
.
position
.
set
(
xOffset
,
yOffset
,
this
.
parentCell
.
zScale
()
/
2
-
zScale
/
2
-
this
.
_vertIndex
*
zScale
);
return
mesh
;
};
return
DNAStraightPart
;
});
\ No newline at end of file
js/parts/LegoPart.js
View file @
29d65126
...
...
@@ -3,7 +3,7 @@
*/
define
([
'
underscore
'
,
'
stlLoader
'
,
'
gikPart
'
,
'
bin!
../assets/stls/parts/
legoBrick
1x1.stl
'
],
function
(
_
,
THREE
,
GIKPart
,
stl
){
define
([
'
underscore
'
,
'
stlLoader
'
,
'
gikPart
'
,
'
bin!legoBrick
STL
'
],
function
(
_
,
THREE
,
GIKPart
,
stl
){
var
loader
=
new
THREE
.
STLLoader
();
var
unitGeo
=
preProcessGeo
(
loader
.
parse
(
stl
));
...
...
js/plists/PList.js
View file @
29d65126
...
...
@@ -254,11 +254,11 @@ define(['three'], function(THREE){
dnaBricks
:
{
name
:
"
DNA Bricks
"
,
parts
:
{
dnaLego
:
{
name
:
"
Lego Blocks
"
},
dnaStraight
:
{
name
:
"
DNA (straight chains)
"
},
dnaLego
:
{
name
:
"
Lego Blocks
"
}
},
aspectRatio
:
new
THREE
.
Vector3
(
1
,
1
,
1
),
...
...
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