private static BuildingPartOutput buildPart(BuildingPart bp, BuildingModel buildingModel, ModelFactory mf,
BuildingElementsTextureManager tm) {
BuildingPartOutput partOutput = new BuildingPartOutput();
CatchFaceFactory catchFaceFactory = new CatchFaceFactory(mf);
Wall w = bp.getWall();
double maxHeight = bp.getDefaultMaxHeight();
double minHeight = bp.getDefaultMinHeight();
WallPart firstWallPart = getFirstWallPart(w);
Color facadeColor = takeFacadeColor(buildingModel, bp, w, firstWallPart, tm);
Color roofColor = takeRoofColor(buildingModel, bp, w, firstWallPart, tm);
TextureData roofTextureData = takeRoofTextureData(buildingModel, bp, w, tm, roofColor != null);
TextureData facadeTextureData = takeFacadeTextureData(buildingModel, bp, w, firstWallPart, tm, facadeColor != null);
RoofOutput roofOutput = buildRoof(bp, mf, maxHeight, facadeColor, roofColor, facadeTextureData, roofTextureData);
double wallHeight = maxHeight - roofOutput.getHeight();
buildWall(w, minHeight, wallHeight, bp, buildingModel, mf, catchFaceFactory, tm, roofOutput.getHeightCalculator());
buildFloor(bp, buildingModel, mf, tm, roofTextureData, facadeColor, minHeight);
if (bp.getInlineWalls() != null) {
for (Wall in : bp.getInlineWalls()) {
buildWall(in, minHeight, wallHeight, bp, buildingModel, mf, catchFaceFactory, tm,
roofOutput.getHeightCalculator());
}
}
partOutput.setRoofDebug(roofOutput.getDebug());
partOutput.setEdges(roofOutput.getEdges());
return partOutput;
}