Initialize class/struct variables with default values in modules/
This commit is contained in:
parent
57e2822a05
commit
f7209b459b
@ -207,7 +207,6 @@ Vector<uint8_t> TextureBasisU::get_basisu_data() const {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TextureBasisU::TextureBasisU() {
|
TextureBasisU::TextureBasisU() {
|
||||||
flags = FLAGS_DEFAULT;
|
|
||||||
texture = RenderingServer::get_singleton()->texture_create();
|
texture = RenderingServer::get_singleton()->texture_create();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class TextureBasisU : public Texture {
|
|||||||
RID texture;
|
RID texture;
|
||||||
Size2 tex_size;
|
Size2 tex_size;
|
||||||
|
|
||||||
uint32_t flags;
|
uint32_t flags = FLAGS_DEFAULT;
|
||||||
|
|
||||||
Vector<uint8_t> data;
|
Vector<uint8_t> data;
|
||||||
|
|
||||||
|
@ -55,24 +55,24 @@ protected:
|
|||||||
|
|
||||||
struct bmp_header_s {
|
struct bmp_header_s {
|
||||||
struct bmp_file_header_s {
|
struct bmp_file_header_s {
|
||||||
uint16_t bmp_signature;
|
uint16_t bmp_signature = 0;
|
||||||
uint32_t bmp_file_size;
|
uint32_t bmp_file_size = 0;
|
||||||
uint32_t bmp_file_padding;
|
uint32_t bmp_file_padding = 0;
|
||||||
uint32_t bmp_file_offset;
|
uint32_t bmp_file_offset = 0;
|
||||||
} bmp_file_header;
|
} bmp_file_header;
|
||||||
|
|
||||||
struct bmp_info_header_s {
|
struct bmp_info_header_s {
|
||||||
uint32_t bmp_header_size;
|
uint32_t bmp_header_size = 0;
|
||||||
uint32_t bmp_width;
|
uint32_t bmp_width = 0;
|
||||||
uint32_t bmp_height;
|
uint32_t bmp_height = 0;
|
||||||
uint16_t bmp_planes;
|
uint16_t bmp_planes = 0;
|
||||||
uint16_t bmp_bit_count;
|
uint16_t bmp_bit_count = 0;
|
||||||
uint32_t bmp_compression;
|
uint32_t bmp_compression = 0;
|
||||||
uint32_t bmp_size_image;
|
uint32_t bmp_size_image = 0;
|
||||||
uint32_t bmp_pixels_per_meter_x;
|
uint32_t bmp_pixels_per_meter_x = 0;
|
||||||
uint32_t bmp_pixels_per_meter_y;
|
uint32_t bmp_pixels_per_meter_y = 0;
|
||||||
uint32_t bmp_colors_used;
|
uint32_t bmp_colors_used = 0;
|
||||||
uint32_t bmp_important_colors;
|
uint32_t bmp_important_colors = 0;
|
||||||
} bmp_info_header;
|
} bmp_info_header;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,18 +80,18 @@ public:
|
|||||||
private:
|
private:
|
||||||
// These are used by function callEvent. Instead to create this each call I create if one time.
|
// These are used by function callEvent. Instead to create this each call I create if one time.
|
||||||
Variant call_event_res[5];
|
Variant call_event_res[5];
|
||||||
Variant *call_event_res_ptr[5];
|
Variant *call_event_res_ptr[5] = {};
|
||||||
|
|
||||||
btGhostObject *btGhost;
|
btGhostObject *btGhost = nullptr;
|
||||||
Vector<OverlappingObjectData> overlappingObjects;
|
Vector<OverlappingObjectData> overlappingObjects;
|
||||||
bool monitorable = true;
|
bool monitorable = true;
|
||||||
|
|
||||||
PhysicsServer3D::AreaSpaceOverrideMode spOv_mode = PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
|
PhysicsServer3D::AreaSpaceOverrideMode spOv_mode = PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
|
||||||
bool spOv_gravityPoint = false;
|
bool spOv_gravityPoint = false;
|
||||||
real_t spOv_gravityPointDistanceScale = 0;
|
real_t spOv_gravityPointDistanceScale = 0.0;
|
||||||
real_t spOv_gravityPointAttenuation = 1;
|
real_t spOv_gravityPointAttenuation = 1.0;
|
||||||
Vector3 spOv_gravityVec = Vector3(0, -1, 0);
|
Vector3 spOv_gravityVec = Vector3(0, -1, 0);
|
||||||
real_t spOv_gravityMag = 10;
|
real_t spOv_gravityMag = 10.0;
|
||||||
real_t spOv_linearDump = 0.1;
|
real_t spOv_linearDump = 0.1;
|
||||||
real_t spOv_angularDump = 0.1;
|
real_t spOv_angularDump = 0.1;
|
||||||
int spOv_priority = 0;
|
int spOv_priority = 0;
|
||||||
|
@ -39,11 +39,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
btRayShape::btRayShape(btScalar length) :
|
btRayShape::btRayShape(btScalar length) :
|
||||||
btConvexInternalShape(),
|
btConvexInternalShape() {
|
||||||
m_shapeAxis(0, 0, 1) {
|
|
||||||
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
|
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
|
||||||
setLength(length);
|
setLength(length);
|
||||||
slipsOnSlope = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
btRayShape::~btRayShape() {
|
btRayShape::~btRayShape() {
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
/// Ray shape around z axis
|
/// Ray shape around z axis
|
||||||
ATTRIBUTE_ALIGNED16(class)
|
ATTRIBUTE_ALIGNED16(class)
|
||||||
btRayShape : public btConvexInternalShape {
|
btRayShape : public btConvexInternalShape {
|
||||||
btScalar m_length;
|
btScalar m_length = 0;
|
||||||
bool slipsOnSlope;
|
bool slipsOnSlope = false;
|
||||||
/// The default axis is the z
|
/// The default axis is the z
|
||||||
btVector3 m_shapeAxis;
|
btVector3 m_shapeAxis = btVector3(0, 0, 1);
|
||||||
|
|
||||||
btTransform m_cacheSupportPoint;
|
btTransform m_cacheSupportPoint;
|
||||||
btScalar m_cacheScaledLength;
|
btScalar m_cacheScaledLength;
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Type type;
|
Type type = TYPE_AREA;
|
||||||
ObjectID instance_id;
|
ObjectID instance_id;
|
||||||
uint32_t collisionLayer = 0;
|
uint32_t collisionLayer = 0;
|
||||||
uint32_t collisionMask = 0;
|
uint32_t collisionMask = 0;
|
||||||
|
@ -51,7 +51,7 @@ class GodotMotionState : public btMotionState {
|
|||||||
/// This data is used to store last world position
|
/// This data is used to store last world position
|
||||||
btTransform bodyCurrentWorldTransform;
|
btTransform bodyCurrentWorldTransform;
|
||||||
|
|
||||||
RigidBodyBullet *owner;
|
RigidBodyBullet *owner = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GodotMotionState(RigidBodyBullet *p_owner) :
|
GodotMotionState(RigidBodyBullet *p_owner) :
|
||||||
|
@ -45,7 +45,7 @@ class GodotRayWorldAlgorithm : public btActivatingCollisionAlgorithm {
|
|||||||
const btDiscreteDynamicsWorld *m_world;
|
const btDiscreteDynamicsWorld *m_world;
|
||||||
btPersistentManifold *m_manifoldPtr;
|
btPersistentManifold *m_manifoldPtr;
|
||||||
bool m_ownManifold = false;
|
bool m_ownManifold = false;
|
||||||
bool m_isSwapped;
|
bool m_isSwapped = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped);
|
GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped);
|
||||||
|
@ -59,8 +59,8 @@ struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResult
|
|||||||
bool m_pickRay = false;
|
bool m_pickRay = false;
|
||||||
int m_shapeId = 0;
|
int m_shapeId = 0;
|
||||||
|
|
||||||
bool collide_with_bodies;
|
bool collide_with_bodies = false;
|
||||||
bool collide_with_areas;
|
bool collide_with_areas = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||||
@ -84,8 +84,8 @@ public:
|
|||||||
// store all colliding object
|
// store all colliding object
|
||||||
struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback {
|
struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback {
|
||||||
public:
|
public:
|
||||||
PhysicsDirectSpaceState3D::ShapeResult *m_results;
|
PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
|
||||||
int m_resultMax;
|
int m_resultMax = 0;
|
||||||
const Set<RID> *m_exclude;
|
const Set<RID> *m_exclude;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@ -117,8 +117,8 @@ public:
|
|||||||
const Set<RID> *m_exclude;
|
const Set<RID> *m_exclude;
|
||||||
int m_shapeId = 0;
|
int m_shapeId = 0;
|
||||||
|
|
||||||
bool collide_with_bodies;
|
bool collide_with_bodies = false;
|
||||||
bool collide_with_areas;
|
bool collide_with_areas = false;
|
||||||
|
|
||||||
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||||
btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
|
btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
|
||||||
@ -134,13 +134,13 @@ public:
|
|||||||
struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
||||||
public:
|
public:
|
||||||
const btCollisionObject *m_self_object;
|
const btCollisionObject *m_self_object;
|
||||||
PhysicsDirectSpaceState3D::ShapeResult *m_results;
|
PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
|
||||||
int m_resultMax;
|
int m_resultMax = 0;
|
||||||
const Set<RID> *m_exclude;
|
const Set<RID> *m_exclude;
|
||||||
int m_count = 0;
|
int m_count = 0;
|
||||||
|
|
||||||
bool collide_with_bodies;
|
bool collide_with_bodies = false;
|
||||||
bool collide_with_areas;
|
bool collide_with_areas = false;
|
||||||
|
|
||||||
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||||
m_self_object(p_self_object),
|
m_self_object(p_self_object),
|
||||||
@ -159,13 +159,13 @@ public:
|
|||||||
struct GodotContactPairContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
struct GodotContactPairContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
||||||
public:
|
public:
|
||||||
const btCollisionObject *m_self_object;
|
const btCollisionObject *m_self_object;
|
||||||
Vector3 *m_results;
|
Vector3 *m_results = nullptr;
|
||||||
int m_resultMax;
|
int m_resultMax = 0;
|
||||||
const Set<RID> *m_exclude;
|
const Set<RID> *m_exclude;
|
||||||
int m_count = 0;
|
int m_count = 0;
|
||||||
|
|
||||||
bool collide_with_bodies;
|
bool collide_with_bodies = false;
|
||||||
bool collide_with_areas;
|
bool collide_with_areas = false;
|
||||||
|
|
||||||
GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||||
m_self_object(p_self_object),
|
m_self_object(p_self_object),
|
||||||
@ -183,14 +183,14 @@ public:
|
|||||||
struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
||||||
public:
|
public:
|
||||||
const btCollisionObject *m_self_object;
|
const btCollisionObject *m_self_object;
|
||||||
PhysicsDirectSpaceState3D::ShapeRestInfo *m_result;
|
PhysicsDirectSpaceState3D::ShapeRestInfo *m_result = nullptr;
|
||||||
const Set<RID> *m_exclude;
|
const Set<RID> *m_exclude;
|
||||||
bool m_collided = false;
|
bool m_collided = false;
|
||||||
real_t m_min_distance = 0;
|
real_t m_min_distance = 0.0;
|
||||||
const btCollisionObject *m_rest_info_collision_object;
|
const btCollisionObject *m_rest_info_collision_object = nullptr;
|
||||||
btVector3 m_rest_info_bt_point;
|
btVector3 m_rest_info_bt_point;
|
||||||
bool collide_with_bodies;
|
bool collide_with_bodies = false;
|
||||||
bool collide_with_areas;
|
bool collide_with_areas = false;
|
||||||
|
|
||||||
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||||
m_self_object(p_self_object),
|
m_self_object(p_self_object),
|
||||||
|
@ -41,7 +41,7 @@ class BulletPhysicsServer3D;
|
|||||||
|
|
||||||
class RIDBullet {
|
class RIDBullet {
|
||||||
RID self;
|
RID self;
|
||||||
BulletPhysicsServer3D *physicsServer;
|
BulletPhysicsServer3D *physicsServer = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
|
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
|
||||||
|
@ -81,8 +81,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RigidBodyBullet *body;
|
RigidBodyBullet *body = nullptr;
|
||||||
real_t deltaTime;
|
real_t deltaTime = 0.0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BulletPhysicsDirectBodyState3D() {}
|
BulletPhysicsDirectBodyState3D() {}
|
||||||
@ -144,13 +144,13 @@ public:
|
|||||||
class RigidBodyBullet : public RigidCollisionObjectBullet {
|
class RigidBodyBullet : public RigidCollisionObjectBullet {
|
||||||
public:
|
public:
|
||||||
struct CollisionData {
|
struct CollisionData {
|
||||||
RigidBodyBullet *otherObject;
|
RigidBodyBullet *otherObject = nullptr;
|
||||||
int other_object_shape;
|
int other_object_shape = 0;
|
||||||
int local_shape;
|
int local_shape = 0;
|
||||||
Vector3 hitLocalLocation;
|
Vector3 hitLocalLocation;
|
||||||
Vector3 hitWorldLocation;
|
Vector3 hitWorldLocation;
|
||||||
Vector3 hitNormal;
|
Vector3 hitNormal;
|
||||||
real_t appliedImpulse;
|
real_t appliedImpulse = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ForceIntegrationCallback {
|
struct ForceIntegrationCallback {
|
||||||
@ -169,7 +169,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KinematicUtilities {
|
struct KinematicUtilities {
|
||||||
RigidBodyBullet *owner;
|
RigidBodyBullet *owner = nullptr;
|
||||||
btScalar safe_margin;
|
btScalar safe_margin;
|
||||||
Vector<KinematicShape> shapes;
|
Vector<KinematicShape> shapes;
|
||||||
|
|
||||||
@ -194,10 +194,10 @@ private:
|
|||||||
GodotMotionState *godotMotionState;
|
GodotMotionState *godotMotionState;
|
||||||
btRigidBody *btBody;
|
btRigidBody *btBody;
|
||||||
uint16_t locked_axis = 0;
|
uint16_t locked_axis = 0;
|
||||||
real_t mass = 1;
|
real_t mass = 1.0;
|
||||||
real_t gravity_scale = 1;
|
real_t gravity_scale = 1.0;
|
||||||
real_t linearDamp = 0;
|
real_t linearDamp = 0.0;
|
||||||
real_t angularDamp = 0;
|
real_t angularDamp = 0.0;
|
||||||
bool can_sleep = true;
|
bool can_sleep = true;
|
||||||
bool omit_forces_integration = false;
|
bool omit_forces_integration = false;
|
||||||
bool can_integrate_forces = false;
|
bool can_integrate_forces = false;
|
||||||
|
@ -213,10 +213,10 @@ private:
|
|||||||
class HeightMapShapeBullet : public ShapeBullet {
|
class HeightMapShapeBullet : public ShapeBullet {
|
||||||
public:
|
public:
|
||||||
Vector<real_t> heights;
|
Vector<real_t> heights;
|
||||||
int width;
|
int width = 0;
|
||||||
int depth;
|
int depth = 0;
|
||||||
real_t min_height;
|
real_t min_height = 0.0;
|
||||||
real_t max_height;
|
real_t max_height = 0.0;
|
||||||
|
|
||||||
HeightMapShapeBullet();
|
HeightMapShapeBullet();
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ private:
|
|||||||
|
|
||||||
class RayShapeBullet : public ShapeBullet {
|
class RayShapeBullet : public ShapeBullet {
|
||||||
public:
|
public:
|
||||||
real_t length = 1;
|
real_t length = 1.0;
|
||||||
bool slips_on_slope = false;
|
bool slips_on_slope = false;
|
||||||
|
|
||||||
RayShapeBullet();
|
RayShapeBullet();
|
||||||
|
@ -59,7 +59,7 @@ class SoftBodyBullet : public CollisionObjectBullet {
|
|||||||
private:
|
private:
|
||||||
btSoftBody *bt_soft_body = nullptr;
|
btSoftBody *bt_soft_body = nullptr;
|
||||||
Vector<Vector<int>> indices_table;
|
Vector<Vector<int>> indices_table;
|
||||||
btSoftBody::Material *mat0; // This is just a copy of pointer managed by btSoftBody
|
btSoftBody::Material *mat0 = nullptr; // This is just a copy of pointer managed by btSoftBody
|
||||||
bool isScratched = false;
|
bool isScratched = false;
|
||||||
|
|
||||||
Ref<Mesh> soft_mesh;
|
Ref<Mesh> soft_mesh;
|
||||||
|
@ -1092,13 +1092,13 @@ private:
|
|||||||
btDbvtVolume bounds;
|
btDbvtVolume bounds;
|
||||||
|
|
||||||
const btCollisionObject *self_collision_object;
|
const btCollisionObject *self_collision_object;
|
||||||
uint32_t collision_layer;
|
uint32_t collision_layer = 0;
|
||||||
uint32_t collision_mask;
|
uint32_t collision_mask = 0;
|
||||||
|
|
||||||
struct CompoundLeafCallback : btDbvt::ICollide {
|
struct CompoundLeafCallback : btDbvt::ICollide {
|
||||||
private:
|
private:
|
||||||
RecoverPenetrationBroadPhaseCallback *parent_callback;
|
RecoverPenetrationBroadPhaseCallback *parent_callback = nullptr;
|
||||||
btCollisionObject *collision_object;
|
btCollisionObject *collision_object = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompoundLeafCallback(RecoverPenetrationBroadPhaseCallback *p_parent_callback, btCollisionObject *p_collision_object) :
|
CompoundLeafCallback(RecoverPenetrationBroadPhaseCallback *p_parent_callback, btCollisionObject *p_collision_object) :
|
||||||
@ -1116,8 +1116,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct BroadphaseResult {
|
struct BroadphaseResult {
|
||||||
btCollisionObject *collision_object;
|
btCollisionObject *collision_object = nullptr;
|
||||||
int compound_child_index;
|
int compound_child_index = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<BroadphaseResult> results;
|
Vector<BroadphaseResult> results;
|
||||||
|
@ -100,12 +100,12 @@ class SpaceBullet : public RIDBullet {
|
|||||||
btGhostPairCallback *ghostPairCallback = nullptr;
|
btGhostPairCallback *ghostPairCallback = nullptr;
|
||||||
GodotFilterCallback *godotFilterCallback = nullptr;
|
GodotFilterCallback *godotFilterCallback = nullptr;
|
||||||
|
|
||||||
btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver;
|
btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver = nullptr;
|
||||||
btVoronoiSimplexSolver *gjk_simplex_solver;
|
btVoronoiSimplexSolver *gjk_simplex_solver = nullptr;
|
||||||
|
|
||||||
BulletPhysicsDirectSpaceState *direct_access;
|
BulletPhysicsDirectSpaceState *direct_access;
|
||||||
Vector3 gravityDirection = Vector3(0, -1, 0);
|
Vector3 gravityDirection = Vector3(0, -1, 0);
|
||||||
real_t gravityMagnitude = 10;
|
real_t gravityMagnitude = 10.0;
|
||||||
|
|
||||||
real_t linear_damp = 0.0;
|
real_t linear_damp = 0.0;
|
||||||
real_t angular_damp = 0.0;
|
real_t angular_damp = 0.0;
|
||||||
|
@ -48,9 +48,9 @@ struct CSGBrush {
|
|||||||
Vector3 vertices[3];
|
Vector3 vertices[3];
|
||||||
Vector2 uvs[3];
|
Vector2 uvs[3];
|
||||||
AABB aabb;
|
AABB aabb;
|
||||||
bool smooth;
|
bool smooth = false;
|
||||||
bool invert;
|
bool invert = false;
|
||||||
int material;
|
int material = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Face> faces;
|
Vector<Face> faces;
|
||||||
@ -74,20 +74,20 @@ struct CSGBrushOperation {
|
|||||||
|
|
||||||
struct MeshMerge {
|
struct MeshMerge {
|
||||||
struct Face {
|
struct Face {
|
||||||
bool from_b;
|
bool from_b = false;
|
||||||
bool inside;
|
bool inside = false;
|
||||||
int points[3];
|
int points[3] = {};
|
||||||
Vector2 uvs[3];
|
Vector2 uvs[3];
|
||||||
bool smooth;
|
bool smooth = false;
|
||||||
bool invert;
|
bool invert = false;
|
||||||
int material_idx;
|
int material_idx = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FaceBVH {
|
struct FaceBVH {
|
||||||
int face;
|
int face = 0;
|
||||||
int left;
|
int left = 0;
|
||||||
int right;
|
int right = 0;
|
||||||
int next;
|
int next = 0;
|
||||||
Vector3 center;
|
Vector3 center;
|
||||||
AABB aabb;
|
AABB aabb;
|
||||||
};
|
};
|
||||||
@ -142,7 +142,7 @@ struct CSGBrushOperation {
|
|||||||
Map<Ref<Material>, int> materials;
|
Map<Ref<Material>, int> materials;
|
||||||
Map<Vector3, int> vertex_map;
|
Map<Vector3, int> vertex_map;
|
||||||
OAHashMap<VertexKey, int, VertexKeyHash> snap_cache;
|
OAHashMap<VertexKey, int, VertexKeyHash> snap_cache;
|
||||||
float vertex_snap;
|
float vertex_snap = 0.0;
|
||||||
|
|
||||||
inline void _add_distance(List<real_t> &r_intersectionsA, List<real_t> &r_intersectionsB, bool p_from_B, real_t p_distance) const;
|
inline void _add_distance(List<real_t> &r_intersectionsA, List<real_t> &r_intersectionsB, bool p_from_B, real_t p_distance) const;
|
||||||
inline bool _bvh_inside(FaceBVH *facebvhptr, int p_max_depth, int p_bvh_first, int p_face_idx) const;
|
inline bool _bvh_inside(FaceBVH *facebvhptr, int p_max_depth, int p_bvh_first, int p_face_idx) const;
|
||||||
@ -159,7 +159,7 @@ struct CSGBrushOperation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Face2D {
|
struct Face2D {
|
||||||
int vertex_idx[3];
|
int vertex_idx[3] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Vertex2D> vertices;
|
Vector<Vertex2D> vertices;
|
||||||
@ -167,7 +167,7 @@ struct CSGBrushOperation {
|
|||||||
Plane plane;
|
Plane plane;
|
||||||
Transform to_2D;
|
Transform to_2D;
|
||||||
Transform to_3D;
|
Transform to_3D;
|
||||||
float vertex_snap2;
|
float vertex_snap2 = 0.0;
|
||||||
|
|
||||||
inline int _get_point_idx(const Vector2 &p_point);
|
inline int _get_point_idx(const Vector2 &p_point);
|
||||||
inline int _add_vertex(const Vertex2D &p_vertex);
|
inline int _add_vertex(const Vertex2D &p_vertex);
|
||||||
|
@ -625,15 +625,6 @@ void CSGShape3D::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSGShape3D::CSGShape3D() {
|
CSGShape3D::CSGShape3D() {
|
||||||
operation = OPERATION_UNION;
|
|
||||||
parent = nullptr;
|
|
||||||
brush = nullptr;
|
|
||||||
dirty = false;
|
|
||||||
snap = 0.001;
|
|
||||||
use_collision = false;
|
|
||||||
collision_layer = 1;
|
|
||||||
collision_mask = 1;
|
|
||||||
calculate_tangents = true;
|
|
||||||
set_notify_local_transform(true);
|
set_notify_local_transform(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,23 +50,23 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Operation operation;
|
Operation operation = OPERATION_UNION;
|
||||||
CSGShape3D *parent;
|
CSGShape3D *parent = nullptr;
|
||||||
|
|
||||||
CSGBrush *brush;
|
CSGBrush *brush = nullptr;
|
||||||
|
|
||||||
AABB node_aabb;
|
AABB node_aabb;
|
||||||
|
|
||||||
bool dirty;
|
bool dirty = false;
|
||||||
float snap;
|
float snap = 0.001;
|
||||||
|
|
||||||
bool use_collision;
|
bool use_collision = false;
|
||||||
uint32_t collision_layer;
|
uint32_t collision_layer = 1;
|
||||||
uint32_t collision_mask;
|
uint32_t collision_mask = 1;
|
||||||
Ref<ConcavePolygonShape3D> root_collision_shape;
|
Ref<ConcavePolygonShape3D> root_collision_shape;
|
||||||
RID root_collision_instance;
|
RID root_collision_instance;
|
||||||
|
|
||||||
bool calculate_tangents;
|
bool calculate_tangents = true;
|
||||||
|
|
||||||
Ref<ArrayMesh> root_mesh;
|
Ref<ArrayMesh> root_mesh;
|
||||||
|
|
||||||
@ -85,12 +85,12 @@ private:
|
|||||||
Vector<Vector2> uvs;
|
Vector<Vector2> uvs;
|
||||||
Vector<float> tans;
|
Vector<float> tans;
|
||||||
Ref<Material> material;
|
Ref<Material> material;
|
||||||
int last_added;
|
int last_added = 0;
|
||||||
|
|
||||||
Vector3 *verticesw;
|
Vector3 *verticesw = nullptr;
|
||||||
Vector3 *normalsw;
|
Vector3 *normalsw = nullptr;
|
||||||
Vector2 *uvsw;
|
Vector2 *uvsw = nullptr;
|
||||||
float *tansw;
|
float *tansw = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
//mikktspace callbacks
|
//mikktspace callbacks
|
||||||
|
@ -37,26 +37,26 @@
|
|||||||
#include <ConvectionKernels.h>
|
#include <ConvectionKernels.h>
|
||||||
|
|
||||||
struct CVTTCompressionJobParams {
|
struct CVTTCompressionJobParams {
|
||||||
bool is_hdr;
|
bool is_hdr = false;
|
||||||
bool is_signed;
|
bool is_signed = false;
|
||||||
int bytes_per_pixel;
|
int bytes_per_pixel = 0;
|
||||||
|
|
||||||
cvtt::Options options;
|
cvtt::Options options;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CVTTCompressionRowTask {
|
struct CVTTCompressionRowTask {
|
||||||
const uint8_t *in_mm_bytes;
|
const uint8_t *in_mm_bytes;
|
||||||
uint8_t *out_mm_bytes;
|
uint8_t *out_mm_bytes = nullptr;
|
||||||
int y_start;
|
int y_start = 0;
|
||||||
int width;
|
int width = 0;
|
||||||
int height;
|
int height = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CVTTCompressionJobQueue {
|
struct CVTTCompressionJobQueue {
|
||||||
CVTTCompressionJobParams job_params;
|
CVTTCompressionJobParams job_params;
|
||||||
const CVTTCompressionRowTask *job_tasks;
|
const CVTTCompressionRowTask *job_tasks;
|
||||||
uint32_t num_tasks;
|
uint32_t num_tasks = 0;
|
||||||
uint32_t current_task;
|
uint32_t current_task = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const CVTTCompressionRowTask &p_row_task) {
|
static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const CVTTCompressionRowTask &p_row_task) {
|
||||||
|
@ -69,11 +69,11 @@ enum DDSFormat {
|
|||||||
|
|
||||||
struct DDSFormatInfo {
|
struct DDSFormatInfo {
|
||||||
const char *name;
|
const char *name;
|
||||||
bool compressed;
|
bool compressed = false;
|
||||||
bool palette;
|
bool palette = false;
|
||||||
uint32_t divisor;
|
uint32_t divisor = 0;
|
||||||
uint32_t block_size;
|
uint32_t block_size = 0;
|
||||||
Image::Format format;
|
Image::Format format = Image::Format::FORMAT_BPTC_RGBA;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DDSFormatInfo dds_format_info[DDS_MAX] = {
|
static const DDSFormatInfo dds_format_info[DDS_MAX] = {
|
||||||
|
@ -866,28 +866,12 @@ void NetworkedMultiplayerENet::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
|
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
|
||||||
active = false;
|
|
||||||
server = false;
|
|
||||||
refuse_connections = false;
|
|
||||||
server_relay = true;
|
|
||||||
unique_id = 0;
|
|
||||||
target_peer = 0;
|
|
||||||
current_packet.packet = nullptr;
|
|
||||||
transfer_mode = TRANSFER_MODE_RELIABLE;
|
|
||||||
channel_count = SYSCH_MAX;
|
|
||||||
transfer_channel = -1;
|
|
||||||
always_ordered = false;
|
|
||||||
connection_status = CONNECTION_DISCONNECTED;
|
|
||||||
compression_mode = COMPRESS_NONE;
|
|
||||||
enet_compressor.context = this;
|
enet_compressor.context = this;
|
||||||
enet_compressor.compress = enet_compress;
|
enet_compressor.compress = enet_compress;
|
||||||
enet_compressor.decompress = enet_decompress;
|
enet_compressor.decompress = enet_decompress;
|
||||||
enet_compressor.destroy = enet_compressor_destroy;
|
enet_compressor.destroy = enet_compressor_destroy;
|
||||||
|
|
||||||
bind_ip = IP_Address("*");
|
bind_ip = IP_Address("*");
|
||||||
|
|
||||||
dtls_enabled = false;
|
|
||||||
dtls_verify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkedMultiplayerENet::~NetworkedMultiplayerENet() {
|
NetworkedMultiplayerENet::~NetworkedMultiplayerENet() {
|
||||||
|
@ -62,35 +62,35 @@ private:
|
|||||||
SYSCH_MAX
|
SYSCH_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
bool active;
|
bool active = false;
|
||||||
bool server;
|
bool server = false;
|
||||||
|
|
||||||
uint32_t unique_id;
|
uint32_t unique_id = 0;
|
||||||
|
|
||||||
int target_peer;
|
int target_peer = 0;
|
||||||
TransferMode transfer_mode;
|
TransferMode transfer_mode = TRANSFER_MODE_RELIABLE;
|
||||||
int transfer_channel;
|
int transfer_channel = -1;
|
||||||
int channel_count;
|
int channel_count = SYSCH_MAX;
|
||||||
bool always_ordered;
|
bool always_ordered = false;
|
||||||
|
|
||||||
ENetEvent event;
|
ENetEvent event;
|
||||||
ENetPeer *peer;
|
ENetPeer *peer = nullptr;
|
||||||
ENetHost *host;
|
ENetHost *host = nullptr;
|
||||||
|
|
||||||
bool refuse_connections;
|
bool refuse_connections = false;
|
||||||
bool server_relay;
|
bool server_relay = true;
|
||||||
|
|
||||||
ConnectionStatus connection_status;
|
ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
|
||||||
|
|
||||||
Map<int, ENetPeer *> peer_map;
|
Map<int, ENetPeer *> peer_map;
|
||||||
|
|
||||||
struct Packet {
|
struct Packet {
|
||||||
ENetPacket *packet;
|
ENetPacket *packet = nullptr;
|
||||||
int from;
|
int from = 0;
|
||||||
int channel;
|
int channel = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
CompressionMode compression_mode;
|
CompressionMode compression_mode = COMPRESS_NONE;
|
||||||
|
|
||||||
List<Packet> incoming_packets;
|
List<Packet> incoming_packets;
|
||||||
|
|
||||||
@ -110,10 +110,10 @@ private:
|
|||||||
|
|
||||||
IP_Address bind_ip;
|
IP_Address bind_ip;
|
||||||
|
|
||||||
bool dtls_enabled;
|
bool dtls_enabled = false;
|
||||||
Ref<CryptoKey> dtls_key;
|
Ref<CryptoKey> dtls_key;
|
||||||
Ref<X509Certificate> dtls_cert;
|
Ref<X509Certificate> dtls_cert;
|
||||||
bool dtls_verify;
|
bool dtls_verify = true;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
|
|
||||||
struct ETC1Header {
|
struct ETC1Header {
|
||||||
char tag[6]; // "PKM 10"
|
char tag[6]; // "PKM 10"
|
||||||
uint16_t format; // Format == number of mips (== zero)
|
uint16_t format = 0; // Format == number of mips (== zero)
|
||||||
uint16_t texWidth; // Texture dimensions, multiple of 4 (big-endian)
|
uint16_t texWidth = 0; // Texture dimensions, multiple of 4 (big-endian)
|
||||||
uint16_t texHeight;
|
uint16_t texHeight = 0;
|
||||||
uint16_t origWidth; // Original dimensions (big-endian)
|
uint16_t origWidth = 0; // Original dimensions (big-endian)
|
||||||
uint16_t origHeight;
|
uint16_t origHeight = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
||||||
|
@ -95,9 +95,9 @@ public:
|
|||||||
class GDNativeLibraryEditorPlugin : public EditorPlugin {
|
class GDNativeLibraryEditorPlugin : public EditorPlugin {
|
||||||
GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin);
|
GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin);
|
||||||
|
|
||||||
GDNativeLibraryEditor *library_editor;
|
GDNativeLibraryEditor *library_editor = nullptr;
|
||||||
EditorNode *editor;
|
EditorNode *editor = nullptr;
|
||||||
Button *button;
|
Button *button = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_name() const override { return "GDNativeLibrary"; }
|
virtual String get_name() const override { return "GDNativeLibrary"; }
|
||||||
|
@ -1196,13 +1196,6 @@ void NativeScriptLanguage::_unload_stuff(bool p_reload) {
|
|||||||
|
|
||||||
NativeScriptLanguage::NativeScriptLanguage() {
|
NativeScriptLanguage::NativeScriptLanguage() {
|
||||||
NativeScriptLanguage::singleton = this;
|
NativeScriptLanguage::singleton = this;
|
||||||
#ifndef NO_THREADS
|
|
||||||
has_objects_to_register = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
profiling = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_init_call_type = "nativescript_init";
|
_init_call_type = "nativescript_init";
|
||||||
_init_call_name = "nativescript_init";
|
_init_call_name = "nativescript_init";
|
||||||
|
@ -51,8 +51,8 @@ struct NativeScriptDesc {
|
|||||||
struct Method {
|
struct Method {
|
||||||
godot_nativescript_instance_method method;
|
godot_nativescript_instance_method method;
|
||||||
MethodInfo info;
|
MethodInfo info;
|
||||||
int rpc_mode;
|
int rpc_mode = 0;
|
||||||
uint16_t rpc_method_id;
|
uint16_t rpc_method_id = 0;
|
||||||
String documentation;
|
String documentation;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ struct NativeScriptDesc {
|
|||||||
godot_nativescript_property_get_func getter;
|
godot_nativescript_property_get_func getter;
|
||||||
PropertyInfo info;
|
PropertyInfo info;
|
||||||
Variant default_value;
|
Variant default_value;
|
||||||
int rset_mode;
|
int rset_mode = 0;
|
||||||
uint16_t rset_property_id;
|
uint16_t rset_property_id;
|
||||||
String documentation;
|
String documentation;
|
||||||
};
|
};
|
||||||
@ -78,7 +78,7 @@ struct NativeScriptDesc {
|
|||||||
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
|
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
|
||||||
StringName base;
|
StringName base;
|
||||||
StringName base_native_type;
|
StringName base_native_type;
|
||||||
NativeScriptDesc *base_data;
|
NativeScriptDesc *base_data = nullptr;
|
||||||
godot_nativescript_instance_create_func create_func;
|
godot_nativescript_instance_create_func create_func;
|
||||||
godot_nativescript_instance_destroy_func destroy_func;
|
godot_nativescript_instance_destroy_func destroy_func;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ struct NativeScriptDesc {
|
|||||||
|
|
||||||
const void *type_tag = nullptr;
|
const void *type_tag = nullptr;
|
||||||
|
|
||||||
bool is_tool;
|
bool is_tool = false;
|
||||||
|
|
||||||
inline NativeScriptDesc() {
|
inline NativeScriptDesc() {
|
||||||
zeromem(&create_func, sizeof(godot_nativescript_instance_create_func));
|
zeromem(&create_func, sizeof(godot_nativescript_instance_create_func));
|
||||||
@ -254,7 +254,7 @@ class NativeScriptLanguage : public ScriptLanguage {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static NativeScriptLanguage *singleton;
|
static NativeScriptLanguage *singleton;
|
||||||
int lang_idx;
|
int lang_idx = 0;
|
||||||
|
|
||||||
void _unload_stuff(bool p_reload = false);
|
void _unload_stuff(bool p_reload = false);
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ private:
|
|||||||
#ifndef NO_THREADS
|
#ifndef NO_THREADS
|
||||||
Set<Ref<GDNativeLibrary>> libs_to_init;
|
Set<Ref<GDNativeLibrary>> libs_to_init;
|
||||||
Set<NativeScript *> scripts_to_register;
|
Set<NativeScript *> scripts_to_register;
|
||||||
volatile bool has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed
|
volatile bool has_objects_to_register = false; // so that we don't lock mutex every frame - it's rarely needed
|
||||||
void defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script);
|
void defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -279,19 +279,19 @@ private:
|
|||||||
|
|
||||||
struct ProfileData {
|
struct ProfileData {
|
||||||
StringName signature;
|
StringName signature;
|
||||||
uint64_t call_count;
|
uint64_t call_count = 0;
|
||||||
uint64_t self_time;
|
uint64_t self_time = 0;
|
||||||
uint64_t total_time;
|
uint64_t total_time = 0;
|
||||||
uint64_t frame_call_count;
|
uint64_t frame_call_count = 0;
|
||||||
uint64_t frame_self_time;
|
uint64_t frame_self_time = 0;
|
||||||
uint64_t frame_total_time;
|
uint64_t frame_total_time = 0;
|
||||||
uint64_t last_frame_call_count;
|
uint64_t last_frame_call_count = 0;
|
||||||
uint64_t last_frame_self_time;
|
uint64_t last_frame_self_time = 0;
|
||||||
uint64_t last_frame_total_time;
|
uint64_t last_frame_total_time = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<StringName, ProfileData> profile_data;
|
Map<StringName, ProfileData> profile_data;
|
||||||
bool profiling;
|
bool profiling = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// These two maps must only be touched on the main thread
|
// These two maps must only be touched on the main thread
|
||||||
|
@ -44,10 +44,10 @@ class PluginScriptInstance : public ScriptInstance {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<PluginScript> _script;
|
Ref<PluginScript> _script;
|
||||||
Object *_owner;
|
Object *_owner = nullptr;
|
||||||
Variant _owner_variant;
|
Variant _owner_variant;
|
||||||
godot_pluginscript_instance_data *_data;
|
godot_pluginscript_instance_data *_data = nullptr;
|
||||||
const godot_pluginscript_instance_desc *_desc;
|
const godot_pluginscript_instance_desc *_desc = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_FORCE_INLINE_ Object *get_owner() { return _owner; }
|
_FORCE_INLINE_ Object *get_owner() { return _owner; }
|
||||||
|
@ -118,7 +118,7 @@ class VideoStreamPlaybackGDNative : public VideoStreamPlayback {
|
|||||||
AudioMixCallback mix_callback = nullptr;
|
AudioMixCallback mix_callback = nullptr;
|
||||||
|
|
||||||
int num_channels = -1;
|
int num_channels = -1;
|
||||||
float time = 0;
|
float time = 0.0;
|
||||||
bool seek_backward = false;
|
bool seek_backward = false;
|
||||||
int mix_rate = 0;
|
int mix_rate = 0;
|
||||||
double delay_compensation = 0;
|
double delay_compensation = 0;
|
||||||
|
@ -51,7 +51,7 @@ union PointKey {
|
|||||||
int64_t z : 21;
|
int64_t z : 21;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t key;
|
uint64_t key = 0;
|
||||||
bool operator<(const PointKey &p_key) const { return key < p_key.key; }
|
bool operator<(const PointKey &p_key) const { return key < p_key.key; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,8 +86,6 @@ struct Edge {
|
|||||||
|
|
||||||
/// The other `Polygon` at this edge id has this `Polygon`.
|
/// The other `Polygon` at this edge id has this `Polygon`.
|
||||||
int other_edge = -1;
|
int other_edge = -1;
|
||||||
|
|
||||||
Edge() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Polygon {
|
struct Polygon {
|
||||||
@ -111,8 +109,6 @@ struct Connection {
|
|||||||
int A_edge = -1;
|
int A_edge = -1;
|
||||||
Polygon *B = nullptr;
|
Polygon *B = nullptr;
|
||||||
int B_edge = -1;
|
int B_edge = -1;
|
||||||
|
|
||||||
Connection() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NavigationPoly {
|
struct NavigationPoly {
|
||||||
@ -141,12 +137,12 @@ struct NavigationPoly {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FreeEdge {
|
struct FreeEdge {
|
||||||
bool is_free;
|
bool is_free = false;
|
||||||
Polygon *poly;
|
Polygon *poly = nullptr;
|
||||||
uint32_t edge_id;
|
uint32_t edge_id = 0;
|
||||||
Vector3 edge_center;
|
Vector3 edge_center;
|
||||||
Vector3 edge_dir;
|
Vector3 edge_dir;
|
||||||
float edge_len_squared;
|
float edge_len_squared = 0.0;
|
||||||
};
|
};
|
||||||
} // namespace gd
|
} // namespace gd
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class RvoAgent : public NavRid {
|
|||||||
NavMap *map = nullptr;
|
NavMap *map = nullptr;
|
||||||
RVO::Agent agent;
|
RVO::Agent agent;
|
||||||
AvoidanceComputedCallback callback;
|
AvoidanceComputedCallback callback;
|
||||||
uint32_t map_update_id;
|
uint32_t map_update_id = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RvoAgent();
|
RvoAgent();
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin {
|
class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin {
|
||||||
GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin);
|
GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin);
|
||||||
|
|
||||||
Vector<String> *ids;
|
Vector<String> *ids = nullptr;
|
||||||
Vector<Vector<String>> *ids_ctx_plural;
|
Vector<Vector<String>> *ids_ctx_plural = nullptr;
|
||||||
|
|
||||||
// List of patterns used for extracting translation strings.
|
// List of patterns used for extracting translation strings.
|
||||||
StringName tr_func = "tr";
|
StringName tr_func = "tr";
|
||||||
|
@ -219,7 +219,7 @@ StringName GDScript::get_instance_base_type() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct _GDScriptMemberSort {
|
struct _GDScriptMemberSort {
|
||||||
int index;
|
int index = 0;
|
||||||
StringName name;
|
StringName name;
|
||||||
_FORCE_INLINE_ bool operator<(const _GDScriptMemberSort &p_member) const { return index < p_member.index; }
|
_FORCE_INLINE_ bool operator<(const _GDScriptMemberSort &p_member) const { return index < p_member.index; }
|
||||||
};
|
};
|
||||||
@ -1162,17 +1162,6 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
|
|||||||
|
|
||||||
GDScript::GDScript() :
|
GDScript::GDScript() :
|
||||||
script_list(this) {
|
script_list(this) {
|
||||||
valid = false;
|
|
||||||
subclass_count = 0;
|
|
||||||
initializer = nullptr;
|
|
||||||
_base = nullptr;
|
|
||||||
_owner = nullptr;
|
|
||||||
tool = false;
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
source_changed_cache = false;
|
|
||||||
placeholder_fallback_enabled = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
{
|
{
|
||||||
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
|
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
|
||||||
|
@ -57,11 +57,11 @@ public:
|
|||||||
|
|
||||||
class GDScript : public Script {
|
class GDScript : public Script {
|
||||||
GDCLASS(GDScript, Script);
|
GDCLASS(GDScript, Script);
|
||||||
bool tool;
|
bool tool = false;
|
||||||
bool valid;
|
bool valid = false;
|
||||||
|
|
||||||
struct MemberInfo {
|
struct MemberInfo {
|
||||||
int index;
|
int index = 0;
|
||||||
StringName setter;
|
StringName setter;
|
||||||
StringName getter;
|
StringName getter;
|
||||||
MultiplayerAPI::RPCMode rpc_mode;
|
MultiplayerAPI::RPCMode rpc_mode;
|
||||||
@ -77,8 +77,8 @@ class GDScript : public Script {
|
|||||||
|
|
||||||
Ref<GDScriptNativeClass> native;
|
Ref<GDScriptNativeClass> native;
|
||||||
Ref<GDScript> base;
|
Ref<GDScript> base;
|
||||||
GDScript *_base; //fast pointer access
|
GDScript *_base = nullptr; //fast pointer access
|
||||||
GDScript *_owner; //for subclasses
|
GDScript *_owner = nullptr; //for subclasses
|
||||||
|
|
||||||
Set<StringName> members; //members are just indices to the instanced script.
|
Set<StringName> members; //members are just indices to the instanced script.
|
||||||
Map<StringName, Variant> constants;
|
Map<StringName, Variant> constants;
|
||||||
@ -97,8 +97,8 @@ class GDScript : public Script {
|
|||||||
Map<StringName, Variant> member_default_values_cache;
|
Map<StringName, Variant> member_default_values_cache;
|
||||||
Ref<GDScript> base_cache;
|
Ref<GDScript> base_cache;
|
||||||
Set<ObjectID> inheriters_cache;
|
Set<ObjectID> inheriters_cache;
|
||||||
bool source_changed_cache;
|
bool source_changed_cache = false;
|
||||||
bool placeholder_fallback_enabled;
|
bool placeholder_fallback_enabled = false;
|
||||||
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
||||||
|
|
||||||
DocData::ClassDoc doc;
|
DocData::ClassDoc doc;
|
||||||
@ -121,7 +121,7 @@ class GDScript : public Script {
|
|||||||
GDScriptFunction *implicit_initializer = nullptr;
|
GDScriptFunction *implicit_initializer = nullptr;
|
||||||
GDScriptFunction *initializer = nullptr; //direct pointer to new , faster to locate
|
GDScriptFunction *initializer = nullptr; //direct pointer to new , faster to locate
|
||||||
|
|
||||||
int subclass_count;
|
int subclass_count = 0;
|
||||||
Set<Object *> instances;
|
Set<Object *> instances;
|
||||||
//exported members
|
//exported members
|
||||||
String source;
|
String source;
|
||||||
|
@ -133,8 +133,8 @@ class GDScriptCompiler {
|
|||||||
Error _parse_class_level(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
Error _parse_class_level(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||||
Error _parse_class_blocks(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
Error _parse_class_blocks(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||||
void _make_scripts(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
void _make_scripts(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||||
int err_line;
|
int err_line = 0;
|
||||||
int err_column;
|
int err_column = 0;
|
||||||
StringName source;
|
StringName source;
|
||||||
String error;
|
String error;
|
||||||
bool within_await = false;
|
bool within_await = false;
|
||||||
|
@ -77,14 +77,14 @@ int GDScriptFunction::get_max_stack_size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct _GDFKC {
|
struct _GDFKC {
|
||||||
int order;
|
int order = 0;
|
||||||
List<int> pos;
|
List<int> pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GDFKCS {
|
struct _GDFKCS {
|
||||||
int order;
|
int order = 0;
|
||||||
StringName id;
|
StringName id;
|
||||||
int pos;
|
int pos = 0;
|
||||||
|
|
||||||
bool operator<(const _GDFKCS &p_r) const {
|
bool operator<(const _GDFKCS &p_r) const {
|
||||||
return order < p_r.order;
|
return order < p_r.order;
|
||||||
@ -294,7 +294,6 @@ void GDScriptFunctionState::_bind_methods() {
|
|||||||
GDScriptFunctionState::GDScriptFunctionState() :
|
GDScriptFunctionState::GDScriptFunctionState() :
|
||||||
scripts_list(this),
|
scripts_list(this),
|
||||||
instances_list(this) {
|
instances_list(this) {
|
||||||
function = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GDScriptFunctionState::~GDScriptFunctionState() {
|
GDScriptFunctionState::~GDScriptFunctionState() {
|
||||||
|
@ -420,19 +420,19 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct CallState {
|
struct CallState {
|
||||||
GDScript *script;
|
GDScript *script = nullptr;
|
||||||
GDScriptInstance *instance;
|
GDScriptInstance *instance = nullptr;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
StringName function_name;
|
StringName function_name;
|
||||||
String script_path;
|
String script_path;
|
||||||
#endif
|
#endif
|
||||||
Vector<uint8_t> stack;
|
Vector<uint8_t> stack;
|
||||||
int stack_size;
|
int stack_size = 0;
|
||||||
Variant self;
|
Variant self;
|
||||||
uint32_t alloca_size;
|
uint32_t alloca_size = 0;
|
||||||
int ip;
|
int ip = 0;
|
||||||
int line;
|
int line = 0;
|
||||||
int defarg;
|
int defarg = 0;
|
||||||
Variant result;
|
Variant result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ public:
|
|||||||
class GDScriptFunctionState : public Reference {
|
class GDScriptFunctionState : public Reference {
|
||||||
GDCLASS(GDScriptFunctionState, Reference);
|
GDCLASS(GDScriptFunctionState, Reference);
|
||||||
friend class GDScriptFunction;
|
friend class GDScriptFunction;
|
||||||
GDScriptFunction *function;
|
GDScriptFunction *function = nullptr;
|
||||||
GDScriptFunction::CallState state;
|
GDScriptFunction::CallState state;
|
||||||
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||||
Ref<GDScriptFunctionState> first_state;
|
Ref<GDScriptFunctionState> first_state;
|
||||||
|
@ -351,7 +351,7 @@ public:
|
|||||||
OP_COMP_GREATER_EQUAL,
|
OP_COMP_GREATER_EQUAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
OpType operation;
|
OpType operation = OpType::OP_ADDITION;
|
||||||
Variant::Operator variant_op = Variant::OP_MAX;
|
Variant::Operator variant_op = Variant::OP_MAX;
|
||||||
ExpressionNode *left_operand = nullptr;
|
ExpressionNode *left_operand = nullptr;
|
||||||
ExpressionNode *right_operand = nullptr;
|
ExpressionNode *right_operand = nullptr;
|
||||||
@ -753,7 +753,7 @@ public:
|
|||||||
|
|
||||||
struct MatchBranchNode : public Node {
|
struct MatchBranchNode : public Node {
|
||||||
Vector<PatternNode *> patterns;
|
Vector<PatternNode *> patterns;
|
||||||
SuiteNode *block;
|
SuiteNode *block = nullptr;
|
||||||
bool has_wildcard = false;
|
bool has_wildcard = false;
|
||||||
|
|
||||||
MatchBranchNode() {
|
MatchBranchNode() {
|
||||||
@ -1001,7 +1001,7 @@ public:
|
|||||||
OP_LOGIC_NOT,
|
OP_LOGIC_NOT,
|
||||||
};
|
};
|
||||||
|
|
||||||
OpType operation;
|
OpType operation = OP_POSITIVE;
|
||||||
Variant::Operator variant_op = Variant::OP_MAX;
|
Variant::Operator variant_op = Variant::OP_MAX;
|
||||||
ExpressionNode *operand = nullptr;
|
ExpressionNode *operand = nullptr;
|
||||||
|
|
||||||
|
@ -178,7 +178,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Token() {
|
Token() {
|
||||||
type = EMPTY;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +36,6 @@
|
|||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
|
||||||
GDScriptLanguageServer::GDScriptLanguageServer() {
|
GDScriptLanguageServer::GDScriptLanguageServer() {
|
||||||
thread_running = false;
|
|
||||||
started = false;
|
|
||||||
|
|
||||||
use_thread = false;
|
|
||||||
port = 6008;
|
|
||||||
_EDITOR_DEF("network/language_server/remote_port", port);
|
_EDITOR_DEF("network/language_server/remote_port", port);
|
||||||
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
|
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
|
||||||
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);
|
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);
|
||||||
|
@ -41,10 +41,10 @@ class GDScriptLanguageServer : public EditorPlugin {
|
|||||||
GDScriptLanguageProtocol protocol;
|
GDScriptLanguageProtocol protocol;
|
||||||
|
|
||||||
Thread thread;
|
Thread thread;
|
||||||
bool thread_running;
|
bool thread_running = false;
|
||||||
bool started;
|
bool started = false;
|
||||||
bool use_thread;
|
bool use_thread = false;
|
||||||
int port;
|
int port = 6008;
|
||||||
static void thread_main(void *p_userdata);
|
static void thread_main(void *p_userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -547,7 +547,7 @@ struct TextDocumentItem {
|
|||||||
* The version number of this document (it will increase after each
|
* The version number of this document (it will increase after each
|
||||||
* change, including undo/redo).
|
* change, including undo/redo).
|
||||||
*/
|
*/
|
||||||
int version;
|
int version = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The content of the opened text document.
|
* The content of the opened text document.
|
||||||
@ -584,7 +584,7 @@ struct TextDocumentContentChangeEvent {
|
|||||||
/**
|
/**
|
||||||
* The length of the range that got replaced.
|
* The length of the range that got replaced.
|
||||||
*/
|
*/
|
||||||
int rangeLength;
|
int rangeLength = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new text of the range/document.
|
* The new text of the range/document.
|
||||||
@ -656,12 +656,12 @@ struct Diagnostic {
|
|||||||
* The diagnostic's severity. Can be omitted. If omitted it is up to the
|
* The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||||
* client to interpret diagnostics as error, warning, info or hint.
|
* client to interpret diagnostics as error, warning, info or hint.
|
||||||
*/
|
*/
|
||||||
int severity;
|
int severity = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The diagnostic's code, which might appear in the user interface.
|
* The diagnostic's code, which might appear in the user interface.
|
||||||
*/
|
*/
|
||||||
int code;
|
int code = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human-readable string describing the source of this
|
* A human-readable string describing the source of this
|
||||||
@ -833,7 +833,7 @@ struct CompletionItem {
|
|||||||
* an icon is chosen by the editor. The standardized set
|
* an icon is chosen by the editor. The standardized set
|
||||||
* of available values is defined in `CompletionItemKind`.
|
* of available values is defined in `CompletionItemKind`.
|
||||||
*/
|
*/
|
||||||
int kind;
|
int kind = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human-readable string with additional information
|
* A human-readable string with additional information
|
||||||
@ -891,7 +891,7 @@ struct CompletionItem {
|
|||||||
* The format of the insert text. The format applies to both the `insertText` property
|
* The format of the insert text. The format applies to both the `insertText` property
|
||||||
* and the `newText` property of a provided `textEdit`.
|
* and the `newText` property of a provided `textEdit`.
|
||||||
*/
|
*/
|
||||||
int insertTextFormat;
|
int insertTextFormat = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An edit which is applied to a document when selecting this completion. When an edit is provided the value of
|
* An edit which is applied to a document when selecting this completion. When an edit is provided the value of
|
||||||
@ -1003,7 +1003,7 @@ struct CompletionList {
|
|||||||
* This list it not complete. Further typing should result in recomputing
|
* This list it not complete. Further typing should result in recomputing
|
||||||
* this list.
|
* this list.
|
||||||
*/
|
*/
|
||||||
bool isIncomplete;
|
bool isIncomplete = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The completion items.
|
* The completion items.
|
||||||
|
@ -38,8 +38,8 @@ class GLTFCamera : public Resource {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool perspective = true;
|
bool perspective = true;
|
||||||
float fov_size = 75;
|
float fov_size = 75.0;
|
||||||
float zfar = 4000;
|
float zfar = 4000.0;
|
||||||
float znear = 0.05;
|
float znear = 0.05;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -2391,7 +2391,7 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> state) {
|
|||||||
e["targetNames"] = target_names;
|
e["targetNames"] = target_names;
|
||||||
|
|
||||||
for (int j = 0; j < target_names.size(); j++) {
|
for (int j = 0; j < target_names.size(); j++) {
|
||||||
real_t weight = 0;
|
real_t weight = 0.0;
|
||||||
if (j < state->meshes.write[gltf_mesh_i]->get_blend_weights().size()) {
|
if (j < state->meshes.write[gltf_mesh_i]->get_blend_weights().size()) {
|
||||||
weight = state->meshes.write[gltf_mesh_i]->get_blend_weights()[j];
|
weight = state->meshes.write[gltf_mesh_i]->get_blend_weights()[j];
|
||||||
}
|
}
|
||||||
@ -5569,7 +5569,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
|
|||||||
animation->set_loop(true);
|
animation->set_loop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
float length = 0;
|
float length = 0.0;
|
||||||
|
|
||||||
for (Map<int, GLTFAnimation::Track>::Element *track_i = anim->get_tracks().front(); track_i; track_i = track_i->next()) {
|
for (Map<int, GLTFAnimation::Track>::Element *track_i = anim->get_tracks().front(); track_i; track_i = track_i->next()) {
|
||||||
const GLTFAnimation::Track &track = track_i->get();
|
const GLTFAnimation::Track &track = track_i->get();
|
||||||
|
@ -1046,26 +1046,7 @@ RID GridMap::get_bake_mesh_instance(int p_idx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GridMap::GridMap() {
|
GridMap::GridMap() {
|
||||||
collision_layer = 1;
|
|
||||||
collision_mask = 1;
|
|
||||||
|
|
||||||
cell_size = Vector3(2, 2, 2);
|
|
||||||
octant_size = 8;
|
|
||||||
awaiting_update = false;
|
|
||||||
_in_tree = false;
|
|
||||||
center_x = true;
|
|
||||||
center_y = true;
|
|
||||||
center_z = true;
|
|
||||||
|
|
||||||
clip = false;
|
|
||||||
clip_floor = 0;
|
|
||||||
clip_axis = Vector3::AXIS_Z;
|
|
||||||
clip_above = true;
|
|
||||||
cell_scale = 1.0;
|
|
||||||
|
|
||||||
navigation = nullptr;
|
|
||||||
set_notify_transform(true);
|
set_notify_transform(true);
|
||||||
recreating_octants = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridMap::~GridMap() {
|
GridMap::~GridMap() {
|
||||||
|
@ -53,7 +53,7 @@ class GridMap : public Node3D {
|
|||||||
int16_t y;
|
int16_t y;
|
||||||
int16_t z;
|
int16_t z;
|
||||||
};
|
};
|
||||||
uint64_t key;
|
uint64_t key = 0;
|
||||||
|
|
||||||
_FORCE_INLINE_ bool operator<(const IndexKey &p_key) const {
|
_FORCE_INLINE_ bool operator<(const IndexKey &p_key) const {
|
||||||
return key < p_key.key;
|
return key < p_key.key;
|
||||||
@ -68,7 +68,7 @@ class GridMap : public Node3D {
|
|||||||
y = (int16_t)p_vector.y;
|
y = (int16_t)p_vector.y;
|
||||||
z = (int16_t)p_vector.z;
|
z = (int16_t)p_vector.z;
|
||||||
}
|
}
|
||||||
IndexKey() { key = 0; }
|
IndexKey() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,13 +80,7 @@ class GridMap : public Node3D {
|
|||||||
unsigned int rot : 5;
|
unsigned int rot : 5;
|
||||||
unsigned int layer : 8;
|
unsigned int layer : 8;
|
||||||
};
|
};
|
||||||
uint32_t cell;
|
uint32_t cell = 0;
|
||||||
|
|
||||||
Cell() {
|
|
||||||
item = 0;
|
|
||||||
rot = 0;
|
|
||||||
layer = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,7 +97,7 @@ class GridMap : public Node3D {
|
|||||||
RID instance;
|
RID instance;
|
||||||
RID multimesh;
|
RID multimesh;
|
||||||
struct Item {
|
struct Item {
|
||||||
int index;
|
int index = 0;
|
||||||
Transform transform;
|
Transform transform;
|
||||||
IndexKey key;
|
IndexKey key;
|
||||||
};
|
};
|
||||||
@ -116,7 +110,7 @@ class GridMap : public Node3D {
|
|||||||
RID collision_debug;
|
RID collision_debug;
|
||||||
RID collision_debug_instance;
|
RID collision_debug_instance;
|
||||||
|
|
||||||
bool dirty;
|
bool dirty = false;
|
||||||
RID static_body;
|
RID static_body;
|
||||||
Map<IndexKey, NavMesh> navmesh_ids;
|
Map<IndexKey, NavMesh> navmesh_ids;
|
||||||
};
|
};
|
||||||
@ -129,35 +123,37 @@ class GridMap : public Node3D {
|
|||||||
int16_t empty;
|
int16_t empty;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t key;
|
uint64_t key = 0;
|
||||||
|
|
||||||
_FORCE_INLINE_ bool operator<(const OctantKey &p_key) const {
|
_FORCE_INLINE_ bool operator<(const OctantKey &p_key) const {
|
||||||
return key < p_key.key;
|
return key < p_key.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
//OctantKey(const IndexKey& p_k, int p_item) { indexkey=p_k.key; item=p_item; }
|
//OctantKey(const IndexKey& p_k, int p_item) { indexkey=p_k.key; item=p_item; }
|
||||||
OctantKey() { key = 0; }
|
OctantKey() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t collision_layer;
|
uint32_t collision_layer = 1;
|
||||||
uint32_t collision_mask;
|
uint32_t collision_mask = 1;
|
||||||
|
|
||||||
Transform last_transform;
|
Transform last_transform;
|
||||||
|
|
||||||
bool _in_tree;
|
bool _in_tree = false;
|
||||||
Vector3 cell_size;
|
Vector3 cell_size = Vector3(2, 2, 2);
|
||||||
int octant_size;
|
int octant_size = 8;
|
||||||
bool center_x, center_y, center_z;
|
bool center_x = true;
|
||||||
float cell_scale;
|
bool center_y = true;
|
||||||
Navigation3D *navigation;
|
bool center_z = true;
|
||||||
|
float cell_scale = 1.0;
|
||||||
|
Navigation3D *navigation = nullptr;
|
||||||
|
|
||||||
bool clip;
|
bool clip = false;
|
||||||
bool clip_above;
|
bool clip_above = true;
|
||||||
int clip_floor;
|
int clip_floor = 0;
|
||||||
|
|
||||||
bool recreating_octants;
|
bool recreating_octants = false;
|
||||||
|
|
||||||
Vector3::Axis clip_axis;
|
Vector3::Axis clip_axis = Vector3::AXIS_Z;
|
||||||
|
|
||||||
Ref<MeshLibrary> mesh_library;
|
Ref<MeshLibrary> mesh_library;
|
||||||
|
|
||||||
@ -167,10 +163,10 @@ class GridMap : public Node3D {
|
|||||||
void _recreate_octant_data();
|
void _recreate_octant_data();
|
||||||
|
|
||||||
struct BakeLight {
|
struct BakeLight {
|
||||||
RS::LightType type;
|
RS::LightType type = RS::LightType::LIGHT_DIRECTIONAL;
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
Vector3 dir;
|
Vector3 dir;
|
||||||
float param[RS::LIGHT_PARAM_MAX];
|
float param[RS::LIGHT_PARAM_MAX] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const {
|
_FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const {
|
||||||
@ -183,7 +179,7 @@ class GridMap : public Node3D {
|
|||||||
bool _octant_update(const OctantKey &p_key);
|
bool _octant_update(const OctantKey &p_key);
|
||||||
void _octant_clean_up(const OctantKey &p_key);
|
void _octant_clean_up(const OctantKey &p_key);
|
||||||
void _octant_transform(const OctantKey &p_key);
|
void _octant_transform(const OctantKey &p_key);
|
||||||
bool awaiting_update;
|
bool awaiting_update = false;
|
||||||
|
|
||||||
void _queue_octants_dirty();
|
void _queue_octants_dirty();
|
||||||
void _update_octants_callback();
|
void _update_octants_callback();
|
||||||
|
@ -769,7 +769,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
|||||||
|
|
||||||
struct _CGMEItemSort {
|
struct _CGMEItemSort {
|
||||||
String name;
|
String name;
|
||||||
int id;
|
int id = 0;
|
||||||
_FORCE_INLINE_ bool operator<(const _CGMEItemSort &r_it) const { return name < r_it.name; }
|
_FORCE_INLINE_ bool operator<(const _CGMEItemSort &r_it) const { return name < r_it.name; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1151,7 +1151,6 @@ void GridMapEditor::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
||||||
input_action = INPUT_NONE;
|
|
||||||
editor = p_editor;
|
editor = p_editor;
|
||||||
undo_redo = p_editor->get_undo_redo();
|
undo_redo = p_editor->get_undo_redo();
|
||||||
|
|
||||||
@ -1234,7 +1233,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||||||
settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
|
settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
|
||||||
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
|
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
|
||||||
|
|
||||||
clip_mode = CLIP_DISABLED;
|
|
||||||
options->get_popup()->connect("id_pressed", callable_mp(this, &GridMapEditor::_menu_option));
|
options->get_popup()->connect("id_pressed", callable_mp(this, &GridMapEditor::_menu_option));
|
||||||
|
|
||||||
HBoxContainer *hb = memnew(HBoxContainer);
|
HBoxContainer *hb = memnew(HBoxContainer);
|
||||||
@ -1275,8 +1273,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||||||
|
|
||||||
EDITOR_DEF("editors/grid_map/preview_size", 64);
|
EDITOR_DEF("editors/grid_map/preview_size", 64);
|
||||||
|
|
||||||
display_mode = DISPLAY_THUMBNAIL;
|
|
||||||
|
|
||||||
mesh_library_palette = memnew(ItemList);
|
mesh_library_palette = memnew(ItemList);
|
||||||
add_child(mesh_library_palette);
|
add_child(mesh_library_palette);
|
||||||
mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
@ -1296,11 +1292,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||||||
edit_floor[1] = -1;
|
edit_floor[1] = -1;
|
||||||
edit_floor[2] = -1;
|
edit_floor[2] = -1;
|
||||||
|
|
||||||
cursor_visible = false;
|
|
||||||
selected_palette = -1;
|
|
||||||
lock_view = false;
|
|
||||||
cursor_rot = 0;
|
|
||||||
|
|
||||||
selection_mesh = RenderingServer::get_singleton()->mesh_create();
|
selection_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||||
paste_mesh = RenderingServer::get_singleton()->mesh_create();
|
paste_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||||
|
|
||||||
@ -1418,8 +1409,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_set_selection(false);
|
_set_selection(false);
|
||||||
updating = false;
|
|
||||||
accumulated_floor_delta = 0.0;
|
|
||||||
|
|
||||||
indicator_mat.instance();
|
indicator_mat.instance();
|
||||||
indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||||
|
@ -65,11 +65,11 @@ class GridMapEditor : public VBoxContainer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UndoRedo *undo_redo;
|
UndoRedo *undo_redo;
|
||||||
InputAction input_action;
|
InputAction input_action = INPUT_NONE;
|
||||||
Panel *panel;
|
Panel *panel;
|
||||||
MenuButton *options;
|
MenuButton *options;
|
||||||
SpinBox *floor;
|
SpinBox *floor;
|
||||||
double accumulated_floor_delta;
|
double accumulated_floor_delta = 0.0;
|
||||||
Button *mode_thumbnail;
|
Button *mode_thumbnail;
|
||||||
Button *mode_list;
|
Button *mode_list;
|
||||||
LineEdit *search_box;
|
LineEdit *search_box;
|
||||||
@ -82,19 +82,19 @@ class GridMapEditor : public VBoxContainer {
|
|||||||
|
|
||||||
struct SetItem {
|
struct SetItem {
|
||||||
Vector3i position;
|
Vector3i position;
|
||||||
int new_value;
|
int new_value = 0;
|
||||||
int new_orientation;
|
int new_orientation = 0;
|
||||||
int old_value;
|
int old_value = 0;
|
||||||
int old_orientation;
|
int old_orientation = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
List<SetItem> set_items;
|
List<SetItem> set_items;
|
||||||
|
|
||||||
GridMap *node = nullptr;
|
GridMap *node = nullptr;
|
||||||
MeshLibrary *last_mesh_library;
|
MeshLibrary *last_mesh_library;
|
||||||
ClipMode clip_mode;
|
ClipMode clip_mode = CLIP_DISABLED;
|
||||||
|
|
||||||
bool lock_view;
|
bool lock_view = false;
|
||||||
Transform grid_xform;
|
Transform grid_xform;
|
||||||
Transform edit_grid_xform;
|
Transform edit_grid_xform;
|
||||||
Vector3::Axis edit_axis;
|
Vector3::Axis edit_axis;
|
||||||
@ -112,9 +112,9 @@ class GridMapEditor : public VBoxContainer {
|
|||||||
RID paste_instance;
|
RID paste_instance;
|
||||||
|
|
||||||
struct ClipboardItem {
|
struct ClipboardItem {
|
||||||
int cell_item;
|
int cell_item = 0;
|
||||||
Vector3 grid_offset;
|
Vector3 grid_offset;
|
||||||
int orientation;
|
int orientation = 0;
|
||||||
RID instance;
|
RID instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,14 +125,14 @@ class GridMapEditor : public VBoxContainer {
|
|||||||
Ref<StandardMaterial3D> outer_mat;
|
Ref<StandardMaterial3D> outer_mat;
|
||||||
Ref<StandardMaterial3D> selection_floor_mat;
|
Ref<StandardMaterial3D> selection_floor_mat;
|
||||||
|
|
||||||
bool updating;
|
bool updating = false;
|
||||||
|
|
||||||
struct Selection {
|
struct Selection {
|
||||||
Vector3 click;
|
Vector3 click;
|
||||||
Vector3 current;
|
Vector3 current;
|
||||||
Vector3 begin;
|
Vector3 begin;
|
||||||
Vector3 end;
|
Vector3 end;
|
||||||
bool active;
|
bool active = false;
|
||||||
} selection;
|
} selection;
|
||||||
Selection last_selection;
|
Selection last_selection;
|
||||||
|
|
||||||
@ -141,18 +141,18 @@ class GridMapEditor : public VBoxContainer {
|
|||||||
Vector3 current;
|
Vector3 current;
|
||||||
Vector3 begin;
|
Vector3 begin;
|
||||||
Vector3 end;
|
Vector3 end;
|
||||||
int orientation;
|
int orientation = 0;
|
||||||
};
|
};
|
||||||
PasteIndicator paste_indicator;
|
PasteIndicator paste_indicator;
|
||||||
|
|
||||||
bool cursor_visible;
|
bool cursor_visible = false;
|
||||||
Transform cursor_transform;
|
Transform cursor_transform;
|
||||||
|
|
||||||
Vector3 cursor_origin;
|
Vector3 cursor_origin;
|
||||||
|
|
||||||
int display_mode;
|
int display_mode = DISPLAY_THUMBNAIL;
|
||||||
int selected_palette;
|
int selected_palette = -1;
|
||||||
int cursor_rot;
|
int cursor_rot = 0;
|
||||||
|
|
||||||
enum Menu {
|
enum Menu {
|
||||||
MENU_OPTION_NEXT_LEVEL,
|
MENU_OPTION_NEXT_LEVEL,
|
||||||
|
@ -46,18 +46,18 @@ class LightmapperRD : public Lightmapper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Light {
|
struct Light {
|
||||||
float position[3];
|
float position[3] = {};
|
||||||
uint32_t type = LIGHT_TYPE_DIRECTIONAL;
|
uint32_t type = LIGHT_TYPE_DIRECTIONAL;
|
||||||
float direction[3];
|
float direction[3] = {};
|
||||||
float energy;
|
float energy = 0.0;
|
||||||
float color[3];
|
float color[3] = {};
|
||||||
float size;
|
float size = 0.0;
|
||||||
float range;
|
float range = 0.0;
|
||||||
float attenuation;
|
float attenuation = 0.0;
|
||||||
float cos_spot_angle;
|
float cos_spot_angle = 0.0;
|
||||||
float inv_spot_attenuation;
|
float inv_spot_attenuation = 0.0;
|
||||||
uint32_t static_bake;
|
uint32_t static_bake = 0;
|
||||||
uint32_t pad[3];
|
uint32_t pad[3] = {};
|
||||||
|
|
||||||
bool operator<(const Light &p_light) const {
|
bool operator<(const Light &p_light) const {
|
||||||
return type < p_light.type;
|
return type < p_light.type;
|
||||||
@ -65,10 +65,10 @@ class LightmapperRD : public Lightmapper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
float position[3];
|
float position[3] = {};
|
||||||
float normal_z;
|
float normal_z = 0.0;
|
||||||
float uv[2];
|
float uv[2] = {};
|
||||||
float normal_xy[2];
|
float normal_xy[2] = {};
|
||||||
|
|
||||||
bool operator==(const Vertex &p_vtx) const {
|
bool operator==(const Vertex &p_vtx) const {
|
||||||
return (position[0] == p_vtx.position[0]) &&
|
return (position[0] == p_vtx.position[0]) &&
|
||||||
@ -102,7 +102,7 @@ class LightmapperRD : public Lightmapper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Probe {
|
struct Probe {
|
||||||
float position[4];
|
float position[4] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Probe> probe_positions;
|
Vector<Probe> probe_positions;
|
||||||
@ -158,15 +158,15 @@ class LightmapperRD : public Lightmapper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Box {
|
struct Box {
|
||||||
float min_bounds[3];
|
float min_bounds[3] = {};
|
||||||
float pad0;
|
float pad0 = 0.0;
|
||||||
float max_bounds[3];
|
float max_bounds[3] = {};
|
||||||
float pad1;
|
float pad1 = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Triangle {
|
struct Triangle {
|
||||||
uint32_t indices[3];
|
uint32_t indices[3] = {};
|
||||||
uint32_t slice;
|
uint32_t slice = 0;
|
||||||
bool operator<(const Triangle &p_triangle) const {
|
bool operator<(const Triangle &p_triangle) const {
|
||||||
return slice < p_triangle.slice;
|
return slice < p_triangle.slice;
|
||||||
}
|
}
|
||||||
@ -177,8 +177,8 @@ class LightmapperRD : public Lightmapper {
|
|||||||
Vector<Light> lights;
|
Vector<Light> lights;
|
||||||
|
|
||||||
struct TriangleSort {
|
struct TriangleSort {
|
||||||
uint32_t cell_index;
|
uint32_t cell_index = 0;
|
||||||
uint32_t triangle_index;
|
uint32_t triangle_index = 0;
|
||||||
bool operator<(const TriangleSort &p_triangle_sort) const {
|
bool operator<(const TriangleSort &p_triangle_sort) const {
|
||||||
return cell_index < p_triangle_sort.cell_index; //sorting by triangle index in this case makes no sense
|
return cell_index < p_triangle_sort.cell_index; //sorting by triangle index in this case makes no sense
|
||||||
}
|
}
|
||||||
@ -187,44 +187,44 @@ class LightmapperRD : public Lightmapper {
|
|||||||
void _plot_triangle_into_triangle_index_list(int p_size, const Vector3i &p_ofs, const AABB &p_bounds, const Vector3 p_points[], uint32_t p_triangle_index, LocalVector<TriangleSort> &triangles, uint32_t p_grid_size);
|
void _plot_triangle_into_triangle_index_list(int p_size, const Vector3i &p_ofs, const AABB &p_bounds, const Vector3 p_points[], uint32_t p_triangle_index, LocalVector<TriangleSort> &triangles, uint32_t p_grid_size);
|
||||||
|
|
||||||
struct RasterPushConstant {
|
struct RasterPushConstant {
|
||||||
float atlas_size[2];
|
float atlas_size[2] = {};
|
||||||
float uv_offset[2];
|
float uv_offset[2] = {};
|
||||||
float to_cell_size[3];
|
float to_cell_size[3] = {};
|
||||||
uint32_t base_triangle;
|
uint32_t base_triangle = 0;
|
||||||
float to_cell_offset[3];
|
float to_cell_offset[3] = {};
|
||||||
float bias;
|
float bias = 0.0;
|
||||||
int32_t grid_size[3];
|
int32_t grid_size[3] = {};
|
||||||
uint32_t pad2;
|
uint32_t pad2 = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RasterSeamsPushConstant {
|
struct RasterSeamsPushConstant {
|
||||||
uint32_t base_index;
|
uint32_t base_index = 0;
|
||||||
uint32_t slice;
|
uint32_t slice = 0;
|
||||||
float uv_offset[2];
|
float uv_offset[2] = {};
|
||||||
uint32_t debug;
|
uint32_t debug = 0;
|
||||||
float blend;
|
float blend = 0.0;
|
||||||
uint32_t pad[2];
|
uint32_t pad[2] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PushConstant {
|
struct PushConstant {
|
||||||
int32_t atlas_size[2];
|
int32_t atlas_size[2] = {};
|
||||||
uint32_t ray_count;
|
uint32_t ray_count = 0;
|
||||||
uint32_t ray_to;
|
uint32_t ray_to = 0;
|
||||||
|
|
||||||
float world_size[3];
|
float world_size[3] = {};
|
||||||
float bias;
|
float bias = 0.0;
|
||||||
|
|
||||||
float to_cell_offset[3];
|
float to_cell_offset[3] = {};
|
||||||
uint32_t ray_from;
|
uint32_t ray_from = 0;
|
||||||
|
|
||||||
float to_cell_size[3];
|
float to_cell_size[3] = {};
|
||||||
uint32_t light_count;
|
uint32_t light_count = 0;
|
||||||
|
|
||||||
int32_t grid_size;
|
int32_t grid_size = 0;
|
||||||
int32_t atlas_slice;
|
int32_t atlas_slice = 0;
|
||||||
int32_t region_ofs[2];
|
int32_t region_ofs[2] = {};
|
||||||
|
|
||||||
float environment_xform[12];
|
float environment_xform[12] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Ref<Image>> bake_textures;
|
Vector<Ref<Image>> bake_textures;
|
||||||
|
@ -246,7 +246,6 @@ int PacketPeerMbedDTLS::get_max_packet_size() const {
|
|||||||
|
|
||||||
PacketPeerMbedDTLS::PacketPeerMbedDTLS() {
|
PacketPeerMbedDTLS::PacketPeerMbedDTLS() {
|
||||||
ssl_ctx.instance();
|
ssl_ctx.instance();
|
||||||
status = STATUS_DISCONNECTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketPeerMbedDTLS::~PacketPeerMbedDTLS() {
|
PacketPeerMbedDTLS::~PacketPeerMbedDTLS() {
|
||||||
|
@ -44,7 +44,7 @@ private:
|
|||||||
|
|
||||||
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||||
|
|
||||||
Status status;
|
Status status = STATUS_DISCONNECTED;
|
||||||
String hostname;
|
String hostname;
|
||||||
|
|
||||||
Ref<PacketPeerUDP> base;
|
Ref<PacketPeerUDP> base;
|
||||||
|
@ -76,7 +76,6 @@ void CookieContextMbedTLS::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CookieContextMbedTLS::CookieContextMbedTLS() {
|
CookieContextMbedTLS::CookieContextMbedTLS() {
|
||||||
inited = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CookieContextMbedTLS::~CookieContextMbedTLS() {
|
CookieContextMbedTLS::~CookieContextMbedTLS() {
|
||||||
@ -205,7 +204,6 @@ mbedtls_ssl_context *SSLContextMbedTLS::get_context() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSLContextMbedTLS::SSLContextMbedTLS() {
|
SSLContextMbedTLS::SSLContextMbedTLS() {
|
||||||
inited = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContextMbedTLS::~SSLContextMbedTLS() {
|
SSLContextMbedTLS::~SSLContextMbedTLS() {
|
||||||
|
@ -50,7 +50,7 @@ class CookieContextMbedTLS : public Reference {
|
|||||||
friend class SSLContextMbedTLS;
|
friend class SSLContextMbedTLS;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool inited;
|
bool inited = false;
|
||||||
mbedtls_entropy_context entropy;
|
mbedtls_entropy_context entropy;
|
||||||
mbedtls_ctr_drbg_context ctr_drbg;
|
mbedtls_ctr_drbg_context ctr_drbg;
|
||||||
mbedtls_ssl_cookie_ctx cookie_ctx;
|
mbedtls_ssl_cookie_ctx cookie_ctx;
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
class SSLContextMbedTLS : public Reference {
|
class SSLContextMbedTLS : public Reference {
|
||||||
protected:
|
protected:
|
||||||
bool inited;
|
bool inited = false;
|
||||||
|
|
||||||
static PackedByteArray _read_file(String p_path);
|
static PackedByteArray _read_file(String p_path);
|
||||||
|
|
||||||
|
@ -274,7 +274,6 @@ int StreamPeerMbedTLS::get_available_bytes() const {
|
|||||||
|
|
||||||
StreamPeerMbedTLS::StreamPeerMbedTLS() {
|
StreamPeerMbedTLS::StreamPeerMbedTLS() {
|
||||||
ssl_ctx.instance();
|
ssl_ctx.instance();
|
||||||
status = STATUS_DISCONNECTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerMbedTLS::~StreamPeerMbedTLS() {
|
StreamPeerMbedTLS::~StreamPeerMbedTLS() {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
class StreamPeerMbedTLS : public StreamPeerSSL {
|
class StreamPeerMbedTLS : public StreamPeerSSL {
|
||||||
private:
|
private:
|
||||||
Status status;
|
Status status = STATUS_DISCONNECTED;
|
||||||
String hostname;
|
String hostname;
|
||||||
|
|
||||||
Ref<StreamPeer> base;
|
Ref<StreamPeer> base;
|
||||||
|
@ -78,11 +78,11 @@ class AudioStreamMP3 : public AudioStream {
|
|||||||
void *data = nullptr;
|
void *data = nullptr;
|
||||||
uint32_t data_len = 0;
|
uint32_t data_len = 0;
|
||||||
|
|
||||||
float sample_rate = 1;
|
float sample_rate = 1.0;
|
||||||
int channels = 1;
|
int channels = 1;
|
||||||
float length = 0;
|
float length = 0.0;
|
||||||
bool loop = false;
|
bool loop = false;
|
||||||
float loop_offset = 0;
|
float loop_offset = 0.0;
|
||||||
void clear_data();
|
void clear_data();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -448,19 +448,7 @@ void MobileVRInterface::process() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
MobileVRInterface::MobileVRInterface() {
|
MobileVRInterface::MobileVRInterface() {}
|
||||||
initialized = false;
|
|
||||||
|
|
||||||
// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
|
|
||||||
eye_height = 1.85;
|
|
||||||
intraocular_dist = 6.0;
|
|
||||||
display_width = 14.5;
|
|
||||||
display_to_lens = 4.0;
|
|
||||||
oversample = 1.5;
|
|
||||||
k1 = 0.215;
|
|
||||||
k2 = 0.215;
|
|
||||||
last_ticks = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
MobileVRInterface::~MobileVRInterface() {
|
MobileVRInterface::~MobileVRInterface() {
|
||||||
// and make sure we cleanup if we haven't already
|
// and make sure we cleanup if we haven't already
|
||||||
|
@ -51,19 +51,21 @@ class MobileVRInterface : public XRInterface {
|
|||||||
GDCLASS(MobileVRInterface, XRInterface);
|
GDCLASS(MobileVRInterface, XRInterface);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialized;
|
bool initialized = false;
|
||||||
Basis orientation;
|
Basis orientation;
|
||||||
float eye_height;
|
|
||||||
uint64_t last_ticks;
|
|
||||||
|
|
||||||
real_t intraocular_dist;
|
// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
|
||||||
real_t display_width;
|
float eye_height = 1.85;
|
||||||
real_t display_to_lens;
|
uint64_t last_ticks = 0;
|
||||||
real_t oversample;
|
|
||||||
|
real_t intraocular_dist = 6.0;
|
||||||
|
real_t display_width = 14.5;
|
||||||
|
real_t display_to_lens = 4.0;
|
||||||
|
real_t oversample = 1.5;
|
||||||
|
|
||||||
//@TODO not yet used, these are needed in our distortion shader...
|
//@TODO not yet used, these are needed in our distortion shader...
|
||||||
real_t k1;
|
real_t k1 = 0.215;
|
||||||
real_t k2;
|
real_t k2 = 0.215;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
logic for processing our sensor data, this was originally in our positional tracker logic but I think
|
logic for processing our sensor data, this was originally in our positional tracker logic but I think
|
||||||
@ -73,9 +75,9 @@ private:
|
|||||||
Vector3 scale_magneto(const Vector3 &p_magnetometer);
|
Vector3 scale_magneto(const Vector3 &p_magnetometer);
|
||||||
Basis combine_acc_mag(const Vector3 &p_grav, const Vector3 &p_magneto);
|
Basis combine_acc_mag(const Vector3 &p_grav, const Vector3 &p_magneto);
|
||||||
|
|
||||||
int mag_count;
|
int mag_count = 0;
|
||||||
bool has_gyro;
|
bool has_gyro = false;
|
||||||
bool sensor_first;
|
bool sensor_first = false;
|
||||||
Vector3 last_accerometer_data;
|
Vector3 last_accerometer_data;
|
||||||
Vector3 last_magnetometer_data;
|
Vector3 last_magnetometer_data;
|
||||||
Vector3 mag_current_min;
|
Vector3 mag_current_min;
|
||||||
|
@ -189,8 +189,6 @@ void GDMonoLog::initialize() {
|
|||||||
|
|
||||||
GDMonoLog::GDMonoLog() {
|
GDMonoLog::GDMonoLog() {
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
|
||||||
log_level_id = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GDMonoLog::~GDMonoLog() {
|
GDMonoLog::~GDMonoLog() {
|
||||||
|
@ -46,9 +46,9 @@
|
|||||||
|
|
||||||
class GDMonoLog {
|
class GDMonoLog {
|
||||||
#ifdef GD_MONO_LOG_ENABLED
|
#ifdef GD_MONO_LOG_ENABLED
|
||||||
int log_level_id;
|
int log_level_id = -1;
|
||||||
|
|
||||||
FileAccess *log_file;
|
FileAccess *log_file = nullptr;
|
||||||
String log_file_path;
|
String log_file_path;
|
||||||
|
|
||||||
bool _try_create_logs_dir(const String &p_logs_dir);
|
bool _try_create_logs_dir(const String &p_logs_dir);
|
||||||
|
@ -33,15 +33,6 @@
|
|||||||
#include "core/core_string_names.h"
|
#include "core/core_string_names.h"
|
||||||
|
|
||||||
NoiseTexture::NoiseTexture() {
|
NoiseTexture::NoiseTexture() {
|
||||||
update_queued = false;
|
|
||||||
regen_queued = false;
|
|
||||||
first_time = true;
|
|
||||||
|
|
||||||
size = Vector2i(512, 512);
|
|
||||||
seamless = false;
|
|
||||||
as_normal_map = false;
|
|
||||||
bump_strength = 8.0;
|
|
||||||
|
|
||||||
noise = Ref<OpenSimplexNoise>();
|
noise = Ref<OpenSimplexNoise>();
|
||||||
|
|
||||||
_queue_update();
|
_queue_update();
|
||||||
|
@ -47,18 +47,18 @@ private:
|
|||||||
|
|
||||||
Thread noise_thread;
|
Thread noise_thread;
|
||||||
|
|
||||||
bool first_time;
|
bool first_time = true;
|
||||||
bool update_queued;
|
bool update_queued = false;
|
||||||
bool regen_queued;
|
bool regen_queued = false;
|
||||||
|
|
||||||
mutable RID texture;
|
mutable RID texture;
|
||||||
uint32_t flags;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
Ref<OpenSimplexNoise> noise;
|
Ref<OpenSimplexNoise> noise;
|
||||||
Vector2i size;
|
Vector2i size = Vector2i(512, 512);
|
||||||
bool seamless;
|
bool seamless = false;
|
||||||
bool as_normal_map;
|
bool as_normal_map = false;
|
||||||
float bump_strength;
|
float bump_strength = 8.0;
|
||||||
|
|
||||||
void _thread_done(const Ref<Image> &p_image);
|
void _thread_done(const Ref<Image> &p_image);
|
||||||
static void _thread_function(void *p_ud);
|
static void _thread_function(void *p_ud);
|
||||||
|
@ -33,12 +33,6 @@
|
|||||||
#include "core/core_string_names.h"
|
#include "core/core_string_names.h"
|
||||||
|
|
||||||
OpenSimplexNoise::OpenSimplexNoise() {
|
OpenSimplexNoise::OpenSimplexNoise() {
|
||||||
seed = 0;
|
|
||||||
persistence = 0.5;
|
|
||||||
octaves = 3;
|
|
||||||
period = 64;
|
|
||||||
lacunarity = 2.0;
|
|
||||||
|
|
||||||
_init_seeds();
|
_init_seeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ class OpenSimplexNoise : public Resource {
|
|||||||
|
|
||||||
osn_context contexts[MAX_OCTAVES];
|
osn_context contexts[MAX_OCTAVES];
|
||||||
|
|
||||||
int seed;
|
int seed = 0;
|
||||||
float persistence; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.
|
float persistence = 0.5; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.
|
||||||
int octaves; // Number of noise layers
|
int octaves = 3; // Number of noise layers
|
||||||
float period; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain.
|
float period = 64.0; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain.
|
||||||
float lacunarity; // Controls period change across octaves. 2 is usually a good value to address all detail levels.
|
float lacunarity = 2.0; // Controls period change across octaves. 2 is usually a good value to address all detail levels.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpenSimplexNoise();
|
OpenSimplexNoise();
|
||||||
|
@ -207,7 +207,7 @@ ResourceFormatPVR::ResourceFormatPVR() {
|
|||||||
|
|
||||||
struct PVRTCBlock {
|
struct PVRTCBlock {
|
||||||
//blocks are 64 bits
|
//blocks are 64 bits
|
||||||
uint32_t data[2];
|
uint32_t data[2] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
_FORCE_INLINE_ bool is_po2(uint32_t p_input) {
|
_FORCE_INLINE_ bool is_po2(uint32_t p_input) {
|
||||||
|
@ -365,12 +365,10 @@ Array RegEx::get_names() const {
|
|||||||
|
|
||||||
RegEx::RegEx() {
|
RegEx::RegEx() {
|
||||||
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
|
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
|
||||||
code = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RegEx::RegEx(const String &p_pattern) {
|
RegEx::RegEx(const String &p_pattern) {
|
||||||
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
|
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
|
||||||
code = nullptr;
|
|
||||||
compile(p_pattern);
|
compile(p_pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ class RegExMatch : public Reference {
|
|||||||
GDCLASS(RegExMatch, Reference);
|
GDCLASS(RegExMatch, Reference);
|
||||||
|
|
||||||
struct Range {
|
struct Range {
|
||||||
int start;
|
int start = 0;
|
||||||
int end;
|
int end = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
String subject;
|
String subject;
|
||||||
@ -72,7 +72,7 @@ class RegEx : public Reference {
|
|||||||
GDCLASS(RegEx, Reference);
|
GDCLASS(RegEx, Reference);
|
||||||
|
|
||||||
void *general_ctx;
|
void *general_ctx;
|
||||||
void *code;
|
void *code = nullptr;
|
||||||
String pattern;
|
String pattern;
|
||||||
|
|
||||||
void _pattern_info(uint32_t what, void *where) const;
|
void _pattern_info(uint32_t what, void *where) const;
|
||||||
|
@ -263,16 +263,7 @@ void AudioStreamOGGVorbis::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset");
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
|
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {}
|
||||||
data = nullptr;
|
|
||||||
data_len = 0;
|
|
||||||
length = 0;
|
|
||||||
sample_rate = 1;
|
|
||||||
channels = 1;
|
|
||||||
loop_offset = 0;
|
|
||||||
decode_mem_size = 0;
|
|
||||||
loop = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioStreamOGGVorbis::~AudioStreamOGGVorbis() {
|
AudioStreamOGGVorbis::~AudioStreamOGGVorbis() {
|
||||||
clear_data();
|
clear_data();
|
||||||
|
@ -41,11 +41,11 @@ class AudioStreamOGGVorbis;
|
|||||||
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
|
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
|
||||||
GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled);
|
GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled);
|
||||||
|
|
||||||
stb_vorbis *ogg_stream;
|
stb_vorbis *ogg_stream = nullptr;
|
||||||
stb_vorbis_alloc ogg_alloc;
|
stb_vorbis_alloc ogg_alloc;
|
||||||
uint32_t frames_mixed;
|
uint32_t frames_mixed = 0;
|
||||||
bool active;
|
bool active = false;
|
||||||
int loops;
|
int loops = 0;
|
||||||
|
|
||||||
friend class AudioStreamOGGVorbis;
|
friend class AudioStreamOGGVorbis;
|
||||||
|
|
||||||
@ -76,15 +76,15 @@ class AudioStreamOGGVorbis : public AudioStream {
|
|||||||
|
|
||||||
friend class AudioStreamPlaybackOGGVorbis;
|
friend class AudioStreamPlaybackOGGVorbis;
|
||||||
|
|
||||||
void *data;
|
void *data = nullptr;
|
||||||
uint32_t data_len;
|
uint32_t data_len = 0;
|
||||||
|
|
||||||
int decode_mem_size;
|
int decode_mem_size = 0;
|
||||||
float sample_rate;
|
float sample_rate = 1.0;
|
||||||
int channels;
|
int channels = 1;
|
||||||
float length;
|
float length = 0.0;
|
||||||
bool loop;
|
bool loop = false;
|
||||||
float loop_offset;
|
float loop_offset = 0.0;
|
||||||
void clear_data();
|
void clear_data();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
struct hb_bmp_font_t {
|
struct hb_bmp_font_t {
|
||||||
BitmapFontDataAdvanced *face = nullptr;
|
BitmapFontDataAdvanced *face = nullptr;
|
||||||
float font_size = 0;
|
float font_size = 0.0;
|
||||||
bool unref = false; /* Whether to destroy bm_face when done. */
|
bool unref = false; /* Whether to destroy bm_face when done. */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ Error BitmapFontDataAdvanced::load_from_file(const String &p_filename, int p_bas
|
|||||||
char_map[idx] = c;
|
char_map[idx] = c;
|
||||||
} else if (type == "kerning") {
|
} else if (type == "kerning") {
|
||||||
KerningPairKey kpk;
|
KerningPairKey kpk;
|
||||||
float k = 0;
|
float k = 0.0;
|
||||||
if (keys.has("first")) {
|
if (keys.has("first")) {
|
||||||
kpk.A = keys["first"].to_int();
|
kpk.A = keys["first"].to_int();
|
||||||
}
|
}
|
||||||
|
@ -74,14 +74,11 @@ private:
|
|||||||
uint32_t size : 16;
|
uint32_t size : 16;
|
||||||
uint32_t outline_size : 16;
|
uint32_t outline_size : 16;
|
||||||
};
|
};
|
||||||
uint32_t key;
|
uint32_t key = 0;
|
||||||
};
|
};
|
||||||
bool operator<(CacheID right) const {
|
bool operator<(CacheID right) const {
|
||||||
return key < right.key;
|
return key < right.key;
|
||||||
}
|
}
|
||||||
CacheID() {
|
|
||||||
key = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DataAtSize {
|
struct DataAtSize {
|
||||||
@ -91,10 +88,10 @@ private:
|
|||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
float scale_color_font = 1.f;
|
float scale_color_font = 1.f;
|
||||||
float ascent = 0;
|
float ascent = 0.0;
|
||||||
float descent = 0;
|
float descent = 0.0;
|
||||||
float underline_position = 0;
|
float underline_position = 0.0;
|
||||||
float underline_thickness = 0;
|
float underline_thickness = 0.0;
|
||||||
|
|
||||||
Vector<CharTexture> textures;
|
Vector<CharTexture> textures;
|
||||||
HashMap<uint32_t, Character> glyph_map;
|
HashMap<uint32_t, Character> glyph_map;
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
class ScriptIterator {
|
class ScriptIterator {
|
||||||
public:
|
public:
|
||||||
struct ScriptRange {
|
struct ScriptRange {
|
||||||
int start;
|
int start = 0;
|
||||||
int end;
|
int end = 0;
|
||||||
hb_script_t script;
|
hb_script_t script = HB_SCRIPT_COMMON;
|
||||||
};
|
};
|
||||||
Vector<ScriptRange> script_ranges;
|
Vector<ScriptRange> script_ranges;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ Error BitmapFontDataFallback::load_from_file(const String &p_filename, int p_bas
|
|||||||
char_map[idx] = c;
|
char_map[idx] = c;
|
||||||
} else if (type == "kerning") {
|
} else if (type == "kerning") {
|
||||||
KerningPairKey kpk;
|
KerningPairKey kpk;
|
||||||
float k = 0;
|
float k = 0.0;
|
||||||
if (keys.has("first")) {
|
if (keys.has("first")) {
|
||||||
kpk.A = keys["first"].to_int();
|
kpk.A = keys["first"].to_int();
|
||||||
}
|
}
|
||||||
|
@ -70,14 +70,11 @@ private:
|
|||||||
uint32_t size : 16;
|
uint32_t size : 16;
|
||||||
uint32_t outline_size : 16;
|
uint32_t outline_size : 16;
|
||||||
};
|
};
|
||||||
uint32_t key;
|
uint32_t key = 0;
|
||||||
};
|
};
|
||||||
bool operator<(CacheID right) const {
|
bool operator<(CacheID right) const {
|
||||||
return key < right.key;
|
return key < right.key;
|
||||||
}
|
}
|
||||||
CacheID() {
|
|
||||||
key = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DataAtSize {
|
struct DataAtSize {
|
||||||
@ -86,10 +83,10 @@ private:
|
|||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
float scale_color_font = 1.f;
|
float scale_color_font = 1.f;
|
||||||
float ascent = 0;
|
float ascent = 0.0;
|
||||||
float descent = 0;
|
float descent = 0.0;
|
||||||
float underline_position = 0;
|
float underline_position = 0.0;
|
||||||
float underline_thickness = 0;
|
float underline_thickness = 0.0;
|
||||||
|
|
||||||
Vector<CharTexture> textures;
|
Vector<CharTexture> textures;
|
||||||
HashMap<char32_t, Character> char_map;
|
HashMap<char32_t, Character> char_map;
|
||||||
|
@ -57,20 +57,20 @@ class ImageLoaderTGA : public ImageFormatLoader {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tga_header_s {
|
struct tga_header_s {
|
||||||
uint8_t id_length;
|
uint8_t id_length = 0;
|
||||||
uint8_t color_map_type;
|
uint8_t color_map_type = 0;
|
||||||
tga_type_e image_type;
|
tga_type_e image_type;
|
||||||
|
|
||||||
uint16_t first_color_entry;
|
uint16_t first_color_entry = 0;
|
||||||
uint16_t color_map_length;
|
uint16_t color_map_length = 0;
|
||||||
uint8_t color_map_depth;
|
uint8_t color_map_depth = 0;
|
||||||
|
|
||||||
uint16_t x_origin;
|
uint16_t x_origin = 0;
|
||||||
uint16_t y_origin;
|
uint16_t y_origin = 0;
|
||||||
uint16_t image_width;
|
uint16_t image_width = 0;
|
||||||
uint16_t image_height;
|
uint16_t image_height = 0;
|
||||||
uint8_t pixel_depth;
|
uint8_t pixel_depth = 0;
|
||||||
uint8_t image_descriptor;
|
uint8_t image_descriptor = 0;
|
||||||
};
|
};
|
||||||
static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size);
|
static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size);
|
||||||
static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_output_size);
|
static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_output_size);
|
||||||
|
@ -645,30 +645,13 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
|
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
|
||||||
file = nullptr;
|
|
||||||
theora_p = 0;
|
|
||||||
vorbis_p = 0;
|
|
||||||
videobuf_ready = 0;
|
|
||||||
playing = false;
|
|
||||||
frames_pending = 0;
|
|
||||||
videobuf_time = 0;
|
|
||||||
paused = false;
|
|
||||||
|
|
||||||
buffering = false;
|
|
||||||
texture = Ref<ImageTexture>(memnew(ImageTexture));
|
texture = Ref<ImageTexture>(memnew(ImageTexture));
|
||||||
mix_callback = nullptr;
|
|
||||||
mix_udata = nullptr;
|
|
||||||
audio_track = 0;
|
|
||||||
delay_compensation = 0;
|
|
||||||
audio_frames_wrote = 0;
|
|
||||||
|
|
||||||
#ifdef THEORA_USE_THREAD_STREAMING
|
#ifdef THEORA_USE_THREAD_STREAMING
|
||||||
int rb_power = nearest_shift(RB_SIZE_KB * 1024);
|
int rb_power = nearest_shift(RB_SIZE_KB * 1024);
|
||||||
ring_buffer.resize(rb_power);
|
ring_buffer.resize(rb_power);
|
||||||
read_buffer.resize(RB_SIZE_KB * 1024);
|
read_buffer.resize(RB_SIZE_KB * 1024);
|
||||||
thread_sem = Semaphore::create();
|
thread_sem = Semaphore::create();
|
||||||
thread_exit = false;
|
|
||||||
thread_eof = false;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -52,12 +52,12 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Image frames[MAX_FRAMES];
|
//Image frames[MAX_FRAMES];
|
||||||
Image::Format format;
|
Image::Format format = Image::Format::FORMAT_L8;
|
||||||
Vector<uint8_t> frame_data;
|
Vector<uint8_t> frame_data;
|
||||||
int frames_pending;
|
int frames_pending = 0;
|
||||||
FileAccess *file;
|
FileAccess *file = nullptr;
|
||||||
String file_name;
|
String file_name;
|
||||||
int audio_frames_wrote;
|
int audio_frames_wrote = 0;
|
||||||
Point2i size;
|
Point2i size;
|
||||||
|
|
||||||
int buffer_data();
|
int buffer_data();
|
||||||
@ -65,8 +65,8 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
|
|||||||
void video_write();
|
void video_write();
|
||||||
float get_time() const;
|
float get_time() const;
|
||||||
|
|
||||||
bool theora_eos;
|
bool theora_eos = false;
|
||||||
bool vorbis_eos;
|
bool vorbis_eos = false;
|
||||||
|
|
||||||
ogg_sync_state oy;
|
ogg_sync_state oy;
|
||||||
ogg_page og;
|
ogg_page og;
|
||||||
@ -74,33 +74,33 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
|
|||||||
ogg_stream_state to;
|
ogg_stream_state to;
|
||||||
th_info ti;
|
th_info ti;
|
||||||
th_comment tc;
|
th_comment tc;
|
||||||
th_dec_ctx *td;
|
th_dec_ctx *td = nullptr;
|
||||||
vorbis_info vi;
|
vorbis_info vi;
|
||||||
vorbis_dsp_state vd;
|
vorbis_dsp_state vd;
|
||||||
vorbis_block vb;
|
vorbis_block vb;
|
||||||
vorbis_comment vc;
|
vorbis_comment vc;
|
||||||
th_pixel_fmt px_fmt;
|
th_pixel_fmt px_fmt;
|
||||||
double videobuf_time;
|
double videobuf_time = 0;
|
||||||
int pp_inc;
|
int pp_inc = 0;
|
||||||
|
|
||||||
int theora_p;
|
int theora_p = 0;
|
||||||
int vorbis_p;
|
int vorbis_p = 0;
|
||||||
int pp_level_max;
|
int pp_level_max = 0;
|
||||||
int pp_level;
|
int pp_level = 0;
|
||||||
int videobuf_ready;
|
int videobuf_ready = 0;
|
||||||
|
|
||||||
bool playing;
|
bool playing = false;
|
||||||
bool buffering;
|
bool buffering = false;
|
||||||
|
|
||||||
double last_update_time;
|
double last_update_time = 0;
|
||||||
double time;
|
double time = 0;
|
||||||
double delay_compensation;
|
double delay_compensation = 0;
|
||||||
|
|
||||||
Ref<ImageTexture> texture;
|
Ref<ImageTexture> texture;
|
||||||
|
|
||||||
AudioMixCallback mix_callback;
|
AudioMixCallback mix_callback;
|
||||||
void *mix_udata;
|
void *mix_udata = nullptr;
|
||||||
bool paused;
|
bool paused = false;
|
||||||
|
|
||||||
#ifdef THEORA_USE_THREAD_STREAMING
|
#ifdef THEORA_USE_THREAD_STREAMING
|
||||||
|
|
||||||
@ -110,16 +110,16 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
|
|||||||
|
|
||||||
RingBuffer<uint8_t> ring_buffer;
|
RingBuffer<uint8_t> ring_buffer;
|
||||||
Vector<uint8_t> read_buffer;
|
Vector<uint8_t> read_buffer;
|
||||||
bool thread_eof;
|
bool thread_eof = false;
|
||||||
Semaphore *thread_sem;
|
Semaphore *thread_sem;
|
||||||
Thread thread;
|
Thread thread;
|
||||||
volatile bool thread_exit;
|
volatile bool thread_exit = false;
|
||||||
|
|
||||||
static void _streaming_thread(void *ud);
|
static void _streaming_thread(void *ud);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int audio_track;
|
int audio_track = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -393,9 +393,6 @@ void UPNP::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UPNP::UPNP() {
|
UPNP::UPNP() {
|
||||||
discover_multicast_if = "";
|
|
||||||
discover_local_port = 0;
|
|
||||||
discover_ipv6 = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UPNP::~UPNP() {
|
UPNP::~UPNP() {
|
||||||
|
@ -41,9 +41,9 @@ class UPNP : public Reference {
|
|||||||
GDCLASS(UPNP, Reference);
|
GDCLASS(UPNP, Reference);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String discover_multicast_if;
|
String discover_multicast_if = "";
|
||||||
int discover_local_port;
|
int discover_local_port = 0;
|
||||||
bool discover_ipv6;
|
bool discover_ipv6 = false;
|
||||||
|
|
||||||
Vector<Ref<UPNPDevice>> devices;
|
Vector<Ref<UPNPDevice>> devices;
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ Ref<VisualScript> VisualScriptNode::get_visual_script() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptNode::VisualScriptNode() {
|
VisualScriptNode::VisualScriptNode() {
|
||||||
breakpoint = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
@ -145,8 +144,6 @@ VisualScriptNode::VisualScriptNode() {
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
|
|
||||||
VisualScriptNodeInstance::VisualScriptNodeInstance() {
|
VisualScriptNodeInstance::VisualScriptNodeInstance() {
|
||||||
sequence_outputs = nullptr;
|
|
||||||
input_ports = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptNodeInstance::~VisualScriptNodeInstance() {
|
VisualScriptNodeInstance::~VisualScriptNodeInstance() {
|
||||||
@ -2623,14 +2620,8 @@ void VisualScriptLanguage::get_registered_node_names(List<String> *r_names) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptLanguage::VisualScriptLanguage() {
|
VisualScriptLanguage::VisualScriptLanguage() {
|
||||||
notification = "_notification";
|
|
||||||
_step = "_step";
|
|
||||||
_subcall = "_subcall";
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
|
||||||
_debug_parse_err_node = -1;
|
|
||||||
_debug_parse_err_file = "";
|
|
||||||
_debug_call_stack_pos = 0;
|
|
||||||
int dmcs = GLOBAL_DEF("debug/settings/visual_script/max_call_stack", 1024);
|
int dmcs = GLOBAL_DEF("debug/settings/visual_script/max_call_stack", 1024);
|
||||||
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/visual_script/max_call_stack", PropertyInfo(Variant::INT, "debug/settings/visual_script/max_call_stack", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); //minimum is 1024
|
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/visual_script/max_call_stack", PropertyInfo(Variant::INT, "debug/settings/visual_script/max_call_stack", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); //minimum is 1024
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class VisualScriptNode : public Resource {
|
|||||||
Ref<VisualScript> script_used;
|
Ref<VisualScript> script_used;
|
||||||
|
|
||||||
Array default_input_values;
|
Array default_input_values;
|
||||||
bool breakpoint;
|
bool breakpoint = false;
|
||||||
|
|
||||||
void _set_default_input_values(Array p_values);
|
void _set_default_input_values(Array p_values);
|
||||||
Array _get_default_input_values() const;
|
Array _get_default_input_values() const;
|
||||||
@ -90,13 +90,9 @@ public:
|
|||||||
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance) = 0;
|
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance) = 0;
|
||||||
|
|
||||||
struct TypeGuess {
|
struct TypeGuess {
|
||||||
Variant::Type type;
|
Variant::Type type = Variant::NIL;
|
||||||
StringName gdclass;
|
StringName gdclass;
|
||||||
Ref<Script> script;
|
Ref<Script> script;
|
||||||
|
|
||||||
TypeGuess() {
|
|
||||||
type = Variant::NIL;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const;
|
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const;
|
||||||
@ -114,19 +110,19 @@ class VisualScriptNodeInstance {
|
|||||||
INPUT_DEFAULT_VALUE_BIT = INPUT_SHIFT, // from unassigned input port, using default value (edited by user)
|
INPUT_DEFAULT_VALUE_BIT = INPUT_SHIFT, // from unassigned input port, using default value (edited by user)
|
||||||
};
|
};
|
||||||
|
|
||||||
int id;
|
int id = 0;
|
||||||
int sequence_index;
|
int sequence_index = 0;
|
||||||
VisualScriptNodeInstance **sequence_outputs;
|
VisualScriptNodeInstance **sequence_outputs = nullptr;
|
||||||
int sequence_output_count;
|
int sequence_output_count = 0;
|
||||||
Vector<VisualScriptNodeInstance *> dependencies;
|
Vector<VisualScriptNodeInstance *> dependencies;
|
||||||
int *input_ports;
|
int *input_ports = nullptr;
|
||||||
int input_port_count;
|
int input_port_count = 0;
|
||||||
int *output_ports;
|
int *output_ports = nullptr;
|
||||||
int output_port_count;
|
int output_port_count = 0;
|
||||||
int working_mem_idx;
|
int working_mem_idx = 0;
|
||||||
int pass_idx;
|
int pass_idx = 0;
|
||||||
|
|
||||||
VisualScriptNode *base;
|
VisualScriptNode *base = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum StartMode {
|
enum StartMode {
|
||||||
@ -178,7 +174,7 @@ public:
|
|||||||
uint64_t from_output : 16;
|
uint64_t from_output : 16;
|
||||||
uint64_t to_node : 24;
|
uint64_t to_node : 24;
|
||||||
};
|
};
|
||||||
uint64_t id;
|
uint64_t id = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator<(const SequenceConnection &p_connection) const {
|
bool operator<(const SequenceConnection &p_connection) const {
|
||||||
@ -194,7 +190,7 @@ public:
|
|||||||
uint64_t to_node : 24;
|
uint64_t to_node : 24;
|
||||||
uint64_t to_port : 8;
|
uint64_t to_port : 8;
|
||||||
};
|
};
|
||||||
uint64_t id;
|
uint64_t id = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator<(const DataConnection &p_connection) const {
|
bool operator<(const DataConnection &p_connection) const {
|
||||||
@ -208,7 +204,7 @@ private:
|
|||||||
StringName base_type;
|
StringName base_type;
|
||||||
struct Argument {
|
struct Argument {
|
||||||
String name;
|
String name;
|
||||||
Variant::Type type;
|
Variant::Type type = Variant::Type::NIL;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NodeData {
|
struct NodeData {
|
||||||
@ -231,7 +227,7 @@ private:
|
|||||||
struct Variable {
|
struct Variable {
|
||||||
PropertyInfo info;
|
PropertyInfo info;
|
||||||
Variant default_value;
|
Variant default_value;
|
||||||
bool _export;
|
bool _export = false;
|
||||||
// Add getter & setter options here.
|
// Add getter & setter options here.
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -388,26 +384,27 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class VisualScriptInstance : public ScriptInstance {
|
class VisualScriptInstance : public ScriptInstance {
|
||||||
Object *owner;
|
Object *owner = nullptr;
|
||||||
Ref<VisualScript> script;
|
Ref<VisualScript> script;
|
||||||
|
|
||||||
Map<StringName, Variant> variables; // Using variable path, not script.
|
Map<StringName, Variant> variables; // Using variable path, not script.
|
||||||
Map<int, VisualScriptNodeInstance *> instances;
|
Map<int, VisualScriptNodeInstance *> instances;
|
||||||
|
|
||||||
struct Function {
|
struct Function {
|
||||||
int node;
|
int node = 0;
|
||||||
int max_stack;
|
int max_stack = 0;
|
||||||
int trash_pos;
|
int trash_pos = 0;
|
||||||
int flow_stack_size;
|
int flow_stack_size = 0;
|
||||||
int pass_stack_size;
|
int pass_stack_size = 0;
|
||||||
int node_count;
|
int node_count = 0;
|
||||||
int argument_count;
|
int argument_count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<StringName, Function> functions;
|
Map<StringName, Function> functions;
|
||||||
|
|
||||||
Vector<Variant> default_values;
|
Vector<Variant> default_values;
|
||||||
int max_input_args, max_output_args;
|
int max_input_args = 0;
|
||||||
|
int max_output_args = 0;
|
||||||
|
|
||||||
StringName source;
|
StringName source;
|
||||||
|
|
||||||
@ -479,14 +476,14 @@ class VisualScriptFunctionState : public Reference {
|
|||||||
|
|
||||||
ObjectID instance_id;
|
ObjectID instance_id;
|
||||||
ObjectID script_id;
|
ObjectID script_id;
|
||||||
VisualScriptInstance *instance;
|
VisualScriptInstance *instance = nullptr;
|
||||||
StringName function;
|
StringName function;
|
||||||
Vector<uint8_t> stack;
|
Vector<uint8_t> stack;
|
||||||
int working_mem_index;
|
int working_mem_index = 0;
|
||||||
int variant_stack_size;
|
int variant_stack_size = 0;
|
||||||
VisualScriptNodeInstance *node;
|
VisualScriptNodeInstance *node = nullptr;
|
||||||
int flow_stack_pos;
|
int flow_stack_pos = 0;
|
||||||
int pass;
|
int pass = 0;
|
||||||
|
|
||||||
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||||
|
|
||||||
@ -507,25 +504,25 @@ class VisualScriptLanguage : public ScriptLanguage {
|
|||||||
Map<String, VisualScriptNodeRegisterFunc> register_funcs;
|
Map<String, VisualScriptNodeRegisterFunc> register_funcs;
|
||||||
|
|
||||||
struct CallLevel {
|
struct CallLevel {
|
||||||
Variant *stack;
|
Variant *stack = nullptr;
|
||||||
Variant **work_mem;
|
Variant **work_mem = nullptr;
|
||||||
const StringName *function;
|
const StringName *function = nullptr;
|
||||||
VisualScriptInstance *instance;
|
VisualScriptInstance *instance = nullptr;
|
||||||
int *current_id;
|
int *current_id = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
int _debug_parse_err_node;
|
int _debug_parse_err_node = -1;
|
||||||
String _debug_parse_err_file;
|
String _debug_parse_err_file = "";
|
||||||
String _debug_error;
|
String _debug_error;
|
||||||
int _debug_call_stack_pos;
|
int _debug_call_stack_pos = 0;
|
||||||
int _debug_max_call_stack;
|
int _debug_max_call_stack;
|
||||||
CallLevel *_call_stack;
|
CallLevel *_call_stack;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StringName notification;
|
StringName notification = "_notification";
|
||||||
StringName _get_output_port_unsequenced;
|
StringName _get_output_port_unsequenced;
|
||||||
StringName _step;
|
StringName _step = "_step";
|
||||||
StringName _subcall;
|
StringName _subcall = "_subcall";
|
||||||
|
|
||||||
static VisualScriptLanguage *singleton;
|
static VisualScriptLanguage *singleton;
|
||||||
|
|
||||||
|
@ -1507,12 +1507,6 @@ VisualScriptNodeInstance *VisualScriptExpression::instance(VisualScriptInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptExpression::VisualScriptExpression() {
|
VisualScriptExpression::VisualScriptExpression() {
|
||||||
output_type = Variant::NIL;
|
|
||||||
expression_dirty = true;
|
|
||||||
error_set = true;
|
|
||||||
root = nullptr;
|
|
||||||
nodes = nullptr;
|
|
||||||
sequenced = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptExpression::~VisualScriptExpression() {
|
VisualScriptExpression::~VisualScriptExpression() {
|
||||||
|
@ -39,20 +39,18 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
friend class VisualScriptNodeInstanceExpression;
|
friend class VisualScriptNodeInstanceExpression;
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
Variant::Type type;
|
Variant::Type type = Variant::NIL;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
Input() { type = Variant::NIL; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Input> inputs;
|
Vector<Input> inputs;
|
||||||
Variant::Type output_type;
|
Variant::Type output_type = Variant::NIL;
|
||||||
|
|
||||||
String expression;
|
String expression;
|
||||||
|
|
||||||
bool sequenced;
|
bool sequenced = false;
|
||||||
int str_ofs;
|
int str_ofs = 0;
|
||||||
bool expression_dirty;
|
bool expression_dirty = true;
|
||||||
|
|
||||||
bool _compile_expression();
|
bool _compile_expression();
|
||||||
|
|
||||||
@ -114,7 +112,7 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
Error _get_token(Token &r_token);
|
Error _get_token(Token &r_token);
|
||||||
|
|
||||||
String error_str;
|
String error_str;
|
||||||
bool error_set;
|
bool error_set = true;
|
||||||
|
|
||||||
struct ENode {
|
struct ENode {
|
||||||
enum Type {
|
enum Type {
|
||||||
@ -131,11 +129,10 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
TYPE_CALL
|
TYPE_CALL
|
||||||
};
|
};
|
||||||
|
|
||||||
ENode *next;
|
ENode *next = nullptr;
|
||||||
|
|
||||||
Type type;
|
Type type = Type::TYPE_SELF;
|
||||||
|
|
||||||
ENode() { next = nullptr; }
|
|
||||||
virtual ~ENode() {
|
virtual ~ENode() {
|
||||||
if (next) {
|
if (next) {
|
||||||
memdelete(next);
|
memdelete(next);
|
||||||
@ -144,17 +141,17 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Expression {
|
struct Expression {
|
||||||
bool is_op;
|
bool is_op = false;
|
||||||
union {
|
union {
|
||||||
Variant::Operator op;
|
Variant::Operator op;
|
||||||
ENode *node;
|
ENode *node = nullptr;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ENode *_parse_expression();
|
ENode *_parse_expression();
|
||||||
|
|
||||||
struct InputNode : public ENode {
|
struct InputNode : public ENode {
|
||||||
int index;
|
int index = 0;
|
||||||
InputNode() {
|
InputNode() {
|
||||||
type = TYPE_INPUT;
|
type = TYPE_INPUT;
|
||||||
}
|
}
|
||||||
@ -168,9 +165,9 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct OperatorNode : public ENode {
|
struct OperatorNode : public ENode {
|
||||||
Variant::Operator op;
|
Variant::Operator op = Variant::Operator::OP_ADD;
|
||||||
|
|
||||||
ENode *nodes[2];
|
ENode *nodes[2] = { nullptr, nullptr };
|
||||||
|
|
||||||
OperatorNode() {
|
OperatorNode() {
|
||||||
type = TYPE_OPERATOR;
|
type = TYPE_OPERATOR;
|
||||||
@ -184,8 +181,8 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IndexNode : public ENode {
|
struct IndexNode : public ENode {
|
||||||
ENode *base;
|
ENode *base = nullptr;
|
||||||
ENode *index;
|
ENode *index = nullptr;
|
||||||
|
|
||||||
IndexNode() {
|
IndexNode() {
|
||||||
type = TYPE_INDEX;
|
type = TYPE_INDEX;
|
||||||
@ -193,7 +190,7 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct NamedIndexNode : public ENode {
|
struct NamedIndexNode : public ENode {
|
||||||
ENode *base;
|
ENode *base = nullptr;
|
||||||
StringName name;
|
StringName name;
|
||||||
|
|
||||||
NamedIndexNode() {
|
NamedIndexNode() {
|
||||||
@ -202,7 +199,7 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ConstructorNode : public ENode {
|
struct ConstructorNode : public ENode {
|
||||||
Variant::Type data_type;
|
Variant::Type data_type = Variant::Type::NIL;
|
||||||
Vector<ENode *> arguments;
|
Vector<ENode *> arguments;
|
||||||
|
|
||||||
ConstructorNode() {
|
ConstructorNode() {
|
||||||
@ -211,7 +208,7 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct CallNode : public ENode {
|
struct CallNode : public ENode {
|
||||||
ENode *base;
|
ENode *base = nullptr;
|
||||||
StringName method;
|
StringName method;
|
||||||
Vector<ENode *> arguments;
|
Vector<ENode *> arguments;
|
||||||
|
|
||||||
@ -235,7 +232,7 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct BuiltinFuncNode : public ENode {
|
struct BuiltinFuncNode : public ENode {
|
||||||
VisualScriptBuiltinFunc::BuiltinFunc func;
|
VisualScriptBuiltinFunc::BuiltinFunc func = VisualScriptBuiltinFunc::BuiltinFunc::BYTES_TO_VAR;
|
||||||
Vector<ENode *> arguments;
|
Vector<ENode *> arguments;
|
||||||
BuiltinFuncNode() {
|
BuiltinFuncNode() {
|
||||||
type = TYPE_BUILTIN_FUNC;
|
type = TYPE_BUILTIN_FUNC;
|
||||||
@ -250,8 +247,8 @@ class VisualScriptExpression : public VisualScriptNode {
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENode *root;
|
ENode *root = nullptr;
|
||||||
ENode *nodes;
|
ENode *nodes = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _set(const StringName &p_name, const Variant &p_value);
|
bool _set(const StringName &p_name, const Variant &p_value);
|
||||||
|
@ -182,16 +182,9 @@ bool WebRTCDataChannelJS::is_negotiated() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRTCDataChannelJS::WebRTCDataChannelJS() {
|
WebRTCDataChannelJS::WebRTCDataChannelJS() {
|
||||||
queue_count = 0;
|
|
||||||
_was_string = false;
|
|
||||||
_write_mode = WRITE_MODE_BINARY;
|
|
||||||
_js_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
|
WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
|
||||||
queue_count = 0;
|
|
||||||
_was_string = false;
|
|
||||||
_write_mode = WRITE_MODE_BINARY;
|
|
||||||
_js_id = js_id;
|
_js_id = js_id;
|
||||||
|
|
||||||
godot_js_rtc_datachannel_connect(js_id, this, &_on_open, &_on_message, &_on_error, &_on_close);
|
godot_js_rtc_datachannel_connect(js_id, this, &_on_open, &_on_message, &_on_error, &_on_close);
|
||||||
|
@ -42,16 +42,16 @@ private:
|
|||||||
String _label;
|
String _label;
|
||||||
String _protocol;
|
String _protocol;
|
||||||
|
|
||||||
bool _was_string;
|
bool _was_string = false;
|
||||||
WriteMode _write_mode;
|
WriteMode _write_mode = WRITE_MODE_BINARY;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PACKET_BUFFER_SIZE = 65536 - 5 // 4 bytes for the size, 1 for for type
|
PACKET_BUFFER_SIZE = 65536 - 5 // 4 bytes for the size, 1 for for type
|
||||||
};
|
};
|
||||||
|
|
||||||
int _js_id;
|
int _js_id = 0;
|
||||||
RingBuffer<uint8_t> in_buffer;
|
RingBuffer<uint8_t> in_buffer;
|
||||||
int queue_count;
|
int queue_count = 0;
|
||||||
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||||
|
|
||||||
static void _on_open(void *p_obj);
|
static void _on_open(void *p_obj);
|
||||||
|
@ -140,11 +140,7 @@ Error EMWSClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffe
|
|||||||
}
|
}
|
||||||
|
|
||||||
EMWSClient::EMWSClient() {
|
EMWSClient::EMWSClient() {
|
||||||
_in_buf_size = DEF_BUF_SHIFT;
|
|
||||||
_in_pkt_size = DEF_PKT_SHIFT;
|
|
||||||
_is_connecting = false;
|
|
||||||
_peer = Ref<EMWSPeer>(memnew(EMWSPeer));
|
_peer = Ref<EMWSPeer>(memnew(EMWSPeer));
|
||||||
_js_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EMWSClient::~EMWSClient() {
|
EMWSClient::~EMWSClient() {
|
||||||
|
@ -41,10 +41,10 @@ class EMWSClient : public WebSocketClient {
|
|||||||
GDCIIMPL(EMWSClient, WebSocketClient);
|
GDCIIMPL(EMWSClient, WebSocketClient);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _js_id;
|
int _js_id = 0;
|
||||||
bool _is_connecting;
|
bool _is_connecting = false;
|
||||||
int _in_buf_size;
|
int _in_buf_size = DEF_BUF_SHIFT;
|
||||||
int _in_pkt_size;
|
int _in_pkt_size = DEF_PKT_SHIFT;
|
||||||
|
|
||||||
static void _esws_on_connect(void *obj, char *proto);
|
static void _esws_on_connect(void *obj, char *proto);
|
||||||
static void _esws_on_message(void *obj, const uint8_t *p_data, int p_data_size, int p_is_string);
|
static void _esws_on_message(void *obj, const uint8_t *p_data, int p_data_size, int p_is_string);
|
||||||
|
@ -106,8 +106,6 @@ void EMWSPeer::set_no_delay(bool p_enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EMWSPeer::EMWSPeer() {
|
EMWSPeer::EMWSPeer() {
|
||||||
peer_sock = -1;
|
|
||||||
write_mode = WRITE_MODE_BINARY;
|
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ class EMWSPeer : public WebSocketPeer {
|
|||||||
GDCIIMPL(EMWSPeer, WebSocketPeer);
|
GDCIIMPL(EMWSPeer, WebSocketPeer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int peer_sock;
|
int peer_sock = -1;
|
||||||
WriteMode write_mode;
|
WriteMode write_mode = WRITE_MODE_BINARY;
|
||||||
|
|
||||||
Vector<uint8_t> _packet_buffer;
|
Vector<uint8_t> _packet_buffer;
|
||||||
PacketBuffer<uint8_t> _in_buffer;
|
PacketBuffer<uint8_t> _in_buffer;
|
||||||
uint8_t _is_string;
|
uint8_t _is_string = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error read_msg(const uint8_t *p_data, uint32_t p_size, bool p_is_string);
|
Error read_msg(const uint8_t *p_data, uint32_t p_size, bool p_is_string);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
GDCINULL(WebSocketClient);
|
GDCINULL(WebSocketClient);
|
||||||
|
|
||||||
WebSocketClient::WebSocketClient() {
|
WebSocketClient::WebSocketClient() {
|
||||||
verify_ssl = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketClient::~WebSocketClient() {
|
WebSocketClient::~WebSocketClient() {
|
||||||
|
@ -42,7 +42,7 @@ class WebSocketClient : public WebSocketMultiplayerPeer {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ref<WebSocketPeer> _peer;
|
Ref<WebSocketPeer> _peer;
|
||||||
bool verify_ssl;
|
bool verify_ssl = true;
|
||||||
Ref<X509Certificate> ssl_cert;
|
Ref<X509Certificate> ssl_cert;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -33,15 +33,6 @@
|
|||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
|
||||||
WebSocketMultiplayerPeer::WebSocketMultiplayerPeer() {
|
WebSocketMultiplayerPeer::WebSocketMultiplayerPeer() {
|
||||||
_is_multiplayer = false;
|
|
||||||
_peer_id = 0;
|
|
||||||
_target_peer = 0;
|
|
||||||
_refusing = false;
|
|
||||||
|
|
||||||
_current_packet.source = 0;
|
|
||||||
_current_packet.destination = 0;
|
|
||||||
_current_packet.size = 0;
|
|
||||||
_current_packet.data = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketMultiplayerPeer::~WebSocketMultiplayerPeer() {
|
WebSocketMultiplayerPeer::~WebSocketMultiplayerPeer() {
|
||||||
|
@ -55,20 +55,20 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Packet {
|
struct Packet {
|
||||||
int source;
|
int source = 0;
|
||||||
int destination;
|
int destination = 0;
|
||||||
uint8_t *data;
|
uint8_t *data = nullptr;
|
||||||
uint32_t size;
|
uint32_t size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
List<Packet> _incoming_packets;
|
List<Packet> _incoming_packets;
|
||||||
Map<int, Ref<WebSocketPeer>> _peer_map;
|
Map<int, Ref<WebSocketPeer>> _peer_map;
|
||||||
Packet _current_packet;
|
Packet _current_packet;
|
||||||
|
|
||||||
bool _is_multiplayer;
|
bool _is_multiplayer = false;
|
||||||
int _target_peer;
|
int _target_peer = 0;
|
||||||
int _peer_id;
|
int _peer_id = 0;
|
||||||
int _refusing;
|
int _refusing = false;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
@ -337,11 +337,6 @@ Error WSLClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
WSLClient::WSLClient() {
|
WSLClient::WSLClient() {
|
||||||
_in_buf_size = DEF_BUF_SHIFT;
|
|
||||||
_in_pkt_size = DEF_PKT_SHIFT;
|
|
||||||
_out_buf_size = DEF_BUF_SHIFT;
|
|
||||||
_out_pkt_size = DEF_PKT_SHIFT;
|
|
||||||
|
|
||||||
_peer.instance();
|
_peer.instance();
|
||||||
_tcp.instance();
|
_tcp.instance();
|
||||||
disconnect_from_host();
|
disconnect_from_host();
|
||||||
|
@ -44,27 +44,27 @@ class WSLClient : public WebSocketClient {
|
|||||||
GDCIIMPL(WSLClient, WebSocketClient);
|
GDCIIMPL(WSLClient, WebSocketClient);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _in_buf_size;
|
int _in_buf_size = DEF_BUF_SHIFT;
|
||||||
int _in_pkt_size;
|
int _in_pkt_size = DEF_PKT_SHIFT;
|
||||||
int _out_buf_size;
|
int _out_buf_size = DEF_BUF_SHIFT;
|
||||||
int _out_pkt_size;
|
int _out_pkt_size = DEF_PKT_SHIFT;
|
||||||
|
|
||||||
Ref<WSLPeer> _peer;
|
Ref<WSLPeer> _peer;
|
||||||
Ref<StreamPeerTCP> _tcp;
|
Ref<StreamPeerTCP> _tcp;
|
||||||
Ref<StreamPeer> _connection;
|
Ref<StreamPeer> _connection;
|
||||||
|
|
||||||
CharString _request;
|
CharString _request;
|
||||||
int _requested;
|
int _requested = 0;
|
||||||
|
|
||||||
uint8_t _resp_buf[WSL_MAX_HEADER_SIZE];
|
uint8_t _resp_buf[WSL_MAX_HEADER_SIZE];
|
||||||
int _resp_pos;
|
int _resp_pos = 0;
|
||||||
|
|
||||||
String _response;
|
String _response;
|
||||||
|
|
||||||
String _key;
|
String _key;
|
||||||
String _host;
|
String _host;
|
||||||
Vector<String> _protocols;
|
Vector<String> _protocols;
|
||||||
bool _use_ssl;
|
bool _use_ssl = false;
|
||||||
|
|
||||||
void _do_handshake();
|
void _do_handshake();
|
||||||
bool _verify_headers(String &r_protocol);
|
bool _verify_headers(String &r_protocol);
|
||||||
|
@ -329,10 +329,6 @@ void WSLPeer::invalidate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WSLPeer::WSLPeer() {
|
WSLPeer::WSLPeer() {
|
||||||
_data = nullptr;
|
|
||||||
_is_string = 0;
|
|
||||||
close_code = -1;
|
|
||||||
write_mode = WRITE_MODE_BINARY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WSLPeer::~WSLPeer() {
|
WSLPeer::~WSLPeer() {
|
||||||
|
@ -48,29 +48,17 @@ class WSLPeer : public WebSocketPeer {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct PeerData {
|
struct PeerData {
|
||||||
bool polling;
|
bool polling = false;
|
||||||
bool destroy;
|
bool destroy = false;
|
||||||
bool valid;
|
bool valid = false;
|
||||||
bool is_server;
|
bool is_server = false;
|
||||||
bool closing;
|
bool closing = false;
|
||||||
void *obj;
|
void *obj = nullptr;
|
||||||
void *peer;
|
void *peer = nullptr;
|
||||||
Ref<StreamPeer> conn;
|
Ref<StreamPeer> conn;
|
||||||
Ref<StreamPeerTCP> tcp;
|
Ref<StreamPeerTCP> tcp;
|
||||||
int id;
|
int id = 1;
|
||||||
wslay_event_context_ptr ctx;
|
wslay_event_context_ptr ctx = nullptr;
|
||||||
|
|
||||||
PeerData() {
|
|
||||||
polling = false;
|
|
||||||
destroy = false;
|
|
||||||
valid = false;
|
|
||||||
is_server = false;
|
|
||||||
id = 1;
|
|
||||||
ctx = nullptr;
|
|
||||||
obj = nullptr;
|
|
||||||
closing = false;
|
|
||||||
peer = nullptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static String compute_key_response(String p_key);
|
static String compute_key_response(String p_key);
|
||||||
@ -80,17 +68,17 @@ private:
|
|||||||
static bool _wsl_poll(struct PeerData *p_data);
|
static bool _wsl_poll(struct PeerData *p_data);
|
||||||
static void _wsl_destroy(struct PeerData **p_data);
|
static void _wsl_destroy(struct PeerData **p_data);
|
||||||
|
|
||||||
struct PeerData *_data;
|
struct PeerData *_data = nullptr;
|
||||||
uint8_t _is_string;
|
uint8_t _is_string = 0;
|
||||||
// Our packet info is just a boolean (is_string), using uint8_t for it.
|
// Our packet info is just a boolean (is_string), using uint8_t for it.
|
||||||
PacketBuffer<uint8_t> _in_buffer;
|
PacketBuffer<uint8_t> _in_buffer;
|
||||||
|
|
||||||
Vector<uint8_t> _packet_buffer;
|
Vector<uint8_t> _packet_buffer;
|
||||||
|
|
||||||
WriteMode write_mode;
|
WriteMode write_mode = WRITE_MODE_BINARY;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int close_code;
|
int close_code = -1;
|
||||||
String close_reason;
|
String close_reason;
|
||||||
void poll(); // Used by client and server.
|
void poll(); // Used by client and server.
|
||||||
|
|
||||||
|
@ -34,15 +34,6 @@
|
|||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
|
||||||
WSLServer::PendingPeer::PendingPeer() {
|
|
||||||
use_ssl = false;
|
|
||||||
time = 0;
|
|
||||||
has_request = false;
|
|
||||||
response_sent = 0;
|
|
||||||
req_pos = 0;
|
|
||||||
memset(req_buf, 0, sizeof(req_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WSLServer::PendingPeer::_parse_request(const Vector<String> p_protocols) {
|
bool WSLServer::PendingPeer::_parse_request(const Vector<String> p_protocols) {
|
||||||
Vector<String> psa = String((char *)req_buf).split("\r\n");
|
Vector<String> psa = String((char *)req_buf).split("\r\n");
|
||||||
int len = psa.size();
|
int len = psa.size();
|
||||||
@ -310,10 +301,6 @@ Error WSLServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
WSLServer::WSLServer() {
|
WSLServer::WSLServer() {
|
||||||
_in_buf_size = DEF_BUF_SHIFT;
|
|
||||||
_in_pkt_size = DEF_PKT_SHIFT;
|
|
||||||
_out_buf_size = DEF_BUF_SHIFT;
|
|
||||||
_out_pkt_size = DEF_PKT_SHIFT;
|
|
||||||
_server.instance();
|
_server.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,26 +53,24 @@ private:
|
|||||||
public:
|
public:
|
||||||
Ref<StreamPeerTCP> tcp;
|
Ref<StreamPeerTCP> tcp;
|
||||||
Ref<StreamPeer> connection;
|
Ref<StreamPeer> connection;
|
||||||
bool use_ssl;
|
bool use_ssl = false;
|
||||||
|
|
||||||
int time;
|
int time = 0;
|
||||||
uint8_t req_buf[WSL_MAX_HEADER_SIZE];
|
uint8_t req_buf[WSL_MAX_HEADER_SIZE] = {};
|
||||||
int req_pos;
|
int req_pos = 0;
|
||||||
String key;
|
String key;
|
||||||
String protocol;
|
String protocol;
|
||||||
bool has_request;
|
bool has_request = false;
|
||||||
CharString response;
|
CharString response;
|
||||||
int response_sent;
|
int response_sent = 0;
|
||||||
|
|
||||||
PendingPeer();
|
|
||||||
|
|
||||||
Error do_handshake(const Vector<String> p_protocols);
|
Error do_handshake(const Vector<String> p_protocols);
|
||||||
};
|
};
|
||||||
|
|
||||||
int _in_buf_size;
|
int _in_buf_size = DEF_BUF_SHIFT;
|
||||||
int _in_pkt_size;
|
int _in_pkt_size = DEF_PKT_SHIFT;
|
||||||
int _out_buf_size;
|
int _out_buf_size = DEF_BUF_SHIFT;
|
||||||
int _out_pkt_size;
|
int _out_pkt_size = DEF_PKT_SHIFT;
|
||||||
|
|
||||||
List<Ref<PendingPeer>> _pending;
|
List<Ref<PendingPeer>> _pending;
|
||||||
Ref<TCP_Server> _server;
|
Ref<TCP_Server> _server;
|
||||||
|
@ -163,8 +163,8 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
|
|||||||
*r_uvs = (float *)malloc(sizeof(float) * output.vertexCount * 2);
|
*r_uvs = (float *)malloc(sizeof(float) * output.vertexCount * 2);
|
||||||
*r_indices = (int *)malloc(sizeof(int) * output.indexCount);
|
*r_indices = (int *)malloc(sizeof(int) * output.indexCount);
|
||||||
|
|
||||||
float max_x = 0;
|
float max_x = 0.0;
|
||||||
float max_y = 0;
|
float max_y = 0.0;
|
||||||
for (uint32_t i = 0; i < output.vertexCount; i++) {
|
for (uint32_t i = 0; i < output.vertexCount; i++) {
|
||||||
(*r_vertices)[i] = output.vertexArray[i].xref;
|
(*r_vertices)[i] = output.vertexArray[i].xref;
|
||||||
(*r_uvs)[i * 2 + 0] = output.vertexArray[i].uv[0] / w;
|
(*r_uvs)[i * 2 + 0] = output.vertexArray[i].uv[0] / w;
|
||||||
|
Loading…
Reference in New Issue
Block a user