-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjsoncad_example_2.html
130 lines (122 loc) · 7.84 KB
/
jsoncad_example_2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<html>
<head>
<title>testviewer</title>
<script type="text/javascript" src="three70.js" ></script>
<script type="text/javascript" src="OrthographicTrackballControls.js" ></script>
<script type="text/javascript" src="potree.js" ></script>
<script type="text/javascript" src="BinaryLoader.js" ></script>
<script type="text/javascript" src="csg.js" ></script>
<script type="text/javascript" src="threecsg.js" ></script>
<script type="text/javascript" src="Arial Narrow_Regular.js" ></script>
<script type="text/javascript" src="openscad.js" ></script>
<script type="text/javascript" src="jsoncad_base.js" ></script>
<script type="text/javascript" src="jsoncad_parser.js" ></script>
<script type="text/javascript" src="jsoncad_annotate.js" ></script>
<script type="text/javascript" >
//JSCad Parsing JSON structure
var nodes = {
'GAZEBOS': {
'GAZEBO' : ['VOBJ', [1, null] , [ {x: 0 ,y: -6.5,z: 0 ,r1: {axis: 1,degrees: -90},r2: {axis: 0,degrees: 0} ,size: [.15, .15, .15]}
, {x: -100 ,y: 2.0 ,z: -50 ,r1: {axis: 1,degrees: -90},r2: {axis: 'y',degrees: 0},color: [0, 0, 1, 1],size: [.05, .05, .05]}
]
]
}
,'POSTS' : [ 'PIPE' ,[10,200, 1, null] , [ {x: 0 ,y: 80 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
, {x: 69.28 ,y: 40 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
, {x: 69.28 ,y: -40 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
, {x: 9.79 ,y: -80 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
, {x: -69.28 ,y: -40 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
, {x: -69.28 ,y: 40 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}
]
]
,'ROOF' : [ 'CONE' ,[ 120, 80, 120, 0, 1,null ], [ {x: 0 ,y: 0 ,z: 200 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
,'HUTSECTION' : {
'subtract' : {
'POST0' : [ 'PIPE' ,[ 100, 50 ,1, null] , [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
, 'POST1' : [ 'PIPE' ,[ 80 ,50 , 1, null] , [ {x: 0 ,y: 0 ,z: 10 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
, 'FLOOR' : [ 'CUBE' ,[50, 50 , 50 ] , [ {x: 100 ,y: 0 ,z: 35 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
}
}
,'GAZEBO' : {
'HUTSECTION' : ['VOBJ', [ .5,null] , [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
,'ROOF' : ['VOBJ', [ .5,null] , [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
,'POSTS' : ['VOBJ', [ .5,null] , [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0 ,degrees: 0 },r2: {axis: 0 ,degrees: 0 } ,size: [1,1,1],color: [1, 0, 1, 1]}]]
}
}
//THree.js Parsing JSON structure
var node3s = {
'veyron' : ['LOD3'
, ['loadurl3', 'obj/veyron/VeyronNoUv_bin.js' , { mats : ['Red' , 'Pure chrome' , 'Red metal' , 'Dark glass', 'Pure chrome', 'Pure chrome' , 'Red glass 50', 'Orange glass 50'], face : null, mmap : [] } , 1, null]
, [ {x: 100 ,y: -25, z: -20 ,rotation : [0, Math.PI - Math.PI /12 ,0] , scale: [.04, .04, .04]}]
]
,'gallardo' : ['LOD3'
, ['loadurl3', 'obj/gallardo/GallardoNoUv_bin.js' , { mats : [ 'Pure chrome', 'Black rough', 'White', 'Dark glass', 'Pure chrome' , 'Pure chrome' , 'Red glass 50' , 'Orange glass 50' ], face : null , mmap : []}, 1, null]
, [ {x:-38 ,y: -2.5,z: 10 ,rotation : [0, -Math.PI/9 ,-Math.PI/12] , scale: [.03, .03, .03]}]
]
,'camaro' : ['LOD3'
, ['loadurl3', 'obj/camaro/CamaroNoUv_bin.js' , { mats : [ 'Blue', 'Pure chrome', 'Pure chrome', 'Dark chrome', 'Light glass', 'Gray shiny', 'Black rough', 'Fullblack rough', 'Fullblack rough'], face : null , mmap : []}, 1, null]
, [ {x: -80,y: 6,z: 102 ,rotation : [ Math.PI/10, -Math.PI/2 , Math.PI/10] , scale: [.75,.75,.75]}]
]
};
// JSCad annoations that reside in 3d Scene space
var threeJSAnnotate=[
{x : -670 ,y : 80 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [3,28,51, 75 ] ,isx : 1 ,txy: [{x: 0,y: 15} ,{x: 0 ,y:15} ,{x : 0, y : 15} ,{x: 0,y:15} ] }
,{x : -200 ,y : 325 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [0, 3,75, 78 ] ,isx : 1 ,txy: [{x: 0,y: 15} ,{x: 0 ,y:15} ,{x : -2, y : 15} ,{x: 4,y:15} ] }
,{x : 230 ,y :-275 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [0,18,46, 84,120] ,isx : 0 ,txy: [{x:-15,y: 2} ,{x:-15 ,y: 2} ,{x :-15, y : 2} ,{x:-15,y: 2},{x:-15,y: 2} ] }
,{x : -255 ,y :-275 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [0, 4,15,112 ] ,isx : 0 ,txy: [{x:-15,y: 2} ,{x:-15 ,y: 2} ,{x :-15, y : 2} ,{x:-15,y: 2} ] }
,{x : -720 ,y : -50 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [2,23 ] ,isx : 0 ,txy: [{x:-15,y: 2} ,{x:-15 ,y: 2} ] }
,{x : -720 ,y :-275 , rz : 0 ,color : 0xff0000 ,fontsz : 7 ,scale: 5 ,line : [2, 8,16,23 ] ,isx : 0 ,txy: [{x:-15,y: 2} ,{x:-15 ,y: 2} ,{x :-15, y : 2} ,{x:-15,y: 2} ] }
];
//
// Images and text that front end the WebGL rendering DOM element
//
var headsUpDisplay = {
id : 'imageid'
, frame: 'acadtemplate1.png'
, etxt : [
{x : 1330 ,y : 580 , rz : -90 ,color : 'blue' ,fontsz : 52 ,scale: 1 ,strng : "XXX FRAME" }
,{x : 1410 ,y : 580 , rz : -90 ,color : 'blue' ,fontsz : 52 ,scale: 1 ,strng : "XXXX YYYYYYY " }
,{x : 1300 ,y : 650 , rz : 0 ,color : 'blue' ,fontsz : 14 ,scale: 1 ,strng : "Ima Notta P.E" }
,{x : 1375 ,y : 844 , rz : 0 ,color : 'blue' ,fontsz : 30 ,scale: 1 ,strng : "M-2" }
,{x : 100 ,y : 100 , rz : 0 ,color : 'deeppink' ,fontsz : 40 ,scale: 1 ,strng : "The Web is Alive... " }
,{x : 400 ,y : 144 , rz : 0 ,color : 'darkmagenta' ,fontsz : 60 ,scale: 1 ,strng : "With The Fun of OpenJSONCad!" }
,{x : 825 ,y : 250 , rz : 0 ,color : 'deepskyblue' ,fontsz : 30 ,scale: 1 ,strng : "(Dough I Hear... Is Very Near!)" }
]
};
//
// The entire set of options sent to JSCad/Three.js/SVG to render and view online
//
var options ={
this_ : null
,containerElm_ : document.getElementById("viewer")
,widthDefault_ : "1600px"
,heightDefault_ : "900px"
,width_ : "1600px"
,height_ : "900px"
,heightRatio_ : 16/9
,perspective_ : 45
,drawOptions_ : { lines : false, faces : true}
,defaultColor_ : [ 0, 0, 1 ,1]
,bgColor_ : [.93,.93,.93,1]
,drawFaces_ : true
,background_ : true
,drawLines_ : false
,csgScript_ : "jscad.jscad"
,headsUpDisplay_ : headsUpDisplay
,pointcloudName_ : "vol_total/cloud.js"
,threeJSEnvObjs_ : node3s
,threeJSAnnotate_ : threeJSAnnotate
,axisxyz_ : false
,camera_ : 'persp'
,renderer_ : 'webgl'
,controls_ : 'ortho'
};
var gViewer = null;
function document_ready(){ gViewer = new OpenJSONCad.Viewer( options); };
</script>
<script id="jscad.jscad" >function main() { return makeVirtualObject(nodes['GAZEBOS'] );}
</script>
</head>
<body onload="document_ready()" >
</body>
</html>