add CameraComponent reflection
This commit is contained in:
parent
4ec877f656
commit
538b63c09f
|
|
@ -30,6 +30,24 @@ namespace Nz
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class TypeReflect<CameraComponent>
|
||||
{
|
||||
public:
|
||||
template <typename TPropertyEnumerator>
|
||||
static void Reflect(TPropertyEnumerator& p, CameraComponent& obj)
|
||||
{
|
||||
p.AddProperty([&obj]() { return obj.GetZNear(); }, [&obj](float v) { obj.UpdateZNear(v); }, "Near", "Near plane");
|
||||
p.AddProperty([&obj]() { return obj.GetZFar(); }, [&obj](float v) { obj.UpdateZFar(v); }, "Far", "Far plane");
|
||||
p.AddProperty([&obj]() { return obj.GetFOV(); }, [&obj](Nz::DegreeAnglef v) { obj.UpdateFOV(v); }, "FOV", "Field of View");
|
||||
p.AddProperty([&obj]() { return obj.GetFOV(); }, [&obj](Nz::DegreeAnglef v) { obj.UpdateFOV(v); }, "FOV", "Field of View");
|
||||
p.AddProperty([&obj]() { return obj.GetClearColor(); }, [&obj](const Nz::Color& v) { obj.UpdateClearColor(v); }, "Clear color", "Clear color");
|
||||
p.AddProperty([&obj]() { return obj.GetRenderOrder(); }, [&obj](Nz::UInt32 v) { obj.UpdateRenderOrder(v); }, "RenderOrder", "Render order");
|
||||
p.AddProperty([&obj]() { return obj.GetRenderMask(); }, [&obj](Nz::UInt32 v) { obj.UpdateRenderMask(v); }, "RenderMask", "Render mask");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace EditorImgui
|
||||
{
|
||||
inline bool Begin(Nz::LightComponent::LightEntry& /*obj*/, const std::string& /*name*/, const std::string& /*tooltip*/)
|
||||
|
|
@ -48,5 +66,14 @@ namespace Nz
|
|||
inline void End(Nz::LightComponent&) {
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
inline bool Begin(Nz::CameraComponent& /*obj*/, const std::string& /*name*/, const std::string& /*tooltip*/)
|
||||
{
|
||||
return ImGui::TreeNodeEx("CameraComponent", ImGuiTreeNodeFlags_Framed);
|
||||
}
|
||||
|
||||
inline void End(Nz::CameraComponent&) {
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,21 @@ namespace Nz
|
|||
}
|
||||
|
||||
inline void End(Nz::Quaternionf&) {}
|
||||
|
||||
template <AngleUnit Unit, typename T>
|
||||
inline bool Begin(Nz::Angle<Unit, T>& obj, const std::string& name, const std::string& tooltip)
|
||||
{
|
||||
auto angle = obj.To<Unit>();
|
||||
if (ImGui::DragFloat(name.c_str(), &angle, 1.f, std::numeric_limits<float>::min(), std::numeric_limits<float>::max()))
|
||||
{
|
||||
obj.From<Unit>(angle);
|
||||
}
|
||||
Tooltip(tooltip);
|
||||
return false;
|
||||
}
|
||||
|
||||
template <AngleUnit Unit, typename T>
|
||||
inline void End(Nz::Angle<Unit, T>& obj) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,6 +37,9 @@ int WinMain(int argc, char* argv[])
|
|||
entt::meta<Nz::NodeComponent>()
|
||||
.type(entt::type_hash<Nz::NodeComponent>::value())
|
||||
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::NodeComponent>>(entt::hashed_string("Reflect"));
|
||||
entt::meta<Nz::CameraComponent>()
|
||||
.type(entt::type_hash<Nz::CameraComponent>::value())
|
||||
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::CameraComponent>>(entt::hashed_string("Reflect"));
|
||||
entt::meta<Nz::LightComponent>()
|
||||
.type(entt::type_hash<Nz::LightComponent>::value())
|
||||
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::LightComponent>>(entt::hashed_string("Reflect"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue