parent
b44cb4e3b9
commit
d28763a4c1
|
@ -557,7 +557,7 @@ void register_global_constants() {
|
|||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); // 10
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT3", Variant::RECT3);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM);
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
|
||||
|
|
|
@ -106,9 +106,9 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
|
|||
return target;
|
||||
}
|
||||
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
SETUP_TYPE(Rect3)
|
||||
SETUP_TYPE(AABB)
|
||||
|
||||
/**/ TRY_TRANSFER_FIELD("px", position.x)
|
||||
else TRY_TRANSFER_FIELD("py", position.y)
|
||||
|
|
|
@ -245,10 +245,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
(*r_len) += 4 * 4;
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
ERR_FAIL_COND_V(len < (int)4 * 6, ERR_INVALID_DATA);
|
||||
Rect3 val;
|
||||
AABB val;
|
||||
val.position.x = decode_float(&buf[0]);
|
||||
val.position.y = decode_float(&buf[4]);
|
||||
val.position.z = decode_float(&buf[8]);
|
||||
|
@ -1045,10 +1045,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
|||
r_len += 4 * 4;
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
if (buf) {
|
||||
Rect3 aabb = p_variant;
|
||||
AABB aabb = p_variant;
|
||||
encode_float(aabb.position.x, &buf[0]);
|
||||
encode_float(aabb.position.y, &buf[4]);
|
||||
encode_float(aabb.position.z, &buf[8]);
|
||||
|
|
|
@ -52,7 +52,7 @@ enum {
|
|||
VARIANT_VECTOR3 = 12,
|
||||
VARIANT_PLANE = 13,
|
||||
VARIANT_QUAT = 14,
|
||||
VARIANT_RECT3 = 15,
|
||||
VARIANT_AABB = 15,
|
||||
VARIANT_MATRIX3 = 16,
|
||||
VARIANT_TRANSFORM = 17,
|
||||
VARIANT_MATRIX32 = 18,
|
||||
|
@ -196,9 +196,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
|
|||
r_v = v;
|
||||
|
||||
} break;
|
||||
case VARIANT_RECT3: {
|
||||
case VARIANT_AABB: {
|
||||
|
||||
Rect3 v;
|
||||
AABB v;
|
||||
v.position.x = f->get_real();
|
||||
v.position.y = f->get_real();
|
||||
v.position.z = f->get_real();
|
||||
|
@ -1374,10 +1374,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property,
|
|||
f->store_real(val.w);
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
f->store_32(VARIANT_RECT3);
|
||||
Rect3 val = p_property;
|
||||
f->store_32(VARIANT_AABB);
|
||||
AABB val = p_property;
|
||||
f->store_real(val.position.x);
|
||||
f->store_real(val.position.y);
|
||||
f->store_real(val.position.z);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* rect3.cpp */
|
||||
/* aabb.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -27,25 +27,25 @@
|
|||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "rect3.h"
|
||||
#include "aabb.h"
|
||||
|
||||
#include "print_string.h"
|
||||
|
||||
real_t Rect3::get_area() const {
|
||||
real_t AABB::get_area() const {
|
||||
|
||||
return size.x * size.y * size.z;
|
||||
}
|
||||
|
||||
bool Rect3::operator==(const Rect3 &p_rval) const {
|
||||
bool AABB::operator==(const AABB &p_rval) const {
|
||||
|
||||
return ((position == p_rval.position) && (size == p_rval.size));
|
||||
}
|
||||
bool Rect3::operator!=(const Rect3 &p_rval) const {
|
||||
bool AABB::operator!=(const AABB &p_rval) const {
|
||||
|
||||
return ((position != p_rval.position) || (size != p_rval.size));
|
||||
}
|
||||
|
||||
void Rect3::merge_with(const Rect3 &p_aabb) {
|
||||
void AABB::merge_with(const AABB &p_aabb) {
|
||||
|
||||
Vector3 beg_1, beg_2;
|
||||
Vector3 end_1, end_2;
|
||||
|
@ -68,7 +68,7 @@ void Rect3::merge_with(const Rect3 &p_aabb) {
|
|||
size = max - min;
|
||||
}
|
||||
|
||||
Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
||||
AABB AABB::intersection(const AABB &p_aabb) const {
|
||||
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -78,7 +78,7 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
|||
Vector3 min, max;
|
||||
|
||||
if (src_min.x > dst_max.x || src_max.x < dst_min.x)
|
||||
return Rect3();
|
||||
return AABB();
|
||||
else {
|
||||
|
||||
min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x;
|
||||
|
@ -86,7 +86,7 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
|||
}
|
||||
|
||||
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
|
||||
return Rect3();
|
||||
return AABB();
|
||||
else {
|
||||
|
||||
min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y;
|
||||
|
@ -94,17 +94,17 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const {
|
|||
}
|
||||
|
||||
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
|
||||
return Rect3();
|
||||
return AABB();
|
||||
else {
|
||||
|
||||
min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z;
|
||||
max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
|
||||
}
|
||||
|
||||
return Rect3(min, max - min);
|
||||
return AABB(min, max - min);
|
||||
}
|
||||
|
||||
bool Rect3::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||
bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||
|
||||
Vector3 c1, c2;
|
||||
Vector3 end = position + size;
|
||||
|
@ -147,7 +147,7 @@ bool Rect3::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||
bool AABB::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||
|
||||
real_t min = 0, max = 1;
|
||||
int axis = 0;
|
||||
|
@ -205,7 +205,7 @@ bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vecto
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Rect3::intersects_plane(const Plane &p_plane) const {
|
||||
bool AABB::intersects_plane(const Plane &p_plane) const {
|
||||
|
||||
Vector3 points[8] = {
|
||||
Vector3(position.x, position.y, position.z),
|
||||
|
@ -232,7 +232,7 @@ bool Rect3::intersects_plane(const Plane &p_plane) const {
|
|||
return under && over;
|
||||
}
|
||||
|
||||
Vector3 Rect3::get_longest_axis() const {
|
||||
Vector3 AABB::get_longest_axis() const {
|
||||
|
||||
Vector3 axis(1, 0, 0);
|
||||
real_t max_size = size.x;
|
||||
|
@ -249,7 +249,7 @@ Vector3 Rect3::get_longest_axis() const {
|
|||
|
||||
return axis;
|
||||
}
|
||||
int Rect3::get_longest_axis_index() const {
|
||||
int AABB::get_longest_axis_index() const {
|
||||
|
||||
int axis = 0;
|
||||
real_t max_size = size.x;
|
||||
|
@ -267,7 +267,7 @@ int Rect3::get_longest_axis_index() const {
|
|||
return axis;
|
||||
}
|
||||
|
||||
Vector3 Rect3::get_shortest_axis() const {
|
||||
Vector3 AABB::get_shortest_axis() const {
|
||||
|
||||
Vector3 axis(1, 0, 0);
|
||||
real_t max_size = size.x;
|
||||
|
@ -284,7 +284,7 @@ Vector3 Rect3::get_shortest_axis() const {
|
|||
|
||||
return axis;
|
||||
}
|
||||
int Rect3::get_shortest_axis_index() const {
|
||||
int AABB::get_shortest_axis_index() const {
|
||||
|
||||
int axis = 0;
|
||||
real_t max_size = size.x;
|
||||
|
@ -302,25 +302,25 @@ int Rect3::get_shortest_axis_index() const {
|
|||
return axis;
|
||||
}
|
||||
|
||||
Rect3 Rect3::merge(const Rect3 &p_with) const {
|
||||
AABB AABB::merge(const AABB &p_with) const {
|
||||
|
||||
Rect3 aabb = *this;
|
||||
AABB aabb = *this;
|
||||
aabb.merge_with(p_with);
|
||||
return aabb;
|
||||
}
|
||||
Rect3 Rect3::expand(const Vector3 &p_vector) const {
|
||||
Rect3 aabb = *this;
|
||||
AABB AABB::expand(const Vector3 &p_vector) const {
|
||||
AABB aabb = *this;
|
||||
aabb.expand_to(p_vector);
|
||||
return aabb;
|
||||
}
|
||||
Rect3 Rect3::grow(real_t p_by) const {
|
||||
AABB AABB::grow(real_t p_by) const {
|
||||
|
||||
Rect3 aabb = *this;
|
||||
AABB aabb = *this;
|
||||
aabb.grow_by(p_by);
|
||||
return aabb;
|
||||
}
|
||||
|
||||
void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
||||
void AABB::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
||||
|
||||
ERR_FAIL_INDEX(p_edge, 12);
|
||||
switch (p_edge) {
|
||||
|
@ -394,7 +394,7 @@ void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
|||
}
|
||||
}
|
||||
|
||||
Rect3::operator String() const {
|
||||
AABB::operator String() const {
|
||||
|
||||
return String() + position + " - " + size;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* rect3.h */
|
||||
/* aabb.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -39,7 +39,7 @@
|
|||
* This is implemented by a point (position) and the box size
|
||||
*/
|
||||
|
||||
class Rect3 {
|
||||
class AABB {
|
||||
public:
|
||||
Vector3 position;
|
||||
Vector3 size;
|
||||
|
@ -60,16 +60,16 @@ public:
|
|||
const Vector3 &get_size() const { return size; }
|
||||
void set_size(const Vector3 &p_size) { size = p_size; }
|
||||
|
||||
bool operator==(const Rect3 &p_rval) const;
|
||||
bool operator!=(const Rect3 &p_rval) const;
|
||||
bool operator==(const AABB &p_rval) const;
|
||||
bool operator!=(const AABB &p_rval) const;
|
||||
|
||||
_FORCE_INLINE_ bool intersects(const Rect3 &p_aabb) const; /// Both AABBs overlap
|
||||
_FORCE_INLINE_ bool intersects_inclusive(const Rect3 &p_aabb) const; /// Both AABBs (or their faces) overlap
|
||||
_FORCE_INLINE_ bool encloses(const Rect3 &p_aabb) const; /// p_aabb is completely inside this
|
||||
_FORCE_INLINE_ bool intersects(const AABB &p_aabb) const; /// Both AABBs overlap
|
||||
_FORCE_INLINE_ bool intersects_inclusive(const AABB &p_aabb) const; /// Both AABBs (or their faces) overlap
|
||||
_FORCE_INLINE_ bool encloses(const AABB &p_aabb) const; /// p_aabb is completely inside this
|
||||
|
||||
Rect3 merge(const Rect3 &p_with) const;
|
||||
void merge_with(const Rect3 &p_aabb); ///merge with another AABB
|
||||
Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
|
||||
AABB merge(const AABB &p_with) const;
|
||||
void merge_with(const AABB &p_aabb); ///merge with another AABB
|
||||
AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
|
||||
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
|
||||
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
|
||||
_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
|
||||
|
@ -88,26 +88,26 @@ public:
|
|||
int get_shortest_axis_index() const;
|
||||
_FORCE_INLINE_ real_t get_shortest_axis_size() const;
|
||||
|
||||
Rect3 grow(real_t p_by) const;
|
||||
AABB grow(real_t p_by) const;
|
||||
_FORCE_INLINE_ void grow_by(real_t p_amount);
|
||||
|
||||
void get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const;
|
||||
_FORCE_INLINE_ Vector3 get_endpoint(int p_point) const;
|
||||
|
||||
Rect3 expand(const Vector3 &p_vector) const;
|
||||
AABB expand(const Vector3 &p_vector) const;
|
||||
_FORCE_INLINE_ void project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const;
|
||||
_FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necessary */
|
||||
|
||||
operator String() const;
|
||||
|
||||
_FORCE_INLINE_ Rect3() {}
|
||||
inline Rect3(const Vector3 &p_pos, const Vector3 &p_size)
|
||||
_FORCE_INLINE_ AABB() {}
|
||||
inline AABB(const Vector3 &p_pos, const Vector3 &p_size)
|
||||
: position(p_pos),
|
||||
size(p_size) {
|
||||
}
|
||||
};
|
||||
|
||||
inline bool Rect3::intersects(const Rect3 &p_aabb) const {
|
||||
inline bool AABB::intersects(const AABB &p_aabb) const {
|
||||
|
||||
if (position.x >= (p_aabb.position.x + p_aabb.size.x))
|
||||
return false;
|
||||
|
@ -125,7 +125,7 @@ inline bool Rect3::intersects(const Rect3 &p_aabb) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const {
|
||||
inline bool AABB::intersects_inclusive(const AABB &p_aabb) const {
|
||||
|
||||
if (position.x > (p_aabb.position.x + p_aabb.size.x))
|
||||
return false;
|
||||
|
@ -143,7 +143,7 @@ inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool Rect3::encloses(const Rect3 &p_aabb) const {
|
||||
inline bool AABB::encloses(const AABB &p_aabb) const {
|
||||
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -159,7 +159,7 @@ inline bool Rect3::encloses(const Rect3 &p_aabb) const {
|
|||
(src_max.z > dst_max.z));
|
||||
}
|
||||
|
||||
Vector3 Rect3::get_support(const Vector3 &p_normal) const {
|
||||
Vector3 AABB::get_support(const Vector3 &p_normal) const {
|
||||
|
||||
Vector3 half_extents = size * 0.5;
|
||||
Vector3 ofs = position + half_extents;
|
||||
|
@ -171,7 +171,7 @@ Vector3 Rect3::get_support(const Vector3 &p_normal) const {
|
|||
ofs;
|
||||
}
|
||||
|
||||
Vector3 Rect3::get_endpoint(int p_point) const {
|
||||
Vector3 AABB::get_endpoint(int p_point) const {
|
||||
|
||||
switch (p_point) {
|
||||
case 0: return Vector3(position.x, position.y, position.z);
|
||||
|
@ -187,7 +187,7 @@ Vector3 Rect3::get_endpoint(int p_point) const {
|
|||
ERR_FAIL_V(Vector3());
|
||||
}
|
||||
|
||||
bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const {
|
||||
bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const {
|
||||
|
||||
Vector3 half_extents = size * 0.5;
|
||||
Vector3 ofs = position + half_extents;
|
||||
|
@ -206,7 +206,7 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Rect3::has_point(const Vector3 &p_point) const {
|
||||
bool AABB::has_point(const Vector3 &p_point) const {
|
||||
|
||||
if (p_point.x < position.x)
|
||||
return false;
|
||||
|
@ -224,7 +224,7 @@ bool Rect3::has_point(const Vector3 &p_point) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline void Rect3::expand_to(const Vector3 &p_vector) {
|
||||
inline void AABB::expand_to(const Vector3 &p_vector) {
|
||||
|
||||
Vector3 begin = position;
|
||||
Vector3 end = position + size;
|
||||
|
@ -247,7 +247,7 @@ inline void Rect3::expand_to(const Vector3 &p_vector) {
|
|||
size = end - begin;
|
||||
}
|
||||
|
||||
void Rect3::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const {
|
||||
void AABB::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(position.x + half_extents.x, position.y + half_extents.y, position.z + half_extents.z);
|
||||
|
@ -258,7 +258,7 @@ void Rect3::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &
|
|||
r_max = distance + length;
|
||||
}
|
||||
|
||||
inline real_t Rect3::get_longest_axis_size() const {
|
||||
inline real_t AABB::get_longest_axis_size() const {
|
||||
|
||||
real_t max_size = size.x;
|
||||
|
||||
|
@ -273,7 +273,7 @@ inline real_t Rect3::get_longest_axis_size() const {
|
|||
return max_size;
|
||||
}
|
||||
|
||||
inline real_t Rect3::get_shortest_axis_size() const {
|
||||
inline real_t AABB::get_shortest_axis_size() const {
|
||||
|
||||
real_t max_size = size.x;
|
||||
|
||||
|
@ -288,7 +288,7 @@ inline real_t Rect3::get_shortest_axis_size() const {
|
|||
return max_size;
|
||||
}
|
||||
|
||||
bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const {
|
||||
bool AABB::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const {
|
||||
|
||||
real_t divx = 1.0 / p_dir.x;
|
||||
real_t divy = 1.0 / p_dir.y;
|
||||
|
@ -332,7 +332,7 @@ bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, rea
|
|||
return ((tmin < t1) && (tmax > t0));
|
||||
}
|
||||
|
||||
void Rect3::grow_by(real_t p_amount) {
|
||||
void AABB::grow_by(real_t p_amount) {
|
||||
|
||||
position.x -= p_amount;
|
||||
position.y -= p_amount;
|
|
@ -31,7 +31,7 @@
|
|||
#include "error_macros.h"
|
||||
#include "print_string.h"
|
||||
|
||||
void BSP_Tree::from_aabb(const Rect3 &p_aabb) {
|
||||
void BSP_Tree::from_aabb(const AABB &p_aabb) {
|
||||
|
||||
planes.clear();
|
||||
|
||||
|
@ -67,7 +67,7 @@ Vector<Plane> BSP_Tree::get_planes() const {
|
|||
return planes;
|
||||
}
|
||||
|
||||
Rect3 BSP_Tree::get_aabb() const {
|
||||
AABB BSP_Tree::get_aabb() const {
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) {
|
|||
error_radius = p_error_radius;
|
||||
}
|
||||
|
||||
BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius)
|
||||
BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius)
|
||||
: nodes(p_nodes),
|
||||
planes(p_planes),
|
||||
aabb(p_aabb),
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
#ifndef BSP_TREE_H
|
||||
#define BSP_TREE_H
|
||||
|
||||
#include "aabb.h"
|
||||
#include "dvector.h"
|
||||
#include "face3.h"
|
||||
#include "method_ptrcall.h"
|
||||
#include "plane.h"
|
||||
#include "rect3.h"
|
||||
#include "variant.h"
|
||||
#include "vector.h"
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ private:
|
|||
|
||||
Vector<Node> nodes;
|
||||
Vector<Plane> planes;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
real_t error_radius;
|
||||
|
||||
int _get_points_inside(int p_node, const Vector3 *p_points, int *p_indices, const Vector3 &p_center, const Vector3 &p_half_extents, int p_indices_count) const;
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
bool is_empty() const { return nodes.size() == 0; }
|
||||
Vector<Node> get_nodes() const;
|
||||
Vector<Plane> get_planes() const;
|
||||
Rect3 get_aabb() const;
|
||||
AABB get_aabb() const;
|
||||
|
||||
bool point_is_inside(const Vector3 &p_point) const;
|
||||
int get_points_inside(const Vector3 *p_points, int p_point_count) const;
|
||||
|
@ -85,12 +85,12 @@ public:
|
|||
|
||||
operator Variant() const;
|
||||
|
||||
void from_aabb(const Rect3 &p_aabb);
|
||||
void from_aabb(const AABB &p_aabb);
|
||||
|
||||
BSP_Tree();
|
||||
BSP_Tree(const Variant &p_variant);
|
||||
BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius = 0);
|
||||
BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius = 0);
|
||||
BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius = 0);
|
||||
~BSP_Tree();
|
||||
};
|
||||
|
||||
|
|
|
@ -596,7 +596,7 @@ void CameraMatrix::make_scale(const Vector3 &p_scale) {
|
|||
matrix[2][2] = p_scale.z;
|
||||
}
|
||||
|
||||
void CameraMatrix::scale_translate_to_fit(const Rect3 &p_aabb) {
|
||||
void CameraMatrix::scale_translate_to_fit(const AABB &p_aabb) {
|
||||
|
||||
Vector3 min = p_aabb.position;
|
||||
Vector3 max = p_aabb.position + p_aabb.size;
|
||||
|
|
|
@ -86,7 +86,7 @@ struct CameraMatrix {
|
|||
|
||||
operator String() const;
|
||||
|
||||
void scale_translate_to_fit(const Rect3 &p_aabb);
|
||||
void scale_translate_to_fit(const AABB &p_aabb);
|
||||
void make_scale(const Vector3 &p_scale);
|
||||
int get_pixels_per_meter(int p_for_pixel_width) const;
|
||||
operator Transform() const;
|
||||
|
|
|
@ -189,13 +189,13 @@ ClockDirection Face3::get_clock_dir() const {
|
|||
return (normal.dot(vertex[0]) >= 0) ? CLOCKWISE : COUNTERCLOCKWISE;
|
||||
}
|
||||
|
||||
bool Face3::intersects_aabb(const Rect3 &p_aabb) const {
|
||||
bool Face3::intersects_aabb(const AABB &p_aabb) const {
|
||||
|
||||
/** TEST PLANE **/
|
||||
if (!p_aabb.intersects_plane(get_plane()))
|
||||
return false;
|
||||
|
||||
/** TEST FACE AXIS */
|
||||
/** TEST FACE AXIS */
|
||||
|
||||
#define TEST_AXIS(m_ax) \
|
||||
{ \
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#ifndef FACE3_H
|
||||
#define FACE3_H
|
||||
|
||||
#include "aabb.h"
|
||||
#include "plane.h"
|
||||
#include "rect3.h"
|
||||
#include "transform.h"
|
||||
#include "vector3.h"
|
||||
|
||||
|
@ -76,16 +76,16 @@ public:
|
|||
void get_support(const Vector3 &p_normal, const Transform &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const;
|
||||
void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
|
||||
|
||||
Rect3 get_aabb() const {
|
||||
AABB get_aabb() const {
|
||||
|
||||
Rect3 aabb(vertex[0], Vector3());
|
||||
AABB aabb(vertex[0], Vector3());
|
||||
aabb.expand_to(vertex[1]);
|
||||
aabb.expand_to(vertex[2]);
|
||||
return aabb;
|
||||
}
|
||||
|
||||
bool intersects_aabb(const Rect3 &p_aabb) const;
|
||||
_FORCE_INLINE_ bool intersects_aabb2(const Rect3 &p_aabb) const;
|
||||
bool intersects_aabb(const AABB &p_aabb) const;
|
||||
_FORCE_INLINE_ bool intersects_aabb2(const AABB &p_aabb) const;
|
||||
operator String() const;
|
||||
|
||||
inline Face3() {}
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
bool Face3::intersects_aabb2(const Rect3 &p_aabb) const {
|
||||
bool Face3::intersects_aabb2(const AABB &p_aabb) const {
|
||||
|
||||
Vector3 perp = (vertex[0] - vertex[2]).cross(vertex[0] - vertex[1]);
|
||||
|
||||
|
@ -256,6 +256,6 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
//this sucks...
|
||||
//this sucks...
|
||||
|
||||
#endif // FACE3_H
|
||||
|
|
|
@ -300,7 +300,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 aabb(Vector3(x, y, z), Vector3(len_x, len_y, len_z));
|
||||
aabb.position = aabb.position * voxelsize;
|
||||
aabb.size = aabb.size * voxelsize;
|
||||
|
||||
|
@ -575,7 +575,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e
|
|||
PoolVector<Face3>::Read facesr = p_array.read();
|
||||
const Face3 *faces = facesr.ptr();
|
||||
|
||||
Rect3 global_aabb;
|
||||
AABB global_aabb;
|
||||
|
||||
for (int i = 0; i < face_count; i++) {
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
#ifndef OCTREE_H
|
||||
#define OCTREE_H
|
||||
|
||||
#include "aabb.h"
|
||||
#include "list.h"
|
||||
#include "map.h"
|
||||
#include "print_string.h"
|
||||
#include "rect3.h"
|
||||
#include "variant.h"
|
||||
#include "vector3.h"
|
||||
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
struct Octant {
|
||||
|
||||
// cached for FAST plane check
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
uint64_t last_pass;
|
||||
Octant *parent;
|
||||
|
@ -152,8 +152,8 @@ private:
|
|||
OctreeElementID _id;
|
||||
Octant *common_parent;
|
||||
|
||||
Rect3 aabb;
|
||||
Rect3 container_aabb;
|
||||
AABB aabb;
|
||||
AABB container_aabb;
|
||||
|
||||
List<PairData *, AL> pair_list;
|
||||
|
||||
|
@ -334,7 +334,7 @@ private:
|
|||
}
|
||||
|
||||
void _insert_element(Element *p_element, Octant *p_octant);
|
||||
void _ensure_valid_root(const Rect3 &p_aabb);
|
||||
void _ensure_valid_root(const AABB &p_aabb);
|
||||
bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = NULL);
|
||||
void _remove_element(Element *p_element);
|
||||
void _pair_element(Element *p_element, Octant *p_octant);
|
||||
|
@ -351,7 +351,7 @@ private:
|
|||
};
|
||||
|
||||
void _cull_convex(Octant *p_octant, _CullConvexData *p_cull);
|
||||
void _cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
|
||||
void _cull_aabb(Octant *p_octant, const AABB &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
|
||||
void _cull_segment(Octant *p_octant, const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
|
||||
void _cull_point(Octant *p_octant, const Vector3 &p_point, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
|
||||
|
||||
|
@ -370,8 +370,8 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
OctreeElementID create(T *p_userdata, const Rect3 &p_aabb = Rect3(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1);
|
||||
void move(OctreeElementID p_id, const Rect3 &p_aabb);
|
||||
OctreeElementID create(T *p_userdata, const AABB &p_aabb = AABB(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1);
|
||||
void move(OctreeElementID p_id, const AABB &p_aabb);
|
||||
void set_pairable(OctreeElementID p_id, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1);
|
||||
void erase(OctreeElementID p_id);
|
||||
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
int get_subindex(OctreeElementID p_id) const;
|
||||
|
||||
int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
|
||||
int cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
|
||||
int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
|
||||
int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
|
||||
|
||||
int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
|
||||
|
@ -479,7 +479,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
|
|||
} else {
|
||||
/* check againt AABB where child should be */
|
||||
|
||||
Rect3 aabb = p_octant->aabb;
|
||||
AABB aabb = p_octant->aabb;
|
||||
aabb.size *= 0.5;
|
||||
|
||||
if (i & 1)
|
||||
|
@ -535,12 +535,12 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
|
|||
}
|
||||
|
||||
template <class T, bool use_pairs, class AL>
|
||||
void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) {
|
||||
void Octree<T, use_pairs, AL>::_ensure_valid_root(const AABB &p_aabb) {
|
||||
|
||||
if (!root) {
|
||||
// octre is empty
|
||||
|
||||
Rect3 base(Vector3(), Vector3(1.0, 1.0, 1.0) * unit_size);
|
||||
AABB base(Vector3(), Vector3(1.0, 1.0, 1.0) * unit_size);
|
||||
|
||||
while (!base.encloses(p_aabb)) {
|
||||
|
||||
|
@ -563,7 +563,7 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) {
|
|||
|
||||
} else {
|
||||
|
||||
Rect3 base = root->aabb;
|
||||
AABB base = root->aabb;
|
||||
|
||||
while (!base.encloses(p_aabb)) {
|
||||
|
||||
|
@ -793,7 +793,7 @@ void Octree<T, use_pairs, AL>::_remove_element(Element *p_element) {
|
|||
}
|
||||
|
||||
template <class T, bool use_pairs, class AL>
|
||||
OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const Rect3 &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) {
|
||||
OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const AABB &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) {
|
||||
|
||||
// check for AABB validity
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
@ -833,7 +833,7 @@ OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const Rect3 &p_a
|
|||
}
|
||||
|
||||
template <class T, bool use_pairs, class AL>
|
||||
void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
|
||||
void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
// check for AABB validity
|
||||
|
@ -859,7 +859,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
|
|||
if (old_has_surf) {
|
||||
_remove_element(&e); // removing
|
||||
e.common_parent = NULL;
|
||||
e.aabb = Rect3();
|
||||
e.aabb = AABB();
|
||||
_optimize();
|
||||
} else {
|
||||
_ensure_valid_root(p_aabb); // inserting
|
||||
|
@ -886,7 +886,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) {
|
|||
return;
|
||||
}
|
||||
|
||||
Rect3 combined = e.aabb;
|
||||
AABB combined = e.aabb;
|
||||
combined.merge_with(p_aabb);
|
||||
_ensure_valid_root(combined);
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
|
|||
}
|
||||
|
||||
template <class T, bool use_pairs, class AL>
|
||||
void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
|
||||
void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const AABB &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
|
||||
|
||||
if (*p_result_idx == p_result_max)
|
||||
return; //pointless
|
||||
|
@ -1313,7 +1313,7 @@ int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_r
|
|||
}
|
||||
|
||||
template <class T, bool use_pairs, class AL>
|
||||
int Octree<T, use_pairs, AL>::cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
|
||||
int Octree<T, use_pairs, AL>::cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
|
||||
|
||||
if (!root)
|
||||
return 0;
|
||||
|
|
|
@ -38,7 +38,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
|
|||
|
||||
/* CREATE AABB VOLUME */
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
for (int i = 0; i < p_points.size(); i++) {
|
||||
|
||||
if (i == 0) {
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#ifndef QUICK_HULL_H
|
||||
#define QUICK_HULL_H
|
||||
|
||||
#include "aabb.h"
|
||||
#include "geometry.h"
|
||||
#include "list.h"
|
||||
#include "rect3.h"
|
||||
#include "set.h"
|
||||
|
||||
class QuickHull {
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#ifndef TRANSFORM_H
|
||||
#define TRANSFORM_H
|
||||
|
||||
#include "aabb.h"
|
||||
#include "matrix3.h"
|
||||
#include "plane.h"
|
||||
#include "rect3.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
@ -80,8 +80,8 @@ public:
|
|||
_FORCE_INLINE_ Plane xform(const Plane &p_plane) const;
|
||||
_FORCE_INLINE_ Plane xform_inv(const Plane &p_plane) const;
|
||||
|
||||
_FORCE_INLINE_ Rect3 xform(const Rect3 &p_aabb) const;
|
||||
_FORCE_INLINE_ Rect3 xform_inv(const Rect3 &p_aabb) const;
|
||||
_FORCE_INLINE_ AABB xform(const AABB &p_aabb) const;
|
||||
_FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const;
|
||||
|
||||
void operator*=(const Transform &p_transform);
|
||||
Transform operator*(const Transform &p_transform) const;
|
||||
|
@ -153,14 +153,14 @@ _FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
|
|||
return Plane(normal, d);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
|
||||
_FORCE_INLINE_ AABB Transform::xform(const AABB &p_aabb) const {
|
||||
/* define vertices */
|
||||
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.position);
|
||||
//could be even further optimized
|
||||
Rect3 new_aabb;
|
||||
AABB new_aabb;
|
||||
new_aabb.position = pos;
|
||||
new_aabb.expand_to(pos + x);
|
||||
new_aabb.expand_to(pos + y);
|
||||
|
@ -172,7 +172,7 @@ _FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const {
|
|||
return new_aabb;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const {
|
||||
_FORCE_INLINE_ AABB Transform::xform_inv(const AABB &p_aabb) const {
|
||||
|
||||
/* define vertices */
|
||||
Vector3 vertices[8] = {
|
||||
|
@ -186,7 +186,7 @@ _FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const {
|
|||
Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z)
|
||||
};
|
||||
|
||||
Rect3 ret;
|
||||
AABB ret;
|
||||
|
||||
ret.position = xform_inv(vertices[0]);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, in
|
|||
return -1;
|
||||
}
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb = p_bb[p_from]->aabb;
|
||||
for (int i = 1; i < p_size; i++) {
|
||||
|
||||
|
@ -166,7 +166,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
|
|||
valid = true;
|
||||
}
|
||||
|
||||
Vector3 TriangleMesh::get_area_normal(const Rect3 &p_aabb) const {
|
||||
Vector3 TriangleMesh::get_area_normal(const AABB &p_aabb) const {
|
||||
|
||||
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class TriangleMesh : public Reference {
|
|||
|
||||
struct BVH {
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
Vector3 center; //used for sorting
|
||||
int left;
|
||||
int right;
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
bool is_valid() const;
|
||||
bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const;
|
||||
bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal) const;
|
||||
Vector3 get_area_normal(const Rect3 &p_aabb) const;
|
||||
Vector3 get_area_normal(const AABB &p_aabb) const;
|
||||
PoolVector<Face3> get_faces() const;
|
||||
|
||||
void create(const PoolVector<Vector3> &p_faces);
|
||||
|
|
|
@ -119,7 +119,7 @@ MAKE_PTRARG_BY_REFERENCE(Vector3);
|
|||
MAKE_PTRARG(Transform2D);
|
||||
MAKE_PTRARG_BY_REFERENCE(Plane);
|
||||
MAKE_PTRARG(Quat);
|
||||
MAKE_PTRARG_BY_REFERENCE(Rect3);
|
||||
MAKE_PTRARG_BY_REFERENCE(AABB);
|
||||
MAKE_PTRARG_BY_REFERENCE(Basis);
|
||||
MAKE_PTRARG_BY_REFERENCE(Transform);
|
||||
MAKE_PTRARG_BY_REFERENCE(Color);
|
||||
|
|
|
@ -234,7 +234,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
|
|||
case Variant::TRANSFORM2D:
|
||||
case Variant::PLANE:
|
||||
case Variant::QUAT:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::BASIS:
|
||||
case Variant::TRANSFORM:
|
||||
case Variant::POOL_BYTE_ARRAY:
|
||||
|
|
|
@ -82,7 +82,7 @@ MAKE_TYPE_INFO(Vector3, Variant::VECTOR3)
|
|||
MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D)
|
||||
MAKE_TYPE_INFO(Plane, Variant::PLANE)
|
||||
MAKE_TYPE_INFO(Quat, Variant::QUAT)
|
||||
MAKE_TYPE_INFO(Rect3, Variant::RECT3)
|
||||
MAKE_TYPE_INFO(AABB, Variant::AABB)
|
||||
MAKE_TYPE_INFO(Basis, Variant::BASIS)
|
||||
MAKE_TYPE_INFO(Transform, Variant::TRANSFORM)
|
||||
MAKE_TYPE_INFO(Color, Variant::COLOR)
|
||||
|
|
|
@ -94,9 +94,9 @@ String Variant::get_type_name(Variant::Type p_type) {
|
|||
|
||||
|
||||
} break;*/
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
return "Rect3";
|
||||
return "AABB";
|
||||
} break;
|
||||
case QUAT: {
|
||||
|
||||
|
@ -754,9 +754,9 @@ bool Variant::is_zero() const {
|
|||
|
||||
|
||||
} break;*/
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
return *_data._rect3 == Rect3();
|
||||
return *_data._aabb == ::AABB();
|
||||
} break;
|
||||
case QUAT: {
|
||||
|
||||
|
@ -954,9 +954,9 @@ void Variant::reference(const Variant &p_variant) {
|
|||
memnew_placement(_data._mem, Plane(*reinterpret_cast<const Plane *>(p_variant._data._mem)));
|
||||
} break;
|
||||
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
_data._rect3 = memnew(Rect3(*p_variant._data._rect3));
|
||||
_data._aabb = memnew(::AABB(*p_variant._data._aabb));
|
||||
} break;
|
||||
case QUAT: {
|
||||
|
||||
|
@ -1079,9 +1079,9 @@ void Variant::clear() {
|
|||
|
||||
memdelete(_data._transform2d);
|
||||
} break;
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
memdelete(_data._rect3);
|
||||
memdelete(_data._aabb);
|
||||
} break;
|
||||
case BASIS: {
|
||||
|
||||
|
@ -1426,7 +1426,7 @@ Variant::operator String() const {
|
|||
case PLANE:
|
||||
return operator Plane();
|
||||
//case QUAT:
|
||||
case RECT3: return operator Rect3();
|
||||
case AABB: return operator ::AABB();
|
||||
case QUAT: return "(" + operator Quat() + ")";
|
||||
case BASIS: {
|
||||
|
||||
|
@ -1617,12 +1617,12 @@ Variant::operator Plane() const {
|
|||
else
|
||||
return Plane();
|
||||
}
|
||||
Variant::operator Rect3() const {
|
||||
Variant::operator ::AABB() const {
|
||||
|
||||
if (type == RECT3)
|
||||
return *_data._rect3;
|
||||
if (type == AABB)
|
||||
return *_data._aabb;
|
||||
else
|
||||
return Rect3();
|
||||
return ::AABB();
|
||||
}
|
||||
|
||||
Variant::operator Basis() const {
|
||||
|
@ -2188,10 +2188,10 @@ Variant::Variant(const Plane &p_plane) {
|
|||
type = PLANE;
|
||||
memnew_placement(_data._mem, Plane(p_plane));
|
||||
}
|
||||
Variant::Variant(const Rect3 &p_aabb) {
|
||||
Variant::Variant(const ::AABB &p_aabb) {
|
||||
|
||||
type = RECT3;
|
||||
_data._rect3 = memnew(Rect3(p_aabb));
|
||||
type = AABB;
|
||||
_data._aabb = memnew(::AABB(p_aabb));
|
||||
}
|
||||
|
||||
Variant::Variant(const Basis &p_matrix) {
|
||||
|
@ -2524,9 +2524,9 @@ void Variant::operator=(const Variant &p_variant) {
|
|||
*reinterpret_cast<Plane *>(_data._mem) = *reinterpret_cast<const Plane *>(p_variant._data._mem);
|
||||
} break;
|
||||
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
*_data._rect3 = *(p_variant._data._rect3);
|
||||
*_data._aabb = *(p_variant._data._aabb);
|
||||
} break;
|
||||
case QUAT: {
|
||||
|
||||
|
@ -2686,13 +2686,13 @@ uint32_t Variant::hash() const {
|
|||
|
||||
|
||||
} break;*/
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
uint32_t hash = 5831;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
hash = hash_djb2_one_float(_data._rect3->position[i], hash);
|
||||
hash = hash_djb2_one_float(_data._rect3->size[i], hash);
|
||||
hash = hash_djb2_one_float(_data._aabb->position[i], hash);
|
||||
hash = hash_djb2_one_float(_data._aabb->size[i], hash);
|
||||
}
|
||||
|
||||
return hash;
|
||||
|
@ -2952,9 +2952,9 @@ bool Variant::hash_compare(const Variant &p_variant) const {
|
|||
(hash_compare_scalar(l->d, r->d));
|
||||
} break;
|
||||
|
||||
case RECT3: {
|
||||
const Rect3 *l = _data._rect3;
|
||||
const Rect3 *r = p_variant._data._rect3;
|
||||
case AABB: {
|
||||
const ::AABB *l = _data._aabb;
|
||||
const ::AABB *r = p_variant._data._aabb;
|
||||
|
||||
return (hash_compare_vector3(l->position, r->position) &&
|
||||
(hash_compare_vector3(l->size, r->size)));
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "aabb.h"
|
||||
#include "array.h"
|
||||
#include "color.h"
|
||||
#include "dictionary.h"
|
||||
|
@ -45,7 +46,6 @@
|
|||
#include "node_path.h"
|
||||
#include "plane.h"
|
||||
#include "quat.h"
|
||||
#include "rect3.h"
|
||||
#include "ref_ptr.h"
|
||||
#include "rid.h"
|
||||
#include "transform.h"
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
TRANSFORM2D,
|
||||
PLANE,
|
||||
QUAT, // 10
|
||||
RECT3,
|
||||
AABB,
|
||||
BASIS,
|
||||
TRANSFORM,
|
||||
|
||||
|
@ -136,7 +136,7 @@ private:
|
|||
int64_t _int;
|
||||
double _real;
|
||||
Transform2D *_transform2d;
|
||||
Rect3 *_rect3;
|
||||
::AABB *_aabb;
|
||||
Basis *_basis;
|
||||
Transform *_transform;
|
||||
RefPtr *_resource;
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
operator Rect2() const;
|
||||
operator Vector3() const;
|
||||
operator Plane() const;
|
||||
operator Rect3() const;
|
||||
operator ::AABB() const;
|
||||
operator Quat() const;
|
||||
operator Basis() const;
|
||||
operator Transform() const;
|
||||
|
@ -253,7 +253,7 @@ public:
|
|||
Variant(const Rect2 &p_rect2);
|
||||
Variant(const Vector3 &p_vector3);
|
||||
Variant(const Plane &p_plane);
|
||||
Variant(const Rect3 &p_aabb);
|
||||
Variant(const ::AABB &p_aabb);
|
||||
Variant(const Quat &p_quat);
|
||||
Variant(const Basis &p_transform);
|
||||
Variant(const Transform2D &p_transform);
|
||||
|
|
|
@ -655,26 +655,26 @@ struct _VariantCall {
|
|||
#define VCALL_PTR5R(m_type, m_method) \
|
||||
static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { r_ret = reinterpret_cast<m_type *>(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4]); }
|
||||
|
||||
VCALL_PTR0R(Rect3, get_area);
|
||||
VCALL_PTR0R(Rect3, has_no_area);
|
||||
VCALL_PTR0R(Rect3, has_no_surface);
|
||||
VCALL_PTR1R(Rect3, intersects);
|
||||
VCALL_PTR1R(Rect3, encloses);
|
||||
VCALL_PTR1R(Rect3, merge);
|
||||
VCALL_PTR1R(Rect3, intersection);
|
||||
VCALL_PTR1R(Rect3, intersects_plane);
|
||||
VCALL_PTR2R(Rect3, intersects_segment);
|
||||
VCALL_PTR1R(Rect3, has_point);
|
||||
VCALL_PTR1R(Rect3, get_support);
|
||||
VCALL_PTR0R(Rect3, get_longest_axis);
|
||||
VCALL_PTR0R(Rect3, get_longest_axis_index);
|
||||
VCALL_PTR0R(Rect3, get_longest_axis_size);
|
||||
VCALL_PTR0R(Rect3, get_shortest_axis);
|
||||
VCALL_PTR0R(Rect3, get_shortest_axis_index);
|
||||
VCALL_PTR0R(Rect3, get_shortest_axis_size);
|
||||
VCALL_PTR1R(Rect3, expand);
|
||||
VCALL_PTR1R(Rect3, grow);
|
||||
VCALL_PTR1R(Rect3, get_endpoint);
|
||||
VCALL_PTR0R(AABB, get_area);
|
||||
VCALL_PTR0R(AABB, has_no_area);
|
||||
VCALL_PTR0R(AABB, has_no_surface);
|
||||
VCALL_PTR1R(AABB, intersects);
|
||||
VCALL_PTR1R(AABB, encloses);
|
||||
VCALL_PTR1R(AABB, merge);
|
||||
VCALL_PTR1R(AABB, intersection);
|
||||
VCALL_PTR1R(AABB, intersects_plane);
|
||||
VCALL_PTR2R(AABB, intersects_segment);
|
||||
VCALL_PTR1R(AABB, has_point);
|
||||
VCALL_PTR1R(AABB, get_support);
|
||||
VCALL_PTR0R(AABB, get_longest_axis);
|
||||
VCALL_PTR0R(AABB, get_longest_axis_index);
|
||||
VCALL_PTR0R(AABB, get_longest_axis_size);
|
||||
VCALL_PTR0R(AABB, get_shortest_axis);
|
||||
VCALL_PTR0R(AABB, get_shortest_axis_index);
|
||||
VCALL_PTR0R(AABB, get_shortest_axis_size);
|
||||
VCALL_PTR1R(AABB, expand);
|
||||
VCALL_PTR1R(AABB, grow);
|
||||
VCALL_PTR1R(AABB, get_endpoint);
|
||||
|
||||
VCALL_PTR0R(Transform2D, inverse);
|
||||
VCALL_PTR0R(Transform2D, affine_inverse);
|
||||
|
@ -755,7 +755,7 @@ struct _VariantCall {
|
|||
|
||||
case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3()); return;
|
||||
case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Plane()); return;
|
||||
case Variant::RECT3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Rect3()); return;
|
||||
case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::AABB()); return;
|
||||
default: r_ret = Variant();
|
||||
}
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ struct _VariantCall {
|
|||
|
||||
case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3()); return;
|
||||
case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Plane()); return;
|
||||
case Variant::RECT3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect3()); return;
|
||||
case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::AABB()); return;
|
||||
default: r_ret = Variant();
|
||||
}
|
||||
}
|
||||
|
@ -878,9 +878,9 @@ struct _VariantCall {
|
|||
r_ret = Color::hex(*p_args[0]);
|
||||
}
|
||||
|
||||
static void Rect3_init1(Variant &r_ret, const Variant **p_args) {
|
||||
static void AABB_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Rect3(*p_args[0], *p_args[1]);
|
||||
r_ret = ::AABB(*p_args[0], *p_args[1]);
|
||||
}
|
||||
|
||||
static void Basis_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
@ -1058,8 +1058,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
|
|||
case TRANSFORM2D: return Transform2D();
|
||||
case PLANE: return Plane();
|
||||
case QUAT: return Quat();
|
||||
case RECT3:
|
||||
return Rect3(); // 10
|
||||
case AABB:
|
||||
return ::AABB(); // 10
|
||||
case BASIS: return Basis();
|
||||
case TRANSFORM:
|
||||
return Transform();
|
||||
|
@ -1138,8 +1138,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
|
|||
case VECTOR3: return (Vector3(*p_args[0]));
|
||||
case PLANE: return (Plane(*p_args[0]));
|
||||
case QUAT: return (Quat(*p_args[0]));
|
||||
case RECT3:
|
||||
return (Rect3(*p_args[0])); // 10
|
||||
case AABB:
|
||||
return (::AABB(*p_args[0])); // 10
|
||||
case BASIS: return (Basis(p_args[0]->operator Basis()));
|
||||
case TRANSFORM:
|
||||
return (Transform(p_args[0]->operator Transform()));
|
||||
|
@ -1707,26 +1707,26 @@ void register_variant_methods() {
|
|||
|
||||
//pointerbased
|
||||
|
||||
ADDFUNC0R(RECT3, REAL, Rect3, get_area, varray());
|
||||
ADDFUNC0R(RECT3, BOOL, Rect3, has_no_area, varray());
|
||||
ADDFUNC0R(RECT3, BOOL, Rect3, has_no_surface, varray());
|
||||
ADDFUNC1R(RECT3, BOOL, Rect3, intersects, RECT3, "with", varray());
|
||||
ADDFUNC1R(RECT3, BOOL, Rect3, encloses, RECT3, "with", varray());
|
||||
ADDFUNC1R(RECT3, RECT3, Rect3, merge, RECT3, "with", varray());
|
||||
ADDFUNC1R(RECT3, RECT3, Rect3, intersection, RECT3, "with", varray());
|
||||
ADDFUNC1R(RECT3, BOOL, Rect3, intersects_plane, PLANE, "plane", varray());
|
||||
ADDFUNC2R(RECT3, BOOL, Rect3, intersects_segment, VECTOR3, "from", VECTOR3, "to", varray());
|
||||
ADDFUNC1R(RECT3, BOOL, Rect3, has_point, VECTOR3, "point", varray());
|
||||
ADDFUNC1R(RECT3, VECTOR3, Rect3, get_support, VECTOR3, "dir", varray());
|
||||
ADDFUNC0R(RECT3, VECTOR3, Rect3, get_longest_axis, varray());
|
||||
ADDFUNC0R(RECT3, INT, Rect3, get_longest_axis_index, varray());
|
||||
ADDFUNC0R(RECT3, REAL, Rect3, get_longest_axis_size, varray());
|
||||
ADDFUNC0R(RECT3, VECTOR3, Rect3, get_shortest_axis, varray());
|
||||
ADDFUNC0R(RECT3, INT, Rect3, get_shortest_axis_index, varray());
|
||||
ADDFUNC0R(RECT3, REAL, Rect3, get_shortest_axis_size, varray());
|
||||
ADDFUNC1R(RECT3, RECT3, Rect3, expand, VECTOR3, "to_point", varray());
|
||||
ADDFUNC1R(RECT3, RECT3, Rect3, grow, REAL, "by", varray());
|
||||
ADDFUNC1R(RECT3, VECTOR3, Rect3, get_endpoint, INT, "idx", varray());
|
||||
ADDFUNC0R(AABB, REAL, AABB, get_area, varray());
|
||||
ADDFUNC0R(AABB, BOOL, AABB, has_no_area, varray());
|
||||
ADDFUNC0R(AABB, BOOL, AABB, has_no_surface, varray());
|
||||
ADDFUNC1R(AABB, BOOL, AABB, intersects, AABB, "with", varray());
|
||||
ADDFUNC1R(AABB, BOOL, AABB, encloses, AABB, "with", varray());
|
||||
ADDFUNC1R(AABB, AABB, AABB, merge, AABB, "with", varray());
|
||||
ADDFUNC1R(AABB, AABB, AABB, intersection, AABB, "with", varray());
|
||||
ADDFUNC1R(AABB, BOOL, AABB, intersects_plane, PLANE, "plane", varray());
|
||||
ADDFUNC2R(AABB, BOOL, AABB, intersects_segment, VECTOR3, "from", VECTOR3, "to", varray());
|
||||
ADDFUNC1R(AABB, BOOL, AABB, has_point, VECTOR3, "point", varray());
|
||||
ADDFUNC1R(AABB, VECTOR3, AABB, get_support, VECTOR3, "dir", varray());
|
||||
ADDFUNC0R(AABB, VECTOR3, AABB, get_longest_axis, varray());
|
||||
ADDFUNC0R(AABB, INT, AABB, get_longest_axis_index, varray());
|
||||
ADDFUNC0R(AABB, REAL, AABB, get_longest_axis_size, varray());
|
||||
ADDFUNC0R(AABB, VECTOR3, AABB, get_shortest_axis, varray());
|
||||
ADDFUNC0R(AABB, INT, AABB, get_shortest_axis_index, varray());
|
||||
ADDFUNC0R(AABB, REAL, AABB, get_shortest_axis_size, varray());
|
||||
ADDFUNC1R(AABB, AABB, AABB, expand, VECTOR3, "to_point", varray());
|
||||
ADDFUNC1R(AABB, AABB, AABB, grow, REAL, "by", varray());
|
||||
ADDFUNC1R(AABB, VECTOR3, AABB, get_endpoint, INT, "idx", varray());
|
||||
|
||||
ADDFUNC0R(TRANSFORM2D, TRANSFORM2D, Transform2D, inverse, varray());
|
||||
ADDFUNC0R(TRANSFORM2D, TRANSFORM2D, Transform2D, affine_inverse, varray());
|
||||
|
@ -1791,7 +1791,7 @@ void register_variant_methods() {
|
|||
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
|
||||
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
|
||||
|
||||
_VariantCall::add_constructor(_VariantCall::Rect3_init1, Variant::RECT3, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
||||
_VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
||||
|
||||
_VariantCall::add_constructor(_VariantCall::Basis_init1, Variant::BASIS, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3);
|
||||
_VariantCall::add_constructor(_VariantCall::Basis_init2, Variant::BASIS, "axis", Variant::VECTOR3, "phi", Variant::REAL);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
CASE_TYPE(PREFIX, OP, TRANSFORM2D) \
|
||||
CASE_TYPE(PREFIX, OP, PLANE) \
|
||||
CASE_TYPE(PREFIX, OP, QUAT) \
|
||||
CASE_TYPE(PREFIX, OP, RECT3) \
|
||||
CASE_TYPE(PREFIX, OP, AABB) \
|
||||
CASE_TYPE(PREFIX, OP, BASIS) \
|
||||
CASE_TYPE(PREFIX, OP, TRANSFORM) \
|
||||
CASE_TYPE(PREFIX, OP, COLOR) \
|
||||
|
@ -81,7 +81,7 @@
|
|||
TYPE(PREFIX, OP, TRANSFORM2D), \
|
||||
TYPE(PREFIX, OP, PLANE), \
|
||||
TYPE(PREFIX, OP, QUAT), \
|
||||
TYPE(PREFIX, OP, RECT3), \
|
||||
TYPE(PREFIX, OP, AABB), \
|
||||
TYPE(PREFIX, OP, BASIS), \
|
||||
TYPE(PREFIX, OP, TRANSFORM), \
|
||||
TYPE(PREFIX, OP, COLOR), \
|
||||
|
@ -465,7 +465,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3, ==, Vector3);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, PLANE, ==, Plane);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, QUAT, ==, Quat);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, RECT3, ==, _rect3);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, AABB, ==, _aabb);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, BASIS, ==, _basis);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM, ==, _transform);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, COLOR, ==, Color);
|
||||
|
@ -555,7 +555,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3, !=, Vector3);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, PLANE, !=, Plane);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, QUAT, !=, Quat);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, RECT3, !=, _rect3);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, AABB, !=, _aabb);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, BASIS, !=, _basis);
|
||||
DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM, !=, _transform);
|
||||
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, COLOR, !=, Color);
|
||||
|
@ -629,7 +629,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_LESS, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_LESS, PLANE)
|
||||
CASE_TYPE(math, OP_LESS, QUAT)
|
||||
CASE_TYPE(math, OP_LESS, RECT3)
|
||||
CASE_TYPE(math, OP_LESS, AABB)
|
||||
CASE_TYPE(math, OP_LESS, BASIS)
|
||||
CASE_TYPE(math, OP_LESS, TRANSFORM)
|
||||
CASE_TYPE(math, OP_LESS, COLOR)
|
||||
|
@ -658,7 +658,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, PLANE)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, QUAT)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, RECT3)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, AABB)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, BASIS)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM)
|
||||
CASE_TYPE(math, OP_LESS_EQUAL, COLOR)
|
||||
|
@ -733,7 +733,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_GREATER, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_GREATER, PLANE)
|
||||
CASE_TYPE(math, OP_GREATER, QUAT)
|
||||
CASE_TYPE(math, OP_GREATER, RECT3)
|
||||
CASE_TYPE(math, OP_GREATER, AABB)
|
||||
CASE_TYPE(math, OP_GREATER, BASIS)
|
||||
CASE_TYPE(math, OP_GREATER, TRANSFORM)
|
||||
CASE_TYPE(math, OP_GREATER, COLOR)
|
||||
|
@ -762,7 +762,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, PLANE)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, QUAT)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, RECT3)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, AABB)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, BASIS)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM)
|
||||
CASE_TYPE(math, OP_GREATER_EQUAL, COLOR)
|
||||
|
@ -818,7 +818,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_ADD, RECT2)
|
||||
CASE_TYPE(math, OP_ADD, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_ADD, PLANE)
|
||||
CASE_TYPE(math, OP_ADD, RECT3)
|
||||
CASE_TYPE(math, OP_ADD, AABB)
|
||||
CASE_TYPE(math, OP_ADD, BASIS)
|
||||
CASE_TYPE(math, OP_ADD, TRANSFORM)
|
||||
CASE_TYPE(math, OP_ADD, NODE_PATH)
|
||||
|
@ -842,7 +842,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_SUBTRACT, RECT2)
|
||||
CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_SUBTRACT, PLANE)
|
||||
CASE_TYPE(math, OP_SUBTRACT, RECT3)
|
||||
CASE_TYPE(math, OP_SUBTRACT, AABB)
|
||||
CASE_TYPE(math, OP_SUBTRACT, BASIS)
|
||||
CASE_TYPE(math, OP_SUBTRACT, TRANSFORM)
|
||||
CASE_TYPE(math, OP_SUBTRACT, NODE_PATH)
|
||||
|
@ -923,7 +923,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_MULTIPLY, STRING)
|
||||
CASE_TYPE(math, OP_MULTIPLY, RECT2)
|
||||
CASE_TYPE(math, OP_MULTIPLY, PLANE)
|
||||
CASE_TYPE(math, OP_MULTIPLY, RECT3)
|
||||
CASE_TYPE(math, OP_MULTIPLY, AABB)
|
||||
CASE_TYPE(math, OP_MULTIPLY, NODE_PATH)
|
||||
CASE_TYPE(math, OP_MULTIPLY, _RID)
|
||||
CASE_TYPE(math, OP_MULTIPLY, OBJECT)
|
||||
|
@ -964,7 +964,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_DIVIDE, RECT2)
|
||||
CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_DIVIDE, PLANE)
|
||||
CASE_TYPE(math, OP_DIVIDE, RECT3)
|
||||
CASE_TYPE(math, OP_DIVIDE, AABB)
|
||||
CASE_TYPE(math, OP_DIVIDE, BASIS)
|
||||
CASE_TYPE(math, OP_DIVIDE, TRANSFORM)
|
||||
CASE_TYPE(math, OP_DIVIDE, NODE_PATH)
|
||||
|
@ -995,7 +995,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_POSITIVE, STRING)
|
||||
CASE_TYPE(math, OP_POSITIVE, RECT2)
|
||||
CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_POSITIVE, RECT3)
|
||||
CASE_TYPE(math, OP_POSITIVE, AABB)
|
||||
CASE_TYPE(math, OP_POSITIVE, BASIS)
|
||||
CASE_TYPE(math, OP_POSITIVE, TRANSFORM)
|
||||
CASE_TYPE(math, OP_POSITIVE, COLOR)
|
||||
|
@ -1029,7 +1029,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_NEGATE, STRING)
|
||||
CASE_TYPE(math, OP_NEGATE, RECT2)
|
||||
CASE_TYPE(math, OP_NEGATE, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_NEGATE, RECT3)
|
||||
CASE_TYPE(math, OP_NEGATE, AABB)
|
||||
CASE_TYPE(math, OP_NEGATE, BASIS)
|
||||
CASE_TYPE(math, OP_NEGATE, TRANSFORM)
|
||||
CASE_TYPE(math, OP_NEGATE, NODE_PATH)
|
||||
|
@ -1088,7 +1088,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
CASE_TYPE(math, OP_MODULE, TRANSFORM2D)
|
||||
CASE_TYPE(math, OP_MODULE, PLANE)
|
||||
CASE_TYPE(math, OP_MODULE, QUAT)
|
||||
CASE_TYPE(math, OP_MODULE, RECT3)
|
||||
CASE_TYPE(math, OP_MODULE, AABB)
|
||||
CASE_TYPE(math, OP_MODULE, BASIS)
|
||||
CASE_TYPE(math, OP_MODULE, TRANSFORM)
|
||||
CASE_TYPE(math, OP_MODULE, COLOR)
|
||||
|
@ -1384,10 +1384,10 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
|
|||
}
|
||||
|
||||
} break; // 10
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
if (p_value.type == Variant::VECTOR3) {
|
||||
Rect3 *v = _data._rect3;
|
||||
::AABB *v = _data._aabb;
|
||||
//scalar name
|
||||
if (p_index == CoreStringNames::singleton->position) {
|
||||
v->position = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
|
||||
|
@ -1609,9 +1609,9 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
|
|||
}
|
||||
|
||||
} break; // 10
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
const Rect3 *v = _data._rect3;
|
||||
const ::AABB *v = _data._aabb;
|
||||
//scalar name
|
||||
if (p_index == CoreStringNames::singleton->position) {
|
||||
return v->position;
|
||||
|
@ -1982,7 +1982,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
|
|||
}
|
||||
|
||||
} break; // 10
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
if (p_value.type != Variant::VECTOR3)
|
||||
return;
|
||||
|
@ -1991,7 +1991,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
|
|||
//scalar name
|
||||
|
||||
const String *str = reinterpret_cast<const String *>(p_index._data._mem);
|
||||
Rect3 *v = _data._rect3;
|
||||
::AABB *v = _data._aabb;
|
||||
if (*str == "position") {
|
||||
valid = true;
|
||||
v->position = p_value;
|
||||
|
@ -2400,13 +2400,13 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
|
|||
}
|
||||
|
||||
} break; // 10
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
|
||||
if (p_index.get_type() == Variant::STRING) {
|
||||
//scalar name
|
||||
|
||||
const String *str = reinterpret_cast<const String *>(p_index._data._mem);
|
||||
const Rect3 *v = _data._rect3;
|
||||
const ::AABB *v = _data._aabb;
|
||||
if (*str == "position") {
|
||||
valid = true;
|
||||
return v->position;
|
||||
|
@ -2835,7 +2835,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
|
|||
p_list->push_back(PropertyInfo(Variant::REAL, "w"));
|
||||
|
||||
} break; // 10
|
||||
case RECT3: {
|
||||
case AABB: {
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR3, "position"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR3, "size"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR3, "end"));
|
||||
|
@ -3457,10 +3457,10 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
|
|||
r_dst = *reinterpret_cast<const Vector3 *>(a._data._mem) + *reinterpret_cast<const Vector3 *>(b._data._mem) * c;
|
||||
}
|
||||
return;
|
||||
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->position + rb->position * c, ra->size + rb->size * c);
|
||||
case AABB: {
|
||||
const ::AABB *ra = reinterpret_cast<const ::AABB *>(a._data._mem);
|
||||
const ::AABB *rb = reinterpret_cast<const ::AABB *>(b._data._mem);
|
||||
r_dst = ::AABB(ra->position + rb->position * c, ra->size + rb->size * c);
|
||||
}
|
||||
return;
|
||||
case QUAT: {
|
||||
|
@ -3591,8 +3591,8 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
|
|||
r_dst = reinterpret_cast<const Quat *>(a._data._mem)->slerp(*reinterpret_cast<const Quat *>(b._data._mem), c);
|
||||
}
|
||||
return;
|
||||
case RECT3: {
|
||||
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));
|
||||
case AABB: {
|
||||
r_dst = ::AABB(a._data._aabb->position.linear_interpolate(b._data._aabb->position, c), a._data._aabb->size.linear_interpolate(b._data._aabb->size, c));
|
||||
}
|
||||
return;
|
||||
case BASIS: {
|
||||
|
|
|
@ -595,7 +595,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|||
value = Quat(args[0], args[1], args[2], args[3]);
|
||||
return OK;
|
||||
|
||||
} else if (id == "Rect3" || id == "AABB") {
|
||||
} else if (id == "AABB") {
|
||||
|
||||
Vector<float> args;
|
||||
Error err = _parse_construct<float>(p_stream, args, line, r_err_str);
|
||||
|
@ -606,7 +606,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|||
r_err_str = "Expected 6 arguments for constructor";
|
||||
}
|
||||
|
||||
value = Rect3(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5]));
|
||||
value = AABB(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5]));
|
||||
return OK;
|
||||
|
||||
} else if (id == "Basis" || id == "Matrix3") { //compatibility
|
||||
|
@ -1634,10 +1634,10 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
|
|||
p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.d) + " )");
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
Rect3 aabb = p_variant;
|
||||
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) + " )");
|
||||
AABB aabb = p_variant;
|
||||
p_store_string_func(p_store_string_ud, "AABB( " + 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: {
|
||||
|
|
|
@ -1332,8 +1332,8 @@
|
|||
<constant name="TYPE_QUAT" value="10">
|
||||
Variable is of type [Quat].
|
||||
</constant>
|
||||
<constant name="TYPE_RECT3" value="11">
|
||||
Variable is of type [Rect3].
|
||||
<constant name="TYPE_AABB" value="11">
|
||||
Variable is of type [AABB].
|
||||
</constant>
|
||||
<constant name="TYPE_BASIS" value="12">
|
||||
Variable is of type [Basis].
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Rect3" category="Built-In Types" version="3.0-alpha">
|
||||
<class name="AABB" category="Built-In Types" version="3.0-alpha">
|
||||
<brief_description>
|
||||
Axis-Aligned Bounding Box.
|
||||
</brief_description>
|
||||
<description>
|
||||
Rect3 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
|
||||
AABB consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<demos>
|
||||
</demos>
|
||||
<methods>
|
||||
<method name="Rect3">
|
||||
<return type="Rect3">
|
||||
<method name="AABB">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="position" type="Vector3">
|
||||
</argument>
|
||||
|
@ -25,26 +25,26 @@
|
|||
<method name="encloses">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="with" type="Rect3">
|
||||
<argument index="0" name="with" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if this [code]Rect3[/code] completely encloses another one.
|
||||
Returns [code]true[/code] if this [code]AABB[/code] completely encloses another one.
|
||||
</description>
|
||||
</method>
|
||||
<method name="expand">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="to_point" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns this [code]Rect3[/code] expanded to include a given point.
|
||||
Returns this [code]AABB[/code] expanded to include a given point.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_area">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Gets the area of the [code]Rect3[/code].
|
||||
Gets the area of the [code]AABB[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_endpoint">
|
||||
|
@ -53,49 +53,49 @@
|
|||
<argument index="0" name="idx" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Gets the position of the 8 endpoints of the [code]Rect3[/code] in space.
|
||||
Gets the position of the 8 endpoints of the [code]AABB[/code] in space.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_longest_axis">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns the normalized longest axis of the [code]Rect3[/code].
|
||||
Returns the normalized longest axis of the [code]AABB[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_longest_axis_index">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum).
|
||||
Returns the index of the longest axis of the [code]AABB[/code] (according to [Vector3]::AXIS* enum).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_longest_axis_size">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the scalar length of the longest axis of the [code]Rect3[/code].
|
||||
Returns the scalar length of the longest axis of the [code]AABB[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_shortest_axis">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns the normalized shortest axis of the [code]Rect3[/code].
|
||||
Returns the normalized shortest axis of the [code]AABB[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_shortest_axis_index">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum).
|
||||
Returns the index of the shortest axis of the [code]AABB[/code] (according to [Vector3]::AXIS* enum).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_shortest_axis_size">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the scalar length of the shortest axis of the [code]Rect3[/code].
|
||||
Returns the scalar length of the shortest axis of the [code]AABB[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_support">
|
||||
|
@ -108,26 +108,26 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="grow">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="by" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides.
|
||||
Returns a copy of the [code]AABB[/code] grown a given amount of units towards all the sides.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_no_area">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] is flat or empty.
|
||||
Returns [code]true[/code] if the [code]AABB[/code] is flat or empty.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_no_surface">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] is empty.
|
||||
Returns [code]true[/code] if the [code]AABB[/code] is empty.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_point">
|
||||
|
@ -136,25 +136,25 @@
|
|||
<argument index="0" name="point" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] contains a point.
|
||||
Returns [code]true[/code] if the [code]AABB[/code] contains a point.
|
||||
</description>
|
||||
</method>
|
||||
<method name="intersection">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="with" type="Rect3">
|
||||
<argument index="0" name="with" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure.
|
||||
Returns the intersection between two [code]AABB[/code]. An empty AABB (size 0,0,0) is returned on failure.
|
||||
</description>
|
||||
</method>
|
||||
<method name="intersects">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="with" type="Rect3">
|
||||
<argument index="0" name="with" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] overlaps with another.
|
||||
Returns [code]true[/code] if the [code]AABB[/code] overlaps with another.
|
||||
</description>
|
||||
</method>
|
||||
<method name="intersects_plane">
|
||||
|
@ -163,7 +163,7 @@
|
|||
<argument index="0" name="plane" type="Plane">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] is on both sides of a plane.
|
||||
Returns [code]true[/code] if the [code]AABB[/code] is on both sides of a plane.
|
||||
</description>
|
||||
</method>
|
||||
<method name="intersects_segment">
|
||||
|
@ -174,16 +174,16 @@
|
|||
<argument index="1" name="to" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if the [code]Rect3[/code] intersects the line segment between [code]from[/code] and [code]to[/code].
|
||||
Returns [code]true[/code] if the [code]AABB[/code] intersects the line segment between [code]from[/code] and [code]to[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="merge">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="with" type="Rect3">
|
||||
<argument index="0" name="with" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a larger Rect3 that contains this Rect3 and [code]with[/code].
|
||||
Returns a larger AABB that contains this AABB and [code]with[/code].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
|
@ -66,7 +66,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_custom_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -95,7 +95,7 @@
|
|||
<method name="set_custom_aabb">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="aabb" type="Rect3">
|
||||
<argument index="0" name="aabb" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</return>
|
||||
<argument index="0" name="triangles" type="TriangleMesh">
|
||||
</argument>
|
||||
<argument index="1" name="bounds" type="Rect3">
|
||||
<argument index="1" name="bounds" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Add collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw].
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bounds" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<method name="set_bounds">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="bounds" type="Rect3">
|
||||
<argument index="0" name="bounds" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<members>
|
||||
<member name="bias" type="float" setter="set_bias" getter="get_bias">
|
||||
</member>
|
||||
<member name="bounds" type="Rect3" setter="set_bounds" getter="get_bounds">
|
||||
<member name="bounds" type="AABB" setter="set_bounds" getter="get_bounds">
|
||||
</member>
|
||||
<member name="cell_size" type="float" setter="set_cell_size" getter="get_cell_size">
|
||||
</member>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
MultiMesh provides low level mesh instancing. If the amount of [Mesh] instances needed goes from hundreds to thousands (and most need to be visible at close proximity) creating such a large amount of [MeshInstance] nodes may affect performance by using too much CPU or video memory.
|
||||
For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead.
|
||||
As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object).
|
||||
Since instances may have any behavior, the Rect3 used for visibility must be provided by the user.
|
||||
Since instances may have any behavior, the AABB used for visibility must be provided by the user.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -15,10 +15,10 @@
|
|||
</demos>
|
||||
<methods>
|
||||
<method name="get_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
Return the visibility Rect3.
|
||||
Return the visibility AABB.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_color_format" qualifiers="const">
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="Nil">
|
||||
<argument index="0" name="from" type="Rect3">
|
||||
<argument index="0" name="from" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</demos>
|
||||
<methods>
|
||||
<method name="capture_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -105,7 +105,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_visibility_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -247,7 +247,7 @@
|
|||
<method name="set_visibility_aabb">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="aabb" type="Rect3">
|
||||
<argument index="0" name="aabb" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -300,7 +300,7 @@
|
|||
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
|
||||
Speed scaling ratio. Default value: [code]1[/code].
|
||||
</member>
|
||||
<member name="visibility_aabb" type="Rect3" setter="set_visibility_aabb" getter="get_visibility_aabb">
|
||||
<member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb">
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -95,10 +95,10 @@
|
|||
<method name="String">
|
||||
<return type="String">
|
||||
</return>
|
||||
<argument index="0" name="from" type="Rect3">
|
||||
<argument index="0" name="from" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs a new String from the given [Rect3].
|
||||
Constructs a new String from the given [AABB].
|
||||
</description>
|
||||
</method>
|
||||
<method name="String">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</demos>
|
||||
<methods>
|
||||
<method name="get_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
Returns the bounding box of the VisibilityNotifier.
|
||||
|
@ -28,7 +28,7 @@
|
|||
<method name="set_aabb">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="rect" type="Rect3">
|
||||
<argument index="0" name="rect" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
Set the visibility bounding box of the VisibilityNotifier.
|
||||
|
@ -36,7 +36,7 @@
|
|||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="aabb" type="Rect3" setter="set_aabb" getter="get_aabb">
|
||||
<member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb">
|
||||
The VisibilityNotifier's bounding box.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</demos>
|
||||
<methods>
|
||||
<method name="get_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -22,7 +22,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_transformed_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -1035,7 +1035,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="mesh_get_custom_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="mesh" type="RID">
|
||||
</argument>
|
||||
|
@ -1085,13 +1085,13 @@
|
|||
</return>
|
||||
<argument index="0" name="mesh" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="aabb" type="Rect3">
|
||||
<argument index="1" name="aabb" type="AABB">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="mesh_surface_get_aabb" qualifiers="const">
|
||||
<return type="Rect3">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="mesh" type="RID">
|
||||
</argument>
|
||||
|
|
|
@ -2600,7 +2600,7 @@ RID RasterizerStorageGLES3::mesh_create() {
|
|||
return mesh_owner.make_rid(mesh);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<Rect3> &p_bone_aabbs) {
|
||||
void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) {
|
||||
|
||||
PoolVector<uint8_t> array = p_array;
|
||||
|
||||
|
@ -3240,11 +3240,11 @@ VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_
|
|||
return mesh->surfaces[p_surface]->primitive;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const {
|
||||
AABB RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const {
|
||||
|
||||
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!mesh, Rect3());
|
||||
ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Rect3());
|
||||
ERR_FAIL_COND_V(!mesh, AABB());
|
||||
ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), AABB());
|
||||
|
||||
return mesh->surfaces[p_surface]->aabb;
|
||||
}
|
||||
|
@ -3279,11 +3279,11 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap
|
|||
|
||||
return bsarr;
|
||||
}
|
||||
Vector<Rect3> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const {
|
||||
Vector<AABB> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const {
|
||||
|
||||
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!mesh, Vector<Rect3>());
|
||||
ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<Rect3>());
|
||||
ERR_FAIL_COND_V(!mesh, Vector<AABB>());
|
||||
ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<AABB>());
|
||||
|
||||
return mesh->surfaces[p_surface]->skeleton_bone_aabb;
|
||||
}
|
||||
|
@ -3337,7 +3337,7 @@ int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const {
|
|||
return mesh->surfaces.size();
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb) {
|
||||
void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {
|
||||
|
||||
Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND(!mesh);
|
||||
|
@ -3345,37 +3345,37 @@ void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aab
|
|||
mesh->custom_aabb = p_aabb;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const {
|
||||
AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const {
|
||||
|
||||
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!mesh, Rect3());
|
||||
ERR_FAIL_COND_V(!mesh, AABB());
|
||||
|
||||
return mesh->custom_aabb;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
||||
AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
||||
|
||||
Mesh *mesh = mesh_owner.get(p_mesh);
|
||||
ERR_FAIL_COND_V(!mesh, Rect3());
|
||||
ERR_FAIL_COND_V(!mesh, AABB());
|
||||
|
||||
if (mesh->custom_aabb != Rect3())
|
||||
if (mesh->custom_aabb != AABB())
|
||||
return mesh->custom_aabb;
|
||||
|
||||
Skeleton *sk = NULL;
|
||||
if (p_skeleton.is_valid())
|
||||
sk = skeleton_owner.get(p_skeleton);
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
if (sk && sk->size != 0) {
|
||||
|
||||
for (int i = 0; i < mesh->surfaces.size(); i++) {
|
||||
|
||||
Rect3 laabb;
|
||||
AABB laabb;
|
||||
if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) {
|
||||
|
||||
int bs = mesh->surfaces[i]->skeleton_bone_aabb.size();
|
||||
const Rect3 *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr();
|
||||
const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr();
|
||||
const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr();
|
||||
|
||||
int sbs = sk->size;
|
||||
|
@ -3401,7 +3401,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
|||
mtx.basis[1].y = texture[base_ofs + 1];
|
||||
mtx.origin.y = texture[base_ofs + 3];
|
||||
|
||||
Rect3 baabb = mtx.xform(skbones[j]);
|
||||
AABB baabb = mtx.xform(skbones[j]);
|
||||
if (first) {
|
||||
laabb = baabb;
|
||||
first = false;
|
||||
|
@ -3434,7 +3434,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
|||
mtx.basis[2].z = texture[base_ofs + 2];
|
||||
mtx.origin.z = texture[base_ofs + 3];
|
||||
|
||||
Rect3 baabb = mtx.xform(skbones[j]);
|
||||
AABB baabb = mtx.xform(skbones[j]);
|
||||
if (first) {
|
||||
laabb = baabb;
|
||||
first = false;
|
||||
|
@ -4028,10 +4028,10 @@ int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) con
|
|||
return multimesh->visible_instances;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const {
|
||||
AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const {
|
||||
|
||||
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
|
||||
ERR_FAIL_COND_V(!multimesh, Rect3());
|
||||
ERR_FAIL_COND_V(!multimesh, AABB());
|
||||
|
||||
const_cast<RasterizerStorageGLES3 *>(this)->update_dirty_multimeshes(); //update pending AABBs
|
||||
|
||||
|
@ -4053,7 +4053,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
|||
|
||||
if (multimesh->size && multimesh->dirty_aabb) {
|
||||
|
||||
Rect3 mesh_aabb;
|
||||
AABB mesh_aabb;
|
||||
|
||||
if (multimesh->mesh.is_valid()) {
|
||||
mesh_aabb = mesh_get_aabb(multimesh->mesh, RID());
|
||||
|
@ -4065,7 +4065,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
|||
int count = multimesh->data.size();
|
||||
float *data = multimesh->data.ptr();
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
if (multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D) {
|
||||
|
||||
|
@ -4080,7 +4080,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
|||
xform.basis[1][1] = dataptr[5];
|
||||
xform.origin[1] = dataptr[7];
|
||||
|
||||
Rect3 laabb = xform.xform(mesh_aabb);
|
||||
AABB laabb = xform.xform(mesh_aabb);
|
||||
if (i == 0)
|
||||
aabb = laabb;
|
||||
else
|
||||
|
@ -4106,7 +4106,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
|||
xform.basis.elements[2][2] = dataptr[10];
|
||||
xform.origin.z = dataptr[11];
|
||||
|
||||
Rect3 laabb = xform.xform(mesh_aabb);
|
||||
AABB laabb = xform.xform(mesh_aabb);
|
||||
if (i == 0)
|
||||
aabb = laabb;
|
||||
else
|
||||
|
@ -4242,10 +4242,10 @@ void RasterizerStorageGLES3::immediate_clear(RID p_immediate) {
|
|||
im->instance_change_notify();
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const {
|
||||
AABB RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const {
|
||||
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND_V(!im, Rect3());
|
||||
ERR_FAIL_COND_V(!im, AABB());
|
||||
return im->aabb;
|
||||
}
|
||||
|
||||
|
@ -4694,10 +4694,10 @@ uint64_t RasterizerStorageGLES3::light_get_version(RID p_light) const {
|
|||
return light->version;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::light_get_aabb(RID p_light) const {
|
||||
AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const {
|
||||
|
||||
const Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND_V(!light, Rect3());
|
||||
ERR_FAIL_COND_V(!light, AABB());
|
||||
|
||||
switch (light->type) {
|
||||
|
||||
|
@ -4705,22 +4705,22 @@ Rect3 RasterizerStorageGLES3::light_get_aabb(RID p_light) const {
|
|||
|
||||
float len = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len;
|
||||
return Rect3(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
} break;
|
||||
case VS::LIGHT_OMNI: {
|
||||
|
||||
float r = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
return Rect3(-Vector3(r, r, r), Vector3(r, r, r) * 2);
|
||||
return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2);
|
||||
} break;
|
||||
case VS::LIGHT_DIRECTIONAL: {
|
||||
|
||||
return Rect3();
|
||||
return AABB();
|
||||
} break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
ERR_FAIL_V(Rect3());
|
||||
return Rect3();
|
||||
ERR_FAIL_V(AABB());
|
||||
return AABB();
|
||||
}
|
||||
|
||||
/* PROBE API */
|
||||
|
@ -4842,11 +4842,11 @@ void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_
|
|||
reflection_probe->instance_change_notify();
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const {
|
||||
AABB RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const {
|
||||
const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe);
|
||||
ERR_FAIL_COND_V(!reflection_probe, Rect3());
|
||||
ERR_FAIL_COND_V(!reflection_probe, AABB());
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb.position = -reflection_probe->extents;
|
||||
aabb.size = reflection_probe->extents * 2.0;
|
||||
|
||||
|
@ -4903,7 +4903,7 @@ RID RasterizerStorageGLES3::gi_probe_create() {
|
|||
|
||||
GIProbe *gip = memnew(GIProbe);
|
||||
|
||||
gip->bounds = Rect3(Vector3(), Vector3(1, 1, 1));
|
||||
gip->bounds = AABB(Vector3(), Vector3(1, 1, 1));
|
||||
gip->dynamic_range = 1.0;
|
||||
gip->energy = 1.0;
|
||||
gip->propagation = 1.0;
|
||||
|
@ -4917,7 +4917,7 @@ RID RasterizerStorageGLES3::gi_probe_create() {
|
|||
return gi_probe_owner.make_rid(gip);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds) {
|
||||
void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {
|
||||
|
||||
GIProbe *gip = gi_probe_owner.getornull(p_probe);
|
||||
ERR_FAIL_COND(!gip);
|
||||
|
@ -4926,10 +4926,10 @@ void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const Rect3 &p_bou
|
|||
gip->version++;
|
||||
gip->instance_change_notify();
|
||||
}
|
||||
Rect3 RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const {
|
||||
AABB RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const {
|
||||
|
||||
const GIProbe *gip = gi_probe_owner.getornull(p_probe);
|
||||
ERR_FAIL_COND_V(!gip, Rect3());
|
||||
ERR_FAIL_COND_V(!gip, AABB());
|
||||
|
||||
return gip->bounds;
|
||||
}
|
||||
|
@ -5338,7 +5338,7 @@ void RasterizerStorageGLES3::_particles_update_histories(Particles *particles) {
|
|||
particles->clear = true;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) {
|
||||
void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) {
|
||||
|
||||
Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND(!particles);
|
||||
|
@ -5429,15 +5429,15 @@ void RasterizerStorageGLES3::particles_request_process(RID p_particles) {
|
|||
}
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
||||
AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
||||
|
||||
const Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, Rect3());
|
||||
ERR_FAIL_COND_V(!particles, AABB());
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]);
|
||||
|
||||
float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT);
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
Transform inv = particles->emission_transform.affine_inverse();
|
||||
|
||||
|
@ -5459,7 +5459,7 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
|||
float longest_axis = 0;
|
||||
for (int i = 0; i < particles->draw_passes.size(); i++) {
|
||||
if (particles->draw_passes[i].is_valid()) {
|
||||
Rect3 maabb = mesh_get_aabb(particles->draw_passes[i], RID());
|
||||
AABB maabb = mesh_get_aabb(particles->draw_passes[i], RID());
|
||||
longest_axis = MAX(maabb.get_longest_axis_size(), longest_axis);
|
||||
}
|
||||
}
|
||||
|
@ -5469,10 +5469,10 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
Rect3 RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const {
|
||||
AABB RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const {
|
||||
|
||||
const Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, Rect3());
|
||||
ERR_FAIL_COND_V(!particles, AABB());
|
||||
|
||||
return particles->custom_aabb;
|
||||
}
|
||||
|
@ -7027,14 +7027,22 @@ void RasterizerStorageGLES3::initialize() {
|
|||
glBindBuffer(GL_ARRAY_BUFFER, resources.quadie);
|
||||
{
|
||||
const float qv[16] = {
|
||||
-1, -1,
|
||||
0, 0,
|
||||
-1, 1,
|
||||
0, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, -1,
|
||||
1, 0,
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
};
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW);
|
||||
|
|
|
@ -592,7 +592,7 @@ public:
|
|||
GLuint instancing_array_wireframe_id;
|
||||
int index_wireframe_len;
|
||||
|
||||
Vector<Rect3> skeleton_bone_aabb;
|
||||
Vector<AABB> skeleton_bone_aabb;
|
||||
Vector<bool> skeleton_bone_used;
|
||||
|
||||
//bool packed;
|
||||
|
@ -604,7 +604,7 @@ public:
|
|||
|
||||
Vector<BlendShape> blend_shapes;
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
int array_len;
|
||||
int index_array_len;
|
||||
|
@ -659,7 +659,7 @@ public:
|
|||
Vector<Surface *> surfaces;
|
||||
int blend_shape_count;
|
||||
VS::BlendShapeMode blend_shape_mode;
|
||||
Rect3 custom_aabb;
|
||||
AABB custom_aabb;
|
||||
mutable uint64_t last_pass;
|
||||
SelfList<MultiMesh>::List multimeshes;
|
||||
|
||||
|
@ -684,7 +684,7 @@ public:
|
|||
|
||||
virtual RID mesh_create();
|
||||
|
||||
virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>());
|
||||
virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
|
||||
|
||||
virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount);
|
||||
virtual int mesh_get_blend_shape_count(RID p_mesh) const;
|
||||
|
@ -706,17 +706,17 @@ public:
|
|||
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const;
|
||||
virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
|
||||
|
||||
virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const;
|
||||
virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const;
|
||||
virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const;
|
||||
virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const;
|
||||
virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const;
|
||||
|
||||
virtual void mesh_remove_surface(RID p_mesh, int p_surface);
|
||||
virtual int mesh_get_surface_count(RID p_mesh) const;
|
||||
|
||||
virtual void mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb);
|
||||
virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const;
|
||||
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb);
|
||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
|
||||
|
||||
virtual Rect3 mesh_get_aabb(RID p_mesh, RID p_skeleton) const;
|
||||
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const;
|
||||
virtual void mesh_clear(RID p_mesh);
|
||||
|
||||
void mesh_render_blend_shapes(Surface *s, float *p_weights);
|
||||
|
@ -729,7 +729,7 @@ public:
|
|||
VS::MultimeshTransformFormat transform_format;
|
||||
VS::MultimeshColorFormat color_format;
|
||||
Vector<float> data;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
SelfList<MultiMesh> update_list;
|
||||
SelfList<MultiMesh> mesh_list;
|
||||
GLuint buffer;
|
||||
|
@ -780,7 +780,7 @@ public:
|
|||
virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible);
|
||||
virtual int multimesh_get_visible_instances(RID p_multimesh) const;
|
||||
|
||||
virtual Rect3 multimesh_get_aabb(RID p_multimesh) const;
|
||||
virtual AABB multimesh_get_aabb(RID p_multimesh) const;
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
|
@ -801,7 +801,7 @@ public:
|
|||
List<Chunk> chunks;
|
||||
bool building;
|
||||
int mask;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
Immediate() {
|
||||
type = GEOMETRY_IMMEDIATE;
|
||||
|
@ -830,7 +830,7 @@ public:
|
|||
virtual void immediate_clear(RID p_immediate);
|
||||
virtual void immediate_set_material(RID p_immediate, RID p_material);
|
||||
virtual RID immediate_get_material(RID p_immediate) const;
|
||||
virtual Rect3 immediate_get_aabb(RID p_immediate) const;
|
||||
virtual AABB immediate_get_aabb(RID p_immediate) const;
|
||||
|
||||
/* SKELETON API */
|
||||
|
||||
|
@ -918,7 +918,7 @@ public:
|
|||
virtual float light_get_param(RID p_light, VS::LightParam p_param);
|
||||
virtual Color light_get_color(RID p_light);
|
||||
|
||||
virtual Rect3 light_get_aabb(RID p_light) const;
|
||||
virtual AABB light_get_aabb(RID p_light) const;
|
||||
virtual uint64_t light_get_version(RID p_light) const;
|
||||
|
||||
/* PROBE API */
|
||||
|
@ -956,7 +956,7 @@ public:
|
|||
virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable);
|
||||
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers);
|
||||
|
||||
virtual Rect3 reflection_probe_get_aabb(RID p_probe) const;
|
||||
virtual AABB reflection_probe_get_aabb(RID p_probe) const;
|
||||
virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
|
||||
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const;
|
||||
|
||||
|
@ -969,7 +969,7 @@ public:
|
|||
|
||||
struct GIProbe : public Instantiable {
|
||||
|
||||
Rect3 bounds;
|
||||
AABB bounds;
|
||||
Transform to_cell;
|
||||
float cell_size;
|
||||
|
||||
|
@ -990,8 +990,8 @@ public:
|
|||
|
||||
virtual RID gi_probe_create();
|
||||
|
||||
virtual void gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds);
|
||||
virtual Rect3 gi_probe_get_bounds(RID p_probe) const;
|
||||
virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds);
|
||||
virtual AABB gi_probe_get_bounds(RID p_probe) const;
|
||||
|
||||
virtual void gi_probe_set_cell_size(RID p_probe, float p_size);
|
||||
virtual float gi_probe_get_cell_size(RID p_probe) const;
|
||||
|
@ -1058,7 +1058,7 @@ public:
|
|||
float explosiveness;
|
||||
float randomness;
|
||||
bool restart_request;
|
||||
Rect3 custom_aabb;
|
||||
AABB custom_aabb;
|
||||
bool use_local_coords;
|
||||
RID process_material;
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ public:
|
|||
|
||||
restart_request = false;
|
||||
|
||||
custom_aabb = Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8));
|
||||
custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
|
||||
|
||||
draw_order = VS::PARTICLES_DRAW_ORDER_INDEX;
|
||||
particle_buffers[0] = 0;
|
||||
|
@ -1155,7 +1155,7 @@ public:
|
|||
virtual void particles_set_pre_process_time(RID p_particles, float p_time);
|
||||
virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio);
|
||||
virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio);
|
||||
virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb);
|
||||
virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb);
|
||||
virtual void particles_set_speed_scale(RID p_particles, float p_scale);
|
||||
virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable);
|
||||
virtual void particles_set_process_material(RID p_particles, RID p_material);
|
||||
|
@ -1169,8 +1169,8 @@ public:
|
|||
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);
|
||||
|
||||
virtual void particles_request_process(RID p_particles);
|
||||
virtual Rect3 particles_get_current_aabb(RID p_particles);
|
||||
virtual Rect3 particles_get_aabb(RID p_particles) const;
|
||||
virtual AABB particles_get_current_aabb(RID p_particles);
|
||||
virtual AABB particles_get_aabb(RID p_particles) const;
|
||||
|
||||
virtual void _particles_update_histories(Particles *particles);
|
||||
|
||||
|
|
|
@ -3330,7 +3330,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
|
|||
h.type == Variant::VECTOR2 ||
|
||||
h.type == Variant::RECT2 ||
|
||||
h.type == Variant::VECTOR3 ||
|
||||
h.type == Variant::RECT3 ||
|
||||
h.type == Variant::AABB ||
|
||||
h.type == Variant::QUAT ||
|
||||
h.type == Variant::COLOR ||
|
||||
h.type == Variant::TRANSFORM) {
|
||||
|
|
|
@ -209,7 +209,7 @@ void ConnectDialog::_add_bind() {
|
|||
case Variant::VECTOR3: value = Vector3(); break;
|
||||
case Variant::PLANE: value = Plane(); break;
|
||||
case Variant::QUAT: value = Quat(); break;
|
||||
case Variant::RECT3: value = Rect3(); break;
|
||||
case Variant::AABB: value = AABB(); break;
|
||||
case Variant::BASIS: value = Basis(); break;
|
||||
case Variant::TRANSFORM: value = Transform(); break;
|
||||
case Variant::COLOR: value = Color(); break;
|
||||
|
@ -295,7 +295,7 @@ ConnectDialog::ConnectDialog() {
|
|||
type_list->add_item("Vector3", Variant::VECTOR3);
|
||||
type_list->add_item("Plane", Variant::PLANE);
|
||||
type_list->add_item("Quat", Variant::QUAT);
|
||||
type_list->add_item("Rect3", Variant::RECT3);
|
||||
type_list->add_item("AABB", Variant::AABB);
|
||||
type_list->add_item("Basis", Variant::BASIS);
|
||||
type_list->add_item("Transform", Variant::TRANSFORM);
|
||||
//type_list->add_separator();
|
||||
|
|
|
@ -182,7 +182,7 @@ void DocDump::dump(const String &p_file) {
|
|||
case Variant::VECTOR3:
|
||||
case Variant::PLANE:
|
||||
case Variant::QUAT:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::BASIS:
|
||||
case Variant::COLOR:
|
||||
case Variant::POOL_BYTE_ARRAY:
|
||||
|
|
|
@ -102,14 +102,14 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
|
|||
textures.push_back(Ref<Texture>());
|
||||
continue;
|
||||
}
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
AABB aabb = mesh->get_aabb();
|
||||
print_line("aabb: " + aabb);
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
aabb.position -= ofs;
|
||||
Transform xform;
|
||||
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25);
|
||||
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis;
|
||||
Rect3 rot_aabb = xform.xform(aabb);
|
||||
AABB rot_aabb = xform.xform(aabb);
|
||||
print_line("rot_aabb: " + rot_aabb);
|
||||
float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
|
||||
if (m == 0) {
|
||||
|
|
|
@ -302,7 +302,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
|
|||
|
||||
// get mesh instance and bounding box
|
||||
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
|
||||
Rect3 aabb = mi->get_aabb();
|
||||
AABB aabb = mi->get_aabb();
|
||||
|
||||
// create a new rigid body collision node
|
||||
RigidBody *rigid_body = memnew(RigidBody);
|
||||
|
|
|
@ -389,7 +389,7 @@ void CollisionPolygonEditor::_polygon_draw() {
|
|||
|
||||
rect = rect.grow(1);
|
||||
|
||||
Rect3 r;
|
||||
AABB r;
|
||||
r.position.x = rect.position.x;
|
||||
r.position.y = rect.position.y;
|
||||
r.position.z = depth;
|
||||
|
|
|
@ -790,13 +790,13 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) {
|
|||
|
||||
VS::get_singleton()->instance_set_base(mesh_instance, mesh->get_rid());
|
||||
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
AABB aabb = mesh->get_aabb();
|
||||
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;
|
||||
Rect3 rot_aabb = xform.xform(aabb);
|
||||
AABB rot_aabb = xform.xform(aabb);
|
||||
float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
|
||||
if (m == 0)
|
||||
return Ref<Texture>();
|
||||
|
|
|
@ -95,7 +95,7 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) {
|
|||
rot_y = 0;
|
||||
_update_rotation();
|
||||
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
AABB aabb = mesh->get_aabb();
|
||||
print_line("aabb: " + aabb);
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
float m = aabb.get_longest_axis_size();
|
||||
|
|
|
@ -153,15 +153,15 @@ void ParticlesEditor::_generate_aabb() {
|
|||
|
||||
EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time));
|
||||
|
||||
Rect3 rect;
|
||||
AABB rect;
|
||||
while (running < time) {
|
||||
|
||||
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
|
||||
ep.step("Generating..", int(running), true);
|
||||
OS::get_singleton()->delay_usec(1000);
|
||||
|
||||
Rect3 capture = node->capture_aabb();
|
||||
if (rect == Rect3())
|
||||
AABB capture = node->capture_aabb();
|
||||
if (rect == AABB())
|
||||
rect = capture;
|
||||
else
|
||||
rect.merge_with(capture);
|
||||
|
@ -247,7 +247,7 @@ void ParticlesEditor::_generate_emission_points() {
|
|||
|
||||
PoolVector<Face3>::Read r = geometry.read();
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
for (int i = 0; i < gcount; i++) {
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ void ScriptTextEditor::_set_theme_for_script() {
|
|||
text_edit->add_keyword_color("Rect2", basetype_color);
|
||||
text_edit->add_keyword_color("Transform2D", basetype_color);
|
||||
text_edit->add_keyword_color("Vector3", basetype_color);
|
||||
text_edit->add_keyword_color("Rect3", basetype_color);
|
||||
text_edit->add_keyword_color("AABB", basetype_color);
|
||||
text_edit->add_keyword_color("Basis", basetype_color);
|
||||
text_edit->add_keyword_color("Plane", basetype_color);
|
||||
text_edit->add_keyword_color("Transform", basetype_color);
|
||||
|
|
|
@ -2011,7 +2011,7 @@ void SpatialEditorViewport::_notification(int p_what) {
|
|||
|
||||
if (se->aabb.has_no_surface()) {
|
||||
|
||||
se->aabb = vi ? vi->get_aabb() : Rect3(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
|
||||
se->aabb = vi ? vi->get_aabb() : AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
|
||||
}
|
||||
|
||||
Transform t = sp->get_global_transform();
|
||||
|
@ -2756,7 +2756,7 @@ void SpatialEditorViewport::focus_selection() {
|
|||
cursor.pos = center;
|
||||
}
|
||||
|
||||
void SpatialEditorViewport::assign_pending_data_pointers(Spatial *p_preview_node, Rect3 *p_preview_bounds, AcceptDialog *p_accept) {
|
||||
void SpatialEditorViewport::assign_pending_data_pointers(Spatial *p_preview_node, AABB *p_preview_bounds, AcceptDialog *p_accept) {
|
||||
preview_node = p_preview_node;
|
||||
preview_bounds = p_preview_bounds;
|
||||
accept = p_accept;
|
||||
|
@ -2819,14 +2819,14 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const
|
|||
return point + offset;
|
||||
}
|
||||
|
||||
Rect3 SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds) {
|
||||
Rect3 bounds = p_bounds;
|
||||
AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const AABB p_bounds) {
|
||||
AABB bounds = p_bounds;
|
||||
for (int i = 0; i < p_parent->get_child_count(); i++) {
|
||||
Spatial *child = Object::cast_to<Spatial>(p_parent->get_child(i));
|
||||
if (child) {
|
||||
MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(child);
|
||||
if (mesh_instance) {
|
||||
Rect3 mesh_instance_bounds = mesh_instance->get_aabb();
|
||||
AABB mesh_instance_bounds = mesh_instance->get_aabb();
|
||||
mesh_instance_bounds.position += mesh_instance->get_global_transform().origin - p_parent->get_global_transform().origin;
|
||||
bounds.merge_with(mesh_instance_bounds);
|
||||
}
|
||||
|
@ -2858,7 +2858,7 @@ void SpatialEditorViewport::_create_preview(const Vector<String> &files) const {
|
|||
editor->get_scene_root()->add_child(preview_node);
|
||||
}
|
||||
}
|
||||
*preview_bounds = _calculate_spatial_bounds(preview_node, Rect3());
|
||||
*preview_bounds = _calculate_spatial_bounds(preview_node, AABB());
|
||||
}
|
||||
|
||||
void SpatialEditorViewport::_remove_preview() {
|
||||
|
@ -3534,7 +3534,7 @@ void SpatialEditor::select_gizmo_highlight_axis(int p_axis) {
|
|||
void SpatialEditor::update_transform_gizmo() {
|
||||
|
||||
List<Node *> &selection = editor_selection->get_selected_node_list();
|
||||
Rect3 center;
|
||||
AABB center;
|
||||
bool first = true;
|
||||
|
||||
Basis gizmo_basis;
|
||||
|
@ -3595,7 +3595,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
|
|||
|
||||
void SpatialEditor::_generate_selection_box() {
|
||||
|
||||
Rect3 aabb(Vector3(), Vector3(1, 1, 1));
|
||||
AABB aabb(Vector3(), Vector3(1, 1, 1));
|
||||
aabb.grow_by(aabb.get_longest_axis_size() / 20.0);
|
||||
|
||||
Ref<SurfaceTool> st = memnew(SurfaceTool);
|
||||
|
@ -4622,7 +4622,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
|||
|
||||
// Drag and drop support;
|
||||
preview_node = memnew(Spatial);
|
||||
preview_bounds = Rect3();
|
||||
preview_bounds = AABB();
|
||||
|
||||
ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KEY_MASK_ALT + KEY_KP_7);
|
||||
ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), KEY_KP_7);
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
Size2 prev_size;
|
||||
|
||||
Spatial *preview_node;
|
||||
Rect3 *preview_bounds;
|
||||
AABB *preview_bounds;
|
||||
Vector<String> selected_files;
|
||||
AcceptDialog *accept;
|
||||
|
||||
|
@ -287,7 +287,7 @@ private:
|
|||
Point2i _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const;
|
||||
|
||||
Vector3 _get_instance_position(const Point2 &p_pos) const;
|
||||
static Rect3 _calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds);
|
||||
static AABB _calculate_spatial_bounds(const Spatial *p_parent, const AABB p_bounds);
|
||||
void _create_preview(const Vector<String> &files) const;
|
||||
void _remove_preview();
|
||||
bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node);
|
||||
|
@ -314,7 +314,7 @@ public:
|
|||
|
||||
void assign_pending_data_pointers(
|
||||
Spatial *p_preview_node,
|
||||
Rect3 *p_preview_bounds,
|
||||
AABB *p_preview_bounds,
|
||||
AcceptDialog *p_accept);
|
||||
|
||||
Viewport *get_viewport_node() { return viewport; }
|
||||
|
@ -327,7 +327,7 @@ class SpatialEditorSelectedItem : public Object {
|
|||
GDCLASS(SpatialEditorSelectedItem, Object);
|
||||
|
||||
public:
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
Transform original; // original location when moving
|
||||
Transform original_local;
|
||||
Transform last_xform; // last transform
|
||||
|
@ -435,7 +435,7 @@ private:
|
|||
|
||||
// Scene drag and drop support
|
||||
Spatial *preview_node;
|
||||
Rect3 preview_bounds;
|
||||
AABB preview_bounds;
|
||||
|
||||
/*
|
||||
struct Selected {
|
||||
|
|
|
@ -755,7 +755,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
value_editor[3]->set_text(String::num(q.w));
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
field_names.push_back("px");
|
||||
field_names.push_back("py");
|
||||
|
@ -765,7 +765,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
field_names.push_back("sz");
|
||||
config_value_editors(6, 3, 16, field_names);
|
||||
|
||||
Rect3 aabb = v;
|
||||
AABB aabb = v;
|
||||
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));
|
||||
|
@ -1585,7 +1585,7 @@ void CustomPropertyEditor::_modified(String p_string) {
|
|||
_emit_changed_whole_or_field();
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
Vector3 pos;
|
||||
Vector3 size;
|
||||
|
@ -1605,7 +1605,7 @@ void CustomPropertyEditor::_modified(String p_string) {
|
|||
size.y = value_editor[4]->get_text().to_double();
|
||||
size.z = value_editor[5]->get_text().to_double();
|
||||
}
|
||||
v = Rect3(pos, size);
|
||||
v = AABB(pos, size);
|
||||
_emit_changed_whole_or_field();
|
||||
|
||||
} break;
|
||||
|
@ -1727,7 +1727,7 @@ void CustomPropertyEditor::_focus_enter() {
|
|||
case Variant::VECTOR3:
|
||||
case Variant::PLANE:
|
||||
case Variant::QUAT:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::TRANSFORM2D:
|
||||
case Variant::BASIS:
|
||||
case Variant::TRANSFORM: {
|
||||
|
@ -1752,7 +1752,7 @@ void CustomPropertyEditor::_focus_exit() {
|
|||
case Variant::VECTOR3:
|
||||
case Variant::PLANE:
|
||||
case Variant::QUAT:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::TRANSFORM2D:
|
||||
case Variant::BASIS:
|
||||
case Variant::TRANSFORM: {
|
||||
|
@ -2238,7 +2238,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p
|
|||
case Variant::VECTOR3:
|
||||
case Variant::QUAT:
|
||||
case Variant::VECTOR2:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::RECT2:
|
||||
case Variant::TRANSFORM2D:
|
||||
case Variant::BASIS:
|
||||
|
@ -3367,13 +3367,13 @@ void PropertyEditor::update_tree() {
|
|||
item->set_icon(0, get_icon("Plane", "EditorIcons"));
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
|
||||
item->set_editable(1, true);
|
||||
item->set_text(1, "Rect3");
|
||||
item->set_text(1, "AABB");
|
||||
if (show_type_icons)
|
||||
item->set_icon(0, get_icon("Rect3", "EditorIcons"));
|
||||
item->set_icon(0, get_icon("AABB", "EditorIcons"));
|
||||
} break;
|
||||
|
||||
case Variant::QUAT: {
|
||||
|
@ -3725,7 +3725,7 @@ void PropertyEditor::_item_edited() {
|
|||
case Variant::QUAT: {
|
||||
|
||||
} break;
|
||||
case Variant::RECT3: {
|
||||
case Variant::AABB: {
|
||||
|
||||
} break;
|
||||
case Variant::BASIS: {
|
||||
|
|
|
@ -149,7 +149,7 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat
|
|||
md = MAX(0, p_lines[i].length());
|
||||
}
|
||||
if (md) {
|
||||
mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
|
|||
md = MAX(0, vs[i].length());
|
||||
}
|
||||
if (md) {
|
||||
mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
|
|||
instances.push_back(ins);
|
||||
}
|
||||
|
||||
void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds) {
|
||||
void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds) {
|
||||
|
||||
collision_mesh = p_tmesh;
|
||||
collision_mesh_bounds = p_bounds;
|
||||
|
@ -270,7 +270,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi
|
|||
md = MAX(0, p_handles[i].length());
|
||||
}
|
||||
if (md) {
|
||||
mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ void MeshInstanceSpatialGizmo::redraw() {
|
|||
|
||||
Ref<TriangleMesh> tm = m->generate_triangle_mesh();
|
||||
if (tm.is_valid()) {
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
add_collision_triangles(tm, aabb);
|
||||
}
|
||||
}
|
||||
|
@ -1336,7 +1336,7 @@ void SkeletonSpatialGizmo::redraw() {
|
|||
|
||||
weights[0] = 1;
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
Color bonecolor = Color(1.0, 0.4, 0.4, 0.3);
|
||||
Color rootcolor = Color(0.4, 1.0, 0.4, 0.1);
|
||||
|
@ -1961,7 +1961,7 @@ void CollisionShapeSpatialGizmo::redraw() {
|
|||
|
||||
Ref<BoxShape> bs = s;
|
||||
Vector<Vector3> lines;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb.position = -bs->get_extents();
|
||||
aabb.size = aabb.position * -2;
|
||||
|
||||
|
@ -2191,7 +2191,7 @@ void VisibilityNotifierGizmo::set_handle(int p_idx, Camera *p_camera, const Poin
|
|||
//gt.orthonormalize();
|
||||
Transform gi = gt.affine_inverse();
|
||||
|
||||
Rect3 aabb = notifier->get_aabb();
|
||||
AABB aabb = notifier->get_aabb();
|
||||
Vector3 ray_from = p_camera->project_ray_origin(p_point);
|
||||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
||||
|
@ -2234,7 +2234,7 @@ void VisibilityNotifierGizmo::redraw() {
|
|||
clear();
|
||||
|
||||
Vector<Vector3> lines;
|
||||
Rect3 aabb = notifier->get_aabb();
|
||||
AABB aabb = notifier->get_aabb();
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -2293,7 +2293,7 @@ void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_poi
|
|||
bool move = p_idx >= 3;
|
||||
p_idx = p_idx % 3;
|
||||
|
||||
Rect3 aabb = particles->get_visibility_aabb();
|
||||
AABB aabb = particles->get_visibility_aabb();
|
||||
Vector3 ray_from = p_camera->project_ray_origin(p_point);
|
||||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
||||
|
@ -2347,7 +2347,7 @@ void ParticlesGizmo::redraw() {
|
|||
clear();
|
||||
|
||||
Vector<Vector3> lines;
|
||||
Rect3 aabb = particles->get_visibility_aabb();
|
||||
AABB aabb = particles->get_visibility_aabb();
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -2420,7 +2420,7 @@ String ReflectionProbeGizmo::get_handle_name(int p_idx) const {
|
|||
}
|
||||
Variant ReflectionProbeGizmo::get_handle_value(int p_idx) const {
|
||||
|
||||
return Rect3(probe->get_extents(), probe->get_origin_offset());
|
||||
return AABB(probe->get_extents(), probe->get_origin_offset());
|
||||
}
|
||||
void ReflectionProbeGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) {
|
||||
|
||||
|
@ -2474,7 +2474,7 @@ void ReflectionProbeGizmo::set_handle(int p_idx, Camera *p_camera, const Point2
|
|||
|
||||
void ReflectionProbeGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
|
||||
|
||||
Rect3 restore = p_restore;
|
||||
AABB restore = p_restore;
|
||||
|
||||
if (p_cancel) {
|
||||
probe->set_extents(restore.position);
|
||||
|
@ -2499,7 +2499,7 @@ void ReflectionProbeGizmo::redraw() {
|
|||
Vector<Vector3> internal_lines;
|
||||
Vector3 extents = probe->get_extents();
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb.position = -extents;
|
||||
aabb.size = extents * 2;
|
||||
|
||||
|
@ -2641,7 +2641,7 @@ void GIProbeGizmo::redraw() {
|
|||
|
||||
static const int subdivs[GIProbe::SUBDIV_MAX] = { 64, 128, 256, 512 };
|
||||
|
||||
Rect3 aabb = Rect3(-extents, extents * 2);
|
||||
AABB aabb = AABB(-extents, extents * 2);
|
||||
int subdiv = subdivs[probe->get_subdiv()];
|
||||
float cell_size = aabb.get_longest_axis_size() / subdiv;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class EditorSpatialGizmo : public SpatialEditorGizmo {
|
|||
|
||||
Vector<Vector3> collision_segments;
|
||||
Ref<TriangleMesh> collision_mesh;
|
||||
Rect3 collision_mesh_bounds;
|
||||
AABB collision_mesh_bounds;
|
||||
|
||||
struct Handle {
|
||||
Vector3 pos;
|
||||
|
@ -100,7 +100,7 @@ protected:
|
|||
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false);
|
||||
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID());
|
||||
void add_collision_segments(const Vector<Vector3> &p_lines);
|
||||
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds = Rect3());
|
||||
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds = AABB());
|
||||
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1);
|
||||
void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false);
|
||||
void add_solid_box(Ref<Material> &p_material, Vector3 size);
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
/*************************************************************************/
|
||||
/* aabb.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "gdnative/aabb.h"
|
||||
|
||||
#include "core/math/aabb.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
|
||||
const Vector3 *pos = (const Vector3 *)p_pos;
|
||||
const Vector3 *size = (const Vector3 *)p_size;
|
||||
AABB *dest = (AABB *)r_dest;
|
||||
*dest = AABB(*pos, *size);
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) {
|
||||
godot_vector3 raw_ret;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
Vector3 *ret = (Vector3 *)&raw_ret;
|
||||
*ret = self->position;
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) {
|
||||
AABB *self = (AABB *)p_self;
|
||||
const Vector3 *v = (const Vector3 *)p_v;
|
||||
self->position = *v;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) {
|
||||
godot_vector3 raw_ret;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
Vector3 *ret = (Vector3 *)&raw_ret;
|
||||
*ret = self->size;
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) {
|
||||
AABB *self = (AABB *)p_self;
|
||||
const Vector3 *v = (const Vector3 *)p_v;
|
||||
self->size = *v;
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) {
|
||||
godot_string ret;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->get_area();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->has_no_area();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->has_no_surface();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const AABB *with = (const AABB *)p_with;
|
||||
return self->intersects(*with);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const AABB *with = (const AABB *)p_with;
|
||||
return self->encloses(*with);
|
||||
}
|
||||
|
||||
godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) {
|
||||
godot_aabb dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const AABB *with = (const AABB *)p_with;
|
||||
*((AABB *)&dest) = self->merge(*with);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) {
|
||||
godot_aabb dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const AABB *with = (const AABB *)p_with;
|
||||
*((AABB *)&dest) = self->intersection(*with);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const Plane *plane = (const Plane *)p_plane;
|
||||
return self->intersects_plane(*plane);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const Vector3 *from = (const Vector3 *)p_from;
|
||||
const Vector3 *to = (const Vector3 *)p_to;
|
||||
return self->intersects_segment(*from, *to);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const Vector3 *point = (const Vector3 *)p_point;
|
||||
return self->has_point(*point);
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) {
|
||||
godot_vector3 dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const Vector3 *dir = (const Vector3 *)p_dir;
|
||||
*((Vector3 *)&dest) = self->get_support(*dir);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) {
|
||||
godot_vector3 dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_longest_axis();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->get_longest_axis_index();
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->get_longest_axis_size();
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) {
|
||||
godot_vector3 dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_shortest_axis();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->get_shortest_axis_index();
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
return self->get_shortest_axis_size();
|
||||
}
|
||||
|
||||
godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) {
|
||||
godot_aabb dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const Vector3 *to_point = (const Vector3 *)p_to_point;
|
||||
*((AABB *)&dest) = self->expand(*to_point);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) {
|
||||
godot_aabb dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
|
||||
*((AABB *)&dest) = self->grow(p_by);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) {
|
||||
godot_vector3 dest;
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
|
||||
*((Vector3 *)&dest) = self->get_endpoint(p_idx);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) {
|
||||
const AABB *self = (const AABB *)p_self;
|
||||
const AABB *b = (const AABB *)p_b;
|
||||
return *self == *b;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,217 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* rect3.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "gdnative/rect3.h"
|
||||
|
||||
#include "core/math/rect3.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
|
||||
const Vector3 *pos = (const Vector3 *)p_pos;
|
||||
const Vector3 *size = (const Vector3 *)p_size;
|
||||
Rect3 *dest = (Rect3 *)r_dest;
|
||||
*dest = Rect3(*pos, *size);
|
||||
}
|
||||
|
||||
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->position;
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
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->position = *v;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) {
|
||||
godot_vector3 raw_ret;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
Vector3 *ret = (Vector3 *)&raw_ret;
|
||||
*ret = self->size;
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) {
|
||||
Rect3 *self = (Rect3 *)p_self;
|
||||
const Vector3 *v = (const Vector3 *)p_v;
|
||||
self->size = *v;
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) {
|
||||
godot_string ret;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->get_area();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->has_no_area();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->has_no_surface();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Rect3 *with = (const Rect3 *)p_with;
|
||||
return self->intersects(*with);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Rect3 *with = (const Rect3 *)p_with;
|
||||
return self->encloses(*with);
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with) {
|
||||
godot_rect3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Rect3 *with = (const Rect3 *)p_with;
|
||||
*((Rect3 *)&dest) = self->merge(*with);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with) {
|
||||
godot_rect3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Rect3 *with = (const Rect3 *)p_with;
|
||||
*((Rect3 *)&dest) = self->intersection(*with);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Plane *plane = (const Plane *)p_plane;
|
||||
return self->intersects_plane(*plane);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Vector3 *from = (const Vector3 *)p_from;
|
||||
const Vector3 *to = (const Vector3 *)p_to;
|
||||
return self->intersects_segment(*from, *to);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Vector3 *point = (const Vector3 *)p_point;
|
||||
return self->has_point(*point);
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir) {
|
||||
godot_vector3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Vector3 *dir = (const Vector3 *)p_dir;
|
||||
*((Vector3 *)&dest) = self->get_support(*dir);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self) {
|
||||
godot_vector3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_longest_axis();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->get_longest_axis_index();
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->get_longest_axis_size();
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self) {
|
||||
godot_vector3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_shortest_axis();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->get_shortest_axis_index();
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
return self->get_shortest_axis_size();
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point) {
|
||||
godot_rect3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Vector3 *to_point = (const Vector3 *)p_to_point;
|
||||
*((Rect3 *)&dest) = self->expand(*to_point);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by) {
|
||||
godot_rect3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
|
||||
*((Rect3 *)&dest) = self->grow(p_by);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx) {
|
||||
godot_vector3 dest;
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
|
||||
*((Vector3 *)&dest) = self->get_endpoint(p_idx);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b) {
|
||||
const Rect3 *self = (const Rect3 *)p_self;
|
||||
const Rect3 *b = (const Rect3 *)p_b;
|
||||
return *self == *b;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -198,20 +198,20 @@ godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_s
|
|||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
|
||||
godot_rect3 raw_dest;
|
||||
Rect3 *dest = (Rect3 *)&raw_dest;
|
||||
godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
|
||||
godot_aabb raw_dest;
|
||||
AABB *dest = (AABB *)&raw_dest;
|
||||
const Transform *self = (const Transform *)p_self;
|
||||
const Rect3 *v = (const Rect3 *)p_v;
|
||||
const AABB *v = (const AABB *)p_v;
|
||||
*dest = self->xform(*v);
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
|
||||
godot_rect3 raw_dest;
|
||||
Rect3 *dest = (Rect3 *)&raw_dest;
|
||||
godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
|
||||
godot_aabb raw_dest;
|
||||
AABB *dest = (AABB *)&raw_dest;
|
||||
const Transform *self = (const Transform *)p_self;
|
||||
const Rect3 *v = (const Rect3 *)p_v;
|
||||
const AABB *v = (const AABB *)p_v;
|
||||
*dest = self->xform_inv(*v);
|
||||
return raw_dest;
|
||||
}
|
||||
|
|
|
@ -118,10 +118,10 @@ void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_qua
|
|||
memnew_placement_custom(dest, Variant, Variant(*quat));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3) {
|
||||
void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Rect3 *rect3 = (Rect3 *)p_rect3;
|
||||
memnew_placement_custom(dest, Variant, Variant(*rect3));
|
||||
AABB *aabb = (AABB *)p_aabb;
|
||||
memnew_placement_custom(dest, Variant, Variant(*aabb));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) {
|
||||
|
@ -304,10 +304,10 @@ godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) {
|
|||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self) {
|
||||
godot_rect3 raw_dest;
|
||||
godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) {
|
||||
godot_aabb raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Rect3 *dest = (Rect3 *)&raw_dest;
|
||||
AABB *dest = (AABB *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
|
|
@ -3221,209 +3221,209 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_new",
|
||||
"name": "godot_aabb_new",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_rect3 *", "r_dest"],
|
||||
["godot_aabb *", "r_dest"],
|
||||
["const godot_vector3 *", "p_pos"],
|
||||
["const godot_vector3 *", "p_size"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_position",
|
||||
"name": "godot_aabb_get_position",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_set_position",
|
||||
"name": "godot_aabb_set_position",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_size",
|
||||
"name": "godot_aabb_get_size",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_set_size",
|
||||
"name": "godot_aabb_set_size",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_as_string",
|
||||
"name": "godot_aabb_as_string",
|
||||
"return_type": "godot_string",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_area",
|
||||
"name": "godot_aabb_get_area",
|
||||
"return_type": "godot_real",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_has_no_area",
|
||||
"name": "godot_aabb_has_no_area",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_has_no_surface",
|
||||
"name": "godot_aabb_has_no_surface",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_intersects",
|
||||
"name": "godot_aabb_intersects",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_rect3 *", "p_with"]
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_aabb *", "p_with"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_encloses",
|
||||
"name": "godot_aabb_encloses",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_rect3 *", "p_with"]
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_aabb *", "p_with"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_merge",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_aabb_merge",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_rect3 *", "p_with"]
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_aabb *", "p_with"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_intersection",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_aabb_intersection",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_rect3 *", "p_with"]
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_aabb *", "p_with"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_intersects_plane",
|
||||
"name": "godot_aabb_intersects_plane",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_plane *", "p_plane"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_intersects_segment",
|
||||
"name": "godot_aabb_intersects_segment",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_from"],
|
||||
["const godot_vector3 *", "p_to"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_has_point",
|
||||
"name": "godot_aabb_has_point",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_point"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_support",
|
||||
"name": "godot_aabb_get_support",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_dir"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_longest_axis",
|
||||
"name": "godot_aabb_get_longest_axis",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_longest_axis_index",
|
||||
"name": "godot_aabb_get_longest_axis_index",
|
||||
"return_type": "godot_int",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_longest_axis_size",
|
||||
"name": "godot_aabb_get_longest_axis_size",
|
||||
"return_type": "godot_real",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_shortest_axis",
|
||||
"name": "godot_aabb_get_shortest_axis",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_shortest_axis_index",
|
||||
"name": "godot_aabb_get_shortest_axis_index",
|
||||
"return_type": "godot_int",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_shortest_axis_size",
|
||||
"name": "godot_aabb_get_shortest_axis_size",
|
||||
"return_type": "godot_real",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"]
|
||||
["const godot_aabb *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_expand",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_aabb_expand",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_vector3 *", "p_to_point"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_grow",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_aabb_grow",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_real", "p_by"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_get_endpoint",
|
||||
"name": "godot_aabb_get_endpoint",
|
||||
"return_type": "godot_vector3",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_int", "p_idx"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_rect3_operator_equal",
|
||||
"name": "godot_aabb_operator_equal",
|
||||
"return_type": "godot_bool",
|
||||
"arguments": [
|
||||
["const godot_rect3 *", "p_self"],
|
||||
["const godot_rect3 *", "p_b"]
|
||||
["const godot_aabb *", "p_self"],
|
||||
["const godot_aabb *", "p_b"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -3632,19 +3632,19 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_transform_xform_rect3",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_transform_xform_aabb",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_transform *", "p_self"],
|
||||
["const godot_rect3 *", "p_v"]
|
||||
["const godot_aabb *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_transform_xform_inv_rect3",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_transform_xform_inv_aabb",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_transform *", "p_self"],
|
||||
["const godot_rect3 *", "p_v"]
|
||||
["const godot_aabb *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -3930,11 +3930,11 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_variant_new_rect3",
|
||||
"name": "godot_variant_new_aabb",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_variant *", "r_dest"],
|
||||
["const godot_rect3 *", "p_rect3"]
|
||||
["const godot_aabb *", "p_aabb"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -4135,8 +4135,8 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_variant_as_rect3",
|
||||
"return_type": "godot_rect3",
|
||||
"name": "godot_variant_as_aabb",
|
||||
"return_type": "godot_aabb",
|
||||
"arguments": [
|
||||
["const godot_variant *", "p_self"]
|
||||
]
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*************************************************************************/
|
||||
/* aabb.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef GODOT_AABB_H
|
||||
#define GODOT_AABB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GODOT_AABB_SIZE 24
|
||||
|
||||
#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
|
||||
#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
|
||||
typedef struct {
|
||||
uint8_t _dont_touch_that[GODOT_AABB_SIZE];
|
||||
} godot_aabb;
|
||||
#endif
|
||||
|
||||
// reduce extern "C" nesting for VS2013
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <gdnative/gdnative.h>
|
||||
#include <gdnative/plane.h>
|
||||
#include <gdnative/vector3.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self);
|
||||
void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self);
|
||||
void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v);
|
||||
|
||||
godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self);
|
||||
|
||||
godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self);
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self);
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self);
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with);
|
||||
|
||||
godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with);
|
||||
|
||||
godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with);
|
||||
|
||||
godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with);
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane);
|
||||
|
||||
godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
|
||||
|
||||
godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self);
|
||||
|
||||
godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self);
|
||||
|
||||
godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self);
|
||||
|
||||
godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self);
|
||||
|
||||
godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self);
|
||||
|
||||
godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point);
|
||||
|
||||
godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by);
|
||||
|
||||
godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx);
|
||||
|
||||
godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_AABB_H
|
|
@ -169,9 +169,9 @@ typedef void godot_object;
|
|||
|
||||
#include <gdnative/quat.h>
|
||||
|
||||
/////// Rect3
|
||||
/////// AABB
|
||||
|
||||
#include <gdnative/rect3.h>
|
||||
#include <gdnative/aabb.h>
|
||||
|
||||
/////// Basis
|
||||
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* rect3.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef GODOT_RECT3_H
|
||||
#define GODOT_RECT3_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GODOT_RECT3_SIZE 24
|
||||
|
||||
#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
|
||||
#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
|
||||
typedef struct {
|
||||
uint8_t _dont_touch_that[GODOT_RECT3_SIZE];
|
||||
} godot_rect3;
|
||||
#endif
|
||||
|
||||
// reduce extern "C" nesting for VS2013
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <gdnative/gdnative.h>
|
||||
#include <gdnative/plane.h>
|
||||
#include <gdnative/vector3.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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_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);
|
||||
|
||||
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
|
||||
|
||||
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self);
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self);
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
||||
|
||||
godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane);
|
||||
|
||||
godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
|
||||
|
||||
godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self);
|
||||
|
||||
godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self);
|
||||
|
||||
godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self);
|
||||
|
||||
godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self);
|
||||
|
||||
godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self);
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point);
|
||||
|
||||
godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by);
|
||||
|
||||
godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx);
|
||||
|
||||
godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_RECT3_H
|
|
@ -51,6 +51,7 @@ typedef struct {
|
|||
}
|
||||
#endif
|
||||
|
||||
#include <gdnative/array.h>
|
||||
#include <gdnative/gdnative.h>
|
||||
#include <gdnative/variant.h>
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self,
|
|||
|
||||
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
|
||||
|
||||
godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
|
||||
godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v);
|
||||
|
||||
godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
|
||||
godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef enum godot_variant_type {
|
|||
GODOT_VARIANT_TYPE_TRANSFORM2D,
|
||||
GODOT_VARIANT_TYPE_PLANE,
|
||||
GODOT_VARIANT_TYPE_QUAT, // 10
|
||||
GODOT_VARIANT_TYPE_RECT3,
|
||||
GODOT_VARIANT_TYPE_AABB,
|
||||
GODOT_VARIANT_TYPE_BASIS,
|
||||
GODOT_VARIANT_TYPE_TRANSFORM,
|
||||
|
||||
|
@ -104,6 +104,7 @@ typedef struct godot_variant_call_error {
|
|||
}
|
||||
#endif
|
||||
|
||||
#include <gdnative/aabb.h>
|
||||
#include <gdnative/array.h>
|
||||
#include <gdnative/basis.h>
|
||||
#include <gdnative/color.h>
|
||||
|
@ -113,7 +114,6 @@ typedef struct godot_variant_call_error {
|
|||
#include <gdnative/pool_arrays.h>
|
||||
#include <gdnative/quat.h>
|
||||
#include <gdnative/rect2.h>
|
||||
#include <gdnative/rect3.h>
|
||||
#include <gdnative/rid.h>
|
||||
#include <gdnative/string.h>
|
||||
#include <gdnative/transform.h>
|
||||
|
@ -145,7 +145,7 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3
|
|||
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
|
||||
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
|
||||
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
|
||||
void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3);
|
||||
void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb);
|
||||
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
|
||||
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
|
||||
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
|
||||
|
@ -173,7 +173,7 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
|
|||
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
|
||||
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
|
||||
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
|
||||
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self);
|
||||
godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self);
|
||||
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
|
||||
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
|
||||
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
|
||||
|
|
|
@ -371,7 +371,7 @@ void unregister_gdnative_types() {
|
|||
print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray)));
|
||||
print_line(String("quat:\t") + itos(sizeof(Quat)));
|
||||
print_line(String("rect2:\t") + itos(sizeof(Rect2)));
|
||||
print_line(String("rect3:\t") + itos(sizeof(Rect3)));
|
||||
print_line(String("aabb:\t") + itos(sizeof(AABB)));
|
||||
print_line(String("rid:\t") + itos(sizeof(RID)));
|
||||
print_line(String("string:\t") + itos(sizeof(String)));
|
||||
print_line(String("transform:\t") + itos(sizeof(Transform)));
|
||||
|
|
|
@ -148,7 +148,7 @@ static const _bit _type_list[] = {
|
|||
{ Variant::RECT2, "Rect2" },
|
||||
{ Variant::TRANSFORM2D, "Transform2D" },
|
||||
{ Variant::VECTOR3, "Vector3" },
|
||||
{ Variant::RECT3, "Rect3" },
|
||||
{ Variant::AABB, "AABB" },
|
||||
{ Variant::PLANE, "Plane" },
|
||||
{ Variant::QUAT, "Quat" },
|
||||
{ Variant::BASIS, "Basis" },
|
||||
|
@ -1125,7 +1125,7 @@ void GDScriptTokenizerText::advance(int p_amount) {
|
|||
_advance();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define BYTECODE_VERSION 12
|
||||
|
||||
|
|
|
@ -1137,7 +1137,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
||||
Rect3 base(Vector3(0, 0, 0), Vector3(1, 1, 1));
|
||||
AABB base(Vector3(0, 0, 0), Vector3(1, 1, 1));
|
||||
Vector3 a, b;
|
||||
base.get_edge(i, a, b);
|
||||
lines.push_back(a);
|
||||
|
|
|
@ -346,7 +346,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
|
|||
Variant::TRANSFORM2D,
|
||||
Variant::PLANE,
|
||||
Variant::QUAT,
|
||||
Variant::RECT3,
|
||||
Variant::AABB,
|
||||
Variant::BASIS,
|
||||
Variant::TRANSFORM,
|
||||
Variant::COLOR,
|
||||
|
|
|
@ -1721,7 +1721,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
|
|||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
|
||||
break;
|
||||
case Variant::PLANE:
|
||||
case Variant::RECT3:
|
||||
case Variant::AABB:
|
||||
case Variant::COLOR:
|
||||
r_iarg.default_argument = "new Color(1, 1, 1, 1)";
|
||||
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
|
||||
|
@ -1793,7 +1793,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
|||
INSERT_STRUCT_TYPE(Basis, "real_t*")
|
||||
INSERT_STRUCT_TYPE(Quat, "real_t*")
|
||||
INSERT_STRUCT_TYPE(Transform, "real_t*")
|
||||
INSERT_STRUCT_TYPE(Rect3, "real_t*")
|
||||
INSERT_STRUCT_TYPE(AABB, "real_t*")
|
||||
INSERT_STRUCT_TYPE(Color, "real_t*")
|
||||
INSERT_STRUCT_TYPE(Plane, "real_t*")
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
using System;
|
||||
|
||||
// file: core/math/rect3.h
|
||||
// file: core/math/aabb.h
|
||||
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
|
||||
// file: core/math/rect3.cpp
|
||||
// file: core/math/aabb.cpp
|
||||
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
|
||||
// file: core/variant_call.cpp
|
||||
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
|
||||
|
||||
namespace Godot
|
||||
{
|
||||
public struct Rect3 : IEquatable<Rect3>
|
||||
public struct AABB : IEquatable<AABB>
|
||||
{
|
||||
private Vector3 position;
|
||||
private Vector3 size;
|
||||
|
@ -38,7 +38,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public bool encloses(Rect3 with)
|
||||
public bool encloses(AABB with)
|
||||
{
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -53,7 +53,7 @@ namespace Godot
|
|||
(src_max.z > dst_max.z));
|
||||
}
|
||||
|
||||
public Rect3 expand(Vector3 to_point)
|
||||
public AABB expand(Vector3 to_point)
|
||||
{
|
||||
Vector3 begin = position;
|
||||
Vector3 end = position + size;
|
||||
|
@ -72,7 +72,7 @@ namespace Godot
|
|||
if (to_point.z > end.z)
|
||||
end.z = to_point.z;
|
||||
|
||||
return new Rect3(begin, end - begin);
|
||||
return new AABB(begin, end - begin);
|
||||
}
|
||||
|
||||
public float get_area()
|
||||
|
@ -222,9 +222,9 @@ namespace Godot
|
|||
(dir.z > 0f) ? -half_extents.z : half_extents.z);
|
||||
}
|
||||
|
||||
public Rect3 grow(float by)
|
||||
public AABB grow(float by)
|
||||
{
|
||||
Rect3 res = this;
|
||||
AABB res = this;
|
||||
|
||||
res.position.x -= by;
|
||||
res.position.y -= by;
|
||||
|
@ -264,7 +264,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public Rect3 intersection(Rect3 with)
|
||||
public AABB intersection(AABB with)
|
||||
{
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -275,7 +275,7 @@ namespace Godot
|
|||
|
||||
if (src_min.x > dst_max.x || src_max.x < dst_min.x)
|
||||
{
|
||||
return new Rect3();
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ namespace Godot
|
|||
|
||||
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
|
||||
{
|
||||
return new Rect3();
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ namespace Godot
|
|||
|
||||
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
|
||||
{
|
||||
return new Rect3();
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -303,10 +303,10 @@ namespace Godot
|
|||
max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
|
||||
}
|
||||
|
||||
return new Rect3(min, max - min);
|
||||
return new AABB(min, max - min);
|
||||
}
|
||||
|
||||
public bool intersects(Rect3 with)
|
||||
public bool intersects(AABB with)
|
||||
{
|
||||
if (position.x >= (with.position.x + with.size.x))
|
||||
return false;
|
||||
|
@ -398,7 +398,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public Rect3 merge(Rect3 with)
|
||||
public AABB merge(AABB with)
|
||||
{
|
||||
Vector3 beg_1 = position;
|
||||
Vector3 beg_2 = with.position;
|
||||
|
@ -417,36 +417,36 @@ namespace Godot
|
|||
(end_1.z > end_2.z) ? end_1.z : end_2.z
|
||||
);
|
||||
|
||||
return new Rect3(min, max - min);
|
||||
return new AABB(min, max - min);
|
||||
}
|
||||
|
||||
public Rect3(Vector3 position, Vector3 size)
|
||||
public AABB(Vector3 position, Vector3 size)
|
||||
{
|
||||
this.position = position;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public static bool operator ==(Rect3 left, Rect3 right)
|
||||
public static bool operator ==(AABB left, AABB right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Rect3 left, Rect3 right)
|
||||
public static bool operator !=(AABB left, AABB right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Rect3)
|
||||
if (obj is AABB)
|
||||
{
|
||||
return Equals((Rect3)obj);
|
||||
return Equals((AABB)obj);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(Rect3 other)
|
||||
public bool Equals(AABB other)
|
||||
{
|
||||
return position == other.position && size == other.size;
|
||||
}
|
|
@ -129,8 +129,8 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
|||
if (tclass == CACHED_CLASS(Transform))
|
||||
SET_FROM_STRUCT_AND_BREAK(Transform);
|
||||
|
||||
if (tclass == CACHED_CLASS(Rect3))
|
||||
SET_FROM_STRUCT_AND_BREAK(Rect3);
|
||||
if (tclass == CACHED_CLASS(AABB))
|
||||
SET_FROM_STRUCT_AND_BREAK(AABB);
|
||||
|
||||
if (tclass == CACHED_CLASS(Color))
|
||||
SET_FROM_STRUCT_AND_BREAK(Color);
|
||||
|
@ -229,7 +229,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
|||
case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D);
|
||||
case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane);
|
||||
case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat);
|
||||
case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3);
|
||||
case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB);
|
||||
case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis);
|
||||
case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform);
|
||||
case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color);
|
||||
|
|
|
@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
|
|||
if (tclass == CACHED_CLASS(Transform))
|
||||
return Variant::TRANSFORM;
|
||||
|
||||
if (tclass == CACHED_CLASS(Rect3))
|
||||
return Variant::RECT3;
|
||||
if (tclass == CACHED_CLASS(AABB))
|
||||
return Variant::AABB;
|
||||
|
||||
if (tclass == CACHED_CLASS(Color))
|
||||
return Variant::COLOR;
|
||||
|
@ -297,8 +297,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
|
|||
if (tclass == CACHED_CLASS(Transform))
|
||||
RETURN_BOXED_STRUCT(Transform, p_var);
|
||||
|
||||
if (tclass == CACHED_CLASS(Rect3))
|
||||
RETURN_BOXED_STRUCT(Rect3, p_var);
|
||||
if (tclass == CACHED_CLASS(AABB))
|
||||
RETURN_BOXED_STRUCT(AABB, p_var);
|
||||
|
||||
if (tclass == CACHED_CLASS(Color))
|
||||
RETURN_BOXED_STRUCT(Color, p_var);
|
||||
|
@ -394,8 +394,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
|
|||
RETURN_BOXED_STRUCT(Plane, p_var);
|
||||
case Variant::QUAT:
|
||||
RETURN_BOXED_STRUCT(Quat, p_var);
|
||||
case Variant::RECT3:
|
||||
RETURN_BOXED_STRUCT(Rect3, p_var);
|
||||
case Variant::AABB:
|
||||
RETURN_BOXED_STRUCT(AABB, p_var);
|
||||
case Variant::BASIS:
|
||||
RETURN_BOXED_STRUCT(Basis, p_var);
|
||||
case Variant::TRANSFORM:
|
||||
|
@ -518,8 +518,8 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
|
|||
if (tclass == CACHED_CLASS(Transform))
|
||||
RETURN_UNBOXED_STRUCT(Transform, p_obj);
|
||||
|
||||
if (tclass == CACHED_CLASS(Rect3))
|
||||
RETURN_UNBOXED_STRUCT(Rect3, p_obj);
|
||||
if (tclass == CACHED_CLASS(AABB))
|
||||
RETURN_UNBOXED_STRUCT(AABB, p_obj);
|
||||
|
||||
if (tclass == CACHED_CLASS(Color))
|
||||
RETURN_UNBOXED_STRUCT(Color, p_obj);
|
||||
|
|
|
@ -197,10 +197,10 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
|
|||
Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \
|
||||
Vector3(m_in[9], m_in[10], m_in[11]));
|
||||
|
||||
// Rect3
|
||||
// AABB
|
||||
|
||||
#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
|
||||
#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
|
||||
#define MARSHALLED_OUT_AABB(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
|
||||
#define MARSHALLED_IN_AABB(m_in, m_out) AABB m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
|
||||
|
||||
// Color
|
||||
|
||||
|
@ -214,6 +214,6 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
|
|||
|
||||
#endif
|
||||
|
||||
} // GDMonoMarshal
|
||||
} // namespace GDMonoMarshal
|
||||
|
||||
#endif // GDMONOMARSHAL_H
|
||||
|
|
|
@ -80,7 +80,7 @@ void MonoCache::clear_members() {
|
|||
class_Basis = NULL;
|
||||
class_Quat = NULL;
|
||||
class_Transform = NULL;
|
||||
class_Rect3 = NULL;
|
||||
class_AABB = NULL;
|
||||
class_Color = NULL;
|
||||
class_Plane = NULL;
|
||||
class_NodePath = NULL;
|
||||
|
@ -147,7 +147,7 @@ void update_godot_api_cache() {
|
|||
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
|
||||
CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
|
||||
CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform));
|
||||
CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3));
|
||||
CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
|
||||
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
|
||||
CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
|
||||
CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
|
||||
|
@ -364,4 +364,4 @@ String get_exception_name_and_message(MonoObject *p_ex) {
|
|||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} // namespace GDMonoUtils
|
||||
|
|
|
@ -82,7 +82,7 @@ struct MonoCache {
|
|||
GDMonoClass *class_Basis;
|
||||
GDMonoClass *class_Quat;
|
||||
GDMonoClass *class_Transform;
|
||||
GDMonoClass *class_Rect3;
|
||||
GDMonoClass *class_AABB;
|
||||
GDMonoClass *class_Color;
|
||||
GDMonoClass *class_Plane;
|
||||
GDMonoClass *class_NodePath;
|
||||
|
@ -166,7 +166,7 @@ MonoDomain *create_domain(const String &p_friendly_name);
|
|||
|
||||
String get_exception_name_and_message(MonoObject *p_ex);
|
||||
|
||||
} // GDMonoUtils
|
||||
} // namespace GDMonoUtils
|
||||
|
||||
#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL)))
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
|
|||
case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break;
|
||||
case Variant::PLANE: color = Color::html("#f77070"); break;
|
||||
case Variant::QUAT: color = Color::html("#ec69a3"); break;
|
||||
case Variant::RECT3: color = Color::html("#ee7991"); break;
|
||||
case Variant::AABB: color = Color::html("#ee7991"); break;
|
||||
case Variant::BASIS: color = Color::html("#e3ec69"); break;
|
||||
case Variant::TRANSFORM: color = Color::html("#f6a86e"); break;
|
||||
|
||||
|
@ -386,7 +386,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
|
|||
case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break;
|
||||
case Variant::PLANE: color = Color::html("#f77070"); break;
|
||||
case Variant::QUAT: color = Color::html("#ec69a3"); break;
|
||||
case Variant::RECT3: color = Color::html("#ee7991"); break;
|
||||
case Variant::AABB: color = Color::html("#ee7991"); break;
|
||||
case Variant::BASIS: color = Color::html("#b2bb19"); break;
|
||||
case Variant::TRANSFORM: color = Color::html("#f49047"); break;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void Particles2D::set_randomness_ratio(float p_ratio) {
|
|||
void Particles2D::set_visibility_rect(const Rect2 &p_aabb) {
|
||||
|
||||
visibility_rect = p_aabb;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb.position.x = p_aabb.position.x;
|
||||
aabb.position.y = p_aabb.position.y;
|
||||
aabb.size.x = p_aabb.size.x;
|
||||
|
@ -223,7 +223,7 @@ String Particles2D::get_configuration_warning() const {
|
|||
|
||||
Rect2 Particles2D::capture_rect() const {
|
||||
|
||||
Rect3 aabb = VS::get_singleton()->particles_get_current_aabb(particles);
|
||||
AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles);
|
||||
Rect2 r;
|
||||
r.position.x = aabb.position.x;
|
||||
r.position.y = aabb.position.y;
|
||||
|
@ -378,7 +378,7 @@ void Particles2D::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta");
|
||||
ADD_GROUP("Drawing", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_rect"), "set_visibility_rect", "get_visibility_rect");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_rect"), "set_visibility_rect", "get_visibility_rect");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order");
|
||||
ADD_GROUP("Process Material", "process_");
|
||||
|
|
|
@ -117,7 +117,7 @@ Vector<Point2> CollisionPolygon::get_polygon() const {
|
|||
return polygon;
|
||||
}
|
||||
|
||||
Rect3 CollisionPolygon::get_item_rect() const {
|
||||
AABB CollisionPolygon::get_item_rect() const {
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void CollisionPolygon::_bind_methods() {
|
|||
|
||||
CollisionPolygon::CollisionPolygon() {
|
||||
|
||||
aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2));
|
||||
aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
|
||||
depth = 1.0;
|
||||
set_notify_local_transform(true);
|
||||
parent = NULL;
|
||||
|
|
|
@ -40,7 +40,7 @@ class CollisionPolygon : public Spatial {
|
|||
|
||||
protected:
|
||||
float depth;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
Vector<Point2> polygon;
|
||||
|
||||
uint32_t owner_id;
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
void set_disabled(bool p_disabled);
|
||||
bool is_disabled() const;
|
||||
|
||||
virtual Rect3 get_item_rect() const;
|
||||
virtual AABB get_item_rect() const;
|
||||
|
||||
String get_configuration_warning() const;
|
||||
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
|
||||
#include "mesh_instance.h"
|
||||
|
||||
void GIProbeData::set_bounds(const Rect3 &p_bounds) {
|
||||
void GIProbeData::set_bounds(const AABB &p_bounds) {
|
||||
|
||||
VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds);
|
||||
}
|
||||
|
||||
Rect3 GIProbeData::get_bounds() const {
|
||||
AABB GIProbeData::get_bounds() const {
|
||||
|
||||
return VS::get_singleton()->gi_probe_get_bounds(probe);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void GIProbeData::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_compress", "compress"), &GIProbeData::set_compress);
|
||||
ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbeData::is_compressed);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT3, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_size", "get_cell_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "to_cell_xform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_to_cell_xform", "get_to_cell_xform");
|
||||
|
||||
|
@ -542,7 +542,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3 &p_pos, const Vector3 *p_vtx,
|
|||
return p_uv[0] * u + p_uv[1] * v + p_uv[2] * w;
|
||||
}
|
||||
|
||||
void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker) {
|
||||
void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker) {
|
||||
|
||||
if (p_level == p_baker->cell_subdiv - 1) {
|
||||
//plot the face by guessing it's albedo and emission value
|
||||
|
@ -702,7 +702,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
int half = (1 << (p_baker->cell_subdiv - 1)) >> (p_level + 1);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
|
||||
Rect3 aabb = p_aabb;
|
||||
AABB aabb = p_aabb;
|
||||
aabb.size *= 0.5;
|
||||
|
||||
int nx = p_x;
|
||||
|
@ -726,7 +726,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
|
|||
continue;
|
||||
|
||||
{
|
||||
Rect3 test_aabb = aabb;
|
||||
AABB test_aabb = aabb;
|
||||
//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
|
||||
|
||||
|
@ -1083,11 +1083,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
|
|||
Ref<Mesh> mesh = mi->get_mesh();
|
||||
if (mesh.is_valid()) {
|
||||
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
AABB aabb = mesh->get_aabb();
|
||||
|
||||
Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform();
|
||||
|
||||
if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
Baker::PlotMesh pm;
|
||||
pm.local_xform = xf;
|
||||
pm.mesh = mesh;
|
||||
|
@ -1113,11 +1113,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
|
|||
if (!mesh.is_valid())
|
||||
continue;
|
||||
|
||||
Rect3 aabb = mesh->get_aabb();
|
||||
AABB aabb = mesh->get_aabb();
|
||||
|
||||
Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
|
||||
|
||||
if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
Baker::PlotMesh pm;
|
||||
pm.local_xform = xf;
|
||||
pm.mesh = mesh;
|
||||
|
@ -1151,7 +1151,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
baker.bake_cells.resize(1);
|
||||
|
||||
//find out the actual real bounds, power of 2, which gets the highest subdivision
|
||||
baker.po2_bounds = Rect3(-extents, extents * 2.0);
|
||||
baker.po2_bounds = AABB(-extents, extents * 2.0);
|
||||
int longest_axis = baker.po2_bounds.get_longest_axis_index();
|
||||
baker.axis_cell_size[longest_axis] = (1 << (baker.cell_subdiv - 1));
|
||||
baker.leaf_voxel_count = 0;
|
||||
|
@ -1286,7 +1286,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
|
||||
Ref<GIProbeData> probe_data;
|
||||
probe_data.instance();
|
||||
probe_data->set_bounds(Rect3(-extents, extents * 2.0));
|
||||
probe_data->set_bounds(AABB(-extents, extents * 2.0));
|
||||
probe_data->set_cell_size(baker.po2_bounds.size[longest_axis] / baker.axis_cell_size[longest_axis]);
|
||||
probe_data->set_dynamic_data(data);
|
||||
probe_data->set_dynamic_range(dynamic_range);
|
||||
|
@ -1306,7 +1306,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
}
|
||||
}
|
||||
|
||||
void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {
|
||||
void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {
|
||||
|
||||
if (p_level == p_baker->cell_subdiv - 1) {
|
||||
|
||||
|
@ -1328,7 +1328,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi
|
|||
if (p_baker->bake_cells[p_idx].childs[i] == Baker::CHILD_EMPTY)
|
||||
continue;
|
||||
|
||||
Rect3 aabb = p_aabb;
|
||||
AABB aabb = p_aabb;
|
||||
aabb.size *= 0.5;
|
||||
|
||||
if (i & 1)
|
||||
|
@ -1440,9 +1440,9 @@ void GIProbe::_debug_bake() {
|
|||
bake(NULL, true);
|
||||
}
|
||||
|
||||
Rect3 GIProbe::get_aabb() const {
|
||||
AABB GIProbe::get_aabb() const {
|
||||
|
||||
return Rect3(-extents, extents * 2);
|
||||
return AABB(-extents, extents * 2);
|
||||
}
|
||||
|
||||
PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const {
|
||||
|
|
|
@ -43,8 +43,8 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_bounds(const Rect3 &p_bounds);
|
||||
Rect3 get_bounds() const;
|
||||
void set_bounds(const AABB &p_bounds);
|
||||
AABB get_bounds() const;
|
||||
|
||||
void set_cell_size(float p_size);
|
||||
float get_cell_size() const;
|
||||
|
@ -146,7 +146,7 @@ private:
|
|||
MaterialCache _get_material_cache(Ref<Material> p_material);
|
||||
int leaf_voxel_count;
|
||||
|
||||
Rect3 po2_bounds;
|
||||
AABB po2_bounds;
|
||||
int axis_cell_size[3];
|
||||
|
||||
struct PlotMesh {
|
||||
|
@ -180,12 +180,12 @@ private:
|
|||
|
||||
Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add);
|
||||
Baker::MaterialCache _get_material_cache(Ref<Material> p_material, Baker *p_baker);
|
||||
void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker);
|
||||
void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker);
|
||||
void _plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_baker, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material);
|
||||
void _find_meshes(Node *p_at_node, Baker *p_baker);
|
||||
void _fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, Baker *p_baker);
|
||||
|
||||
void _debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker);
|
||||
void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker);
|
||||
void _create_debug_mesh(Baker *p_baker);
|
||||
|
||||
void _debug_bake();
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
|
||||
void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false);
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
GIProbe();
|
||||
|
|
|
@ -85,7 +85,7 @@ void ImmediateGeometry::clear() {
|
|||
cached_textures.clear();
|
||||
}
|
||||
|
||||
Rect3 ImmediateGeometry::get_aabb() const {
|
||||
AABB ImmediateGeometry::get_aabb() const {
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class ImmediateGeometry : public GeometryInstance {
|
|||
// in VisualServer from becoming invalid if the texture is no longer used
|
||||
List<Ref<Texture> > cached_textures;
|
||||
bool empty;
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
void add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv = true);
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
ImmediateGeometry();
|
||||
|
|
|
@ -117,24 +117,24 @@ bool Light::get_shadow_reverse_cull_face() const {
|
|||
return reverse_cull;
|
||||
}
|
||||
|
||||
Rect3 Light::get_aabb() const {
|
||||
AABB Light::get_aabb() const {
|
||||
|
||||
if (type == VisualServer::LIGHT_DIRECTIONAL) {
|
||||
|
||||
return Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2));
|
||||
return AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
|
||||
|
||||
} else if (type == VisualServer::LIGHT_OMNI) {
|
||||
|
||||
return Rect3(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]);
|
||||
return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]);
|
||||
|
||||
} else if (type == VisualServer::LIGHT_SPOT) {
|
||||
|
||||
float len = param[PARAM_RANGE];
|
||||
float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len;
|
||||
return Rect3(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
}
|
||||
|
||||
return Rect3();
|
||||
return AABB();
|
||||
}
|
||||
|
||||
PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const {
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
void set_shadow_reverse_cull_face(bool p_enable);
|
||||
bool get_shadow_reverse_cull_face() const;
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
Light();
|
||||
|
|
|
@ -165,12 +165,12 @@ NodePath MeshInstance::get_skeleton_path() {
|
|||
return skeleton_path;
|
||||
}
|
||||
|
||||
Rect3 MeshInstance::get_aabb() const {
|
||||
AABB MeshInstance::get_aabb() const {
|
||||
|
||||
if (!mesh.is_null())
|
||||
return mesh->get_aabb();
|
||||
|
||||
return Rect3();
|
||||
return AABB();
|
||||
}
|
||||
|
||||
PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const {
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
void create_debug_tangents();
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
MeshInstance();
|
||||
|
|
|
@ -55,10 +55,10 @@ PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const {
|
|||
return PoolVector<Face3>();
|
||||
}
|
||||
|
||||
Rect3 MultiMeshInstance::get_aabb() const {
|
||||
AABB MultiMeshInstance::get_aabb() const {
|
||||
|
||||
if (multimesh.is_null())
|
||||
return Rect3();
|
||||
return AABB();
|
||||
else
|
||||
return multimesh->get_aabb();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
void set_multimesh(const Ref<MultiMesh> &p_multimesh);
|
||||
Ref<MultiMesh> get_multimesh() const;
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
|
||||
MultiMeshInstance();
|
||||
~MultiMeshInstance();
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#include "scene/resources/surface_tool.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
Rect3 Particles::get_aabb() const {
|
||||
AABB Particles::get_aabb() const {
|
||||
|
||||
return Rect3();
|
||||
return AABB();
|
||||
}
|
||||
PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const {
|
||||
|
||||
|
@ -82,7 +82,7 @@ void Particles::set_randomness_ratio(float p_ratio) {
|
|||
randomness_ratio = p_ratio;
|
||||
VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
|
||||
}
|
||||
void Particles::set_visibility_aabb(const Rect3 &p_aabb) {
|
||||
void Particles::set_visibility_aabb(const AABB &p_aabb) {
|
||||
|
||||
visibility_aabb = p_aabb;
|
||||
VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb);
|
||||
|
@ -140,7 +140,7 @@ float Particles::get_randomness_ratio() const {
|
|||
|
||||
return randomness_ratio;
|
||||
}
|
||||
Rect3 Particles::get_visibility_aabb() const {
|
||||
AABB Particles::get_visibility_aabb() const {
|
||||
|
||||
return visibility_aabb;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void Particles::restart() {
|
|||
VisualServer::get_singleton()->particles_restart(particles);
|
||||
}
|
||||
|
||||
Rect3 Particles::capture_aabb() const {
|
||||
AABB Particles::capture_aabb() const {
|
||||
|
||||
return VS::get_singleton()->particles_get_current_aabb(particles);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void Particles::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta");
|
||||
ADD_GROUP("Drawing", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime,View Depth"), "set_draw_order", "get_draw_order");
|
||||
ADD_GROUP("Process Material", "");
|
||||
|
@ -367,7 +367,7 @@ Particles::Particles() {
|
|||
set_pre_process_time(0);
|
||||
set_explosiveness_ratio(0);
|
||||
set_randomness_ratio(0);
|
||||
set_visibility_aabb(Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8)));
|
||||
set_visibility_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8)));
|
||||
set_use_local_coordinates(true);
|
||||
set_draw_passes(1);
|
||||
set_draw_order(DRAW_ORDER_INDEX);
|
||||
|
|
|
@ -65,7 +65,7 @@ private:
|
|||
float explosiveness_ratio;
|
||||
float randomness_ratio;
|
||||
float speed_scale;
|
||||
Rect3 visibility_aabb;
|
||||
AABB visibility_aabb;
|
||||
bool local_coords;
|
||||
int fixed_fps;
|
||||
bool fractional_delta;
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
virtual void _validate_property(PropertyInfo &property) const;
|
||||
|
||||
public:
|
||||
Rect3 get_aabb() const;
|
||||
AABB get_aabb() const;
|
||||
PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
void set_emitting(bool p_emitting);
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
void set_pre_process_time(float p_time);
|
||||
void set_explosiveness_ratio(float p_ratio);
|
||||
void set_randomness_ratio(float p_ratio);
|
||||
void set_visibility_aabb(const Rect3 &p_aabb);
|
||||
void set_visibility_aabb(const AABB &p_aabb);
|
||||
void set_use_local_coordinates(bool p_enable);
|
||||
void set_process_material(const Ref<Material> &p_material);
|
||||
void set_speed_scale(float p_scale);
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
float get_pre_process_time() const;
|
||||
float get_explosiveness_ratio() const;
|
||||
float get_randomness_ratio() const;
|
||||
Rect3 get_visibility_aabb() const;
|
||||
AABB get_visibility_aabb() const;
|
||||
bool get_use_local_coordinates() const;
|
||||
Ref<Material> get_process_material() const;
|
||||
float get_speed_scale() const;
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
void restart();
|
||||
|
||||
Rect3 capture_aabb() const;
|
||||
AABB capture_aabb() const;
|
||||
Particles();
|
||||
~Particles();
|
||||
};
|
||||
|
|
|
@ -98,7 +98,7 @@ void Portal::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
p_list->push_back(PropertyInfo(Variant::REAL, "connect_range", PROPERTY_HINT_RANGE, "0.1,4096,0.01"));
|
||||
}
|
||||
|
||||
Rect3 Portal::get_aabb() const {
|
||||
AABB Portal::get_aabb() const {
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class Portal : public VisualInstance {
|
|||
Color disabled_color;
|
||||
float connect_range;
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
|
||||
protected:
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
|
@ -63,7 +63,7 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
void set_enabled(bool p_enabled);
|
||||
|
|
|
@ -178,9 +178,9 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
|
|||
return update_mode;
|
||||
}
|
||||
|
||||
Rect3 ReflectionProbe::get_aabb() const {
|
||||
AABB ReflectionProbe::get_aabb() const {
|
||||
|
||||
Rect3 aabb;
|
||||
AABB aabb;
|
||||
aabb.position = -origin_offset;
|
||||
aabb.size = origin_offset + extents;
|
||||
return aabb;
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
void set_update_mode(UpdateMode p_mode);
|
||||
UpdateMode get_update_mode() const;
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
ReflectionProbe();
|
||||
|
|
|
@ -66,12 +66,12 @@ void Room::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
Rect3 Room::get_aabb() const {
|
||||
AABB Room::get_aabb() const {
|
||||
|
||||
if (room.is_null())
|
||||
return Rect3();
|
||||
return AABB();
|
||||
|
||||
return Rect3();
|
||||
return AABB();
|
||||
}
|
||||
|
||||
PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const {
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
NOTIFICATION_AREA_CHANGED = 60
|
||||
};
|
||||
|
||||
virtual Rect3 get_aabb() const;
|
||||
virtual AABB get_aabb() const;
|
||||
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
||||
|
||||
void set_room(const Ref<RoomBounds> &p_room);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue