-
Notifications
You must be signed in to change notification settings - Fork 9
/
jsoncad_example_10.html
107 lines (98 loc) · 5.24 KB
/
jsoncad_example_10.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
<html>
<head>
<title>JSONCad Parser Example 1</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" >
// Three examples of calling a remove file to generate CSG objects
// EX5X calls gazebo.js twice to generate two Gazebo's each for a total of four offset 20 in the z axis
// EX5Y calls example005.jscad twice to generate two separate Gazebos for a total of two objects offest in x and z axis
// In theory (although i have not yet tested it this remote JSON call process could continue to call other files adinfinitum
//
var nodes = {
'TEST_LIST': {
'EX5X': ['GOBJ', ['GAZEBOS', 'gazebo.js','nodeext', 1, null] , [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0} ,color: [1, 0, 1, 1],size: [1, 1, 1]}
, {x: 0 ,y: 0 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0} ,color: [0, 1, 1, 1],size: [1, 1, 1]}
]
]
, 'EX5Y': ['GETF', ['example005', 'example005.jscad',null, .5, null] , [ {x: 0 ,y: 2.2,z: 40 ,r1: {axis: 1,degrees: -90},r2: {axis: 0,degrees: 0} ,size: [.15, .15, .15]}
, {x: -120 ,y: 7.25,z: -20 ,r1: {axis: 1,degrees: -90},r2: {axis: 'y',degrees: 0},color: [0, 0, 1, 1],size: [.05, .05, .05]}
]
]
}
}
// JSCad annoations that reside in 3d Scene space
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]}]
]
};
//
// 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_ : null
,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['TEST_LIST'] );}</script>
</head>
<body onload="document_ready()" >
</body>
</html>