mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Added an index based getter and setter to Tensor3 and Matrix.
This commit is contained in:
parent
90dbd6657e
commit
33ac510e6f
@ -112,6 +112,9 @@ void MLPPMatrix::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("resize", "size"), &MLPPMatrix::resize);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element_index", "index"), &MLPPMatrix::get_element_index);
|
||||
ClassDB::bind_method(D_METHOD("set_element_index", "index", "val"), &MLPPMatrix::set_element_index);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPMatrix::get_element);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPMatrix::set_element);
|
||||
|
||||
|
@ -240,6 +240,18 @@ public:
|
||||
return _data[p_index];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element_index(int p_index) const {
|
||||
ERR_FAIL_INDEX_V(p_index, data_size(), 0);
|
||||
|
||||
return _data[p_index];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element_index(int p_index, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index, data_size());
|
||||
|
||||
_data[p_index] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element(int p_index_y, int p_index_x) const {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
|
@ -129,6 +129,9 @@ void MLPPTensor3::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("resize", "size"), &MLPPTensor3::resize);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element_index", "index"), &MLPPTensor3::get_element_index);
|
||||
ClassDB::bind_method(D_METHOD("set_element_index", "index", "val"), &MLPPTensor3::set_element_index);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPTensor3::get_element);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPTensor3::set_element);
|
||||
|
||||
|
@ -243,6 +243,18 @@ public:
|
||||
return _data[p_index];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element_index(int p_index) const {
|
||||
ERR_FAIL_INDEX_V(p_index, data_size(), 0);
|
||||
|
||||
return _data[p_index];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element_index(int p_index, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index, data_size());
|
||||
|
||||
_data[p_index] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element(int p_index_y, int p_index_x, int p_index_z) const {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user