11 if (s.empty())
return false;
12 return std::all_of(s.begin(), s.end(), [](
unsigned char c) {
13 return (c >=
'0' && c <=
'9') || (c >=
'A' && c <=
'Z') || (c >=
'a' && c <=
'z') ||
21 FxVec4ui8 m_fillColor{200, 200, 200, 255};
22 FxVec4ui8 m_outlineColor{10, 10, 10, 255};
23 float m_outlineThickness = 2.5f;
24 std::string m_fillTexturePath =
"";
33 m_fillTexturePath =
"";
37 void set_fillTexture(
const std::string& filePath) { m_fillTexturePath = filePath; }
40 const std::string&
fillTexture()
const {
return m_fillTexturePath; }
52 uint32_t m_entity_id = 0;
59 float _inertia = 1.0f;
60 float _inv_mass = 1.0f;
61 float _inv_inertia = 1.0f;
65 FxVec3f _init_velocity{0, 0, 0};
68 FxVec3d m_correction_carry{0, 0, 0};
71 std::shared_ptr<FxCollisionShape> m_collision;
72 std::shared_ptr<FxVisualShape> m_visual = std::make_shared<FxVisualShape>();
75 float m_eff_moment = 0.0f;
79 float m_eff_impulse_moment = 0.0f;
86 float m_sleep_timer = 0.0f;
87 bool m_sleeping =
false;
92 int32_t m_broad_phase_node = -1;
93 int32_t m_packed_index = -1;
96 void __update_pose(
const double& step_dt);
131 m_sleep_timer = 0.0f;
140 const std::string&
get_name()
const {
return m_name; }
159 float mass()
const {
return _mass; }
172 m_visual = std::make_shared<FxVisualShape>(std::move(visual));
173 m_visual->set_world_pose(
pose);
176 m_collision = std::make_shared<FxCollisionShape>(std::move(collision));
180 m_collision->set_world_pose(
pose, m_bounding_box);
bool is_valid_name(const std::string &s)
Fixed-size, aligned value array.
A named rigid body with state, material properties, geometry, and forces.
void set_init_pose(const FxVec3f &o_pose)
void apply_impulse(const FxVec2f &impulse)
int32_t packed_index() const
FxVec3f apply_pose_correction(const FxVec3f &delta)
void step(const FxVec2f &gravity, const double &step_dt)
FxVec2f velocity_at_local_point(const FxVec2f &local_position) const
void set_mass(const float &mass)
const std::shared_ptr< FxCollisionShape > & collision_geometry() const
void set_inertia(const float &inertia)
bool aabb_overlap_check(const std::shared_ptr< FxEntity > &other) const
float sleep_threshold_linear
int32_t broad_phase_node() const
float sleep_threshold_angular
FxVec2f to_entity_frame(const FxVec2f &world_point) const
void set_packed_index(int32_t index)
void apply_force(const FxVec2f &force)
FxVec2fArray velocity_at_local_point(const FxVec2fArray &local_position) const
void set_entity_id(uint32_t id)
const std::shared_ptr< FxVisualShape > & visual_geometry() const
bool aabb_overlap_check(const FxEntity &other) const
void del_visual_geometry()
FxVec2f to_world_frame(const FxVec2f &local_point) const
void del_collision_geometry()
void set_collision_geometry(FxCollisionShape collision)
float sleep_time_required
FxVec2fArray velocity_at_world_point(const FxVec2fArray &position) const
void enable_external_forces(bool enable)
FxVec3f calc_acceleration()
uint32_t get_entity_id() const
const FxArray< float > & bounding_box() const
FxEntity(const std::string &entityName)
void apply_force(const FxVec2f &force, const FxVec2f &contact_point)
void set_init_velocity(const FxVec3f &o_velocity)
void set_visual_geometry(FxVisualShape visual)
FxVec3f calc_acceleration(const FxVec2f &gravity)
const std::string & get_name() const
FxVec2f velocity_at_world_point(const FxVec2f &position) const
void set_broad_phase_node(int32_t node)
float inv_inertia() const
void tick_sleep(float dt)
void apply_impulse(const FxVec2f &impulse, const FxVec2f &contact_point)
void apply_torque(float torque)
Single-precision 2D vector.
Double-precision three-component vector.
Single-precision three-component vector, including poses.
Unified circle, capsule, polygon, edge, and chain representation.
const std::string & fillTexture() const
void set_fillTexture(const std::string &filePath)
void set_outlineThickness(const float &thickness)
float outlineThickness() const
FxVisualShape(const FxShape &base)
void set_fillColor(const FxVec4ui8 &color)
const FxVec4ui8 & fillColor() const
void set_outlineColor(const FxVec4ui8 &color)
const FxVec4ui8 & outlineColor() const