@@ -159,7 +159,8 @@ v3s16 MapNode::getWallMountedDir(INodeDefManager *nodemgr) const
159
159
}
160
160
}
161
161
162
- void MapNode::rotateAlongYAxis (INodeDefManager *nodemgr, Rotation rot) {
162
+ void MapNode::rotateAlongYAxis (INodeDefManager *nodemgr, Rotation rot)
163
+ {
163
164
ContentParamType2 cpt2 = nodemgr->get (*this ).param_type_2 ;
164
165
165
166
if (cpt2 == CPT2_FACEDIR) {
@@ -180,6 +181,59 @@ void MapNode::rotateAlongYAxis(INodeDefManager *nodemgr, Rotation rot) {
180
181
}
181
182
}
182
183
184
+ void MapNode::rotateAlongYAxisFull (INodeDefManager *nodemgr, Rotation rot)
185
+ {
186
+ ContentParamType2 cpt2 = nodemgr->get (*this ).param_type_2 ;
187
+
188
+ if (cpt2 == CPT2_FACEDIR) {
189
+ static const u16 rotate_facedir[24 * 4 ] = {
190
+ // Table value = rotated facedir
191
+ // Columns: 0, 90, 180, 270 degrees rotation around vertical axis
192
+ // Rotation is anticlockwise as seen from above (+Y)
193
+
194
+ 0 , 1 , 2 , 3 , // Initial facedir 0 to 3
195
+ 1 , 2 , 3 , 0 ,
196
+ 2 , 3 , 0 , 1 ,
197
+ 3 , 0 , 1 , 2 ,
198
+
199
+ 4 , 13 , 10 , 19 , // 4 to 7
200
+ 5 , 14 , 11 , 16 ,
201
+ 6 , 15 , 8 , 17 ,
202
+ 7 , 12 , 9 , 18 ,
203
+
204
+ 8 , 17 , 6 , 15 , // 8 to 11
205
+ 9 , 18 , 7 , 12 ,
206
+ 10 , 19 , 4 , 13 ,
207
+ 11 , 16 , 5 , 14 ,
208
+
209
+ 12 , 9 , 18 , 7 , // 12 to 15
210
+ 13 , 10 , 19 , 4 ,
211
+ 14 , 11 , 16 , 5 ,
212
+ 15 , 8 , 17 , 6 ,
213
+
214
+ 16 , 5 , 14 , 11 , // 16 to 19
215
+ 17 , 6 , 15 , 8 ,
216
+ 18 , 7 , 12 , 9 ,
217
+ 19 , 4 , 13 , 10 ,
218
+
219
+ 20 , 23 , 22 , 21 , // 20 to 23
220
+ 21 , 20 , 23 , 22 ,
221
+ 22 , 21 , 20 , 23 ,
222
+ 23 , 22 , 21 , 20
223
+ };
224
+ u16 index = param2 * 4 + rot;
225
+ param2 = rotate_facedir[index ];
226
+ } else if (cpt2 == CPT2_WALLMOUNTED) {
227
+ u8 wmountface = (param2 & 7 );
228
+ if (wmountface <= 1 )
229
+ return ;
230
+
231
+ Rotation oldrot = wallmounted_to_rot[wmountface - 2 ];
232
+ param2 &= ~7 ;
233
+ param2 |= rot_to_wallmounted[(oldrot - rot) & 3 ];
234
+ }
235
+ }
236
+
183
237
static std::vector<aabb3f> transformNodeBox (const MapNode &n,
184
238
const NodeBox &nodebox, INodeDefManager *nodemgr)
185
239
{
0 commit comments