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] generated accessor methods on light
- Loading branch information
1 parent
76a2b29
commit 0a0cba8
Showing
11 changed files
with
332 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,48 @@ | ||
#pragma once | ||
// This file is generated. Do not edit. | ||
|
||
#pragma once | ||
#include <mbgl/style/property_value.hpp> | ||
#include <mbgl/style/transition_options.hpp> | ||
#include <mbgl/style/types.hpp> | ||
#include <mbgl/style/position.hpp> | ||
#include <mbgl/util/color.hpp> | ||
#include <mbgl/util/indexed_tuple.hpp> | ||
|
||
namespace mbgl { | ||
namespace style { | ||
|
||
template <class T> | ||
class LightProperty { | ||
public: | ||
using Type = T; | ||
using ValueType = PropertyValue<T>; | ||
class RenderLight; | ||
|
||
PropertyValue<T> value; | ||
TransitionOptions transition; | ||
}; | ||
|
||
struct LightAnchor : LightProperty<LightAnchorType> { | ||
static LightAnchorType defaultValue() { | ||
return LightAnchorType::Viewport; | ||
} | ||
}; | ||
|
||
struct LightPosition : LightProperty<Position> { | ||
static Position defaultValue() { | ||
std::array<float, 3> default_ = { { 1.15, 210, 30 } }; | ||
return Position{ { default_ } }; | ||
} | ||
}; | ||
namespace style { | ||
|
||
struct LightColor : LightProperty<Color> { | ||
static Color defaultValue() { | ||
return Color::white(); | ||
} | ||
}; | ||
class Light { | ||
public: | ||
|
||
struct LightIntensity : LightProperty<float> { | ||
static float defaultValue() { | ||
return 0.5; | ||
} | ||
static LightAnchorType getDefaultAnchor(); | ||
PropertyValue<LightAnchorType> getAnchor() const; | ||
void setAnchor(PropertyValue<LightAnchorType>); | ||
void setAnchorTransition(const TransitionOptions&); | ||
TransitionOptions getAnchorTransition() const; | ||
|
||
static Position getDefaultPosition(); | ||
PropertyValue<Position> getPosition() const; | ||
void setPosition(PropertyValue<Position>); | ||
void setPositionTransition(const TransitionOptions&); | ||
TransitionOptions getPositionTransition() const; | ||
|
||
static Color getDefaultColor(); | ||
PropertyValue<Color> getColor() const; | ||
void setColor(PropertyValue<Color>); | ||
void setColorTransition(const TransitionOptions&); | ||
TransitionOptions getColorTransition() const; | ||
|
||
static float getDefaultIntensity(); | ||
PropertyValue<float> getIntensity() const; | ||
void setIntensity(PropertyValue<float>); | ||
void setIntensityTransition(const TransitionOptions&); | ||
TransitionOptions getIntensityTransition() const; | ||
|
||
private: | ||
IndexedTuple<LightProperties, LightProperties> properties; | ||
|
||
friend class mbgl::RenderLight; | ||
}; | ||
|
||
using LightProperties = TypeList<LightAnchor, LightPosition, LightColor, LightIntensity>; | ||
class Light : public IndexedTuple<LightProperties, LightProperties> {}; | ||
|
||
} // 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,35 @@ | ||
<% | ||
const properties = locals.properties; | ||
-%> | ||
// This file is generated. Do not edit. | ||
|
||
#pragma once | ||
#include <mbgl/style/property_value.hpp> | ||
#include <mbgl/style/transition_options.hpp> | ||
#include <mbgl/style/types.hpp> | ||
|
||
namespace mbgl { | ||
|
||
class RenderLight; | ||
|
||
namespace style { | ||
|
||
class Light { | ||
public: | ||
|
||
<% for (const property of properties) { -%> | ||
static <%- evaluatedType(property) %> getDefault<%- camelize(property.name) %>(); | ||
<%- propertyValueType(property) %> get<%- camelize(property.name) %>() const; | ||
void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>); | ||
void set<%- camelize(property.name) %>Transition(const TransitionOptions&); | ||
TransitionOptions get<%- camelize(property.name) %>Transition() const; | ||
<% } -%> | ||
private: | ||
IndexedTuple<LightProperties, LightProperties> properties; | ||
friend class mbgl::RenderLight; | ||
}; | ||
} // 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
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,115 @@ | ||
// This file is generated. Do not edit. | ||
|
||
#include <mbgl/style/light.hpp> | ||
#include <mbgl/style/light_impl.hpp> | ||
#include <mbgl/style/light_properties.hpp> | ||
|
||
namespace mbgl { | ||
namespace style { | ||
|
||
LightAnchorType Light::getDefaultAnchor() { | ||
return LightAnchor::defaultValue(); | ||
} | ||
|
||
PropertyValue<LightAnchorType> Light::getAnchor() const { | ||
return properties.get<LightAnchor>().value; | ||
} | ||
|
||
void Light::setAnchor(PropertyValue<LightAnchorType> property) { | ||
properties.get<LightAnchor>().value = property; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
void Light::setAnchorTransition(const TransitionOptions& transition) { | ||
properties.get<LightAnchor>().transition = transition; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
TransitionOptions Light::getAnchorTransition() const { | ||
return properties.get<LightAnchor>().transition; | ||
} | ||
|
||
Position Light::getDefaultPosition() { | ||
return LightPosition::defaultValue(); | ||
} | ||
|
||
PropertyValue<Position> Light::getPosition() const { | ||
return properties.get<LightPosition>().value; | ||
} | ||
|
||
void Light::setPosition(PropertyValue<Position> property) { | ||
properties.get<LightPosition>().value = property; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
void Light::setPositionTransition(const TransitionOptions& transition) { | ||
properties.get<LightPosition>().transition = transition; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
TransitionOptions Light::getPositionTransition() const { | ||
return properties.get<LightPosition>().transition; | ||
} | ||
|
||
Color Light::getDefaultColor() { | ||
return LightColor::defaultValue(); | ||
} | ||
|
||
PropertyValue<Color> Light::getColor() const { | ||
return properties.get<LightColor>().value; | ||
} | ||
|
||
void Light::setColor(PropertyValue<Color> property) { | ||
properties.get<LightColor>().value = property; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
void Light::setColorTransition(const TransitionOptions& transition) { | ||
properties.get<LightColor>().transition = transition; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
TransitionOptions Light::getColorTransition() const { | ||
return properties.get<LightColor>().transition; | ||
} | ||
|
||
float Light::getDefaultIntensity() { | ||
return LightIntensity::defaultValue(); | ||
} | ||
|
||
PropertyValue<float> Light::getIntensity() const { | ||
return properties.get<LightIntensity>().value; | ||
} | ||
|
||
void Light::setIntensity(PropertyValue<float> property) { | ||
properties.get<LightIntensity>().value = property; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
void Light::setIntensityTransition(const TransitionOptions& transition) { | ||
properties.get<LightIntensity>().transition = transition; | ||
if (observer) { | ||
observer->onLightChanged(*this); | ||
} | ||
} | ||
|
||
TransitionOptions Light::getIntensityTransition() const { | ||
return properties.get<LightIntensity>().transition; | ||
} | ||
|
||
} // namespace style | ||
} // namespace mbgl |
Oops, something went wrong.