mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Added set_shape to MLPPTensor3.
This commit is contained in:
parent
b1d00a629f
commit
83f4c22e74
@ -225,6 +225,15 @@ public:
|
||||
CRASH_COND_MSG(!_data, "Out of memory");
|
||||
}
|
||||
|
||||
void set_shape(const Size3i &p_size) {
|
||||
int ds = data_size();
|
||||
int new_data_size = p_size.x * p_size.y * p_size.z;
|
||||
|
||||
ERR_FAIL_COND_MSG(ds != new_data_size, "The new size has a different volume than the old. If this is intended use resize()!");
|
||||
|
||||
_size = p_size;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int calculate_index(int p_index_y, int p_index_x, int p_index_z) const {
|
||||
return p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user