mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Style: Various fixes to play nice with clang-format
This commit is contained in:
parent
39114178a0
commit
2a0ddc1e89
@ -143,10 +143,22 @@ void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, floa
|
||||
float c = - ( p_far + p_near ) / ( p_far - p_near );
|
||||
float d = - 2 * p_far * p_near / ( p_far - p_near );
|
||||
|
||||
te[0] = x; te[4] = 0; te[8] = a; te[12] = 0;
|
||||
te[1] = 0; te[5] = y; te[9] = b; te[13] = 0;
|
||||
te[2] = 0; te[6] = 0; te[10] = c; te[14] = d;
|
||||
te[3] = 0; te[7] = 0; te[11] = - 1; te[15] = 0;
|
||||
te[0] = x;
|
||||
te[1] = 0;
|
||||
te[2] = 0;
|
||||
te[3] = 0;
|
||||
te[4] = 0;
|
||||
te[5] = y;
|
||||
te[6] = 0;
|
||||
te[7] = 0;
|
||||
te[8] = a;
|
||||
te[9] = b;
|
||||
te[10] = c;
|
||||
te[11] = -1;
|
||||
te[12] = 0;
|
||||
te[13] = 0;
|
||||
te[14] = d;
|
||||
te[15] = 0;
|
||||
|
||||
#endif
|
||||
|
||||
@ -186,18 +198,21 @@ void CameraMatrix::get_viewport_size(float& r_width, float& r_height) const {
|
||||
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
||||
matrix[ 7] + matrix[ 6],
|
||||
matrix[11] + matrix[10],
|
||||
-matrix[15] - matrix[14]).normalized();
|
||||
-matrix[15] - matrix[14])
|
||||
near_plane.normalize();
|
||||
|
||||
///////--- Right Plane ---///////
|
||||
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
||||
matrix[ 7] - matrix[ 4],
|
||||
matrix[11] - matrix[ 8],
|
||||
- matrix[15] + matrix[12]).normalized();
|
||||
- matrix[15] + matrix[12])
|
||||
right_plane.normalize();
|
||||
|
||||
Plane top_plane=Plane(matrix[ 3] - matrix[ 1],
|
||||
matrix[ 7] - matrix[ 5],
|
||||
matrix[11] - matrix[ 9],
|
||||
-matrix[15] + matrix[13]).normalized();
|
||||
-matrix[15] + matrix[13])
|
||||
top_plane.normalize();
|
||||
|
||||
Vector3 res;
|
||||
near_plane.intersect_3(right_plane,top_plane,&res);
|
||||
@ -214,26 +229,29 @@ bool CameraMatrix::get_endpoints(const Transform& p_transform, Vector3 *p_8point
|
||||
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
||||
matrix[ 7] + matrix[ 6],
|
||||
matrix[11] + matrix[10],
|
||||
-matrix[15] - matrix[14]).normalized();
|
||||
-matrix[15] - matrix[14])
|
||||
near_plane.normalize();
|
||||
|
||||
///////--- Far Plane ---///////
|
||||
Plane far_plane=Plane(matrix[ 2] - matrix[ 3],
|
||||
matrix[ 6] - matrix[ 7],
|
||||
matrix[10] - matrix[11],
|
||||
matrix[15] - matrix[14]).normalized();
|
||||
|
||||
matrix[15] - matrix[14])
|
||||
far_plane.normalize();
|
||||
|
||||
///////--- Right Plane ---///////
|
||||
Plane right_plane=Plane(matrix[ 0] - matrix[ 3],
|
||||
matrix[ 4] - matrix[ 7],
|
||||
matrix[8] - matrix[ 11],
|
||||
- matrix[15] + matrix[12]).normalized();
|
||||
- matrix[15] + matrix[12])
|
||||
right_plane.normalize();
|
||||
|
||||
///////--- Top Plane ---///////
|
||||
Plane top_plane=Plane(matrix[ 1] - matrix[ 3],
|
||||
matrix[ 5] - matrix[ 7],
|
||||
matrix[9] - matrix[ 11],
|
||||
-matrix[15] + matrix[13]).normalized();
|
||||
-matrix[15] + matrix[13])
|
||||
top_plane.normalize();
|
||||
|
||||
Vector3 near_endpoint;
|
||||
Vector3 far_endpoint;
|
||||
@ -549,7 +567,8 @@ float CameraMatrix::get_fov() const {
|
||||
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
||||
matrix[ 7] - matrix[ 4],
|
||||
matrix[11] - matrix[ 8],
|
||||
- matrix[15] + matrix[12]).normalized();
|
||||
- matrix[15] + matrix[12])
|
||||
right_plane.normalize();
|
||||
|
||||
return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x)))*2.0;
|
||||
}
|
||||
|
@ -236,21 +236,22 @@ Vector3 TriangleMesh::get_area_normal(const Rect3& p_aabb) const {
|
||||
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
}
|
||||
}
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_LEFT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.left|TEST_AABB_BIT;
|
||||
level++;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_RIGHT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.right|TEST_AABB_BIT;
|
||||
level++;
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_DONE_BIT: {
|
||||
|
||||
if (level==0) {
|
||||
@ -258,8 +259,8 @@ Vector3 TriangleMesh::get_area_normal(const Rect3& p_aabb) const {
|
||||
break;
|
||||
} else
|
||||
level--;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -357,21 +358,22 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end
|
||||
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
}
|
||||
}
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_LEFT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.left|TEST_AABB_BIT;
|
||||
level++;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_RIGHT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.right|TEST_AABB_BIT;
|
||||
level++;
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_DONE_BIT: {
|
||||
|
||||
if (level==0) {
|
||||
@ -379,8 +381,8 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end
|
||||
break;
|
||||
} else
|
||||
level--;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -478,21 +480,22 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec
|
||||
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
}
|
||||
}
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_LEFT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.left|TEST_AABB_BIT;
|
||||
level++;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_RIGHT_BIT: {
|
||||
|
||||
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
|
||||
stack[level+1]=b.right|TEST_AABB_BIT;
|
||||
level++;
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
case VISIT_DONE_BIT: {
|
||||
|
||||
if (level==0) {
|
||||
@ -500,8 +503,8 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec
|
||||
break;
|
||||
} else
|
||||
level--;
|
||||
|
||||
} continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,6 +39,8 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
/** Current clang-format style doesn't play well with the aligned return values of that switch. */
|
||||
/* clang-format off */
|
||||
case NONE:
|
||||
return true;
|
||||
case KEY:
|
||||
@ -80,6 +82,7 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
|
||||
case ACTION:
|
||||
return action.action == p_event.action.action
|
||||
&& action.pressed == p_event.action.pressed;
|
||||
/* clang-format on */
|
||||
default:
|
||||
ERR_PRINT("No logic to compare InputEvents of this type, this shouldn't happen.");
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ struct _KeyCodeText {
|
||||
|
||||
static const _KeyCodeText _keycodes[]={
|
||||
|
||||
/* clang-format off */
|
||||
{KEY_ESCAPE ,"Escape"},
|
||||
{KEY_TAB ,"Tab"},
|
||||
{KEY_BACKTAB ,"BackTab"},
|
||||
@ -281,7 +282,8 @@ static const _KeyCodeText _keycodes[]={
|
||||
|
||||
{KEY_DIVISION ,"Division"},
|
||||
{KEY_YDIAERESIS ,"Ydiaeresis"},
|
||||
{0 ,0}
|
||||
{0 ,0}
|
||||
/* clang-format on */
|
||||
};
|
||||
|
||||
bool keycode_has_unicode(uint32_t p_keycode) {
|
||||
@ -299,7 +301,8 @@ bool keycode_has_unicode(uint32_t p_keycode) {
|
||||
case KEY_MEDIAPREVIOUS: case KEY_MEDIANEXT: case KEY_MEDIARECORD: case KEY_HOMEPAGE: case KEY_FAVORITES: case KEY_SEARCH: case KEY_STANDBY:
|
||||
case KEY_OPENURL: case KEY_LAUNCHMAIL: case KEY_LAUNCHMEDIA: case KEY_LAUNCH0: case KEY_LAUNCH1: case KEY_LAUNCH2: case KEY_LAUNCH3: case KEY_LAUNCH4:
|
||||
case KEY_LAUNCH5: case KEY_LAUNCH6: case KEY_LAUNCH7: case KEY_LAUNCH8: case KEY_LAUNCH9: case KEY_LAUNCHA: case KEY_LAUNCHB: case KEY_LAUNCHC: case KEY_LAUNCHD:
|
||||
case KEY_LAUNCHE: case KEY_LAUNCHF: return false;
|
||||
case KEY_LAUNCHE: case KEY_LAUNCHF:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1,3 +0,0 @@
|
||||
#include "profile_clock.h"
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
#ifndef PROFILE_CLOCK_H
|
||||
#define PROFILE_CLOCK_H
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // PROFILE_CLOCK_H
|
@ -40,41 +40,39 @@
|
||||
#define _STR(m_x) #m_x
|
||||
#define _MKSTR(m_x) _STR(m_x)
|
||||
#endif
|
||||
// have to include version.h for this to work, include it in the .cpp not the .h
|
||||
|
||||
/**
|
||||
* Version macros - it is necessary to include "version.h" for those to work.
|
||||
* Include it in the .cpp file, not the header.
|
||||
*/
|
||||
#ifdef VERSION_PATCH
|
||||
#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"." _MKSTR(VERSION_MINOR)"." _MKSTR(VERSION_PATCH)"." _MKSTR(VERSION_STATUS)"." _MKSTR(VERSION_REVISION)
|
||||
#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION)
|
||||
#else
|
||||
#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"." _MKSTR(VERSION_MINOR)"." _MKSTR(VERSION_STATUS)"." _MKSTR(VERSION_REVISION)
|
||||
#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION)
|
||||
#endif // VERSION_PATCH
|
||||
#define VERSION_FULL_NAME _MKSTR(VERSION_NAME)" v" VERSION_MKSTRING
|
||||
#define VERSION_FULL_NAME "" _MKSTR(VERSION_NAME) " v" VERSION_MKSTRING
|
||||
|
||||
|
||||
#ifndef _ALWAYS_INLINE_
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 )
|
||||
# define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
|
||||
#define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
|
||||
#elif defined(__llvm__)
|
||||
# define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
|
||||
#define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
|
||||
#elif defined(_MSC_VER)
|
||||
# define _ALWAYS_INLINE_ __forceinline
|
||||
#define _ALWAYS_INLINE_ __forceinline
|
||||
#else
|
||||
# define _ALWAYS_INLINE_ inline
|
||||
#define _ALWAYS_INLINE_ inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _FORCE_INLINE_
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
#define _FORCE_INLINE_ inline
|
||||
|
||||
#else
|
||||
|
||||
#define _FORCE_INLINE_ _ALWAYS_INLINE_
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -97,16 +95,16 @@ T *_nullptr() { T*t=NULL; return t; }
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef min // override standard definition
|
||||
# undef max // override standard definition
|
||||
# undef ERROR // override (really stupid) wingdi.h standard definition
|
||||
# undef DELETE // override (another really stupid) winnt.h standard definition
|
||||
# undef MessageBox // override winuser.h standard definition
|
||||
# undef MIN // override standard definition
|
||||
# undef MAX // override standard definition
|
||||
# undef CLAMP // override standard definition
|
||||
# undef Error
|
||||
# undef OK
|
||||
#undef min // override standard definition
|
||||
#undef max // override standard definition
|
||||
#undef ERROR // override (really stupid) wingdi.h standard definition
|
||||
#undef DELETE // override (another really stupid) winnt.h standard definition
|
||||
#undef MessageBox // override winuser.h standard definition
|
||||
#undef MIN // override standard definition
|
||||
#undef MAX // override standard definition
|
||||
#undef CLAMP // override standard definition
|
||||
#undef Error
|
||||
#undef OK
|
||||
#endif
|
||||
|
||||
#include "error_macros.h"
|
||||
@ -150,30 +148,30 @@ inline void __swap_tmpl(T &x, T &y ) {
|
||||
|
||||
#endif //swap
|
||||
|
||||
#define HEX2CHR( m_hex ) ( (m_hex>='0' && m_hex<='9')?(m_hex-'0'):\
|
||||
((m_hex>='A' && m_hex<='F')?(10+m_hex-'A'):\
|
||||
((m_hex>='a' && m_hex<='f')?(10+m_hex-'a'):0)))
|
||||
/* clang-format off */
|
||||
#define HEX2CHR(m_hex) \
|
||||
((m_hex >= '0' && m_hex <= '9') ? (m_hex - '0') : \
|
||||
((m_hex >= 'A' && m_hex <= 'F') ? (10 + m_hex - 'A') : \
|
||||
((m_hex >= 'a' && m_hex <= 'f') ? (10 + m_hex - 'a') : 0)))
|
||||
/* clang-format on */
|
||||
|
||||
// Macro to check whether we are compiled by clang
|
||||
// and we have a specific builtin
|
||||
#if defined(__llvm__) && defined(__has_builtin)
|
||||
#define _llvm_has_builtin(x) __has_builtin(x)
|
||||
#define _llvm_has_builtin(x) __has_builtin(x)
|
||||
#else
|
||||
#define _llvm_has_builtin(x) 0
|
||||
#define _llvm_has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 5)) || _llvm_has_builtin(__builtin_mul_overflow)
|
||||
# define _mul_overflow __builtin_mul_overflow
|
||||
#define _mul_overflow __builtin_mul_overflow
|
||||
#endif
|
||||
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 5)) || _llvm_has_builtin(__builtin_add_overflow)
|
||||
# define _add_overflow __builtin_add_overflow
|
||||
#define _add_overflow __builtin_add_overflow
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Function to find the nearest (bigger) power of 2 to an integer */
|
||||
|
||||
static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
|
||||
@ -276,14 +274,11 @@ struct _GlobalLock {
|
||||
};
|
||||
|
||||
#define GLOBAL_LOCK_FUNCTION _GlobalLock _global_lock_;
|
||||
|
||||
#ifdef NO_SAFE_CAST
|
||||
|
||||
#define SAFE_CAST static_cast
|
||||
|
||||
#else
|
||||
|
||||
#define SAFE_CAST dynamic_cast
|
||||
|
||||
#endif
|
||||
|
||||
#define MT_SAFE
|
||||
@ -291,7 +286,4 @@ struct _GlobalLock {
|
||||
#define __STRX(m_index) #m_index
|
||||
#define __STR(m_index) __STRX(m_index)
|
||||
|
||||
|
||||
|
||||
#endif /* typedefs.h */
|
||||
|
||||
|
@ -1053,31 +1053,31 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i
|
||||
|
||||
// math types
|
||||
|
||||
case VECTOR2: return Vector2(); // 5
|
||||
case VECTOR2: return Vector2(); // 5
|
||||
case RECT2: return Rect2();
|
||||
case VECTOR3: return Vector3();
|
||||
case TRANSFORM2D: return Transform2D();
|
||||
case PLANE: return Plane();
|
||||
case QUAT: return Quat();
|
||||
case RECT3: return Rect3(); //sorry naming convention fail :( not like it's used often // 10
|
||||
case RECT3: return Rect3(); // 10
|
||||
case BASIS: return Basis();
|
||||
case TRANSFORM: return Transform();
|
||||
|
||||
// misc types
|
||||
case COLOR: return Color();
|
||||
case IMAGE: return Image();
|
||||
case NODE_PATH: return NodePath();; // 15
|
||||
case NODE_PATH: return NodePath(); // 15
|
||||
case _RID: return RID();
|
||||
case OBJECT: return (Object*)NULL;
|
||||
case INPUT_EVENT: return InputEvent();
|
||||
case DICTIONARY: return Dictionary();
|
||||
case ARRAY: return Array();; // 20
|
||||
case ARRAY: return Array(); // 20
|
||||
case POOL_BYTE_ARRAY: return PoolByteArray();
|
||||
case POOL_INT_ARRAY: return PoolIntArray();
|
||||
case POOL_REAL_ARRAY: return PoolRealArray();
|
||||
case POOL_STRING_ARRAY: return PoolStringArray();
|
||||
case POOL_VECTOR2_ARRAY: return PoolVector2Array();; // 25
|
||||
case POOL_VECTOR3_ARRAY: return PoolVector3Array();; // 25
|
||||
case POOL_VECTOR2_ARRAY: return PoolVector2Array(); // 25
|
||||
case POOL_VECTOR3_ARRAY: return PoolVector3Array();
|
||||
case POOL_COLOR_ARRAY: return PoolColorArray();
|
||||
default: return Variant();
|
||||
}
|
||||
@ -1127,27 +1127,27 @@ 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])); //sorry naming convention fail :( not like it's used often // 10
|
||||
case RECT3: return (Rect3(*p_args[0])); // 10
|
||||
case BASIS: return (Basis(p_args[0]->operator Basis()));
|
||||
case TRANSFORM: return (Transform(p_args[0]->operator Transform()));
|
||||
|
||||
// misc types
|
||||
case COLOR: return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]);
|
||||
case IMAGE: return (Image(*p_args[0]));
|
||||
case NODE_PATH: return (NodePath(p_args[0]->operator NodePath())); // 15
|
||||
case NODE_PATH: return (NodePath(p_args[0]->operator NodePath())); // 15
|
||||
case _RID: return (RID(*p_args[0]));
|
||||
case OBJECT: return ((Object*)(p_args[0]->operator Object *()));
|
||||
case INPUT_EVENT: return (InputEvent(*p_args[0]));
|
||||
case DICTIONARY: return p_args[0]->operator Dictionary();
|
||||
case ARRAY: return p_args[0]->operator Array();
|
||||
case ARRAY: return p_args[0]->operator Array(); // 20
|
||||
|
||||
// arrays
|
||||
case POOL_BYTE_ARRAY: return (PoolByteArray(*p_args[0]));
|
||||
case POOL_INT_ARRAY: return (PoolIntArray(*p_args[0]));
|
||||
case POOL_REAL_ARRAY: return (PoolRealArray(*p_args[0]));
|
||||
case POOL_STRING_ARRAY: return (PoolStringArray(*p_args[0]));
|
||||
case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25
|
||||
case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0])); // 25
|
||||
case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25
|
||||
case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0]));
|
||||
case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0]));
|
||||
default: return Variant();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
|
||||
case 'r': res=13; break;
|
||||
case '\"': res='\"'; break;
|
||||
case '\\': res='\\'; break;
|
||||
case '/': res='/'; break; //wtf
|
||||
case '/': res='/'; break;
|
||||
case 'u': {
|
||||
//hexnumbarh - oct is deprecated
|
||||
|
||||
|
@ -441,7 +441,8 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
|
||||
} else if (custom_h && callfunc=="cosh_custom") {
|
||||
|
||||
if (!cosh_used) {
|
||||
global_code= "float cosh_custom(float val)\n"\
|
||||
global_code=
|
||||
"float cosh_custom(float val)\n"\
|
||||
"{\n"\
|
||||
" float tmp = exp(val);\n"\
|
||||
" float cosH = (tmp + 1.0 / tmp) / 2.0;\n"\
|
||||
@ -453,7 +454,8 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
|
||||
} else if (custom_h && callfunc=="sinh_custom") {
|
||||
|
||||
if (!sinh_used) {
|
||||
global_code= "float sinh_custom(float val)\n"\
|
||||
global_code=
|
||||
"float sinh_custom(float val)\n"\
|
||||
"{\n"\
|
||||
" float tmp = exp(val);\n"\
|
||||
" float sinH = (tmp - 1.0 / tmp) / 2.0;\n"\
|
||||
@ -465,7 +467,8 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
|
||||
} else if (custom_h && callfunc=="tanh_custom") {
|
||||
|
||||
if (!tanh_used) {
|
||||
global_code= "float tanh_custom(float val)\n"\
|
||||
global_code=
|
||||
"float tanh_custom(float val)\n"\
|
||||
"{\n"\
|
||||
" float tmp = exp(val);\n"\
|
||||
" float tanH = (tmp - 1.0 / tmp) / (tmp + 1.0 / tmp);\n"\
|
||||
|
@ -1526,7 +1526,7 @@ bool Main::start() {
|
||||
//sml->get_root()->add_child(scene);
|
||||
sml->add_current_scene(scene);
|
||||
|
||||
String iconpath = GLOBAL_DEF("application/icon","Variant()""");
|
||||
String iconpath = GLOBAL_DEF("application/icon","Variant()");
|
||||
if (iconpath!="") {
|
||||
Image icon;
|
||||
if (icon.load(iconpath)==OK)
|
||||
|
@ -643,7 +643,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
|
||||
case GDTokenizer::TK_OP_ADD: e.op=OperatorNode::OP_POS; break;
|
||||
case GDTokenizer::TK_OP_SUB: e.op=OperatorNode::OP_NEG; break;
|
||||
case GDTokenizer::TK_OP_NOT: e.op=OperatorNode::OP_NOT; break;
|
||||
case GDTokenizer::TK_OP_BIT_INVERT: e.op=OperatorNode::OP_BIT_INVERT;; break;
|
||||
case GDTokenizer::TK_OP_BIT_INVERT: e.op=OperatorNode::OP_BIT_INVERT; break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
|
@ -464,16 +464,19 @@ static void get_modulation_value(int x, int y, const int p_2bit, const int p_mod
|
||||
if(((x^y)&1)==0)
|
||||
mod_val = rep_vals0[p_modulation[y][x]];
|
||||
else if(p_modulation_modes[y][x] == 1) {
|
||||
mod_val = (rep_vals0[p_modulation[y-1][x]] +
|
||||
rep_vals0[p_modulation[y+1][x]] +
|
||||
rep_vals0[p_modulation[y][x-1]] +
|
||||
rep_vals0[p_modulation[y][x+1]] + 2) / 4;
|
||||
mod_val = (
|
||||
rep_vals0[p_modulation[y-1][x]] +
|
||||
rep_vals0[p_modulation[y+1][x]] +
|
||||
rep_vals0[p_modulation[y][x-1]] +
|
||||
rep_vals0[p_modulation[y][x+1]] + 2) / 4;
|
||||
} else if(p_modulation_modes[y][x] == 2) {
|
||||
mod_val = (rep_vals0[p_modulation[y][x-1]] +
|
||||
rep_vals0[p_modulation[y][x+1]] + 1) / 2;
|
||||
mod_val = (
|
||||
rep_vals0[p_modulation[y][x-1]] +
|
||||
rep_vals0[p_modulation[y][x+1]] + 1) / 2;
|
||||
} else {
|
||||
mod_val = (rep_vals0[p_modulation[y-1][x]] +
|
||||
rep_vals0[p_modulation[y+1][x]] + 1) / 2;
|
||||
mod_val = (
|
||||
rep_vals0[p_modulation[y-1][x]] +
|
||||
rep_vals0[p_modulation[y+1][x]] + 1) / 2;
|
||||
}
|
||||
} else {
|
||||
mod_val = rep_vals1[p_modulation[y][x]];
|
||||
@ -615,11 +618,12 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
|
||||
for(j = 0; j < 2; j++) {
|
||||
unpack_5554(p_blocks[i][j], colors5554[i][j].Reps);
|
||||
|
||||
unpack_modulations(p_blocks[i][j],
|
||||
p_2bit,
|
||||
p_modulation,
|
||||
p_modulation_modes,
|
||||
p_x, p_y);
|
||||
unpack_modulations(
|
||||
p_blocks[i][j],
|
||||
p_2bit,
|
||||
p_modulation,
|
||||
p_modulation_modes,
|
||||
p_x, p_y);
|
||||
|
||||
p_x += x_block_size;
|
||||
}
|
||||
@ -632,19 +636,21 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
|
||||
}
|
||||
|
||||
|
||||
interpolate_colors(colors5554[0][0].Reps[0],
|
||||
colors5554[0][1].Reps[0],
|
||||
colors5554[1][0].Reps[0],
|
||||
colors5554[1][1].Reps[0],
|
||||
p_2bit, x, y,
|
||||
ASig);
|
||||
interpolate_colors(
|
||||
colors5554[0][0].Reps[0],
|
||||
colors5554[0][1].Reps[0],
|
||||
colors5554[1][0].Reps[0],
|
||||
colors5554[1][1].Reps[0],
|
||||
p_2bit, x, y,
|
||||
ASig);
|
||||
|
||||
interpolate_colors(colors5554[0][0].Reps[1],
|
||||
colors5554[0][1].Reps[1],
|
||||
colors5554[1][0].Reps[1],
|
||||
colors5554[1][1].Reps[1],
|
||||
p_2bit, x, y,
|
||||
BSig);
|
||||
interpolate_colors(
|
||||
colors5554[0][0].Reps[1],
|
||||
colors5554[0][1].Reps[1],
|
||||
colors5554[1][0].Reps[1],
|
||||
colors5554[1][1].Reps[1],
|
||||
p_2bit, x, y,
|
||||
BSig);
|
||||
|
||||
get_modulation_value(x,y, p_2bit, (const int (*)[16])p_modulation, (const int (*)[16])p_modulation_modes,
|
||||
&Mod, &DoPT);
|
||||
|
@ -141,7 +141,7 @@ int AudioStreamPlaybackOGGVorbis::mix(int16_t* p_bufer,int p_frames) {
|
||||
int errv = ov_open_callbacks(f,&vf,NULL,0,_ov_callbacks);
|
||||
if (errv!=0) {
|
||||
playing=false;
|
||||
break;; // :(
|
||||
break; // :(
|
||||
}
|
||||
|
||||
if (loop_restart_time) {
|
||||
|
@ -13,7 +13,11 @@ extern "C" {
|
||||
extern EGLDisplay egl_disp;
|
||||
extern EGLSurface egl_surf;
|
||||
|
||||
enum RENDERING_API {GL_ES_1 = EGL_OPENGL_ES_BIT, GL_ES_2 = EGL_OPENGL_ES2_BIT, VG = EGL_OPENVG_BIT};
|
||||
enum RENDERING_API {
|
||||
GL_ES_1 = EGL_OPENGL_ES_BIT,
|
||||
GL_ES_2 = EGL_OPENGL_ES2_BIT,
|
||||
VG = EGL_OPENVG_BIT
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes EGL, GL and loads a default font
|
||||
|
@ -32,38 +32,41 @@
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
#include "os_uwp.h"
|
||||
#include "GLES2/gl2.h"
|
||||
#include "os_uwp.h"
|
||||
|
||||
/** clang-format does not play nice with this C++/CX hybrid, needs investigation. */
|
||||
/* clang-format off */
|
||||
|
||||
namespace GodotUWP
|
||||
{
|
||||
ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
|
||||
{
|
||||
public:
|
||||
App();
|
||||
ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
|
||||
{
|
||||
public:
|
||||
App();
|
||||
|
||||
// IFrameworkView Methods.
|
||||
virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
|
||||
virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
|
||||
virtual void Load(Platform::String^ entryPoint);
|
||||
virtual void Run();
|
||||
virtual void Uninitialize();
|
||||
// IFrameworkView Methods.
|
||||
virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
|
||||
virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
|
||||
virtual void Load(Platform::String^ entryPoint);
|
||||
virtual void Run();
|
||||
virtual void Uninitialize();
|
||||
|
||||
property Windows::Foundation::EventRegistrationToken MouseMovedToken {
|
||||
Windows::Foundation::EventRegistrationToken get() { return this->mouseMovedToken; }
|
||||
void set(Windows::Foundation::EventRegistrationToken p_token) { this->mouseMovedToken = p_token; }
|
||||
};
|
||||
Windows::Foundation::EventRegistrationToken get() { return this->mouseMovedToken; }
|
||||
void set(Windows::Foundation::EventRegistrationToken p_token) { this->mouseMovedToken = p_token; }
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void RecreateRenderer();
|
||||
|
||||
// Application lifecycle event handlers.
|
||||
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
|
||||
// Application lifecycle event handlers.
|
||||
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
|
||||
|
||||
// Window event handlers.
|
||||
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
|
||||
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
|
||||
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
|
||||
// Window event handlers.
|
||||
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
|
||||
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
|
||||
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
|
||||
|
||||
void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed, bool p_is_wheel = false);
|
||||
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
||||
@ -81,20 +84,20 @@ namespace GodotUWP
|
||||
void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
|
||||
void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
|
||||
|
||||
void UpdateWindowSize(Windows::Foundation::Size size);
|
||||
void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
|
||||
void CleanupEGL();
|
||||
void UpdateWindowSize(Windows::Foundation::Size size);
|
||||
void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
|
||||
void CleanupEGL();
|
||||
|
||||
char** get_command_line(unsigned int* out_argc);
|
||||
|
||||
bool mWindowClosed;
|
||||
bool mWindowVisible;
|
||||
GLsizei mWindowWidth;
|
||||
GLsizei mWindowHeight;
|
||||
bool mWindowClosed;
|
||||
bool mWindowVisible;
|
||||
GLsizei mWindowWidth;
|
||||
GLsizei mWindowHeight;
|
||||
|
||||
EGLDisplay mEglDisplay;
|
||||
EGLContext mEglContext;
|
||||
EGLSurface mEglSurface;
|
||||
EGLDisplay mEglDisplay;
|
||||
EGLContext mEglContext;
|
||||
EGLSurface mEglSurface;
|
||||
|
||||
CoreWindow^ window;
|
||||
OSUWP* os;
|
||||
@ -103,6 +106,7 @@ namespace GodotUWP
|
||||
int last_touch_y[32];
|
||||
int number_of_contacts;
|
||||
Windows::Foundation::Point last_mouse_pos;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
@ -618,9 +618,7 @@ void AppxPackager::make_content_types() {
|
||||
|
||||
types[ext] = content_type(ext);
|
||||
|
||||
tmp_file->store_string("<Default Extension=\"" + ext +
|
||||
"\" ContentType=\""
|
||||
+ types[ext] + "\" />");
|
||||
tmp_file->store_string("<Default Extension=\"" + ext + "\" ContentType=\"" + types[ext] + "\" />");
|
||||
}
|
||||
|
||||
// Appx signature file
|
||||
@ -1174,9 +1172,9 @@ Error AppxPackager::MakeIndirectDataContent(asn1::SPCIndirectDataContent &idc) {
|
||||
MakeSPCInfoValue(*infoValue);
|
||||
|
||||
ASN1_TYPE* value =
|
||||
EncodedASN1::FromItem<asn1::SPCInfoValue,
|
||||
asn1::i2d_SPCInfoValue>(infoValue)
|
||||
.ToSequenceType();
|
||||
EncodedASN1::FromItem<asn1::SPCInfoValue,
|
||||
asn1::i2d_SPCInfoValue>(infoValue)
|
||||
.ToSequenceType();
|
||||
|
||||
{
|
||||
Vector<uint8_t> digest;
|
||||
@ -1202,8 +1200,10 @@ Error AppxPackager::add_attributes(PKCS7_SIGNER_INFO * p_signer_info) {
|
||||
asn1::SPCSpOpusInfo* opus = asn1::SPCSpOpusInfo_new();
|
||||
if (!opus) return openssl_error(ERR_peek_last_error());
|
||||
|
||||
ASN1_STRING* opus_value = EncodedASN1::FromItem<asn1::SPCSpOpusInfo, asn1::i2d_SPCSpOpusInfo>(opus)
|
||||
.ToSequenceString();
|
||||
ASN1_STRING* opus_value =
|
||||
EncodedASN1::FromItem<asn1::SPCSpOpusInfo,
|
||||
asn1::i2d_SPCSpOpusInfo>(opus)
|
||||
.ToSequenceString();
|
||||
|
||||
if (!PKCS7_add_signed_attribute(
|
||||
p_signer_info,
|
||||
@ -1237,8 +1237,9 @@ Error AppxPackager::add_attributes(PKCS7_SIGNER_INFO * p_signer_info) {
|
||||
|
||||
statement_type->type = OBJ_nid2obj(NID_ms_code_ind);
|
||||
ASN1_STRING* statement_type_value =
|
||||
EncodedASN1::FromItem<asn1::SPCStatementType, asn1::i2d_SPCStatementType>(statement_type)
|
||||
.ToSequenceString();
|
||||
EncodedASN1::FromItem<asn1::SPCStatementType,
|
||||
asn1::i2d_SPCStatementType>(statement_type)
|
||||
.ToSequenceString();
|
||||
|
||||
if (!PKCS7_add_signed_attribute(
|
||||
p_signer_info,
|
||||
|
@ -33,10 +33,12 @@
|
||||
|
||||
ref class JoypadUWP sealed {
|
||||
|
||||
/** clang-format breaks this, it does not understand this token. */
|
||||
/* clang-format off */
|
||||
internal:
|
||||
|
||||
void register_events();
|
||||
uint32_t process_controllers(uint32_t p_last_id);
|
||||
/* clang-format on */
|
||||
|
||||
JoypadUWP();
|
||||
JoypadUWP(InputDefault* p_input);
|
||||
|
@ -157,9 +157,12 @@ private:
|
||||
void on_magnetometer_reading_changed(Windows::Devices::Sensors::Magnetometer^ sender, Windows::Devices::Sensors::MagnetometerReadingChangedEventArgs^ args);
|
||||
void on_gyroscope_reading_changed(Windows::Devices::Sensors::Gyrometer^ sender, Windows::Devices::Sensors::GyrometerReadingChangedEventArgs^ args);
|
||||
|
||||
/** clang-format breaks this, it does not understand this token. */
|
||||
/* clang-format off */
|
||||
internal:
|
||||
ManagedType() { alert_close_handle = false; }
|
||||
property OSUWP* os;
|
||||
/* clang-format on */
|
||||
};
|
||||
ManagedType^ managed_object;
|
||||
Windows::Devices::Sensors::Accelerometer^ accelerometer;
|
||||
|
@ -249,7 +249,7 @@ BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE* instance, void
|
||||
|
||||
|
||||
JoypadWindows* self = (JoypadWindows*)pContext;
|
||||
if (self->is_xinput_device(&instance->guidProduct)) {;
|
||||
if (self->is_xinput_device(&instance->guidProduct)) {
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
self->setup_dinput_joypad(instance);
|
||||
|
@ -545,11 +545,10 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
|
||||
}
|
||||
}
|
||||
|
||||
if (XGrabPointer(x11_display, x11_window, True,
|
||||
ButtonPressMask | ButtonReleaseMask |
|
||||
PointerMotionMask, GrabModeAsync, GrabModeAsync,
|
||||
x11_window, None, CurrentTime) !=
|
||||
GrabSuccess) {
|
||||
if (XGrabPointer(
|
||||
x11_display, x11_window, True,
|
||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||
GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime) != GrabSuccess) {
|
||||
ERR_PRINT("NO GRAB");
|
||||
}
|
||||
|
||||
@ -1290,10 +1289,10 @@ void OS_X11::process_xevents() {
|
||||
minimized = false;
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
|
||||
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
||||
XGrabPointer(x11_display, x11_window, True,
|
||||
ButtonPressMask | ButtonReleaseMask |
|
||||
PointerMotionMask, GrabModeAsync, GrabModeAsync,
|
||||
x11_window, None, CurrentTime);
|
||||
XGrabPointer(
|
||||
x11_display, x11_window, True,
|
||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||
GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -156,7 +156,7 @@ RID VisualServer::_make_test_cube() {
|
||||
PoolVector<Vector3> uvs;
|
||||
|
||||
int vtx_idx=0;
|
||||
#define ADD_VTX(m_idx);\
|
||||
#define ADD_VTX(m_idx) \
|
||||
vertices.push_back( face_points[m_idx] );\
|
||||
normals.push_back( normal_points[m_idx] );\
|
||||
tangents.push_back( normal_points[m_idx][1] );\
|
||||
|
@ -5520,7 +5520,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
FileAccess::set_backup_save(true);
|
||||
|
||||
PathRemap::get_singleton()->clear_remaps();; //editor uses no remaps
|
||||
PathRemap::get_singleton()->clear_remaps(); //editor uses no remaps
|
||||
TranslationServer::get_singleton()->set_enabled(false);
|
||||
// load settings
|
||||
if (!EditorSettings::get_singleton())
|
||||
|
@ -286,7 +286,8 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi
|
||||
Vector<Vector3> normals;
|
||||
|
||||
int vtx_idx=0;
|
||||
#define ADD_VTX(m_idx);\
|
||||
|
||||
#define ADD_VTX(m_idx) \
|
||||
vertices.push_back( (face_points[m_idx]*HANDLE_HALF_SIZE+p_handles[ih]) );\
|
||||
normals.push_back( normal_points[m_idx] );\
|
||||
vtx_idx++;\
|
||||
@ -3437,7 +3438,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
|
||||
PoolVector<Vector3> vertices;
|
||||
|
||||
#undef ADD_VTX
|
||||
#define ADD_VTX(m_idx);\
|
||||
#define ADD_VTX(m_idx) \
|
||||
vertices.push_back( face_points[m_idx] );
|
||||
|
||||
for (int i=0;i<6;i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user