renamed all Rect3.pos to Rect3.position
This commit is contained in:
parent
63fd693c1e
commit
935f730170
42 changed files with 298 additions and 298 deletions
|
@ -110,9 +110,9 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
|
|||
|
||||
SETUP_TYPE(Rect3)
|
||||
|
||||
/**/ TRY_TRANSFER_FIELD("px", pos.x)
|
||||
else TRY_TRANSFER_FIELD("py", pos.y)
|
||||
else TRY_TRANSFER_FIELD("pz", pos.z)
|
||||
/**/ TRY_TRANSFER_FIELD("px", position.x)
|
||||
else TRY_TRANSFER_FIELD("py", position.y)
|
||||
else TRY_TRANSFER_FIELD("pz", position.z)
|
||||
else TRY_TRANSFER_FIELD("sx", size.x)
|
||||
else TRY_TRANSFER_FIELD("sy", size.y)
|
||||
else TRY_TRANSFER_FIELD("sz", size.z)
|
||||
|
|
|
@ -211,9 +211,9 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
|
||||
ERR_FAIL_COND_V(len < (int)4 * 6, ERR_INVALID_DATA);
|
||||
Rect3 val;
|
||||
val.pos.x = decode_float(&buf[0]);
|
||||
val.pos.y = decode_float(&buf[4]);
|
||||
val.pos.z = decode_float(&buf[8]);
|
||||
val.position.x = decode_float(&buf[0]);
|
||||
val.position.y = decode_float(&buf[4]);
|
||||
val.position.z = decode_float(&buf[8]);
|
||||
val.size.x = decode_float(&buf[12]);
|
||||
val.size.y = decode_float(&buf[16]);
|
||||
val.size.z = decode_float(&buf[20]);
|
||||
|
@ -926,9 +926,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
|
|||
|
||||
if (buf) {
|
||||
Rect3 aabb = p_variant;
|
||||
encode_float(aabb.pos.x, &buf[0]);
|
||||
encode_float(aabb.pos.y, &buf[4]);
|
||||
encode_float(aabb.pos.z, &buf[8]);
|
||||
encode_float(aabb.position.x, &buf[0]);
|
||||
encode_float(aabb.position.y, &buf[4]);
|
||||
encode_float(aabb.position.z, &buf[8]);
|
||||
encode_float(aabb.size.x, &buf[12]);
|
||||
encode_float(aabb.size.y, &buf[16]);
|
||||
encode_float(aabb.size.z, &buf[20]);
|
||||
|
|
|
@ -191,9 +191,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
|
|||
case VARIANT_RECT3: {
|
||||
|
||||
Rect3 v;
|
||||
v.pos.x = f->get_real();
|
||||
v.pos.y = f->get_real();
|
||||
v.pos.z = f->get_real();
|
||||
v.position.x = f->get_real();
|
||||
v.position.y = f->get_real();
|
||||
v.position.z = f->get_real();
|
||||
v.size.x = f->get_real();
|
||||
v.size.y = f->get_real();
|
||||
v.size.z = f->get_real();
|
||||
|
@ -1327,9 +1327,9 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property,
|
|||
|
||||
f->store_32(VARIANT_RECT3);
|
||||
Rect3 val = p_property;
|
||||
f->store_real(val.pos.x);
|
||||
f->store_real(val.pos.y);
|
||||
f->store_real(val.pos.z);
|
||||
f->store_real(val.position.x);
|
||||
f->store_real(val.position.y);
|
||||
f->store_real(val.position.z);
|
||||
f->store_real(val.size.x);
|
||||
f->store_real(val.size.y);
|
||||
f->store_real(val.size.z);
|
||||
|
|
|
@ -39,8 +39,8 @@ void BSP_Tree::from_aabb(const Rect3 &p_aabb) {
|
|||
|
||||
Vector3 n;
|
||||
n[i] = 1;
|
||||
planes.push_back(Plane(n, p_aabb.pos[i] + p_aabb.size[i]));
|
||||
planes.push_back(Plane(-n, -p_aabb.pos[i]));
|
||||
planes.push_back(Plane(n, p_aabb.position[i] + p_aabb.size[i]));
|
||||
planes.push_back(Plane(-n, -p_aabb.position[i]));
|
||||
}
|
||||
|
||||
nodes.clear();
|
||||
|
@ -552,7 +552,7 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) {
|
|||
|
||||
if (first) {
|
||||
|
||||
aabb.pos = f.vertex[0];
|
||||
aabb.position = f.vertex[0];
|
||||
first = false;
|
||||
} else {
|
||||
|
||||
|
|
|
@ -559,8 +559,8 @@ void CameraMatrix::make_scale(const Vector3 &p_scale) {
|
|||
|
||||
void CameraMatrix::scale_translate_to_fit(const Rect3 &p_aabb) {
|
||||
|
||||
Vector3 min = p_aabb.pos;
|
||||
Vector3 max = p_aabb.pos + p_aabb.size;
|
||||
Vector3 min = p_aabb.position;
|
||||
Vector3 max = p_aabb.position + p_aabb.size;
|
||||
|
||||
matrix[0][0] = 2 / (max.x - min.x);
|
||||
matrix[1][0] = 0;
|
||||
|
|
|
@ -197,20 +197,20 @@ bool Face3::intersects_aabb(const Rect3 &p_aabb) const {
|
|||
|
||||
/** TEST FACE AXIS */
|
||||
|
||||
#define TEST_AXIS(m_ax) \
|
||||
{ \
|
||||
real_t aabb_min = p_aabb.pos.m_ax; \
|
||||
real_t aabb_max = p_aabb.pos.m_ax + p_aabb.size.m_ax; \
|
||||
real_t tri_min, tri_max; \
|
||||
for (int i = 0; i < 3; i++) { \
|
||||
if (i == 0 || vertex[i].m_ax > tri_max) \
|
||||
tri_max = vertex[i].m_ax; \
|
||||
if (i == 0 || vertex[i].m_ax < tri_min) \
|
||||
tri_min = vertex[i].m_ax; \
|
||||
} \
|
||||
\
|
||||
if (tri_max < aabb_min || aabb_max < tri_min) \
|
||||
return false; \
|
||||
#define TEST_AXIS(m_ax) \
|
||||
{ \
|
||||
real_t aabb_min = p_aabb.position.m_ax; \
|
||||
real_t aabb_max = p_aabb.position.m_ax + p_aabb.size.m_ax; \
|
||||
real_t tri_min, tri_max; \
|
||||
for (int i = 0; i < 3; i++) { \
|
||||
if (i == 0 || vertex[i].m_ax > tri_max) \
|
||||
tri_max = vertex[i].m_ax; \
|
||||
if (i == 0 || vertex[i].m_ax < tri_min) \
|
||||
tri_min = vertex[i].m_ax; \
|
||||
} \
|
||||
\
|
||||
if (tri_max < aabb_min || aabb_max < tri_min) \
|
||||
return false; \
|
||||
}
|
||||
|
||||
TEST_AXIS(x);
|
||||
|
|
|
@ -101,7 +101,7 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const {
|
|||
Vector3 perp = (vertex[0] - vertex[2]).cross(vertex[0] - vertex[1]);
|
||||
|
||||
Vector3 half_extents = p_aabb.size * 0.5;
|
||||
Vector3 ofs = p_aabb.pos + half_extents;
|
||||
Vector3 ofs = p_aabb.position + half_extents;
|
||||
|
||||
Vector3 sup = Vector3(
|
||||
(perp.x > 0) ? -half_extents.x : half_extents.x,
|
||||
|
@ -117,8 +117,8 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const {
|
|||
|
||||
#define TEST_AXIS(m_ax) \
|
||||
{ \
|
||||
real_t aabb_min = p_aabb.pos.m_ax; \
|
||||
real_t aabb_max = p_aabb.pos.m_ax + p_aabb.size.m_ax; \
|
||||
real_t aabb_min = p_aabb.position.m_ax; \
|
||||
real_t aabb_max = p_aabb.position.m_ax + p_aabb.size.m_ax; \
|
||||
real_t tri_min, tri_max; \
|
||||
for (int i = 0; i < 3; i++) { \
|
||||
if (i == 0 || vertex[i].m_ax > tri_max) \
|
||||
|
@ -150,68 +150,68 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const {
|
|||
|
||||
case 0: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z);
|
||||
} break;
|
||||
case 1: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z);
|
||||
} break;
|
||||
case 2: {
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
|
||||
} break;
|
||||
case 3: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
|
||||
} break;
|
||||
case 4: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
} break;
|
||||
case 5: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
} break;
|
||||
case 6: {
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
|
||||
} break;
|
||||
case 7: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
|
||||
} break;
|
||||
case 8: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
|
||||
} break;
|
||||
case 9: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
|
||||
} break;
|
||||
case 10: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z);
|
||||
|
||||
} break;
|
||||
case 11: {
|
||||
|
||||
from = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z);
|
||||
from = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z);
|
||||
to = Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z);
|
||||
|
||||
} break;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ enum _CellFlags {
|
|||
static inline void _plot_face(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, const Vector3 &voxelsize, const Face3 &p_face) {
|
||||
|
||||
Rect3 aabb(Vector3(x, y, z), Vector3(len_x, len_y, len_z));
|
||||
aabb.pos = aabb.pos * voxelsize;
|
||||
aabb.position = aabb.position * voxelsize;
|
||||
aabb.size = aabb.size * voxelsize;
|
||||
|
||||
if (!p_face.intersects_aabb(aabb))
|
||||
|
@ -640,7 +640,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
|
|||
Face3 f = faces[i];
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
||||
f.vertex[j] -= global_aabb.pos;
|
||||
f.vertex[j] -= global_aabb.position;
|
||||
}
|
||||
_plot_face(cell_status, 0, 0, 0, div_x, div_y, div_z, voxelsize, f);
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
|
|||
|
||||
Vector3 &v = wrapped_faces_ptr[i].vertex[j];
|
||||
v = v * voxelsize;
|
||||
v += global_aabb.pos;
|
||||
v += global_aabb.position;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -483,11 +483,11 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
|
|||
aabb.size *= 0.5;
|
||||
|
||||
if (i & 1)
|
||||
aabb.pos.x += aabb.size.x;
|
||||
aabb.position.x += aabb.size.x;
|
||||
if (i & 2)
|
||||
aabb.pos.y += aabb.size.y;
|
||||
aabb.position.y += aabb.size.y;
|
||||
if (i & 4)
|
||||
aabb.pos.z += aabb.size.z;
|
||||
aabb.position.z += aabb.size.z;
|
||||
|
||||
if (aabb.intersects_inclusive(p_element->aabb)) {
|
||||
/* if actually intersects, create the child */
|
||||
|
@ -544,11 +544,11 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) {
|
|||
|
||||
while (!base.encloses(p_aabb)) {
|
||||
|
||||
if (ABS(base.pos.x + base.size.x) <= ABS(base.pos.x)) {
|
||||
if (ABS(base.position.x + base.size.x) <= ABS(base.position.x)) {
|
||||
/* grow towards positive */
|
||||
base.size *= 2.0;
|
||||
} else {
|
||||
base.pos -= base.size;
|
||||
base.position -= base.size;
|
||||
base.size *= 2.0;
|
||||
}
|
||||
}
|
||||
|
@ -576,14 +576,14 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) {
|
|||
octant_count++;
|
||||
root->parent = gp;
|
||||
|
||||
if (ABS(base.pos.x + base.size.x) <= ABS(base.pos.x)) {
|
||||
if (ABS(base.position.x + base.size.x) <= ABS(base.position.x)) {
|
||||
/* grow towards positive */
|
||||
base.size *= 2.0;
|
||||
gp->aabb = base;
|
||||
gp->children[0] = root;
|
||||
root->parent_index = 0;
|
||||
} else {
|
||||
base.pos -= base.size;
|
||||
base.position -= base.size;
|
||||
base.size *= 2.0;
|
||||
gp->aabb = base;
|
||||
gp->children[(1 << 0) | (1 << 1) | (1 << 2)] = root; // add at all-positive
|
||||
|
@ -797,9 +797,9 @@ OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const Rect3 &p_a
|
|||
|
||||
// check for AABB validity
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_COND_V(p_aabb.pos.x > 1e15 || p_aabb.pos.x < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.pos.y > 1e15 || p_aabb.pos.y < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.pos.z > 1e15 || p_aabb.pos.z < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.position.x > 1e15 || p_aabb.position.x < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.position.y > 1e15 || p_aabb.position.y < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.position.z > 1e15 || p_aabb.position.z < -1e15, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.size.x > 1e15 || p_aabb.size.x < 0.0, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.size.y > 1e15 || p_aabb.size.y < 0.0, 0);
|
||||
ERR_FAIL_COND_V(p_aabb.size.z > 1e15 || p_aabb.size.z < 0.0, 0);
|
||||
|
@ -837,9 +837,9 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
// check for AABB validity
|
||||
ERR_FAIL_COND(p_aabb.pos.x > 1e15 || p_aabb.pos.x < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.pos.y > 1e15 || p_aabb.pos.y < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.pos.z > 1e15 || p_aabb.pos.z < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.position.x > 1e15 || p_aabb.position.x < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.position.y > 1e15 || p_aabb.position.y < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.position.z > 1e15 || p_aabb.position.z < -1e15);
|
||||
ERR_FAIL_COND(p_aabb.size.x > 1e15 || p_aabb.size.x < 0.0);
|
||||
ERR_FAIL_COND(p_aabb.size.y > 1e15 || p_aabb.size.y < 0.0);
|
||||
ERR_FAIL_COND(p_aabb.size.z > 1e15 || p_aabb.size.z < 0.0);
|
||||
|
|
|
@ -42,7 +42,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
|
|||
for (int i = 0; i < p_points.size(); i++) {
|
||||
|
||||
if (i == 0) {
|
||||
aabb.pos = p_points[i];
|
||||
aabb.position = p_points[i];
|
||||
} else {
|
||||
aabb.expand_to(p_points[i]);
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@ real_t Rect3::get_area() const {
|
|||
|
||||
bool Rect3::operator==(const Rect3 &p_rval) const {
|
||||
|
||||
return ((pos == p_rval.pos) && (size == p_rval.size));
|
||||
return ((position == p_rval.position) && (size == p_rval.size));
|
||||
}
|
||||
bool Rect3::operator!=(const Rect3 &p_rval) const {
|
||||
|
||||
return ((pos != p_rval.pos) || (size != p_rval.size));
|
||||
return ((position != p_rval.position) || (size != p_rval.size));
|
||||
}
|
||||
|
||||
void Rect3::merge_with(const Rect3 &p_aabb) {
|
||||
|
@ -51,8 +51,8 @@ void Rect3::merge_with(const Rect3 &p_aabb) {
|
|||
Vector3 end_1, end_2;
|
||||
Vector3 min, max;
|
||||
|
||||
beg_1 = pos;
|
||||
beg_2 = p_aabb.pos;
|
||||
beg_1 = position;
|
||||
beg_2 = p_aabb.position;
|
||||
end_1 = Vector3(size.x, size.y, size.z) + beg_1;
|
||||
end_2 = Vector3(p_aabb.size.x, p_aabb.size.y, p_aabb.size.z) + beg_2;
|
||||
|
||||
|
@ -64,16 +64,16 @@ void Rect3::merge_with(const Rect3 &p_aabb) {
|
|||
max.y = (end_1.y > end_2.y) ? end_1.y : end_2.y;
|
||||
max.z = (end_1.z > end_2.z) ? end_1.z : end_2.z;
|
||||
|
||||
pos = min;
|
||||
position = min;
|
||||
size = max - min;
|
||||
}
|
||||
|
||||
Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
||||
|
||||
Vector3 src_min = pos;
|
||||
Vector3 src_max = pos + size;
|
||||
Vector3 dst_min = p_aabb.pos;
|
||||
Vector3 dst_max = p_aabb.pos + p_aabb.size;
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
Vector3 dst_min = p_aabb.position;
|
||||
Vector3 dst_max = p_aabb.position + p_aabb.size;
|
||||
|
||||
Vector3 min, max;
|
||||
|
||||
|
@ -107,18 +107,18 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
|||
bool Rect3::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||
|
||||
Vector3 c1, c2;
|
||||
Vector3 end = pos + size;
|
||||
Vector3 end = position + size;
|
||||
real_t near = -1e20;
|
||||
real_t far = 1e20;
|
||||
int axis = 0;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (p_dir[i] == 0) {
|
||||
if ((p_from[i] < pos[i]) || (p_from[i] > end[i])) {
|
||||
if ((p_from[i] < position[i]) || (p_from[i] > end[i])) {
|
||||
return false;
|
||||
}
|
||||
} else { // ray not parallel to planes in this direction
|
||||
c1[i] = (pos[i] - p_from[i]) / p_dir[i];
|
||||
c1[i] = (position[i] - p_from[i]) / p_dir[i];
|
||||
c2[i] = (end[i] - p_from[i]) / p_dir[i];
|
||||
|
||||
if (c1[i] > c2[i]) {
|
||||
|
@ -156,7 +156,7 @@ bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vecto
|
|||
for (int i = 0; i < 3; i++) {
|
||||
real_t seg_from = p_from[i];
|
||||
real_t seg_to = p_to[i];
|
||||
real_t box_begin = pos[i];
|
||||
real_t box_begin = position[i];
|
||||
real_t box_end = box_begin + size[i];
|
||||
real_t cmin, cmax;
|
||||
real_t csign;
|
||||
|
@ -208,14 +208,14 @@ bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vecto
|
|||
bool Rect3::intersects_plane(const Plane &p_plane) const {
|
||||
|
||||
Vector3 points[8] = {
|
||||
Vector3(pos.x, pos.y, pos.z),
|
||||
Vector3(pos.x, pos.y, pos.z + size.z),
|
||||
Vector3(pos.x, pos.y + size.y, pos.z),
|
||||
Vector3(pos.x, pos.y + size.y, pos.z + size.z),
|
||||
Vector3(pos.x + size.x, pos.y, pos.z),
|
||||
Vector3(pos.x + size.x, pos.y, pos.z + size.z),
|
||||
Vector3(pos.x + size.x, pos.y + size.y, pos.z),
|
||||
Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z),
|
||||
Vector3(position.x, position.y, position.z),
|
||||
Vector3(position.x, position.y, position.z + size.z),
|
||||
Vector3(position.x, position.y + size.y, position.z),
|
||||
Vector3(position.x, position.y + size.y, position.z + size.z),
|
||||
Vector3(position.x + size.x, position.y, position.z),
|
||||
Vector3(position.x + size.x, position.y, position.z + size.z),
|
||||
Vector3(position.x + size.x, position.y + size.y, position.z),
|
||||
Vector3(position.x + size.x, position.y + size.y, position.z + size.z),
|
||||
};
|
||||
|
||||
bool over = false;
|
||||
|
@ -327,68 +327,68 @@ void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
|||
|
||||
case 0: {
|
||||
|
||||
r_from = Vector3(pos.x + size.x, pos.y, pos.z);
|
||||
r_to = Vector3(pos.x, pos.y, pos.z);
|
||||
r_from = Vector3(position.x + size.x, position.y, position.z);
|
||||
r_to = Vector3(position.x, position.y, position.z);
|
||||
} break;
|
||||
case 1: {
|
||||
|
||||
r_from = Vector3(pos.x + size.x, pos.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y, pos.z);
|
||||
r_from = Vector3(position.x + size.x, position.y, position.z + size.z);
|
||||
r_to = Vector3(position.x + size.x, position.y, position.z);
|
||||
} break;
|
||||
case 2: {
|
||||
r_from = Vector3(pos.x, pos.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x, position.y, position.z + size.z);
|
||||
r_to = Vector3(position.x + size.x, position.y, position.z + size.z);
|
||||
|
||||
} break;
|
||||
case 3: {
|
||||
|
||||
r_from = Vector3(pos.x, pos.y, pos.z);
|
||||
r_to = Vector3(pos.x, pos.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x, position.y, position.z);
|
||||
r_to = Vector3(position.x, position.y, position.z + size.z);
|
||||
|
||||
} break;
|
||||
case 4: {
|
||||
|
||||
r_from = Vector3(pos.x, pos.y + size.y, pos.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y + size.y, pos.z);
|
||||
r_from = Vector3(position.x, position.y + size.y, position.z);
|
||||
r_to = Vector3(position.x + size.x, position.y + size.y, position.z);
|
||||
} break;
|
||||
case 5: {
|
||||
|
||||
r_from = Vector3(pos.x + size.x, pos.y + size.y, pos.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x + size.x, position.y + size.y, position.z);
|
||||
r_to = Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
|
||||
} break;
|
||||
case 6: {
|
||||
r_from = Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x, pos.y + size.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
|
||||
r_to = Vector3(position.x, position.y + size.y, position.z + size.z);
|
||||
|
||||
} break;
|
||||
case 7: {
|
||||
|
||||
r_from = Vector3(pos.x, pos.y + size.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x, pos.y + size.y, pos.z);
|
||||
r_from = Vector3(position.x, position.y + size.y, position.z + size.z);
|
||||
r_to = Vector3(position.x, position.y + size.y, position.z);
|
||||
|
||||
} break;
|
||||
case 8: {
|
||||
|
||||
r_from = Vector3(pos.x, pos.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x, pos.y + size.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x, position.y, position.z + size.z);
|
||||
r_to = Vector3(position.x, position.y + size.y, position.z + size.z);
|
||||
|
||||
} break;
|
||||
case 9: {
|
||||
|
||||
r_from = Vector3(pos.x, pos.y, pos.z);
|
||||
r_to = Vector3(pos.x, pos.y + size.y, pos.z);
|
||||
r_from = Vector3(position.x, position.y, position.z);
|
||||
r_to = Vector3(position.x, position.y + size.y, position.z);
|
||||
|
||||
} break;
|
||||
case 10: {
|
||||
|
||||
r_from = Vector3(pos.x + size.x, pos.y, pos.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y + size.y, pos.z);
|
||||
r_from = Vector3(position.x + size.x, position.y, position.z);
|
||||
r_to = Vector3(position.x + size.x, position.y + size.y, position.z);
|
||||
|
||||
} break;
|
||||
case 11: {
|
||||
|
||||
r_from = Vector3(pos.x + size.x, pos.y, pos.z + size.z);
|
||||
r_to = Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z);
|
||||
r_from = Vector3(position.x + size.x, position.y, position.z + size.z);
|
||||
r_to = Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
|
||||
|
||||
} break;
|
||||
}
|
||||
|
@ -396,5 +396,5 @@ void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
|||
|
||||
Rect3::operator String() const {
|
||||
|
||||
return String() + pos + " - " + size;
|
||||
return String() + position + " - " + size;
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
|
||||
/**
|
||||
* AABB / AABB (Axis Aligned Bounding Box)
|
||||
* This is implemented by a point (pos) and the box size
|
||||
* This is implemented by a point (position) and the box size
|
||||
*/
|
||||
|
||||
class Rect3 {
|
||||
public:
|
||||
Vector3 pos;
|
||||
Vector3 position;
|
||||
Vector3 size;
|
||||
|
||||
real_t get_area() const; /// get area
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
return (size.x <= CMP_EPSILON && size.y <= CMP_EPSILON && size.z <= CMP_EPSILON);
|
||||
}
|
||||
|
||||
const Vector3 &get_pos() const { return pos; }
|
||||
void set_pos(const Vector3 &p_pos) { pos = p_pos; }
|
||||
const Vector3 &get_position() const { return position; }
|
||||
void set_position(const Vector3 &p_pos) { position = p_pos; }
|
||||
const Vector3 &get_size() const { return size; }
|
||||
void set_size(const Vector3 &p_size) { size = p_size; }
|
||||
|
||||
|
@ -102,24 +102,24 @@ public:
|
|||
|
||||
_FORCE_INLINE_ Rect3() {}
|
||||
inline Rect3(const Vector3 &p_pos, const Vector3 &p_size) {
|
||||
pos = p_pos;
|
||||
position = p_pos;
|
||||
size = p_size;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool Rect3::intersects(const Rect3 &p_aabb) const {
|
||||
|
||||
if (pos.x >= (p_aabb.pos.x + p_aabb.size.x))
|
||||
if (position.x >= (p_aabb.position.x + p_aabb.size.x))
|
||||
return false;
|
||||
if ((pos.x + size.x) <= p_aabb.pos.x)
|
||||
if ((position.x + size.x) <= p_aabb.position.x)
|
||||
return false;
|
||||
if (pos.y >= (p_aabb.pos.y + p_aabb.size.y))
|
||||
if (position.y >= (p_aabb.position.y + p_aabb.size.y))
|
||||
return false;
|
||||
if ((pos.y + size.y) <= p_aabb.pos.y)
|
||||
if ((position.y + size.y) <= p_aabb.position.y)
|
||||
return false;
|
||||
if (pos.z >= (p_aabb.pos.z + p_aabb.size.z))
|
||||
if (position.z >= (p_aabb.position.z + p_aabb.size.z))
|
||||
return false;
|
||||
if ((pos.z + size.z) <= p_aabb.pos.z)
|
||||
if ((position.z + size.z) <= p_aabb.position.z)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -127,17 +127,17 @@ inline bool Rect3::intersects(const Rect3 &p_aabb) const {
|
|||
|
||||
inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const {
|
||||
|
||||
if (pos.x > (p_aabb.pos.x + p_aabb.size.x))
|
||||
if (position.x > (p_aabb.position.x + p_aabb.size.x))
|
||||
return false;
|
||||
if ((pos.x + size.x) < p_aabb.pos.x)
|
||||
if ((position.x + size.x) < p_aabb.position.x)
|
||||
return false;
|
||||
if (pos.y > (p_aabb.pos.y + p_aabb.size.y))
|
||||
if (position.y > (p_aabb.position.y + p_aabb.size.y))
|
||||
return false;
|
||||
if ((pos.y + size.y) < p_aabb.pos.y)
|
||||
if ((position.y + size.y) < p_aabb.position.y)
|
||||
return false;
|
||||
if (pos.z > (p_aabb.pos.z + p_aabb.size.z))
|
||||
if (position.z > (p_aabb.position.z + p_aabb.size.z))
|
||||
return false;
|
||||
if ((pos.z + size.z) < p_aabb.pos.z)
|
||||
if ((position.z + size.z) < p_aabb.position.z)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -145,10 +145,10 @@ inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const {
|
|||
|
||||
inline bool Rect3::encloses(const Rect3 &p_aabb) const {
|
||||
|
||||
Vector3 src_min = pos;
|
||||
Vector3 src_max = pos + size;
|
||||
Vector3 dst_min = p_aabb.pos;
|
||||
Vector3 dst_max = p_aabb.pos + p_aabb.size;
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
Vector3 dst_min = p_aabb.position;
|
||||
Vector3 dst_max = p_aabb.position + p_aabb.size;
|
||||
|
||||
return (
|
||||
(src_min.x <= dst_min.x) &&
|
||||
|
@ -162,7 +162,7 @@ inline bool Rect3::encloses(const Rect3 &p_aabb) const {
|
|||
Vector3 Rect3::get_support(const Vector3 &p_normal) const {
|
||||
|
||||
Vector3 half_extents = size * 0.5;
|
||||
Vector3 ofs = pos + half_extents;
|
||||
Vector3 ofs = position + half_extents;
|
||||
|
||||
return Vector3(
|
||||
(p_normal.x > 0) ? -half_extents.x : half_extents.x,
|
||||
|
@ -174,14 +174,14 @@ Vector3 Rect3::get_support(const Vector3 &p_normal) const {
|
|||
Vector3 Rect3::get_endpoint(int p_point) const {
|
||||
|
||||
switch (p_point) {
|
||||
case 0: return Vector3(pos.x, pos.y, pos.z);
|
||||
case 1: return Vector3(pos.x, pos.y, pos.z + size.z);
|
||||
case 2: return Vector3(pos.x, pos.y + size.y, pos.z);
|
||||
case 3: return Vector3(pos.x, pos.y + size.y, pos.z + size.z);
|
||||
case 4: return Vector3(pos.x + size.x, pos.y, pos.z);
|
||||
case 5: return Vector3(pos.x + size.x, pos.y, pos.z + size.z);
|
||||
case 6: return Vector3(pos.x + size.x, pos.y + size.y, pos.z);
|
||||
case 7: return Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z);
|
||||
case 0: return Vector3(position.x, position.y, position.z);
|
||||
case 1: return Vector3(position.x, position.y, position.z + size.z);
|
||||
case 2: return Vector3(position.x, position.y + size.y, position.z);
|
||||
case 3: return Vector3(position.x, position.y + size.y, position.z + size.z);
|
||||
case 4: return Vector3(position.x + size.x, position.y, position.z);
|
||||
case 5: return Vector3(position.x + size.x, position.y, position.z + size.z);
|
||||
case 6: return Vector3(position.x + size.x, position.y + size.y, position.z);
|
||||
case 7: return Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
|
||||
};
|
||||
|
||||
ERR_FAIL_V(Vector3());
|
||||
|
@ -192,7 +192,7 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co
|
|||
#if 1
|
||||
|
||||
Vector3 half_extents = size * 0.5;
|
||||
Vector3 ofs = pos + half_extents;
|
||||
Vector3 ofs = position + half_extents;
|
||||
|
||||
for (int i = 0; i < p_plane_count; i++) {
|
||||
const Plane &p = p_planes[i];
|
||||
|
@ -210,14 +210,14 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co
|
|||
//cache all points to check against!
|
||||
// #warning should be easy to optimize, just use the same as when taking the support and use only that point
|
||||
Vector3 points[8] = {
|
||||
Vector3(pos.x, pos.y, pos.z),
|
||||
Vector3(pos.x, pos.y, pos.z + size.z),
|
||||
Vector3(pos.x, pos.y + size.y, pos.z),
|
||||
Vector3(pos.x, pos.y + size.y, pos.z + size.z),
|
||||
Vector3(pos.x + size.x, pos.y, pos.z),
|
||||
Vector3(pos.x + size.x, pos.y, pos.z + size.z),
|
||||
Vector3(pos.x + size.x, pos.y + size.y, pos.z),
|
||||
Vector3(pos.x + size.x, pos.y + size.y, pos.z + size.z),
|
||||
Vector3(position.x, position.y, position.z),
|
||||
Vector3(position.x, position.y, position.z + size.z),
|
||||
Vector3(position.x, position.y + size.y, position.z),
|
||||
Vector3(position.x, position.y + size.y, position.z + size.z),
|
||||
Vector3(position.x + size.x, position.y, position.z),
|
||||
Vector3(position.x + size.x, position.y, position.z + size.z),
|
||||
Vector3(position.x + size.x, position.y + size.y, position.z),
|
||||
Vector3(position.x + size.x, position.y + size.y, position.z + size.z),
|
||||
};
|
||||
|
||||
for (int i = 0; i < p_plane_count; i++) { //for each plane
|
||||
|
@ -246,17 +246,17 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co
|
|||
|
||||
bool Rect3::has_point(const Vector3 &p_point) const {
|
||||
|
||||
if (p_point.x < pos.x)
|
||||
if (p_point.x < position.x)
|
||||
return false;
|
||||
if (p_point.y < pos.y)
|
||||
if (p_point.y < position.y)
|
||||
return false;
|
||||
if (p_point.z < pos.z)
|
||||
if (p_point.z < position.z)
|
||||
return false;
|
||||
if (p_point.x > pos.x + size.x)
|
||||
if (p_point.x > position.x + size.x)
|
||||
return false;
|
||||
if (p_point.y > pos.y + size.y)
|
||||
if (p_point.y > position.y + size.y)
|
||||
return false;
|
||||
if (p_point.z > pos.z + size.z)
|
||||
if (p_point.z > position.z + size.z)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -264,8 +264,8 @@ bool Rect3::has_point(const Vector3 &p_point) const {
|
|||
|
||||
inline void Rect3::expand_to(const Vector3 &p_vector) {
|
||||
|
||||
Vector3 begin = pos;
|
||||
Vector3 end = pos + size;
|
||||
Vector3 begin = position;
|
||||
Vector3 end = position + size;
|
||||
|
||||
if (p_vector.x < begin.x)
|
||||
begin.x = p_vector.x;
|
||||
|
@ -281,14 +281,14 @@ inline void Rect3::expand_to(const Vector3 &p_vector) {
|
|||
if (p_vector.z > end.z)
|
||||
end.z = p_vector.z;
|
||||
|
||||
pos = begin;
|
||||
position = begin;
|
||||
size = end - begin;
|
||||
}
|
||||
|
||||
void Rect3::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const {
|
||||
|
||||
Vector3 half_extents(size.x * 0.5, size.y * 0.5, size.z * 0.5);
|
||||
Vector3 center(pos.x + half_extents.x, pos.y + half_extents.y, pos.z + half_extents.z);
|
||||
Vector3 center(position.x + half_extents.x, position.y + half_extents.y, position.z + half_extents.z);
|
||||
|
||||
real_t length = p_plane.normal.abs().dot(half_extents);
|
||||
real_t distance = p_plane.distance_to(center);
|
||||
|
@ -332,21 +332,21 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
|
|||
real_t divy = 1.0 / dir.y;
|
||||
real_t divz = 1.0 / dir.z;
|
||||
|
||||
Vector3 upbound = pos + size;
|
||||
Vector3 upbound = position + size;
|
||||
real_t tmin, tmax, tymin, tymax, tzmin, tzmax;
|
||||
if (dir.x >= 0) {
|
||||
tmin = (pos.x - from.x) * divx;
|
||||
tmin = (position.x - from.x) * divx;
|
||||
tmax = (upbound.x - from.x) * divx;
|
||||
} else {
|
||||
tmin = (upbound.x - from.x) * divx;
|
||||
tmax = (pos.x - from.x) * divx;
|
||||
tmax = (position.x - from.x) * divx;
|
||||
}
|
||||
if (dir.y >= 0) {
|
||||
tymin = (pos.y - from.y) * divy;
|
||||
tymin = (position.y - from.y) * divy;
|
||||
tymax = (upbound.y - from.y) * divy;
|
||||
} else {
|
||||
tymin = (upbound.y - from.y) * divy;
|
||||
tymax = (pos.y - from.y) * divy;
|
||||
tymax = (position.y - from.y) * divy;
|
||||
}
|
||||
if ((tmin > tymax) || (tymin > tmax))
|
||||
return false;
|
||||
|
@ -355,11 +355,11 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
|
|||
if (tymax < tmax)
|
||||
tmax = tymax;
|
||||
if (dir.z >= 0) {
|
||||
tzmin = (pos.z - from.z) * divz;
|
||||
tzmin = (position.z - from.z) * divz;
|
||||
tzmax = (upbound.z - from.z) * divz;
|
||||
} else {
|
||||
tzmin = (upbound.z - from.z) * divz;
|
||||
tzmax = (pos.z - from.z) * divz;
|
||||
tzmax = (position.z - from.z) * divz;
|
||||
}
|
||||
if ((tmin > tzmax) || (tzmin > tmax))
|
||||
return false;
|
||||
|
@ -372,9 +372,9 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
|
|||
|
||||
void Rect3::grow_by(real_t p_amount) {
|
||||
|
||||
pos.x -= p_amount;
|
||||
pos.y -= p_amount;
|
||||
pos.z -= p_amount;
|
||||
position.x -= p_amount;
|
||||
position.y -= p_amount;
|
||||
position.z -= p_amount;
|
||||
size.x += 2.0 * p_amount;
|
||||
size.y += 2.0 * p_amount;
|
||||
size.z += 2.0 * p_amount;
|
||||
|
|
|
@ -167,10 +167,10 @@ _FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
|
|||
Vector3 x = basis.get_axis(0) * p_aabb.size.x;
|
||||
Vector3 y = basis.get_axis(1) * p_aabb.size.y;
|
||||
Vector3 z = basis.get_axis(2) * p_aabb.size.z;
|
||||
Vector3 pos = xform(p_aabb.pos);
|
||||
Vector3 pos = xform(p_aabb.position);
|
||||
//could be even further optimized
|
||||
Rect3 new_aabb;
|
||||
new_aabb.pos = pos;
|
||||
new_aabb.position = pos;
|
||||
new_aabb.expand_to(pos + x);
|
||||
new_aabb.expand_to(pos + y);
|
||||
new_aabb.expand_to(pos + z);
|
||||
|
@ -182,14 +182,14 @@ _FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
|
|||
#else
|
||||
|
||||
Vector3 vertices[8] = {
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z)
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z)
|
||||
};
|
||||
|
||||
AABB ret;
|
||||
|
@ -208,19 +208,19 @@ _FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const {
|
|||
|
||||
/* define vertices */
|
||||
Vector3 vertices[8] = {
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x + p_aabb.size.x, p_aabb.pos.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y + p_aabb.size.y, p_aabb.pos.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.pos.x, p_aabb.pos.y, p_aabb.pos.z)
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z),
|
||||
Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z)
|
||||
};
|
||||
|
||||
Rect3 ret;
|
||||
|
||||
ret.pos = xform_inv(vertices[0]);
|
||||
ret.position = xform_inv(vertices[0]);
|
||||
|
||||
for (int i = 1; i < 8; i++) {
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, in
|
|||
int index = max_alloc++;
|
||||
BVH *_new = &p_bvh[index];
|
||||
_new->aabb = aabb;
|
||||
_new->center = aabb.pos + aabb.size * 0.5;
|
||||
_new->center = aabb.position + aabb.size * 0.5;
|
||||
_new->face_index = -1;
|
||||
_new->left = left;
|
||||
_new->right = right;
|
||||
|
@ -128,7 +128,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
|
|||
|
||||
f.indices[j] = vidx;
|
||||
if (j == 0)
|
||||
bw[i].aabb.pos = vs;
|
||||
bw[i].aabb.position = vs;
|
||||
else
|
||||
bw[i].aabb.expand_to(vs);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
|
|||
bw[i].left = -1;
|
||||
bw[i].right = -1;
|
||||
bw[i].face_index = i;
|
||||
bw[i].center = bw[i].aabb.pos + bw[i].aabb.size * 0.5;
|
||||
bw[i].center = bw[i].aabb.position + bw[i].aabb.size * 0.5;
|
||||
}
|
||||
|
||||
vertices.resize(db.size());
|
||||
|
|
|
@ -2590,7 +2590,7 @@ uint32_t Variant::hash() const {
|
|||
uint32_t hash = 5831;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
hash = hash_djb2_one_float(_data._rect3->pos[i], hash);
|
||||
hash = hash_djb2_one_float(_data._rect3->position[i], hash);
|
||||
hash = hash_djb2_one_float(_data._rect3->size[i], hash);
|
||||
}
|
||||
|
||||
|
@ -2855,7 +2855,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
|
|||
const Rect3 *l = _data._rect3;
|
||||
const Rect3 *r = p_variant._data._rect3;
|
||||
|
||||
return (hash_compare_vector3(l->pos, r->pos) &&
|
||||
return (hash_compare_vector3(l->position, r->position) &&
|
||||
(hash_compare_vector3(l->size, r->size)));
|
||||
|
||||
} break;
|
||||
|
|
|
@ -1304,9 +1304,9 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
|
|||
|
||||
const String *str = reinterpret_cast<const String *>(p_index._data._mem);
|
||||
Rect3 *v = _data._rect3;
|
||||
if (*str == "pos") {
|
||||
if (*str == "position") {
|
||||
valid = true;
|
||||
v->pos = p_value;
|
||||
v->position = p_value;
|
||||
return;
|
||||
} else if (*str == "size") {
|
||||
valid = true;
|
||||
|
@ -1314,7 +1314,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
|
|||
return;
|
||||
} else if (*str == "end") {
|
||||
valid = true;
|
||||
v->size = Vector3(p_value) - v->pos;
|
||||
v->size = Vector3(p_value) - v->position;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1718,15 +1718,15 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
|
|||
|
||||
const String *str = reinterpret_cast<const String *>(p_index._data._mem);
|
||||
const Rect3 *v = _data._rect3;
|
||||
if (*str == "pos") {
|
||||
if (*str == "position") {
|
||||
valid = true;
|
||||
return v->pos;
|
||||
return v->position;
|
||||
} else if (*str == "size") {
|
||||
valid = true;
|
||||
return v->size;
|
||||
} else if (*str == "end") {
|
||||
valid = true;
|
||||
return v->size + v->pos;
|
||||
return v->size + v->position;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@ -2769,7 +2769,7 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
|
|||
case RECT3: {
|
||||
const Rect3 *ra = reinterpret_cast<const Rect3 *>(a._data._mem);
|
||||
const Rect3 *rb = reinterpret_cast<const Rect3 *>(b._data._mem);
|
||||
r_dst = Rect3(ra->pos + rb->pos * c, ra->size + rb->size * c);
|
||||
r_dst = Rect3(ra->position + rb->position * c, ra->size + rb->size * c);
|
||||
}
|
||||
return;
|
||||
case QUAT: {
|
||||
|
@ -2899,7 +2899,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
|
|||
}
|
||||
return;
|
||||
case RECT3: {
|
||||
r_dst = Rect3(a._data._rect3->pos.linear_interpolate(b._data._rect3->pos, c), a._data._rect3->size.linear_interpolate(b._data._rect3->size, c));
|
||||
r_dst = Rect3(a._data._rect3->position.linear_interpolate(b._data._rect3->position, c), a._data._rect3->size.linear_interpolate(b._data._rect3->size, c));
|
||||
}
|
||||
return;
|
||||
case BASIS: {
|
||||
|
|
|
@ -1637,7 +1637,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
|
|||
case Variant::RECT3: {
|
||||
|
||||
Rect3 aabb = p_variant;
|
||||
p_store_string_func(p_store_string_ud, "Rect3( " + rtosfix(aabb.pos.x) + ", " + rtosfix(aabb.pos.y) + ", " + rtosfix(aabb.pos.z) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + ", " + rtosfix(aabb.size.z) + " )");
|
||||
p_store_string_func(p_store_string_ud, "Rect3( " + rtosfix(aabb.position.x) + ", " + rtosfix(aabb.position.y) + ", " + rtosfix(aabb.position.z) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + ", " + rtosfix(aabb.size.z) + " )");
|
||||
|
||||
} break;
|
||||
case Variant::QUAT: {
|
||||
|
|
|
@ -3830,7 +3830,7 @@ void RasterizerStorageGLES3::immediate_vertex(RID p_immediate, const Vector3 &p_
|
|||
|
||||
if (c->vertices.empty() && im->chunks.size() == 1) {
|
||||
|
||||
im->aabb.pos = p_vertex;
|
||||
im->aabb.position = p_vertex;
|
||||
im->aabb.size = Vector3();
|
||||
} else {
|
||||
im->aabb.expand_to(p_vertex);
|
||||
|
@ -4497,7 +4497,7 @@ Rect3 RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const {
|
|||
ERR_FAIL_COND_V(!reflection_probe, Rect3());
|
||||
|
||||
Rect3 aabb;
|
||||
aabb.pos = -reflection_probe->extents;
|
||||
aabb.position = -reflection_probe->extents;
|
||||
aabb.size = reflection_probe->extents * 2.0;
|
||||
|
||||
return aabb;
|
||||
|
@ -5090,7 +5090,7 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
|||
pos = inv.xform(pos);
|
||||
}
|
||||
if (i == 0)
|
||||
aabb.pos = pos;
|
||||
aabb.position = pos;
|
||||
else
|
||||
aabb.expand_to(pos);
|
||||
}
|
||||
|
|
|
@ -795,8 +795,8 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) {
|
|||
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
print_line("mesh aabb: " + aabb);
|
||||
Vector3 ofs = aabb.pos + aabb.size * 0.5;
|
||||
aabb.pos -= ofs;
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
aabb.position -= ofs;
|
||||
Transform xform;
|
||||
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.125);
|
||||
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.125) * xform.basis;
|
||||
|
|
|
@ -254,7 +254,7 @@ void ParticlesEditor::_generate_emission_points() {
|
|||
for (int j = 0; j < 3; j++) {
|
||||
|
||||
if (i == 0 && j == 0)
|
||||
aabb.pos = r[i].vertex[j];
|
||||
aabb.position = r[i].vertex[j];
|
||||
else
|
||||
aabb.expand_to(r[i].vertex[j]);
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ void ParticlesEditor::_generate_emission_points() {
|
|||
dir[Math::rand() % 3] = 1.0;
|
||||
Vector3 ofs = Vector3(1, 1, 1) - dir;
|
||||
ofs = (Vector3(1, 1, 1) - dir) * Vector3(Math::randf(), Math::randf(), Math::randf()) * aabb.size;
|
||||
ofs += aabb.pos;
|
||||
ofs += aabb.position;
|
||||
|
||||
Vector3 ofsv = ofs + aabb.size * dir;
|
||||
|
||||
|
|
|
@ -1676,7 +1676,7 @@ void SpatialEditorViewport::_notification(int p_what) {
|
|||
}
|
||||
|
||||
Transform t = sp->get_global_transform();
|
||||
t.translate(se->aabb.pos);
|
||||
t.translate(se->aabb.position);
|
||||
t.basis.scale(se->aabb.size);
|
||||
|
||||
exist = true;
|
||||
|
@ -2379,7 +2379,7 @@ void SpatialEditor::update_transform_gizmo() {
|
|||
|
||||
Transform xf = se->sp->get_global_transform();
|
||||
if (first) {
|
||||
center.pos = xf.origin;
|
||||
center.position = xf.origin;
|
||||
first = false;
|
||||
if (local_gizmo_coords) {
|
||||
gizmo_basis = xf.basis;
|
||||
|
@ -2392,7 +2392,7 @@ void SpatialEditor::update_transform_gizmo() {
|
|||
//count++;
|
||||
}
|
||||
|
||||
Vector3 pcenter = center.pos + center.size * 0.5;
|
||||
Vector3 pcenter = center.position + center.size * 0.5;
|
||||
gizmo.visible = !first;
|
||||
gizmo.transform.origin = pcenter;
|
||||
gizmo.transform.basis = gizmo_basis;
|
||||
|
|
|
@ -733,9 +733,9 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
config_value_editors(6, 3, 16, field_names);
|
||||
|
||||
Rect3 aabb = v;
|
||||
value_editor[0]->set_text(String::num(aabb.pos.x));
|
||||
value_editor[1]->set_text(String::num(aabb.pos.y));
|
||||
value_editor[2]->set_text(String::num(aabb.pos.z));
|
||||
value_editor[0]->set_text(String::num(aabb.position.x));
|
||||
value_editor[1]->set_text(String::num(aabb.position.y));
|
||||
value_editor[2]->set_text(String::num(aabb.position.z));
|
||||
value_editor[3]->set_text(String::num(aabb.size.x));
|
||||
value_editor[4]->set_text(String::num(aabb.size.y));
|
||||
value_editor[5]->set_text(String::num(aabb.size.z));
|
||||
|
|
|
@ -1722,8 +1722,8 @@ void CollisionShapeSpatialGizmo::redraw() {
|
|||
Ref<BoxShape> bs = s;
|
||||
Vector<Vector3> lines;
|
||||
Rect3 aabb;
|
||||
aabb.pos = -bs->get_extents();
|
||||
aabb.size = aabb.pos * -2;
|
||||
aabb.position = -bs->get_extents();
|
||||
aabb.size = aabb.position * -2;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -1953,7 +1953,7 @@ void VisibilityNotifierGizmo::set_handle(int p_idx, Camera *p_camera, const Poin
|
|||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
||||
Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) };
|
||||
Vector3 ofs = aabb.pos + aabb.size * 0.5;
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
|
||||
Vector3 axis;
|
||||
axis[p_idx] = 1.0;
|
||||
|
@ -1964,7 +1964,7 @@ void VisibilityNotifierGizmo::set_handle(int p_idx, Camera *p_camera, const Poin
|
|||
if (d < 0.001)
|
||||
d = 0.001;
|
||||
|
||||
aabb.pos[p_idx] = (aabb.pos[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.position[p_idx] = (aabb.position[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.size[p_idx] = d * 2;
|
||||
notifier->set_aabb(aabb);
|
||||
}
|
||||
|
@ -2002,7 +2002,7 @@ void VisibilityNotifierGizmo::redraw() {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Vector3 ax;
|
||||
ax[i] = aabb.pos[i] + aabb.size[i];
|
||||
ax[i] = aabb.position[i] + aabb.size[i];
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
|
@ -2053,7 +2053,7 @@ void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_poi
|
|||
|
||||
Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) };
|
||||
|
||||
Vector3 ofs = aabb.pos + aabb.size * 0.5;
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
|
||||
Vector3 axis;
|
||||
axis[p_idx] = 1.0;
|
||||
|
@ -2065,7 +2065,7 @@ void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_poi
|
|||
|
||||
float d = ra[p_idx];
|
||||
|
||||
aabb.pos[p_idx] = d - 1.0 - aabb.size[p_idx] * 0.5;
|
||||
aabb.position[p_idx] = d - 1.0 - aabb.size[p_idx] * 0.5;
|
||||
particles->set_visibility_aabb(aabb);
|
||||
|
||||
} else {
|
||||
|
@ -2076,7 +2076,7 @@ void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_poi
|
|||
if (d < 0.001)
|
||||
d = 0.001;
|
||||
//resize
|
||||
aabb.pos[p_idx] = (aabb.pos[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.position[p_idx] = (aabb.position[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.size[p_idx] = d * 2;
|
||||
particles->set_visibility_aabb(aabb);
|
||||
}
|
||||
|
@ -2115,13 +2115,13 @@ void ParticlesGizmo::redraw() {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Vector3 ax;
|
||||
ax[i] = aabb.pos[i] + aabb.size[i];
|
||||
ax[(i + 1) % 3] = aabb.pos[(i + 1) % 3] + aabb.size[(i + 1) % 3] * 0.5;
|
||||
ax[(i + 2) % 3] = aabb.pos[(i + 2) % 3] + aabb.size[(i + 2) % 3] * 0.5;
|
||||
ax[i] = aabb.position[i] + aabb.size[i];
|
||||
ax[(i + 1) % 3] = aabb.position[(i + 1) % 3] + aabb.size[(i + 1) % 3] * 0.5;
|
||||
ax[(i + 2) % 3] = aabb.position[(i + 2) % 3] + aabb.size[(i + 2) % 3] * 0.5;
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
Vector3 center = aabb.pos + aabb.size * 0.5;
|
||||
Vector3 center = aabb.position + aabb.size * 0.5;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Vector3 ax;
|
||||
|
@ -2218,7 +2218,7 @@ void ReflectionProbeGizmo::commit_handle(int p_idx, const Variant &p_restore, bo
|
|||
Rect3 restore = p_restore;
|
||||
|
||||
if (p_cancel) {
|
||||
probe->set_extents(restore.pos);
|
||||
probe->set_extents(restore.position);
|
||||
probe->set_origin_offset(restore.size);
|
||||
return;
|
||||
}
|
||||
|
@ -2227,7 +2227,7 @@ void ReflectionProbeGizmo::commit_handle(int p_idx, const Variant &p_restore, bo
|
|||
ur->create_action(TTR("Change Probe Extents"));
|
||||
ur->add_do_method(probe, "set_extents", probe->get_extents());
|
||||
ur->add_do_method(probe, "set_origin_offset", probe->get_origin_offset());
|
||||
ur->add_undo_method(probe, "set_extents", restore.pos);
|
||||
ur->add_undo_method(probe, "set_extents", restore.position);
|
||||
ur->add_undo_method(probe, "set_origin_offset", restore.size);
|
||||
ur->commit_action();
|
||||
}
|
||||
|
@ -2241,7 +2241,7 @@ void ReflectionProbeGizmo::redraw() {
|
|||
Vector3 extents = probe->get_extents();
|
||||
|
||||
Rect3 aabb;
|
||||
aabb.pos = -extents;
|
||||
aabb.position = -extents;
|
||||
aabb.size = extents * 2;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
@ -2262,7 +2262,7 @@ void ReflectionProbeGizmo::redraw() {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Vector3 ax;
|
||||
ax[i] = aabb.pos[i] + aabb.size[i];
|
||||
ax[i] = aabb.position[i] + aabb.size[i];
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
|
@ -2392,7 +2392,7 @@ void GIProbeGizmo::redraw() {
|
|||
|
||||
for (int k = 0; k < 4; k++) {
|
||||
|
||||
Vector3 from = aabb.pos, to = aabb.pos;
|
||||
Vector3 from = aabb.position, to = aabb.position;
|
||||
from[j] += cell_size * i;
|
||||
to[j] += cell_size * i;
|
||||
|
||||
|
@ -2421,7 +2421,7 @@ void GIProbeGizmo::redraw() {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Vector3 ax;
|
||||
ax[i] = aabb.pos[i] + aabb.size[i];
|
||||
ax[i] = aabb.position[i] + aabb.size[i];
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,18 +45,18 @@ void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, cons
|
|||
*dest = Rect3(*pos, *size);
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_pos(const godot_rect3 *p_self) {
|
||||
godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) {
|
||||
godot_vector3 raw_ret;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
Vector3 *ret = (Vector3 *)&raw_ret;
|
||||
*ret = self->pos;
|
||||
*ret = self->position;
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
void GDAPI godot_rect3_set_pos(const godot_rect3 *p_self, const godot_vector3 *p_v) {
|
||||
void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) {
|
||||
Rect3 *self = (Rect3 *)p_self;
|
||||
const Vector3 *v = (const Vector3 *)p_v;
|
||||
self->pos = *v;
|
||||
self->position = *v;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) {
|
||||
|
|
|
@ -49,8 +49,8 @@ typedef struct godot_rect3 {
|
|||
|
||||
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_pos(const godot_rect3 *p_self);
|
||||
void GDAPI godot_rect3_set_pos(const godot_rect3 *p_self, const godot_vector3 *p_v);
|
||||
godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self);
|
||||
void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self);
|
||||
void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v);
|
||||
|
|
|
@ -1057,12 +1057,12 @@ Error GridMap::create_area(int p_id, const Rect3 &p_bounds) {
|
|||
|
||||
// FIRST VALIDATE AREA
|
||||
IndexKey from, to;
|
||||
from.x = p_bounds.pos.x;
|
||||
from.y = p_bounds.pos.y;
|
||||
from.z = p_bounds.pos.z;
|
||||
to.x = p_bounds.pos.x + p_bounds.size.x;
|
||||
to.y = p_bounds.pos.y + p_bounds.size.y;
|
||||
to.z = p_bounds.pos.z + p_bounds.size.z;
|
||||
from.x = p_bounds.position.x;
|
||||
from.y = p_bounds.position.y;
|
||||
from.z = p_bounds.position.z;
|
||||
to.x = p_bounds.position.x + p_bounds.size.x;
|
||||
to.y = p_bounds.position.y + p_bounds.size.y;
|
||||
to.z = p_bounds.position.z + p_bounds.size.z;
|
||||
|
||||
for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) {
|
||||
//this should somehow be faster...
|
||||
|
@ -1101,8 +1101,8 @@ Rect3 GridMap::area_get_bounds(int p_area) const {
|
|||
|
||||
const Area *a = area_map[p_area];
|
||||
Rect3 aabb;
|
||||
aabb.pos = Vector3(a->from.x, a->from.y, a->from.z);
|
||||
aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.pos;
|
||||
aabb.position = Vector3(a->from.x, a->from.y, a->from.z);
|
||||
aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.position;
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
|
|
@ -635,7 +635,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
|
|||
|
||||
int area = E->get();
|
||||
Rect3 aabb = node->area_get_bounds(area);
|
||||
aabb.pos *= node->get_cell_size();
|
||||
aabb.position *= node->get_cell_size();
|
||||
aabb.size *= node->get_cell_size();
|
||||
|
||||
Vector3 rclip, rnormal;
|
||||
|
|
|
@ -208,7 +208,7 @@ void CollisionPolygon::set_polygon(const Vector<Point2> &p_polygon) {
|
|||
|
||||
aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2));
|
||||
} else {
|
||||
aabb.pos -= aabb.size * 0.3;
|
||||
aabb.position -= aabb.size * 0.3;
|
||||
aabb.size += aabb.size * 0.6;
|
||||
}
|
||||
_update_parent();
|
||||
|
|
|
@ -564,7 +564,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
|
||||
Vector3 ofs_j = float(j) * t2;
|
||||
|
||||
Vector3 from = p_aabb.pos + ofs_i + ofs_j;
|
||||
Vector3 from = p_aabb.position + ofs_i + ofs_j;
|
||||
Vector3 to = from + t1 + t2 + axis * p_aabb.size[closest_axis];
|
||||
Vector3 half = (to - from) * 0.5;
|
||||
|
||||
|
@ -619,7 +619,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
//could not in any way get texture information.. so use closest point to center
|
||||
|
||||
Face3 f(p_vtx[0], p_vtx[1], p_vtx[2]);
|
||||
Vector3 inters = f.get_closest_point_to(p_aabb.pos + p_aabb.size * 0.5);
|
||||
Vector3 inters = f.get_closest_point_to(p_aabb.position + p_aabb.size * 0.5);
|
||||
|
||||
Vector2 uv = get_uv(inters, p_vtx, p_uv);
|
||||
|
||||
|
@ -700,15 +700,15 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
int nz = p_z;
|
||||
|
||||
if (i & 1) {
|
||||
aabb.pos.x += aabb.size.x;
|
||||
aabb.position.x += aabb.size.x;
|
||||
nx += half;
|
||||
}
|
||||
if (i & 2) {
|
||||
aabb.pos.y += aabb.size.y;
|
||||
aabb.position.y += aabb.size.y;
|
||||
ny += half;
|
||||
}
|
||||
if (i & 4) {
|
||||
aabb.pos.z += aabb.size.z;
|
||||
aabb.position.z += aabb.size.z;
|
||||
nz += half;
|
||||
}
|
||||
//make sure to not plot beyond limits
|
||||
|
@ -720,7 +720,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
//test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time
|
||||
Vector3 qsize = test_aabb.size * 0.5; //quarter size, for fast aabb test
|
||||
|
||||
if (!fast_tri_box_overlap(test_aabb.pos + qsize, qsize, p_vtx)) {
|
||||
if (!fast_tri_box_overlap(test_aabb.position + qsize, qsize, p_vtx)) {
|
||||
//if (!Face3(p_vtx[0],p_vtx[1],p_vtx[2]).intersects_aabb2(aabb)) {
|
||||
//does not fit in child, go on
|
||||
continue;
|
||||
|
@ -1155,7 +1155,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
|
||||
Transform to_bounds;
|
||||
to_bounds.basis.scale(Vector3(baker.po2_bounds.size[longest_axis], baker.po2_bounds.size[longest_axis], baker.po2_bounds.size[longest_axis]));
|
||||
to_bounds.origin = baker.po2_bounds.pos;
|
||||
to_bounds.origin = baker.po2_bounds.position;
|
||||
|
||||
Transform to_grid;
|
||||
to_grid.basis.scale(Vector3(baker.axis_cell_size[longest_axis], baker.axis_cell_size[longest_axis], baker.axis_cell_size[longest_axis]));
|
||||
|
@ -1274,7 +1274,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi
|
|||
|
||||
if (p_level == p_baker->cell_subdiv - 1) {
|
||||
|
||||
Vector3 center = p_aabb.pos + p_aabb.size * 0.5;
|
||||
Vector3 center = p_aabb.position + p_aabb.size * 0.5;
|
||||
Transform xform;
|
||||
xform.origin = center;
|
||||
xform.basis.scale(p_aabb.size * 0.5);
|
||||
|
@ -1296,11 +1296,11 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi
|
|||
aabb.size *= 0.5;
|
||||
|
||||
if (i & 1)
|
||||
aabb.pos.x += aabb.size.x;
|
||||
aabb.position.x += aabb.size.x;
|
||||
if (i & 2)
|
||||
aabb.pos.y += aabb.size.y;
|
||||
aabb.position.y += aabb.size.y;
|
||||
if (i & 4)
|
||||
aabb.pos.z += aabb.size.z;
|
||||
aabb.position.z += aabb.size.z;
|
||||
|
||||
_debug_mesh(p_baker->bake_cells[p_idx].childs[i], p_level + 1, aabb, p_multimesh, idx, p_baker);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void ImmediateGeometry::add_vertex(const Vector3 &p_vertex) {
|
|||
|
||||
VS::get_singleton()->immediate_vertex(im, p_vertex);
|
||||
if (empty) {
|
||||
aabb.pos = p_vertex;
|
||||
aabb.position = p_vertex;
|
||||
aabb.size = Vector3();
|
||||
empty = false;
|
||||
} else {
|
||||
|
|
|
@ -181,7 +181,7 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
|
|||
Rect3 ReflectionProbe::get_aabb() const {
|
||||
|
||||
Rect3 aabb;
|
||||
aabb.pos = -origin_offset;
|
||||
aabb.position = -origin_offset;
|
||||
aabb.size = origin_offset + extents;
|
||||
return aabb;
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ void Sprite3D::_draw() {
|
|||
vtx[y_axis] = vertices[i][1];
|
||||
VS::get_singleton()->immediate_vertex(immediate, vtx);
|
||||
if (i == 0) {
|
||||
aabb.pos = vtx;
|
||||
aabb.position = vtx;
|
||||
aabb.size = Vector3();
|
||||
} else {
|
||||
aabb.expand_to(vtx);
|
||||
|
@ -922,7 +922,7 @@ void AnimatedSprite3D::_draw() {
|
|||
vtx[y_axis] = vertices[i][1];
|
||||
VS::get_singleton()->immediate_vertex(immediate, vtx);
|
||||
if (i == 0) {
|
||||
aabb.pos = vtx;
|
||||
aabb.position = vtx;
|
||||
aabb.size = Vector3();
|
||||
} else {
|
||||
aabb.expand_to(vtx);
|
||||
|
|
|
@ -421,9 +421,9 @@ Variant Tween::_run_equation(InterpolateData &p_data) {
|
|||
Rect3 d = delta_val;
|
||||
Rect3 r;
|
||||
|
||||
APPLY_EQUATION(pos.x);
|
||||
APPLY_EQUATION(pos.y);
|
||||
APPLY_EQUATION(pos.z);
|
||||
APPLY_EQUATION(position.x);
|
||||
APPLY_EQUATION(position.y);
|
||||
APPLY_EQUATION(position.z);
|
||||
APPLY_EQUATION(size.x);
|
||||
APPLY_EQUATION(size.y);
|
||||
APPLY_EQUATION(size.z);
|
||||
|
@ -963,7 +963,7 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final
|
|||
case Variant::RECT3: {
|
||||
Rect3 i = initial_val;
|
||||
Rect3 f = final_val;
|
||||
delta_val = Rect3(f.pos - i.pos, f.size - i.size);
|
||||
delta_val = Rect3(f.position - i.position, f.size - i.size);
|
||||
} break;
|
||||
case Variant::TRANSFORM: {
|
||||
Transform i = initial_val;
|
||||
|
|
|
@ -1165,7 +1165,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
|
|||
Rect3 pb = p_post_b;
|
||||
|
||||
return Rect3(
|
||||
a.pos.cubic_interpolate(b.pos, pa.pos, pb.pos, p_c),
|
||||
a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c),
|
||||
a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c));
|
||||
} break;
|
||||
default: {
|
||||
|
|
|
@ -34,8 +34,8 @@ Vector<Vector3> BoxShape::_gen_debug_mesh_lines() {
|
|||
|
||||
Vector<Vector3> lines;
|
||||
Rect3 aabb;
|
||||
aabb.pos = -get_extents();
|
||||
aabb.size = aabb.pos * -2;
|
||||
aabb.position = -get_extents();
|
||||
aabb.size = aabb.position * -2;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
|
|
@ -720,7 +720,7 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
|
|||
for (int i = 0; i < len; i++) {
|
||||
|
||||
if (i == 0)
|
||||
aabb.pos = vtx[i];
|
||||
aabb.position = vtx[i];
|
||||
else
|
||||
aabb.expand_to(vtx[i]);
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ void ArrayMesh::add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data
|
|||
for (int i = 0; i < p_mesh_data.vertices.size(); i++) {
|
||||
|
||||
if (i == 0)
|
||||
aabb.pos = p_mesh_data.vertices[i];
|
||||
aabb.position = p_mesh_data.vertices[i];
|
||||
else
|
||||
aabb.expand_to(p_mesh_data.vertices[i]);
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3 &p_motion) {
|
|||
Rect3 shape_aabb = s.shape->get_aabb();
|
||||
Transform xform = transform * s.xform;
|
||||
shape_aabb = xform.xform(shape_aabb);
|
||||
shape_aabb = shape_aabb.merge(Rect3(shape_aabb.pos + p_motion, shape_aabb.size)); //use motion
|
||||
shape_aabb = shape_aabb.merge(Rect3(shape_aabb.position + p_motion, shape_aabb.size)); //use motion
|
||||
s.aabb_cache = shape_aabb;
|
||||
|
||||
space->get_broadphase()->move(s.bpid, shape_aabb);
|
||||
|
|
|
@ -166,7 +166,7 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform
|
|||
smin *= axis_scale;
|
||||
smax *= axis_scale;
|
||||
|
||||
local_aabb.pos[i] = smin;
|
||||
local_aabb.position[i] = smin;
|
||||
local_aabb.size[i] = smax - smin;
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform
|
|||
Rect3 cc_hint_aabb;
|
||||
if (use_cc_hint) {
|
||||
cc_hint_aabb = p_concave_hint;
|
||||
cc_hint_aabb.pos -= p_transform_B.origin;
|
||||
cc_hint_aabb.position -= p_transform_B.origin;
|
||||
}
|
||||
|
||||
Rect3 local_aabb;
|
||||
|
@ -353,7 +353,7 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform
|
|||
smin *= axis_scale;
|
||||
smax *= axis_scale;
|
||||
|
||||
local_aabb.pos[i] = smin;
|
||||
local_aabb.position[i] = smin;
|
||||
local_aabb.size[i] = smax - smin;
|
||||
}
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
|
|||
for (int i = 0; i < mesh.vertices.size(); i++) {
|
||||
|
||||
if (i == 0)
|
||||
_aabb.pos = mesh.vertices[i];
|
||||
_aabb.position = mesh.vertices[i];
|
||||
else
|
||||
_aabb.expand_to(mesh.vertices[i]);
|
||||
}
|
||||
|
@ -1388,7 +1388,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
|
|||
Face3 face(facesr[i * 3 + 0], facesr[i * 3 + 1], facesr[i * 3 + 2]);
|
||||
|
||||
bvh_arrayw[i].aabb = face.get_aabb();
|
||||
bvh_arrayw[i].center = bvh_arrayw[i].aabb.pos + bvh_arrayw[i].aabb.size * 0.5;
|
||||
bvh_arrayw[i].center = bvh_arrayw[i].aabb.position + bvh_arrayw[i].aabb.size * 0.5;
|
||||
bvh_arrayw[i].face_index = i;
|
||||
facesw[i].indices[0] = i * 3 + 0;
|
||||
facesw[i].indices[1] = i * 3 + 1;
|
||||
|
@ -1504,7 +1504,7 @@ void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_d
|
|||
|
||||
Vector3 pos(j * cell_size, h, i * cell_size);
|
||||
if (i == 0 || j == 0)
|
||||
aabb.pos = pos;
|
||||
aabb.position = pos;
|
||||
else
|
||||
aabb.expand_to(pos);
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
|
|||
ERR_FAIL_COND_V(!shape, false);
|
||||
|
||||
Rect3 aabb = p_xform.xform(shape->get_aabb());
|
||||
aabb = aabb.merge(Rect3(aabb.pos + p_motion, aabb.size)); //motion
|
||||
aabb = aabb.merge(Rect3(aabb.position + p_motion, aabb.size)); //motion
|
||||
aabb = aabb.grow(p_margin);
|
||||
|
||||
/*
|
||||
|
|
|
@ -813,7 +813,7 @@ public:
|
|||
const Item::CommandMesh *mesh = static_cast<const Item::CommandMesh *>(c);
|
||||
Rect3 aabb = RasterizerStorage::base_singleton->mesh_get_aabb(mesh->mesh, mesh->skeleton);
|
||||
|
||||
r = Rect2(aabb.pos.x, aabb.pos.y, aabb.size.x, aabb.size.y);
|
||||
r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y);
|
||||
|
||||
} break;
|
||||
case Item::Command::TYPE_MULTIMESH: {
|
||||
|
@ -821,7 +821,7 @@ public:
|
|||
const Item::CommandMultiMesh *multimesh = static_cast<const Item::CommandMultiMesh *>(c);
|
||||
Rect3 aabb = RasterizerStorage::base_singleton->multimesh_get_aabb(multimesh->multimesh);
|
||||
|
||||
r = Rect2(aabb.pos.x, aabb.pos.y, aabb.size.x, aabb.size.y);
|
||||
r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y);
|
||||
|
||||
} break;
|
||||
case Item::Command::TYPE_CIRCLE: {
|
||||
|
|
|
@ -770,7 +770,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
|||
if (bptr->size.x < 0) {
|
||||
//first
|
||||
bptr[idx] = Rect3();
|
||||
bptr[idx].pos = v;
|
||||
bptr[idx].position = v;
|
||||
any_valid = true;
|
||||
} else {
|
||||
bptr[idx].expand_to(v);
|
||||
|
|
Loading…
Reference in a new issue