v3f p, v3s16 dir, v3f scale, u8 light_source, std::vector<FastFace> &dest)
{
FastFace face;
-
+
// Position is at the center of the cube.
v3f pos = p * BS;
v3f vertex_pos[4];
v3s16 vertex_dirs[4];
getNodeVertexDirs(dir, vertex_dirs);
+
v3s16 t;
+ u16 t1;
switch (tile.rotation)
{
case 0:
vertex_dirs[3] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[1];
vertex_dirs[1] = t;
+ t1=li0;
+ li0=li3;
+ li3=li2;
+ li2=li1;
+ li1=t1;
break;
case 2: //R180
t = vertex_dirs[0];
t = vertex_dirs[1];
vertex_dirs[1] = vertex_dirs[3];
vertex_dirs[3] = t;
+ t1 = li0;
+ li0 = li2;
+ li2 = t1;
+ t1 = li1;
+ li1 = li3;
+ li3 = t1;
break;
case 3: //R270
t = vertex_dirs[0];
vertex_dirs[1] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[3];
vertex_dirs[3] = t;
+ t1 = li0;
+ li0 = li1;
+ li1 = li2;
+ li2 = li3;
+ li3 = t1;
break;
case 4: //FXR90
t = vertex_dirs[0];
vertex_dirs[3] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[1];
vertex_dirs[1] = t;
+ t1 = li0;
+ li0 = li3;
+ li3 = li2;
+ li2 = li1;
+ li1 = t1;
y0 += h;
h *= -1;
break;
vertex_dirs[1] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[3];
vertex_dirs[3] = t;
+ t1 = li0;
+ li0 = li1;
+ li1 = li2;
+ li2 = li3;
+ li3 = t1;
y0 += h;
h *= -1;
break;
vertex_dirs[3] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[1];
vertex_dirs[1] = t;
+ t1 = li0;
+ li0 = li3;
+ li3 = li2;
+ li2 = li1;
+ li1 = t1;
x0 += w;
w *= -1;
break;
vertex_dirs[1] = vertex_dirs[2];
vertex_dirs[2] = vertex_dirs[3];
vertex_dirs[3] = t;
+ t1 = li0;
+ li0 = li1;
+ li1 = li2;
+ li2 = li3;
+ li3 = t1;
x0 += w;
w *= -1;
break;
default:
break;
}
+
for(u16 i=0; i<4; i++)
{
vertex_pos[i] = v3f(
vertex_pos[i] += pos;
}
- f32 abs_scale = 1.;
+ f32 abs_scale = 1.0;
if (scale.X < 0.999 || scale.X > 1.001) abs_scale = scale.X;
else if(scale.Y < 0.999 || scale.Y > 1.001) abs_scale = scale.Y;
else if(scale.Z < 0.999 || scale.Z > 1.001) abs_scale = scale.Z;
core::vector2d<f32>(x0+w*abs_scale, y0));
face.tile = tile;
-
dest.push_back(face);
}