diff options
author | Brett Weiland <brettsweiland@gmail.com> | 2024-05-27 20:56:59 -0500 |
---|---|---|
committer | Brett Weiland <brettsweiland@gmail.com> | 2024-05-27 20:56:59 -0500 |
commit | 093200a449ea38952de52012e324036c106e294b (patch) | |
tree | 6030076eb894ca100d6aa0d6550ab56955e7fb2f /entity.cuh | |
parent | 7e9e2150619c05f9e8a74432e596b11f373518b9 (diff) |
boutta switch away from templates
Diffstat (limited to 'entity.cuh')
-rw-r--r-- | entity.cuh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/entity.cuh b/entity.cuh new file mode 100644 index 0000000..737ef8b --- /dev/null +++ b/entity.cuh @@ -0,0 +1,31 @@ +#ifndef ENTITY_H +#define ENTITY_H +#include "common.cuh" + +//we could make a template to allow double percision, but start with float +//idk how nessesary it is yet so I'll go ahead. +//I know I needed it for zoomin far into the mandelbrot ig, so it's not +//out of the question +template<class T> class entity { + using T3 = typename vect_t3<T>::vect_t; + public: + __device__ entity() : pos_(vect_create<T3>(0)), rot_(vect_create<T3>(0)), scale_(vect_create<T3>(0)) {}; + __device__ entity(const T3 pos, const T3 rot, const T3 scale) : pos_(pos), rot_(rot), scale_(scale) {}; + __device__ entity(const float3 pos) : pos_(pos), rot_(vect_create<T3>(0)), scale_(vect_create<T3>(0)) {}; + + + T3 get_pos() const { return pos_; } + T3 get_rot() const { return rot_; } + T3 get_scale() const { return scale_; } + + __device__ void set_pos(const T3 pos) { pos_ = pos; } + __device__ void set_rot(const T3 rot) { rot_ = rot; } + __device__ void set_scale(const T3 scale) { scale_ = scale; } + + protected: + T3 pos_; + T3 rot_; + T3 scale_; + +}; +#endif |