godot/servers/physics_2d/collision_object_2d_sw.h

197 lines
7.3 KiB
C++
Raw Normal View History

2014-02-10 01:10:30 +00:00
/*************************************************************************/
/* collision_object_2d_sw.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
2014-02-10 01:10:30 +00:00
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
2014-02-10 01:10:30 +00:00
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
2014-02-10 01:10:30 +00:00
#ifndef COLLISION_OBJECT_2D_SW_H
#define COLLISION_OBJECT_2D_SW_H
#include "broad_phase_2d_sw.h"
#include "core/self_list.h"
#include "servers/physics_server_2d.h"
#include "shape_2d_sw.h"
2014-02-10 01:10:30 +00:00
class Space2DSW;
class CollisionObject2DSW : public ShapeOwner2DSW {
public:
enum Type {
TYPE_AREA,
TYPE_BODY
};
private:
2014-02-10 01:10:30 +00:00
Type type;
RID self;
ObjectID instance_id;
ObjectID canvas_instance_id;
bool pickable;
2014-02-10 01:10:30 +00:00
struct Shape {
Transform2D xform;
Transform2D xform_inv;
2014-02-10 01:10:30 +00:00
BroadPhase2DSW::ID bpid;
Rect2 aabb_cache; //for rayqueries
Shape2DSW *shape;
Variant metadata;
bool disabled;
bool one_way_collision;
float one_way_collision_margin;
Shape() {
disabled = false;
one_way_collision = false;
one_way_collision_margin = 0;
}
2014-02-10 01:10:30 +00:00
};
Vector<Shape> shapes;
Space2DSW *space;
Transform2D transform;
Transform2D inv_transform;
uint32_t collision_mask;
2017-06-13 15:45:01 +00:00
uint32_t collision_layer;
2014-02-10 01:10:30 +00:00
bool _static;
SelfList<CollisionObject2DSW> pending_shape_update_list;
2014-02-10 01:10:30 +00:00
void _update_shapes();
protected:
void _update_shapes_with_motion(const Vector2 &p_motion);
2014-02-10 01:10:30 +00:00
void _unregister_shapes();
_FORCE_INLINE_ void _set_transform(const Transform2D &p_transform, bool p_update_shapes = true) {
transform = p_transform;
if (p_update_shapes) {
_update_shapes();
}
}
_FORCE_INLINE_ void _set_inv_transform(const Transform2D &p_transform) { inv_transform = p_transform; }
2014-02-10 01:10:30 +00:00
void _set_static(bool p_static);
virtual void _shapes_changed() = 0;
void _set_space(Space2DSW *p_space);
2014-02-10 01:10:30 +00:00
CollisionObject2DSW(Type p_type);
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ RID get_self() const { return self; }
_FORCE_INLINE_ void set_instance_id(const ObjectID &p_instance_id) { instance_id = p_instance_id; }
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ ObjectID get_instance_id() const { return instance_id; }
_FORCE_INLINE_ void set_canvas_instance_id(const ObjectID &p_canvas_instance_id) { canvas_instance_id = p_canvas_instance_id; }
_FORCE_INLINE_ ObjectID get_canvas_instance_id() const { return canvas_instance_id; }
2014-02-10 01:10:30 +00:00
void _shape_changed();
_FORCE_INLINE_ Type get_type() const { return type; }
void add_shape(Shape2DSW *p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false);
void set_shape(int p_index, Shape2DSW *p_shape);
void set_shape_transform(int p_index, const Transform2D &p_transform);
void set_shape_metadata(int p_index, const Variant &p_metadata);
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ int get_shape_count() const { return shapes.size(); }
_FORCE_INLINE_ bool is_shape_disabled(int p_index) const {
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].disabled;
}
_FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].shape;
}
_FORCE_INLINE_ const Transform2D &get_shape_transform(int p_index) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].xform;
}
_FORCE_INLINE_ const Transform2D &get_shape_inv_transform(int p_index) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].xform_inv;
}
_FORCE_INLINE_ const Rect2 &get_shape_aabb(int p_index) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].aabb_cache;
}
_FORCE_INLINE_ const Variant &get_shape_metadata(int p_index) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].metadata;
}
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ Transform2D get_transform() const { return transform; }
_FORCE_INLINE_ Transform2D get_inv_transform() const { return inv_transform; }
_FORCE_INLINE_ Space2DSW *get_space() const { return space; }
2014-02-10 01:10:30 +00:00
void set_shape_as_disabled(int p_idx, bool p_disabled);
_FORCE_INLINE_ bool is_shape_set_as_disabled(int p_idx) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_idx, shapes.size());
return shapes[p_idx].disabled;
}
_FORCE_INLINE_ void set_shape_as_one_way_collision(int p_idx, bool p_one_way_collision, float p_margin) {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_idx, shapes.size());
shapes.write[p_idx].one_way_collision = p_one_way_collision;
shapes.write[p_idx].one_way_collision_margin = p_margin;
}
_FORCE_INLINE_ bool is_shape_set_as_one_way_collision(int p_idx) const {
Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
2018-09-27 11:11:41 +00:00
CRASH_BAD_INDEX(p_idx, shapes.size());
return shapes[p_idx].one_way_collision;
}
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ float get_shape_one_way_collision_margin(int p_idx) const {
CRASH_BAD_INDEX(p_idx, shapes.size());
return shapes[p_idx].one_way_collision_margin;
}
void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; }
_FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; }
2017-06-13 15:45:01 +00:00
void set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; }
_FORCE_INLINE_ uint32_t get_collision_layer() const { return collision_layer; }
2014-02-10 01:10:30 +00:00
void remove_shape(Shape2DSW *p_shape);
void remove_shape(int p_index);
virtual void set_space(Space2DSW *p_space) = 0;
2014-02-10 01:10:30 +00:00
_FORCE_INLINE_ bool is_static() const { return _static; }
2014-02-10 01:10:30 +00:00
void set_pickable(bool p_pickable) { pickable = p_pickable; }
_FORCE_INLINE_ bool is_pickable() const { return pickable; }
_FORCE_INLINE_ bool test_collision_mask(CollisionObject2DSW *p_other) const {
2017-06-13 15:45:01 +00:00
return collision_layer & p_other->collision_mask || p_other->collision_layer & collision_mask;
}
2014-02-10 01:10:30 +00:00
virtual ~CollisionObject2DSW() {}
};
#endif // COLLISION_OBJECT_2D_SW_H