Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BlocksCAD
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
BlocksCAD
Commits
212f554e
Commit
212f554e
authored
Oct 01, 2015
by
Juan Blanco Segleau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added axes labels and z axis hashmarks
parent
9389d378
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
202 additions
and
173 deletions
+202
-173
blockscad/threeViewer.js
blockscad/threeViewer.js
+28
-1
blockscad/viewer_compressed.js
blockscad/viewer_compressed.js
+174
-172
No files found.
blockscad/threeViewer.js
View file @
212f554e
...
@@ -39,7 +39,7 @@ Blockscad.Viewer = function(containerelement, width, height, initialdepth) {
...
@@ -39,7 +39,7 @@ Blockscad.Viewer = function(containerelement, width, height, initialdepth) {
this
.
light
.
castShadow
=
true
;
this
.
light
.
castShadow
=
true
;
this
.
light
.
position
.
copy
(
this
.
camera
.
position
);
this
.
light
.
position
.
copy
(
this
.
camera
.
position
);
this
.
scene
.
add
(
this
.
light
);
this
.
scene
.
add
(
this
.
light
);
this
.
axes
=
this
.
buildAxes
(
10
00
);
this
.
axes
=
this
.
buildAxes
(
5
00
);
this
.
GridPlane
=
this
.
buildGridPlane
(
500
);
this
.
GridPlane
=
this
.
buildGridPlane
(
500
);
this
.
scene
.
add
(
this
.
axes
);
this
.
scene
.
add
(
this
.
axes
);
this
.
scene
.
add
(
this
.
GridPlane
);
this
.
scene
.
add
(
this
.
GridPlane
);
...
@@ -146,6 +146,7 @@ Blockscad.Viewer.prototype = {
...
@@ -146,6 +146,7 @@ Blockscad.Viewer.prototype = {
return
axis
;
return
axis
;
},
},
buildAxes
:
function
(
length
){
buildAxes
:
function
(
length
){
length
=
length
/
2
;
var
axes
=
new
THREE
.
Object3D
();
var
axes
=
new
THREE
.
Object3D
();
axes
.
name
=
"
axes
"
;
axes
.
name
=
"
axes
"
;
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
length
,
0
,
0
),
0xFF0000
,
false
,
1
));
// +X
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
length
,
0
,
0
),
0xFF0000
,
false
,
1
));
// +X
...
@@ -154,6 +155,20 @@ Blockscad.Viewer.prototype = {
...
@@ -154,6 +155,20 @@ Blockscad.Viewer.prototype = {
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
length
,
0
),
0x00FF00
,
true
,
1
));
// -Y
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
-
length
,
0
),
0x00FF00
,
true
,
1
));
// -Y
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
0
,
length
),
0x0000FF
,
false
,
1
));
// +Z
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
0
,
length
),
0x0000FF
,
false
,
1
));
// +Z
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
0
,
-
length
),
0x0000FF
,
true
,
1
));
// -Z
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
0
,
-
length
),
0x0000FF
,
true
,
1
));
// -Z
//draw X character
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
5
+
length
+
5
,
-
5
,
0
),
new
THREE
.
Vector3
(
5
+
length
+
5
,
5
,
0
),
0x000000
,
false
,
1
));
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
5
+
length
+
5
,
-
5
,
0
),
new
THREE
.
Vector3
(
-
5
+
length
+
5
,
5
,
0
),
0x000000
,
false
,
1
));
//draw Y character
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
0
+
length
,
0
),
new
THREE
.
Vector3
(
0
,
5
+
length
,
0
),
0x000000
,
false
,
1
));
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
5
+
length
,
0
),
new
THREE
.
Vector3
(
5
,
10
+
length
,
0
),
0x000000
,
false
,
1
));
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0
,
5
+
length
,
0
),
new
THREE
.
Vector3
(
-
5
,
10
+
length
,
0
),
0x000000
,
false
,
1
));
//draw Z character
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
5
,
0
,
0
+
length
+
5
),
new
THREE
.
Vector3
(
5
,
0
,
0
+
length
+
5
),
0x000000
,
false
,
1
));
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
5
,
0
,
0
+
length
+
5
),
new
THREE
.
Vector3
(
5
,
0
,
10
+
length
+
5
),
0x000000
,
false
,
1
));
axes
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
5
,
0
,
10
+
length
+
5
),
new
THREE
.
Vector3
(
-
5
,
0
,
10
+
length
+
5
),
0x000000
,
false
,
1
));
return
axes
;
return
axes
;
},
},
buildGridPlane
:
function
(
size
){
buildGridPlane
:
function
(
size
){
...
@@ -167,19 +182,31 @@ Blockscad.Viewer.prototype = {
...
@@ -167,19 +182,31 @@ Blockscad.Viewer.prototype = {
for
(
var
x
=
1
;
x
<=
size
;
x
++
)
{
for
(
var
x
=
1
;
x
<=
size
;
x
++
)
{
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xDDDDDD
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xDDDDDD
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xDDDDDD
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xDDDDDD
,
false
,
1
));
//draw hashmarks on z axis
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
0.5
,
-
0.5
,
x
),
new
THREE
.
Vector3
(
0.5
,
0.5
,
x
),
0xDDDDDD
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
0.5
,
-
0.5
,
x
),
new
THREE
.
Vector3
(
-
0.5
,
0.5
,
x
),
0xDDDDDD
,
false
,
1
));
}
}
for
(
var
x
=-
size
;
x
<
0
;
x
+=
10
)
{
for
(
var
x
=-
size
;
x
<
0
;
x
+=
10
)
{
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xC4C4C4
,
false
,
1
));
//draw mayor hashmarks on -z axis
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
1
,
-
1
,
x
),
new
THREE
.
Vector3
(
1
,
1
,
x
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
1
,
-
1
,
x
),
new
THREE
.
Vector3
(
-
1
,
1
,
x
),
0xC4C4C4
,
false
,
1
));
}
}
for
(
var
x
=
10
;
x
<=
size
;
x
+=
10
)
{
for
(
var
x
=
10
;
x
<=
size
;
x
+=
10
)
{
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
x
,
-
size
,
0
),
new
THREE
.
Vector3
(
x
,
size
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
size
,
x
,
0
),
new
THREE
.
Vector3
(
size
,
x
,
0
),
0xC4C4C4
,
false
,
1
));
//draw mayor hashmarks on z axis
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
-
1
,
-
1
,
x
),
new
THREE
.
Vector3
(
1
,
1
,
x
),
0xC4C4C4
,
false
,
1
));
GridPlane
.
add
(
this
.
buildLine
(
new
THREE
.
Vector3
(
1
,
-
1
,
x
),
new
THREE
.
Vector3
(
-
1
,
1
,
x
),
0xC4C4C4
,
false
,
1
));
}
}
return
GridPlane
;
return
GridPlane
;
}
}
};
};
Blockscad
.
Viewer
.
getGeometryVertice
=
function
(
threeGeometry
,
vertice_position
){
Blockscad
.
Viewer
.
getGeometryVertice
=
function
(
threeGeometry
,
vertice_position
){
threeGeometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
vertice_position
.
x
,
vertice_position
.
y
,
vertice_position
.
z
)
);
threeGeometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
vertice_position
.
x
,
vertice_position
.
y
,
vertice_position
.
z
)
);
return
threeGeometry
.
vertices
.
length
-
1
;
return
threeGeometry
.
vertices
.
length
-
1
;
...
...
blockscad/viewer_compressed.js
View file @
212f554e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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