Skip to content

Commit

Permalink
Auto-update from libvoxelstorm: latest improvements from webgpu demo3…
Browse files Browse the repository at this point in the history
… for the Armchair engine (f235ae1)
  • Loading branch information
slowriot committed Jan 8, 2025
1 parent 91c5813 commit 642a849
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
21 changes: 19 additions & 2 deletions vectorstorm/vector/vector2.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,32 @@ class vector2 {
return vector2<T>(-x, -y);
}

//-------------[ size operations ]---------------------------
//-------------[ data operations ]---------------------------
/**
* Data access
* @return pointer to the first element in the vector
*/
inline T constexpr *data() noexcept __attribute__((__always_inline__)) {
return &x;
}
/**
* Data access
* @return pointer to the first element in the vector, const version
*/
inline T constexpr const *data() const noexcept __attribute__((__always_inline__)) {
return &x;
}

/**
* Get number of elements in the vector.
* @return number of elements (will always return 2)
*/
static inline size_t consteval size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
static inline unsigned int constexpr size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
return 2u;
}

//-------------[ size operations ]---------------------------

/**
* Return square of length.
* @return length ^ 2
Expand Down
20 changes: 18 additions & 2 deletions vectorstorm/vector/vector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -779,15 +779,31 @@ class vector3 {
return vector3<T>(-x, -y, -z);
}

//-------------[ size operations ]---------------------------
//-------------[ data operations ]---------------------------
/**
* Data access
* @return pointer to the first element in the vector
*/
inline T constexpr *data() noexcept __attribute__((__always_inline__)) {
return &x;
}
/**
* Data access
* @return pointer to the first element in the vector, const version
*/
inline T constexpr const *data() const noexcept __attribute__((__always_inline__)) {
return &x;
}

/**
* Get number of elements in the vector.
* @return number of elements (will always return 3)
*/
static inline size_t consteval size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
static inline unsigned int constexpr size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
return 3u;
}

//-------------[ size operations ]---------------------------
/**
* Return square of length.
* @return length ^ 2
Expand Down
20 changes: 18 additions & 2 deletions vectorstorm/vector/vector4.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,15 +903,31 @@ class vector4 {
return *this;
}

//-------------[ size operations ]---------------------------
//-------------[ data operations ]---------------------------
/**
* Data access
* @return pointer to the first element in the vector
*/
inline T constexpr *data() noexcept __attribute__((__always_inline__)) {
return &x;
}
/**
* Data access
* @return pointer to the first element in the vector, const version
*/
inline T constexpr const *data() const noexcept __attribute__((__always_inline__)) {
return &x;
}

/**
* Get number of elements in the vector.
* @return number of elements (will always return 4)
*/
static inline size_t consteval size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
static inline unsigned int constexpr size() noexcept __attribute__((__always_inline__)) __attribute__((__const__)) {
return 4u;
}

//-------------[ size operations ]---------------------------
/**
* Return square of length.
* @return length ^ 2
Expand Down

0 comments on commit 642a849

Please sign in to comment.