This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Render fill-extrusion layers (#8431)
- Loading branch information
Lauren Budorick
authored
Apr 27, 2017
1 parent
839ad87
commit f6e79d7
Showing
111 changed files
with
4,855 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#pragma once | ||
|
||
#include <mbgl/style/light.hpp> | ||
#include <mbgl/style/conversion.hpp> | ||
#include <mbgl/style/conversion/position.hpp> | ||
#include <mbgl/style/conversion/property_value.hpp> | ||
#include <mbgl/style/conversion/transition_options.hpp> | ||
|
||
namespace mbgl { | ||
namespace style { | ||
namespace conversion { | ||
|
||
template <> | ||
struct Converter<Light> { | ||
public: | ||
template <class V> | ||
optional<Light> operator()(const V& value, Error& error) const { | ||
if (!isObject(value)) { | ||
error = { "light must be an object" }; | ||
return {}; | ||
} | ||
|
||
Light light; | ||
|
||
const auto anchor = objectMember(value, "anchor"); | ||
if (anchor) { | ||
optional<PropertyValue<LightAnchorType>> convertedAnchor = | ||
convert<PropertyValue<LightAnchorType>>(*anchor, error); | ||
|
||
if (convertedAnchor) { | ||
light.get<LightAnchor>().value = *convertedAnchor; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto anchorTransition = objectMember(value, "anchor-transition"); | ||
if (anchorTransition) { | ||
optional<TransitionOptions> transition = | ||
convert<TransitionOptions>(*anchorTransition, error); | ||
if (transition) { | ||
light.get<LightAnchor>().transition = *transition; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto color = objectMember(value, "color"); | ||
if (color) { | ||
optional<PropertyValue<Color>> convertedColor = | ||
convert<PropertyValue<Color>>(*color, error); | ||
|
||
if (convertedColor) { | ||
light.get<LightColor>().value = *convertedColor; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto colorTransition = objectMember(value, "color-transition"); | ||
if (colorTransition) { | ||
optional<TransitionOptions> transition = | ||
convert<TransitionOptions>(*colorTransition, error); | ||
if (transition) { | ||
light.get<LightColor>().transition = *transition; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto position = objectMember(value, "position"); | ||
if (position) { | ||
optional<PropertyValue<Position>> convertedPosition = | ||
convert<PropertyValue<Position>>(*position, error); | ||
|
||
if (convertedPosition) { | ||
light.get<LightPosition>().value = *convertedPosition; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto positionTransition = objectMember(value, "position-transition"); | ||
if (positionTransition) { | ||
optional<TransitionOptions> transition = | ||
convert<TransitionOptions>(*positionTransition, error); | ||
if (transition) { | ||
light.get<LightPosition>().transition = *transition; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto intensity = objectMember(value, "intensity"); | ||
if (intensity) { | ||
optional<PropertyValue<float>> convertedIntensity = | ||
convert<PropertyValue<float>>(*intensity, error); | ||
|
||
if (convertedIntensity) { | ||
light.get<LightIntensity>().value = *convertedIntensity; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
|
||
const auto intensityTransition = objectMember(value, "intensity-transition"); | ||
if (intensityTransition) { | ||
optional<TransitionOptions> transition = | ||
convert<TransitionOptions>(*intensityTransition, error); | ||
if (transition) { | ||
light.get<LightIntensity>().transition = *transition; | ||
} else { | ||
return {}; | ||
} | ||
} | ||
return { light }; | ||
}; | ||
}; | ||
|
||
} // namespace conversion | ||
} // namespace style | ||
} // namespace mbgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <mbgl/style/conversion.hpp> | ||
#include <mbgl/style/position.hpp> | ||
#include <mbgl/util/optional.hpp> | ||
|
||
#include <array> | ||
|
||
namespace mbgl { | ||
namespace style { | ||
namespace conversion { | ||
|
||
template <> | ||
struct Converter<Position> { | ||
template <class V> | ||
optional<Position> operator()(const V& value, Error& error) const { | ||
optional<std::array<float, 3>> spherical = convert<std::array<float, 3>>(value, error); | ||
|
||
if (!spherical) { | ||
return {}; | ||
} | ||
|
||
return Position(*spherical); | ||
} | ||
}; | ||
|
||
} // namespace conversion | ||
} // namespace style | ||
} // namespace mbgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f6e79d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏