@@ -30,39 +30,40 @@ const view = viewer.createView({
30
30
31
31
// Position the View's Camera
32
32
33
- view . camera . eye = [ 0 , - 5 , 20 ] ;
34
- view . camera . look = [ 0 , - 5 , 0 ] ;
35
- view . camera . up = [ 0 , 1 , 0 ] ;
33
+ view . camera . eye = [ 10 , 20 , 15 ] ;
34
+ view . camera . look = [ 0 , 0 , 0 ] ;
35
+ view . camera . up = [ 0 , 0 , 1 ] ;
36
+
36
37
37
38
// Add a CameraControl to interactively control the View's Camera with keyboard,
38
39
// mouse and touch input
39
40
40
41
const cameraControl = new xeokit . cameracontrol . CameraControl ( view , { } ) ;
41
42
42
- // Create a SceneModel to hold geometry and materials
43
+ // Within the Scene, create a SceneModel to hold geometry and materials for our model
43
44
44
45
const sceneModel = scene . createModel ( {
45
- id : "demoModel"
46
+ id : "demoModel"
46
47
} ) ;
47
48
48
49
// Create a box-shaped SceneGeometry, which we'll reuse for the tabletop and legs.
49
50
50
51
sceneModel . createGeometry ( {
51
- id : "demoBoxGeometry" ,
52
- primitive : xeokit . constants . TrianglesPrimitive ,
53
- positions : [
54
- 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , 1 , 1 , 1 , - 1 , - 1 , 1 ,
55
- - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 1 , - 1 , - 1 , - 1 , 1 , - 1 , - 1 , 1 , - 1 , 1 , - 1 , - 1 , 1 , 1 ,
56
- - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 1 , - 1 , 1 , 1 , - 1
57
- ] ,
58
- indices : [
59
- 0 , 1 , 2 , 0 , 2 , 3 , // front
60
- 4 , 5 , 6 , 4 , 6 , 7 , // right
61
- 8 , 9 , 10 , 8 , 10 , 11 , // top
62
- 12 , 13 , 14 , 12 , 14 , 15 , // left
63
- 16 , 17 , 18 , 16 , 18 , 19 , // bottom
64
- 20 , 21 , 22 , 20 , 22 , 23
65
- ]
52
+ id : "demoBoxGeometry" ,
53
+ primitive : xeokit . constants . TrianglesPrimitive ,
54
+ positions : [
55
+ 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , 1 , 1 , 1 , - 1 , - 1 , 1 ,
56
+ - 1 , - 1 , 1 , 1 , - 1 , 1 , 1 , - 1 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 1 , - 1 , - 1 , - 1 , 1 , - 1 , - 1 , 1 , - 1 , 1 , - 1 , - 1 , 1 , 1 ,
57
+ - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 1 , - 1 , 1 , 1 , - 1
58
+ ] ,
59
+ indices : [
60
+ 0 , 1 , 2 , 0 , 2 , 3 , // front
61
+ 4 , 5 , 6 , 4 , 6 , 7 , // right
62
+ 8 , 9 , 10 , 8 , 10 , 11 , // top
63
+ 12 , 13 , 14 , 12 , 14 , 15 , // left
64
+ 16 , 17 , 18 , 16 , 18 , 19 , // bottom
65
+ 20 , 21 , 22 , 20 , 22 , 23
66
+ ]
66
67
} ) ;
67
68
68
69
// Create SceneObjects to represent the tabletop and legs. Each SceneObject
@@ -71,78 +72,78 @@ sceneModel.createGeometry({
71
72
// vertex positons.
72
73
73
74
sceneModel . createMesh ( {
74
- id : "redLegMesh" ,
75
- geometryId : "demoBoxGeometry" ,
76
- matrix : xeokit . scene . buildMat4 ( {
77
- position : [ - 4 , - 6 , - 4 ] ,
78
- scale : [ 1 , 3 , 1 ]
79
- } ) ,
80
- color : [ 1 , 0.3 , 0.3 ]
75
+ id : "redLegMesh" ,
76
+ geometryId : "demoBoxGeometry" ,
77
+ matrix : xeokit . scene . buildMat4 ( {
78
+ position : [ - 4 , - 4 , 6 ] ,
79
+ scale : [ 1 , 1 , 3 ]
80
+ } ) ,
81
+ color : [ 1 , 0.3 , 0.3 ]
81
82
} ) ;
82
83
83
84
sceneModel . createObject ( {
84
- id : "redLeg" ,
85
- meshIds : [ "redLegMesh" ]
85
+ id : "redLeg" ,
86
+ meshIds : [ "redLegMesh" ]
86
87
} ) ;
87
88
88
89
sceneModel . createMesh ( {
89
- id : "greenLegMesh" ,
90
- geometryId : "demoBoxGeometry" ,
91
- matrix : xeokit . scene . buildMat4 ( {
92
- position : [ 4 , - 6 , - 4 ] ,
93
- scale : [ 1 , 3 , 1 ]
94
- } ) ,
95
- color : [ 0.3 , 1.0 , 0.3 ]
90
+ id : "greenLegMesh" ,
91
+ geometryId : "demoBoxGeometry" ,
92
+ matrix : xeokit . scene . buildMat4 ( {
93
+ position : [ 4 , - 4 , 6 ] ,
94
+ scale : [ 1 , 1 , 3 ]
95
+ } ) ,
96
+ color : [ 0.3 , 1.0 , 0.3 ]
96
97
} ) ;
97
98
98
99
sceneModel . createObject ( {
99
- id : "greenLeg" ,
100
- meshIds : [ "greenLegMesh" ]
100
+ id : "greenLeg" ,
101
+ meshIds : [ "greenLegMesh" ]
101
102
} ) ;
102
103
103
104
sceneModel . createMesh ( {
104
- id : "blueLegMesh" ,
105
- geometryId : "demoBoxGeometry" ,
106
- matrix : xeokit . scene . buildMat4 ( {
107
- position : [ 4 , - 6 , 4 ] ,
108
- scale : [ 1 , 3 , 1 ]
109
- } ) ,
110
- color : [ 0.3 , 0.3 , 1.0 ]
105
+ id : "blueLegMesh" ,
106
+ geometryId : "demoBoxGeometry" ,
107
+ matrix : xeokit . scene . buildMat4 ( {
108
+ position : [ 4 , 4 , 6 ] ,
109
+ scale : [ 1 , 1 , 3 ]
110
+ } ) ,
111
+ color : [ 0.3 , 0.3 , 1.0 ]
111
112
} ) ;
112
113
113
114
sceneModel . createObject ( {
114
- id : "blueLeg" ,
115
- meshIds : [ "blueLegMesh" ]
115
+ id : "blueLeg" ,
116
+ meshIds : [ "blueLegMesh" ]
116
117
} ) ;
117
118
118
119
sceneModel . createMesh ( {
119
- id : "yellowLegMesh" ,
120
- geometryId : "demoBoxGeometry" ,
121
- matrix : xeokit . scene . buildMat4 ( {
122
- position : [ - 4 , - 6 , 4 ] ,
123
- scale : [ 1 , 3 , 1 ]
124
- } ) ,
125
- color : [ 1.0 , 1.0 , 0.0 ]
120
+ id : "yellowLegMesh" ,
121
+ geometryId : "demoBoxGeometry" ,
122
+ matrix : xeokit . scene . buildMat4 ( {
123
+ position : [ - 4 , 4 , 6 ] ,
124
+ scale : [ 1 , 1 , 3 ]
125
+ } ) ,
126
+ color : [ 1.0 , 1.0 , 0.0 ]
126
127
} ) ;
127
128
128
129
sceneModel . createObject ( {
129
- id : "yellowLeg" ,
130
- meshIds : [ "yellowLegMesh" ]
130
+ id : "yellowLeg" ,
131
+ meshIds : [ "yellowLegMesh" ]
131
132
} ) ;
132
133
133
134
sceneModel . createMesh ( {
134
- id : "purpleTableTopMesh" ,
135
- geometryId : "demoBoxGeometry" ,
136
- matrix : xeokit . scene . buildMat4 ( {
137
- position : [ 0 , - 3 , 0 ] ,
138
- scale : [ 6 , 0.5 , 6 ]
139
- } ) ,
140
- color : [ 1.0 , 0.3 , 1.0 ]
135
+ id : "purpleTableTopMesh" ,
136
+ geometryId : "demoBoxGeometry" ,
137
+ matrix : xeokit . scene . buildMat4 ( {
138
+ position : [ 0 , 0 , 9 ] ,
139
+ scale : [ 6 , 6 , 0.5 ]
140
+ } ) ,
141
+ color : [ 1.0 , 0.3 , 1.0 ]
141
142
} ) ;
142
143
143
144
sceneModel . createObject ( {
144
- id : "purpleTableTop" ,
145
- meshIds : [ "purpleTableTopMesh" ]
145
+ id : "purpleTableTop" ,
146
+ meshIds : [ "purpleTableTopMesh" ]
146
147
} ) ;
147
148
148
149
// Build the SceneModel. The View will now contain a ViewObject for each
0 commit comments