@@ -29,6 +29,7 @@ class Checkerboard{
29
29
const sceneBorder = new LineSegments ( new EdgesGeometry ( ) , new LineBasicMaterial ( { color : 0x000000 } ) ) ;
30
30
const planes = new Group ( ) ;
31
31
const dimensionsText = buildTextMesh ( this . width , this . height ) ;
32
+ const tableLegs = new Group ( ) ;
32
33
33
34
34
35
function buildPlanes ( width , height , elevation , unitValue )
@@ -132,6 +133,25 @@ class Checkerboard{
132
133
133
134
buildPlanes ( width , height , elevation , unit . value ) ;
134
135
updateText ( width , height , elevation , unit ) ;
136
+ createTableLegs ( width , height , elevation , unit ) ;
137
+ }
138
+
139
+ function createTableLegs ( width , height , elevation , unit ) {
140
+ tableLegs . clear ( ) ;
141
+ const tableLegsGeometry = new BoxGeometry ( 1 / 15 , elevation , 1 / 15 ) ;
142
+ const material = new MeshBasicMaterial ( { color : 0x111111 , side : DoubleSide } ) ;
143
+ let leg1 = new Mesh ( tableLegsGeometry , material ) ;
144
+ leg1 . position . set ( width , elevation / 2 , height ) ;
145
+ tableLegs . add ( leg1 ) ;
146
+ let leg2 = new Mesh ( tableLegsGeometry , material ) ;
147
+ leg2 . position . set ( 0 , elevation / 2 , height ) ;
148
+ tableLegs . add ( leg2 ) ;
149
+ let leg3 = new Mesh ( tableLegsGeometry , material ) ;
150
+ leg3 . position . set ( 0 , elevation / 2 , 0 ) ;
151
+ tableLegs . add ( leg3 ) ;
152
+ let leg4 = new Mesh ( tableLegsGeometry , material ) ;
153
+ leg4 . position . set ( width , elevation / 2 , 0 ) ;
154
+ tableLegs . add ( leg4 ) ;
135
155
}
136
156
137
157
function applyTransforms ( object , width , height , elevation )
@@ -154,6 +174,7 @@ class Checkerboard{
154
174
scene . add ( sceneBorder ) ;
155
175
scene . add ( planes ) ;
156
176
scene . add ( dimensionsText ) ;
177
+ scene . add ( tableLegs ) ;
157
178
}
158
179
159
180
this . toggleUnit = function ( unit )
@@ -183,6 +204,7 @@ class Checkerboard{
183
204
scene . remove ( sceneBorder ) ;
184
205
scene . remove ( planes ) ;
185
206
scene . remove ( dimensionsText ) ;
207
+ scene . remove ( tableLegs ) ;
186
208
}
187
209
188
210
this . dispose = function ( )
0 commit comments