mirror of
https://github.com/Relintai/gdnative_cpp.git
synced 2024-11-20 10:57:23 +01:00
Codestyle.
This commit is contained in:
parent
0a7e5d0f4a
commit
990db21277
@ -30,13 +30,11 @@
|
||||
|
||||
#include "array.h"
|
||||
#include "pandemonium_global.h"
|
||||
#include "variant.h"
|
||||
#include "ustring.h"
|
||||
#include "variant.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
||||
class Object;
|
||||
|
||||
Array::Array() {
|
||||
@ -223,5 +221,3 @@ void Array::shuffle() {
|
||||
Array::~Array() {
|
||||
Pandemonium::api->pandemonium_array_destroy(&_pandemonium_array);
|
||||
}
|
||||
|
||||
|
||||
|
14
core/array.h
14
core/array.h
@ -1,3 +1,8 @@
|
||||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
#include <gdn/array.h>
|
||||
|
||||
/*************************************************************************/
|
||||
/* array.h */
|
||||
/*************************************************************************/
|
||||
@ -28,13 +33,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
#include <gdn/array.h>
|
||||
|
||||
|
||||
|
||||
class String;
|
||||
|
||||
namespace helpers {
|
||||
@ -186,6 +184,4 @@ public:
|
||||
~Array();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // ARRAY_H
|
||||
|
10
core/basis.h
10
core/basis.h
@ -1,3 +1,6 @@
|
||||
#ifndef BASIS_H
|
||||
#define BASIS_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* basis.h */
|
||||
/*************************************************************************/
|
||||
@ -28,17 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef BASIS_H
|
||||
#define BASIS_H
|
||||
|
||||
#include <gdn/basis.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include "vector3.h"
|
||||
|
||||
|
||||
|
||||
class Quaternion;
|
||||
|
||||
class Basis {
|
||||
@ -453,6 +451,4 @@ public:
|
||||
operator Quaternion() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BASIS_H
|
||||
|
12
core/color.h
12
core/color.h
@ -1,3 +1,6 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* color.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#include <gdn/color.h>
|
||||
|
||||
#include <cmath>
|
||||
@ -38,8 +38,6 @@
|
||||
#include "defs.h"
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
struct Color {
|
||||
private:
|
||||
// static float _parse_col(const String& p_str, int p_ofs);
|
||||
@ -141,7 +139,7 @@ public:
|
||||
|
||||
String to_html(bool p_alpha = true) const;
|
||||
|
||||
bool operator<(const Color &p_color) const; //used in set keys
|
||||
bool operator<(const Color &p_color) const; // used in set keys
|
||||
|
||||
operator String() const;
|
||||
|
||||
@ -166,6 +164,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // COLOR_H
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef CORETYPES_H
|
||||
#define CORETYPES_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* core_types.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef CORETYPES_H
|
||||
#define CORETYPES_H
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include "aabb.h"
|
||||
@ -41,15 +41,15 @@
|
||||
#include "node_path.h"
|
||||
#include "plane.h"
|
||||
#include "pool_arrays.h"
|
||||
#include "projection.h"
|
||||
#include "quaternion.h"
|
||||
#include "rid.h"
|
||||
#include "rect2.h"
|
||||
#include "rect2i.h"
|
||||
#include "ustring.h"
|
||||
#include "rid.h"
|
||||
#include "string_name.h"
|
||||
#include "transform.h"
|
||||
#include "transform_2d.h"
|
||||
#include "projection.h"
|
||||
#include "ustring.h"
|
||||
#include "variant.h"
|
||||
#include "vector2.h"
|
||||
#include "vector2i.h"
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "pandemonium_global.h"
|
||||
#include "variant.h"
|
||||
|
||||
|
||||
|
||||
Dictionary::Dictionary() {
|
||||
Pandemonium::api->pandemonium_dictionary_new(&_pandemonium_dictionary);
|
||||
}
|
||||
@ -106,5 +104,3 @@ Array Dictionary::values() const {
|
||||
Dictionary::~Dictionary() {
|
||||
Pandemonium::api->pandemonium_dictionary_destroy(&_pandemonium_dictionary);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef DICTIONARY_H
|
||||
#define DICTIONARY_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* dictionary.h */
|
||||
/*************************************************************************/
|
||||
@ -28,16 +31,11 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef DICTIONARY_H
|
||||
#define DICTIONARY_H
|
||||
|
||||
#include "array.h"
|
||||
#include "variant.h"
|
||||
|
||||
#include <gdn/dictionary.h>
|
||||
|
||||
|
||||
|
||||
class Variant;
|
||||
|
||||
class Dictionary {
|
||||
@ -85,6 +83,4 @@ public:
|
||||
~Dictionary();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DICTIONARY_H
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef PANDEMONIUM_MATH_H
|
||||
#define PANDEMONIUM_MATH_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Math.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef PANDEMONIUM_MATH_H
|
||||
#define PANDEMONIUM_MATH_H
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <float.h>
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef PANDEMONIUM_H
|
||||
#define PANDEMONIUM_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Pandemonium.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef PANDEMONIUM_H
|
||||
#define PANDEMONIUM_H
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
||||
|
||||
#include "pandemonium_global.h"
|
||||
|
||||
#include "ustring.h"
|
||||
#include "array.h"
|
||||
#include "ustring.h"
|
||||
|
||||
#include "wrapped.h"
|
||||
|
||||
@ -51,8 +51,6 @@ static GDCALLINGCONV void wrapper_destroy(void *data, void *wrapper) {
|
||||
Pandemonium::api->pandemonium_free(wrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *_RegisterState::nativescript_handle;
|
||||
int _RegisterState::language_index;
|
||||
|
||||
@ -203,5 +201,3 @@ void Pandemonium::nativescript_init(void *handle) {
|
||||
void Pandemonium::nativescript_terminate(void *handle) {
|
||||
Pandemonium::nativescript_api->pandemonium_nativescript_unregister_instance_binding_data_functions(_RegisterState::language_index);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef PANDEMONIUM_GLOBAL_H
|
||||
#define PANDEMONIUM_GLOBAL_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* pandemonium_global.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef PANDEMONIUM_GLOBAL_H
|
||||
#define PANDEMONIUM_GLOBAL_H
|
||||
|
||||
#include <gdnative_api_struct.gen.h>
|
||||
|
||||
#include "array.h"
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
|
||||
FunctionProfiling::FunctionProfiling(const char *p_function, const int p_line) {
|
||||
snprintf(signature, 1024, "::%d::%s", p_line, p_function);
|
||||
ticks = OS::get_singleton()->get_ticks_usec();
|
||||
@ -18,4 +16,3 @@ FunctionProfiling::~FunctionProfiling() {
|
||||
Pandemonium::gdnative_profiling_add_data(signature, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef PANDEMONIUM_PROFILING_H
|
||||
#define PANDEMONIUM_PROFILING_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* pandemonium_profiling.h */
|
||||
/*************************************************************************/
|
||||
@ -28,13 +31,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef PANDEMONIUM_PROFILING_H
|
||||
#define PANDEMONIUM_PROFILING_H
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
|
||||
class FunctionProfiling {
|
||||
char signature[1024];
|
||||
uint64_t ticks;
|
||||
@ -44,8 +42,6 @@ public:
|
||||
~FunctionProfiling();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#define PANDEMONIUM_PROFILING_FUNCTION FunctionProfiling __function_profiling(__FUNCTION__, __LINE__);
|
||||
#else
|
||||
|
@ -34,8 +34,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
void Plane::set_normal(const Vector3 &p_normal) {
|
||||
this->normal = p_normal;
|
||||
}
|
||||
@ -107,15 +105,15 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio
|
||||
Vector3 segment = p_dir;
|
||||
real_t den = normal.dot(segment);
|
||||
|
||||
//printf("den is %i\n",den);
|
||||
// printf("den is %i\n",den);
|
||||
if (::fabs(den) <= CMP_EPSILON) {
|
||||
return false;
|
||||
}
|
||||
|
||||
real_t dist = (normal.dot(p_from) - d) / den;
|
||||
//printf("dist is %i\n",dist);
|
||||
// printf("dist is %i\n",dist);
|
||||
|
||||
if (dist > CMP_EPSILON) { //this is a ray, before the emiting pos (p_from) doesnt exist
|
||||
if (dist > CMP_EPSILON) { // this is a ray, before the emiting pos (p_from) doesnt exist
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -130,13 +128,13 @@ bool Plane::intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_inters
|
||||
Vector3 segment = p_begin - p_end;
|
||||
real_t den = normal.dot(segment);
|
||||
|
||||
//printf("den is %i\n",den);
|
||||
// printf("den is %i\n",den);
|
||||
if (::fabs(den) <= CMP_EPSILON) {
|
||||
return false;
|
||||
}
|
||||
|
||||
real_t dist = (normal.dot(p_begin) - d) / den;
|
||||
//printf("dist is %i\n",dist);
|
||||
// printf("dist is %i\n",dist);
|
||||
|
||||
if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) {
|
||||
return false;
|
||||
@ -200,5 +198,3 @@ bool Plane::operator==(const Plane &p_plane) const {
|
||||
bool Plane::operator!=(const Plane &p_plane) const {
|
||||
return normal != p_plane.normal || d != p_plane.d;
|
||||
}
|
||||
|
||||
|
||||
|
12
core/plane.h
12
core/plane.h
@ -1,3 +1,6 @@
|
||||
#ifndef PLANE_H
|
||||
#define PLANE_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Plane.h */
|
||||
/*************************************************************************/
|
||||
@ -28,15 +31,10 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef PLANE_H
|
||||
#define PLANE_H
|
||||
|
||||
#include "vector3.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
enum ClockDirection {
|
||||
|
||||
CLOCKWISE,
|
||||
@ -50,7 +48,7 @@ public:
|
||||
|
||||
void set_normal(const Vector3 &p_normal);
|
||||
|
||||
inline Vector3 get_normal() const { return normal; } ///Point is coplanar, CMP_EPSILON for precision
|
||||
inline Vector3 get_normal() const { return normal; } /// Point is coplanar, CMP_EPSILON for precision
|
||||
|
||||
void normalize();
|
||||
|
||||
@ -93,6 +91,4 @@ public:
|
||||
Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // PLANE_H
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include <gdn/pool_arrays.h>
|
||||
|
||||
|
||||
|
||||
PoolByteArray::PoolByteArray() {
|
||||
Pandemonium::api->pandemonium_pool_byte_array_new(&_pandemonium_array);
|
||||
}
|
||||
@ -644,5 +642,3 @@ int PoolColorArray::size() const {
|
||||
PoolColorArray::~PoolColorArray() {
|
||||
Pandemonium::api->pandemonium_pool_color_array_destroy(&_pandemonium_array);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef POOLARRAYS_H
|
||||
#define POOLARRAYS_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* PoolArrays.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef POOLARRAYS_H
|
||||
#define POOLARRAYS_H
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include "color.h"
|
||||
@ -42,8 +42,6 @@
|
||||
|
||||
#include <gdn/pool_arrays.h>
|
||||
|
||||
|
||||
|
||||
class Array;
|
||||
|
||||
class PoolByteArray {
|
||||
@ -864,6 +862,4 @@ public:
|
||||
~PoolColorArray();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // POOLARRAYS_H
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef PROJECTION_H
|
||||
#define PROJECTION_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Projection.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef CAMERA_MATRIX_H
|
||||
#define CAMERA_MATRIX_H
|
||||
|
||||
#include "defs.h"
|
||||
#include "math_funcs.h"
|
||||
#include "plane.h"
|
||||
|
@ -35,8 +35,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
const Quaternion Quaternion::IDENTITY = Quaternion();
|
||||
|
||||
// set_euler_xyz expects a vector containing the Euler angles in the format
|
||||
@ -192,7 +190,7 @@ Quaternion Quaternion::slerpni(const Quaternion &q, const real_t &t) const {
|
||||
}
|
||||
|
||||
Quaternion Quaternion::cubic_slerp(const Quaternion &q, const Quaternion &prep, const Quaternion &postq, const real_t &t) const {
|
||||
//the only way to do slerp :|
|
||||
// the only way to do slerp :|
|
||||
real_t t2 = (1.0 - t) * t * 2;
|
||||
Quaternion sp = this->slerp(q, t);
|
||||
Quaternion sq = prep.slerpni(postq, t);
|
||||
@ -348,5 +346,3 @@ bool Quaternion::operator==(const Quaternion &p_quaternion) const {
|
||||
bool Quaternion::operator!=(const Quaternion &p_quaternion) const {
|
||||
return x != p_quaternion.x || y != p_quaternion.y || z != p_quaternion.z || w != p_quaternion.w;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef QUATERNION_H
|
||||
#define QUATERNION_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Quaternion.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef QUATERNION_H
|
||||
#define QUATERNION_H
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "vector3.h"
|
||||
|
@ -29,14 +29,12 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "rect2.h"
|
||||
#include "ustring.h"
|
||||
#include "transform_2d.h"
|
||||
#include "ustring.h"
|
||||
#include "vector2.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) (a > b ? a : b)
|
||||
#endif
|
||||
@ -106,7 +104,7 @@ Rect2 Rect2::merge(const Rect2 &p_rect) const { ///< return a merged rect
|
||||
new_rect.size.x = MAX(p_rect.position.x + p_rect.size.x, position.x + size.x);
|
||||
new_rect.size.y = MAX(p_rect.position.y + p_rect.size.y, position.y + size.y);
|
||||
|
||||
new_rect.size = new_rect.size - new_rect.position; //make relative again
|
||||
new_rect.size = new_rect.size - new_rect.position; // make relative again
|
||||
|
||||
return new_rect;
|
||||
}
|
||||
@ -171,7 +169,7 @@ bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2
|
||||
}
|
||||
|
||||
bool Rect2::intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const {
|
||||
//SAT intersection between local and transformed rect2
|
||||
// SAT intersection between local and transformed rect2
|
||||
|
||||
Vector2 xf_points[4] = {
|
||||
p_xform.xform(p_rect.position),
|
||||
@ -182,7 +180,7 @@ bool Rect2::intersects_transformed(const Transform2D &p_xform, const Rect2 &p_re
|
||||
|
||||
real_t low_limit;
|
||||
|
||||
//base rect2 first (faster)
|
||||
// base rect2 first (faster)
|
||||
|
||||
if (xf_points[0].y > position.y)
|
||||
goto next1;
|
||||
@ -319,5 +317,3 @@ next4:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
12
core/rect2.h
12
core/rect2.h
@ -1,3 +1,6 @@
|
||||
#ifndef RECT2_H
|
||||
#define RECT2_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Rect2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,17 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef RECT2_H
|
||||
#define RECT2_H
|
||||
|
||||
#include "vector2.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
||||
class String;
|
||||
|
||||
typedef Vector2 Size2;
|
||||
@ -123,7 +121,7 @@ struct Rect2 {
|
||||
return r;
|
||||
}
|
||||
|
||||
inline void expand_to(const Vector2 &p_vector) { //in place function for speed
|
||||
inline void expand_to(const Vector2 &p_vector) { // in place function for speed
|
||||
|
||||
Vector2 begin = position;
|
||||
Vector2 end = position + size;
|
||||
@ -155,6 +153,4 @@ struct Rect2 {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // RECT2_H
|
||||
|
@ -32,10 +32,6 @@
|
||||
#include "ustring.h"
|
||||
#include "vector2i.h"
|
||||
|
||||
|
||||
|
||||
Rect2i::operator String() const {
|
||||
return String(position) + ", " + String(size);
|
||||
}
|
||||
|
||||
|
||||
|
16
core/ref.h
16
core/ref.h
@ -1,3 +1,6 @@
|
||||
#ifndef REF_H
|
||||
#define REF_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Ref.h */
|
||||
/*************************************************************************/
|
||||
@ -28,15 +31,10 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef REF_H
|
||||
#define REF_H
|
||||
|
||||
#include "pandemonium_global.h"
|
||||
#include "reference.h"
|
||||
#include "variant.h"
|
||||
|
||||
|
||||
|
||||
// Replicates Pandemonium's Ref<T> behavior
|
||||
// Rewritten from f5234e70be7dec4930c2d5a0e829ff480d044b1d.
|
||||
template <class T>
|
||||
@ -178,19 +176,19 @@ public:
|
||||
inline bool is_null() const { return reference == nullptr; }
|
||||
|
||||
void unref() {
|
||||
//TODO this should be moved to mutexes, since this engine does not really
|
||||
// TODO this should be moved to mutexes, since this engine does not really
|
||||
// do a lot of referencing on references and stuff
|
||||
// mutexes will avoid more crashes?
|
||||
|
||||
if (reference && reference->unreference()) {
|
||||
//memdelete(reference);
|
||||
// memdelete(reference);
|
||||
reference->free();
|
||||
}
|
||||
reference = nullptr;
|
||||
}
|
||||
|
||||
void instance() {
|
||||
//ref(memnew(T));
|
||||
// ref(memnew(T));
|
||||
ref(T::_new());
|
||||
}
|
||||
|
||||
@ -211,6 +209,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -34,8 +34,6 @@
|
||||
|
||||
#include "pandemonium_global.h"
|
||||
|
||||
|
||||
|
||||
RID::RID() {
|
||||
Pandemonium::api->pandemonium_rid_new(&_pandemonium_rid);
|
||||
}
|
||||
@ -75,5 +73,3 @@ bool RID::operator<=(const RID &p_other) const {
|
||||
bool RID::operator>=(const RID &p_other) const {
|
||||
return !(*this < p_other);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef STRING_NAME_H
|
||||
#define STRING_NAME_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* string.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef STRING_NAME_H
|
||||
#define STRING_NAME_H
|
||||
|
||||
#include <gdn/string_name.h>
|
||||
|
||||
class String;
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef TAGDB_H
|
||||
#define TAGDB_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* TagDB.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef TAGDB_H
|
||||
#define TAGDB_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace _TagDB {
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
#include "quaternion.h"
|
||||
|
||||
|
||||
|
||||
const Transform Transform::IDENTITY = Transform();
|
||||
const Transform Transform::FLIP_X = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||
const Transform Transform::FLIP_Y = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0);
|
||||
@ -111,7 +109,7 @@ AABB Transform::xform(const AABB &p_aabb) const {
|
||||
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
|
||||
// could be even further optimized
|
||||
AABB new_aabb;
|
||||
new_aabb.position = pos;
|
||||
new_aabb.expand_to(pos + x);
|
||||
@ -301,5 +299,3 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) {
|
||||
basis = p_basis;
|
||||
origin = p_origin;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef TRANSFORM_H
|
||||
#define TRANSFORM_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Transform.h */
|
||||
/*************************************************************************/
|
||||
@ -28,16 +31,11 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef TRANSFORM_H
|
||||
#define TRANSFORM_H
|
||||
|
||||
#include "basis.h"
|
||||
|
||||
#include "aabb.h"
|
||||
#include "plane.h"
|
||||
|
||||
|
||||
|
||||
class Transform {
|
||||
public:
|
||||
static const Transform IDENTITY;
|
||||
@ -116,6 +114,4 @@ public:
|
||||
inline Transform() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // TRANSFORM_H
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef TRANSFORM2D_H
|
||||
#define TRANSFORM2D_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Transform2D.h */
|
||||
/*************************************************************************/
|
||||
@ -28,13 +31,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef TRANSFORM2D_H
|
||||
#define TRANSFORM2D_H
|
||||
|
||||
#include "vector2.h"
|
||||
|
||||
|
||||
|
||||
typedef Vector2 Size2;
|
||||
|
||||
struct Rect2;
|
||||
@ -131,6 +129,4 @@ struct Transform2D {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // TRANSFORM2D_H
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define _MKSTR(m_x) _STR(m_x)
|
||||
#endif
|
||||
|
||||
//should always inline no matter what
|
||||
// should always inline no matter what
|
||||
#ifndef _ALWAYS_INLINE_
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
@ -107,7 +107,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//custom, gcc-safe offsetof, because gcc complains a lot.
|
||||
// custom, gcc-safe offsetof, because gcc complains a lot.
|
||||
template <class T>
|
||||
T *_nullptr() {
|
||||
T *t = NULL;
|
||||
@ -179,7 +179,7 @@ inline void __swap_tmpl(T &x, T &y) {
|
||||
y = aux;
|
||||
}
|
||||
|
||||
#endif //swap
|
||||
#endif // swap
|
||||
|
||||
/* clang-format off */
|
||||
#define HEX2CHR(m_hex) \
|
||||
@ -381,7 +381,7 @@ struct _GlobalLock {
|
||||
// Limit the depth of recursive algorithms when dealing with Array/Dictionary
|
||||
#define MAX_RECURSION 100
|
||||
|
||||
//HAS_TRIVIAL_CONSTRUCTOR
|
||||
// HAS_TRIVIAL_CONSTRUCTOR
|
||||
|
||||
#if defined(__llvm__) && _llvm_has_builtin(__is_trivially_constructible)
|
||||
#define HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T)
|
||||
@ -391,7 +391,7 @@ struct _GlobalLock {
|
||||
#define HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
|
||||
#endif
|
||||
|
||||
//HAS_TRIVIAL_DESTRUCTOR
|
||||
// HAS_TRIVIAL_DESTRUCTOR
|
||||
|
||||
#if defined(__llvm__) && _llvm_has_builtin(__is_trivially_destructible)
|
||||
#define HAS_TRIVIAL_DESTRUCTOR(T) __is_trivially_destructible(T)
|
||||
@ -401,7 +401,7 @@ struct _GlobalLock {
|
||||
#define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
|
||||
#endif
|
||||
|
||||
//HAS_TRIVIAL_COPY
|
||||
// HAS_TRIVIAL_COPY
|
||||
|
||||
#if defined(__llvm__) && _llvm_has_builtin(__is_trivially_copyable)
|
||||
#define HAS_TRIVIAL_COPY(T) __is_trivially_copyable(T)
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* String.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
#include <gdn/string.h>
|
||||
|
||||
class NodePath;
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VARIANT_H
|
||||
#define VARIANT_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Variant.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VARIANT_H
|
||||
#define VARIANT_H
|
||||
|
||||
#include <gdn/variant.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -34,8 +34,6 @@
|
||||
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
const Vector2 Vector2::ZERO = Vector2();
|
||||
const Vector2 Vector2::ONE = Vector2(1, 1);
|
||||
const Vector2 Vector2::INF = Vector2(INFINITY, INFINITY);
|
||||
@ -96,5 +94,3 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
|
||||
Vector2::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR2_H
|
||||
#define VECTOR2_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* Vector2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR2_H
|
||||
#define VECTOR2_H
|
||||
|
||||
#include <gdn/vector2.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
Vector2i::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR2I_H
|
||||
#define VECTOR2I_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* vector2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,17 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR2I_H
|
||||
#define VECTOR2I_H
|
||||
|
||||
#include <gdn/vector2i.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <math_funcs.h>
|
||||
|
||||
|
||||
|
||||
class String;
|
||||
|
||||
struct Vector2i {
|
||||
@ -64,6 +62,4 @@ struct Vector2i {
|
||||
operator String() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // VECTOR2_H
|
||||
|
@ -36,8 +36,6 @@
|
||||
|
||||
#include "basis.h"
|
||||
|
||||
|
||||
|
||||
const Vector3 Vector3::ZERO = Vector3();
|
||||
const Vector3 Vector3::ONE = Vector3(1, 1, 1);
|
||||
const Vector3 Vector3::INF = Vector3(INFINITY, INFINITY, INFINITY);
|
||||
@ -117,5 +115,3 @@ void Vector3::snap(real_t p_val) {
|
||||
Vector3::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y) + ", " + String::num(z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR3_H
|
||||
#define VECTOR3_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* vector3.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR3_H
|
||||
#define VECTOR3_H
|
||||
|
||||
#include <gdn/vector3.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
Vector3i::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) ;
|
||||
return String::num(x) + ", " + String::num(y) + ", " + String::num(z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR3I_H
|
||||
#define VECTOR3I_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* vector2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,17 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR3I_H
|
||||
#define VECTOR3I_H
|
||||
|
||||
#include <gdn/vector3i.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <math_funcs.h>
|
||||
|
||||
|
||||
|
||||
class String;
|
||||
|
||||
struct Vector3i {
|
||||
@ -67,6 +65,4 @@ struct Vector3i {
|
||||
operator String() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // VECTOR2_H
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
Vector4::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR4_H
|
||||
#define VECTOR4_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* vector2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,17 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR4_H
|
||||
#define VECTOR4_H
|
||||
|
||||
#include <gdn/vector4.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <math_funcs.h>
|
||||
|
||||
|
||||
|
||||
class String;
|
||||
|
||||
struct Vector4 {
|
||||
@ -70,6 +68,4 @@ struct Vector4 {
|
||||
operator String() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // VECTOR2_H
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
#include "ustring.h"
|
||||
|
||||
|
||||
|
||||
Vector4i::operator String() const {
|
||||
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef VECTOR4I_H
|
||||
#define VECTOR4I_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* vector2.h */
|
||||
/*************************************************************************/
|
||||
@ -28,9 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VECTOR4I_H
|
||||
#define VECTOR4I_H
|
||||
|
||||
#include <gdn/vector4i.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
Loading…
Reference in New Issue
Block a user