mirror of
https://github.com/Relintai/gdnative_cpp.git
synced 2024-11-12 10:25:31 +01:00
Include typedefs.h in defs.h.
This commit is contained in:
parent
6ea7b53e5a
commit
3e2e07a056
@ -34,8 +34,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
bool AABB::intersects(const AABB &p_aabb) const {
|
||||
if (position.x >= (p_aabb.position.x + p_aabb.size.x))
|
||||
return false;
|
||||
@ -600,5 +598,3 @@ void AABB::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const {
|
||||
AABB::operator String() const {
|
||||
return String() + position + " - " + size;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
const Basis Basis::IDENTITY = Basis();
|
||||
const Basis Basis::FLIP_X = Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
||||
const Basis Basis::FLIP_Y = Basis(1, 0, 0, 0, -1, 0, 0, 0, 1);
|
||||
@ -258,7 +256,7 @@ void Basis::set_euler_xyz(const Vector3 &p_euler) {
|
||||
s = ::sin(p_euler.z);
|
||||
Basis zmat(c, -s, 0.0, s, c, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
//optimizer will optimize away all this anyway
|
||||
// optimizer will optimize away all this anyway
|
||||
*this = xmat * (ymat * zmat);
|
||||
}
|
||||
|
||||
@ -325,7 +323,7 @@ void Basis::set_euler_yxz(const Vector3 &p_euler) {
|
||||
s = ::sin(p_euler.z);
|
||||
Basis zmat(c, -s, 0.0, s, c, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
//optimizer will optimize away all this anyway
|
||||
// optimizer will optimize away all this anyway
|
||||
*this = ymat * xmat * zmat;
|
||||
}
|
||||
|
||||
@ -599,7 +597,7 @@ static const Basis _ortho_bases[24] = {
|
||||
};
|
||||
|
||||
int Basis::get_orthogonal_index() const {
|
||||
//could be sped up if i come up with a way
|
||||
// could be sped up if i come up with a way
|
||||
Basis orth = *this;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
@ -624,7 +622,7 @@ int Basis::get_orthogonal_index() const {
|
||||
}
|
||||
|
||||
void Basis::set_orthogonal_index(int p_index) {
|
||||
//there only exist 24 orthogonal bases in r3
|
||||
// there only exist 24 orthogonal bases in r3
|
||||
ERR_FAIL_COND(p_index >= 24);
|
||||
|
||||
*this = _ortho_bases[p_index];
|
||||
@ -634,12 +632,8 @@ Basis::Basis(const Vector3 &p_euler) {
|
||||
set_euler(p_euler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "quaternion.h"
|
||||
|
||||
|
||||
|
||||
Basis::Basis(const Quaternion &p_quaternion) {
|
||||
real_t d = p_quaternion.length_squared();
|
||||
real_t s = 2.0 / d;
|
||||
@ -674,8 +668,8 @@ Basis::Basis(const Vector3 &p_axis, real_t p_phi) {
|
||||
}
|
||||
|
||||
Basis::operator Quaternion() const {
|
||||
//commenting this check because precision issues cause it to fail when it shouldn't
|
||||
//ERR_FAIL_COND_V(is_rotation() == false, Quaternion());
|
||||
// commenting this check because precision issues cause it to fail when it shouldn't
|
||||
// ERR_FAIL_COND_V(is_rotation() == false, Quaternion());
|
||||
|
||||
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
|
||||
real_t temp[4];
|
||||
@ -690,8 +684,8 @@ Basis::operator Quaternion() const {
|
||||
temp[2] = ((elements[1][0] - elements[0][1]) * s);
|
||||
} else {
|
||||
int i = elements[0][0] < elements[1][1] ?
|
||||
(elements[1][1] < elements[2][2] ? 2 : 1) :
|
||||
(elements[0][0] < elements[2][2] ? 2 : 0);
|
||||
(elements[1][1] < elements[2][2] ? 2 : 1) :
|
||||
(elements[0][0] < elements[2][2] ? 2 : 0);
|
||||
int j = (i + 1) % 3;
|
||||
int k = (i + 2) % 3;
|
||||
|
||||
@ -706,5 +700,3 @@ Basis::operator Quaternion() const {
|
||||
|
||||
return Quaternion(temp[0], temp[1], temp[2], temp[3]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,11 +35,6 @@
|
||||
#include <gdn/color.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
#define MIN(a, b) (a < b ? a : b)
|
||||
#define MAX(a, b) (a > b ? a : b)
|
||||
|
||||
static String _to_hex(float p_val);
|
||||
|
||||
static float _parse_col(const String &p_str, int p_ofs) {
|
||||
@ -651,5 +646,3 @@ Color Color::operator-() const {
|
||||
1.0 - b,
|
||||
1.0 - a);
|
||||
}
|
||||
|
||||
|
||||
|
12
core/defs.h
12
core/defs.h
@ -1,3 +1,6 @@
|
||||
#ifndef DEFS_H
|
||||
#define DEFS_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* defs.h */
|
||||
/*************************************************************************/
|
||||
@ -28,11 +31,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef DEFS_H
|
||||
#define DEFS_H
|
||||
|
||||
|
||||
|
||||
enum class Error {
|
||||
OK,
|
||||
FAILED, ///< Generic fail error
|
||||
@ -85,8 +83,6 @@ enum class Error {
|
||||
ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include <pandemonium_global.h>
|
||||
|
||||
// alloca() is non-standard. When using MSVC, it's in malloc.h.
|
||||
@ -119,6 +115,8 @@ typedef float real_t;
|
||||
#define unlikely(x) x
|
||||
#endif
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
// Don't use this directly; instead, use any of the CRASH_* macros
|
||||
#ifdef _MSC_VER
|
||||
#define GENERATE_TRAP \
|
||||
|
@ -343,14 +343,6 @@ struct _GlobalLock {
|
||||
#define __STRX(m_index) #m_index
|
||||
#define __STR(m_index) __STRX(m_index)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#define likely(x) x
|
||||
#define unlikely(x) x
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define _PRINTF_FORMAT_ATTRIBUTE_2_0 __attribute__((format(printf, 2, 0)))
|
||||
#define _PRINTF_FORMAT_ATTRIBUTE_2_3 __attribute__((format(printf, 2, 3)))
|
||||
|
Loading…
Reference in New Issue
Block a user