S3DBLayer: distinguish extrusion style (side / top) colors (#592)
This commit is contained in:
parent
f258bae8fd
commit
f44f083378
@ -68,7 +68,7 @@ public class S3DBLayer extends BuildingLayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param colored true: use colour written in '*:colour' tag,
|
* @param colored true: use colour written in '*:colour' tag,
|
||||||
* false: use top colour of extrusion style
|
* false: use colours of extrusion style
|
||||||
*/
|
*/
|
||||||
public void setColored(boolean colored) {
|
public void setColored(boolean colored) {
|
||||||
mColored = colored;
|
mColored = colored;
|
||||||
@ -160,10 +160,10 @@ public class S3DBLayer extends BuildingLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bColor == null) {
|
if (bColor == null) {
|
||||||
bColor = extrusion.colorTop;
|
bColor = extrusion.colorSide;
|
||||||
} else if (mTransparent) {
|
} else if (mTransparent) {
|
||||||
// Multiply alpha channel of extrusion style
|
// Multiply alpha channel of extrusion style
|
||||||
bColor = ExtrusionStyle.blendAlpha(bColor, Color.aToFloat(extrusion.colorTop));
|
bColor = ExtrusionStyle.blendAlpha(bColor, Color.aToFloat(extrusion.colorSide));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale x, y and z axis
|
// Scale x, y and z axis
|
||||||
@ -173,7 +173,7 @@ public class S3DBLayer extends BuildingLayer {
|
|||||||
float minRoofHeightS = ExtrusionUtils.mapGroundScale(maxHeight - roofHeight, groundScale) * TILE_SCALE;
|
float minRoofHeightS = ExtrusionUtils.mapGroundScale(maxHeight - roofHeight, groundScale) * TILE_SCALE;
|
||||||
|
|
||||||
// Process building and roof
|
// Process building and roof
|
||||||
processRoof(element, tile, minRoofHeightS, maxHeightS, bColor);
|
processRoof(element, tile, minRoofHeightS, maxHeightS, bColor, extrusion.colorTop);
|
||||||
if (S3DBUtils.calcOutlines(element, minHeightS, minRoofHeightS)) {
|
if (S3DBUtils.calcOutlines(element, minHeightS, minRoofHeightS)) {
|
||||||
get(tile).addMeshElement(element, groundScale, bColor);
|
get(tile).addMeshElement(element, groundScale, bColor);
|
||||||
}
|
}
|
||||||
@ -230,14 +230,16 @@ public class S3DBLayer extends BuildingLayer {
|
|||||||
/**
|
/**
|
||||||
* Process the roof parts of building.
|
* Process the roof parts of building.
|
||||||
*
|
*
|
||||||
* @param element the MapElement which needs a roof
|
* @param element the MapElement which needs a roof
|
||||||
* @param tile the tile which contains map element
|
* @param tile the tile which contains map element
|
||||||
* @param minHeight the height of the underlying building
|
* @param minHeight the height of the underlying building
|
||||||
* @param maxHeight the height of the roof + minHeight (whole building)
|
* @param maxHeight the height of the roof + minHeight (whole building)
|
||||||
* @param buildingColor the color of main building
|
* @param buildingColor the color of main building
|
||||||
|
* @param defaultRoofColor the default color of roof
|
||||||
*/
|
*/
|
||||||
private void processRoof(MapElement element, MapTile tile, float minHeight, float maxHeight, int buildingColor) {
|
private void processRoof(MapElement element, MapTile tile, float minHeight, float maxHeight,
|
||||||
Integer roofColor = null;
|
int buildingColor, int defaultRoofColor) {
|
||||||
|
int roofColor = defaultRoofColor;
|
||||||
String v;
|
String v;
|
||||||
|
|
||||||
if (mColored) {
|
if (mColored) {
|
||||||
@ -265,11 +267,10 @@ public class S3DBLayer extends BuildingLayer {
|
|||||||
|
|
||||||
GeometryBuffer gElement = new GeometryBuffer(element);
|
GeometryBuffer gElement = new GeometryBuffer(element);
|
||||||
GeometryBuffer specialParts = null;
|
GeometryBuffer specialParts = null;
|
||||||
if (roofColor == null)
|
|
||||||
roofColor = buildingColor;
|
if (mTransparent) {
|
||||||
else if (mTransparent) {
|
// Use transparency of default roof color
|
||||||
// For simplicity use transparency of building, which is identical in nearly all cases
|
roofColor = ExtrusionStyle.blendAlpha(roofColor, Color.aToFloat(defaultRoofColor));
|
||||||
roofColor = ExtrusionStyle.blendAlpha(roofColor, Color.aToFloat(buildingColor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean success;
|
boolean success;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user