public CellRamp(MapGridType type, WRot orientation, RampCornerHeight tl = RampCornerHeight.Low, RampCornerHeight tr = RampCornerHeight.Low, RampCornerHeight br = RampCornerHeight.Low, RampCornerHeight bl = RampCornerHeight.Low, RampSplit split = RampSplit.Flat) { Orientation = orientation; if (type == MapGridType.RectangularIsometric) { Corners = new[] { new WVec(0, -724, 724 * (int)tl), new WVec(724, 0, 724 * (int)tr), new WVec(0, 724, 724 * (int)br), new WVec(-724, 0, 724 * (int)bl), }; } else { Corners = new[] { new WVec(-512, -512, 512 * (int)tl), new WVec(512, -512, 512 * (int)tr), new WVec(512, 512, 512 * (int)br), new WVec(-512, 512, 512 * (int)bl) }; } if (split == RampSplit.X) { Polygons = new[] { new[] { Corners[0], Corners[1], Corners[3] }, new[] { Corners[1], Corners[2], Corners[3] } }; } else if (split == RampSplit.Y) { Polygons = new[] { new[] { Corners[0], Corners[1], Corners[2] }, new[] { Corners[0], Corners[2], Corners[3] } }; } else { Polygons = new[] { Corners } }; // Initial value must be asigned before HeightOffset can be called CenterHeightOffset = 0; CenterHeightOffset = HeightOffset(0, 0); }
public WVec Rotate(WRot rot) { return(Rotate(rot.AsMatrix())); }
public WVec Rotate(WRot rot) { var mtx = rot.AsMatrix(); var lx = (long)X; var ly = (long)Y; var lz = (long)Z; return new WVec( (int)((lx * mtx[0] + ly*mtx[4] + lz*mtx[8]) / mtx[15]), (int)((lx * mtx[1] + ly*mtx[5] + lz*mtx[9]) / mtx[15]), (int)((lx * mtx[2] + ly*mtx[6] + lz*mtx[10]) / mtx[15])); }
public WVec Rotate(WRot rot) { rot.AsMatrix(out var mtx); return(Rotate(ref mtx)); }