[ox/std] Cleanup geo types to not depend on ox/model
This commit is contained in:
parent
437b33cdb5
commit
07284ac595
17
deps/ox/src/ox/std/bounds.hpp
vendored
17
deps/ox/src/ox/std/bounds.hpp
vendored
@ -8,7 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/model/def.hpp>
|
||||
#include <ox/std/error.hpp>
|
||||
#include <ox/std/new.hpp>
|
||||
|
||||
@ -125,11 +124,15 @@ constexpr void Bounds::set(const Point &pt1, const Point &pt2) noexcept {
|
||||
this->height = y2 - y1;
|
||||
}
|
||||
|
||||
oxModelBegin(Bounds)
|
||||
oxModelField(x)
|
||||
oxModelField(y)
|
||||
oxModelField(width)
|
||||
oxModelField(height)
|
||||
oxModelEnd()
|
||||
template<typename T>
|
||||
constexpr Error model(T *io, ox::CommonPtrWith<Bounds> auto *obj) noexcept {
|
||||
io->template setTypeInfo<Bounds>();
|
||||
oxReturnError(io->field("x", &obj->x));
|
||||
oxReturnError(io->field("y", &obj->y));
|
||||
oxReturnError(io->field("width", &obj->width));
|
||||
oxReturnError(io->field("height", &obj->height));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
11
deps/ox/src/ox/std/point.hpp
vendored
11
deps/ox/src/ox/std/point.hpp
vendored
@ -184,9 +184,12 @@ constexpr bool Point::operator!=(const Point &p) const noexcept {
|
||||
return x != p.x || y != p.y;
|
||||
}
|
||||
|
||||
oxModelBegin(Point)
|
||||
oxModelField(x)
|
||||
oxModelField(y)
|
||||
oxModelEnd()
|
||||
template<typename T>
|
||||
constexpr Error model(T *io, ox::CommonPtrWith<Point> auto *obj) noexcept {
|
||||
io->template setTypeInfo<Point>();
|
||||
oxReturnError(io->field("x", &obj->x));
|
||||
oxReturnError(io->field("y", &obj->y));
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
12
deps/ox/src/ox/std/size.hpp
vendored
12
deps/ox/src/ox/std/size.hpp
vendored
@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
#include <ox/std/concepts.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@ -184,9 +185,12 @@ constexpr bool Size::operator!=(const Size &p) const noexcept {
|
||||
}
|
||||
|
||||
|
||||
oxModelBegin(Size)
|
||||
oxModelField(width)
|
||||
oxModelField(height)
|
||||
oxModelEnd()
|
||||
template<typename T>
|
||||
constexpr Error model(T *io, ox::CommonPtrWith<Size> auto *obj) noexcept {
|
||||
io->template setTypeInfo<Size>();
|
||||
oxReturnError(io->field("width", &obj->width));
|
||||
oxReturnError(io->field("height", &obj->height));
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
11
deps/ox/src/ox/std/vec.hpp
vendored
11
deps/ox/src/ox/std/vec.hpp
vendored
@ -260,9 +260,12 @@ struct Vec {
|
||||
|
||||
using Vec2 = Vec<float>;
|
||||
|
||||
oxModelBegin(Vec2)
|
||||
oxModelField(x)
|
||||
oxModelField(y)
|
||||
oxModelEnd()
|
||||
template<typename T>
|
||||
constexpr Error model(T *io, ox::CommonPtrWith<Vec2> auto *obj) noexcept {
|
||||
io->template setTypeInfo<Vec2>();
|
||||
oxReturnError(io->field("x", &obj->x));
|
||||
oxReturnError(io->field("y", &obj->y));
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user