xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
vec.hpp
浏览该文件的文档.
1#pragma once
2#include <xcal/public.h>
3
6
7namespace xcal::property {
8template <typename T, size_t N>
9class XCAL_API Vec : public MProperty {
11 public:
13
14 private:
15 Proxy<data_t> value_{this, T{}};
16
17 public:
18 template <typename... Args>
19 requires std::constructible_from<data_t, Args...>
20 // NOLINTNEXTLINE
21 Vec(Args&&... args) : value_{this, std::forward<Args>(args)...} {}
22 Vec(const Vec&) = delete;
23 Vec(Vec&&) = delete;
24 Vec& operator=(const Vec&) = delete;
25 Vec& operator=(Vec&&) = delete;
26 data_t& value() { return value_; }
27 const data_t& value() const { return value_; }
28 float_t x() const
29 requires(N > 0)
30 {
31 return ((const data_t&)value_).x();
32 }
33 float_t y() const
34 requires(N > 1)
35 {
36 return ((const data_t&)value_).y();
37 }
38 float_t z() const
39 requires(N > 2)
40 {
41 return ((const data_t&)value_).z();
42 }
44 requires(N > 0)
45 {
46 return ((data_t&)value_).x();
47 }
49 requires(N > 1)
50 {
51 return ((data_t&)value_).y();
52 }
54 requires(N > 2)
55 {
56 return ((data_t&)value_).z();
57 }
58 // NOLINTNEXTLINE
59 operator data_t&() { return value_; }
60 // NOLINTNEXTLINE
61 operator const data_t&() const { return value_; }
62
63 Vec& operator=(const data_t& v) {
64 value_ = v;
65 return *this;
66 }
67};
68} // namespace xcal::property
float_t z() const
Definition vec.hpp:38
Vec(Vec &&)=delete
Vec & operator=(const data_t &v)
Definition vec.hpp:63
Vec(const Vec &)=delete
float_t x() const
Definition vec.hpp:28
float_t & x()
Definition vec.hpp:43
Vec & operator=(const Vec &)=delete
float_t y() const
Definition vec.hpp:33
Vec(Args &&... args)
Definition vec.hpp:21
data_t & value()
Definition vec.hpp:26
const data_t & value() const
Definition vec.hpp:27
Vec & operator=(Vec &&)=delete
float_t & z()
Definition vec.hpp:53
float_t & y()
Definition vec.hpp:48
Vector class template
Definition vec.hpp:206
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