xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
position.hpp
浏览该文件的文档.
1#pragma once
3#include <xcmath/xcmath.hpp>
4
6
7namespace xcal::property {
8
9class XCAL_API Position : public MProperty {
11 public:
14
15 private:
16 MProxy data_{this, {0.0f}};
17
18 public:
19 Position() = default;
20 Position(const Position &) = delete;
21 Position(Position &&) = delete;
22 Position &operator=(const Position &) = delete;
24 Position(float_t x, float_t y) : data_(this, {x, y}) { data_ = {{x, y}}; }
25 explicit Position(xcmath::vec<float_t, 2> list) { data_ = list; }
26 const float_t &x() const { return data_[0]; }
27 const float_t &y() const { return data_[1]; }
28 float_t &x() { return data_[0]; }
29 float_t &y() { return data_[1]; }
30 const data_t &value() const { return data_; }
31 data_t &value() { return data_; }
33 data_ = v;
34 return *this;
35 }
36};
37
41
42 private:
43 Proxy<float_t> z_{this, 0.0};
44
45 public:
46 explicit ThreeDPosition() = delete;
47 ThreeDPosition(const ThreeDPosition &) = delete;
51 ThreeDPosition(float_t x, float_t y, float_t z) : Position(x, y) { z_ = z; }
52 const float_t &z() const { return z_; }
53 float_t &z() { return z_; }
55 *(Position *)this = v.xy();
56 z_ = v[2];
57 return *this;
58 }
59};
60
61} // namespace xcal::property
Position & operator=(Position &&)=delete
Position(xcmath::vec< float_t, 2 > list)
Definition position.hpp:25
const float_t & x() const
Definition position.hpp:26
Position & operator=(const Position &)=delete
const float_t & y() const
Definition position.hpp:27
const data_t & value() const
Definition position.hpp:30
Position & operator=(const data_t &v)
Definition position.hpp:32
Position(float_t x, float_t y)
Definition position.hpp:24
Position(Position &&)=delete
Position(const Position &)=delete
ThreeDPosition(ThreeDPosition &&)=delete
ThreeDPosition & operator=(ThreeDPosition &&)=delete
ThreeDPosition(float_t x, float_t y, float_t z)
Definition position.hpp:51
ThreeDPosition & operator=(const data_t &v)
Definition position.hpp:54
const float_t & z() const
Definition position.hpp:52
ThreeDPosition(const ThreeDPosition &)=delete
ThreeDPosition & operator=(const ThreeDPosition &)=delete
Vector class template
Definition vec.hpp:206
constexpr const vec< _Tp, 2 > & xy() const
Definition vec.hpp:537
float float_t
Definition public.h:27
#define XCAL_PROPERTY_TYPE(type)
Definition property.hpp:6
#define XCAL_API
Definition public.h:69
N-dimensional mathematical vector implementation with template metaprogramming support