Skip to content

Commit

Permalink
unify component definition class naming style (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlorinMedas authored and hyv1001 committed May 1, 2022
1 parent 949fe57 commit 3bf4b10
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Pilot
{
MotorComponent::MotorComponent(const MotorRes& motor_param, GObject* parent_object) :
MotorComponent::MotorComponent(const MotorComponentRes& motor_param, GObject* parent_object) :
Component(parent_object), m_motor_res(motor_param)
{
if (motor_param.m_controller_config.getTypeName() == "PhysicsControllerConfig")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Pilot
REFLECTION_BODY(MotorComponent)
public:
MotorComponent() {}
MotorComponent(const MotorRes& motor_param, GObject* parent_object);
MotorComponent(const MotorComponentRes& motor_param, GObject* parent_object);

~MotorComponent() override;

Expand All @@ -47,7 +47,7 @@ namespace Pilot
void calculateTargetPosition(const Vector3&& current_position);

META(Enable)
MotorRes m_motor_res;
MotorComponentRes m_motor_res;

float m_move_speed_ratio {0.f};
float m_vertical_move_speed {0.f};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Pilot
{
RigidBodyComponent::RigidBodyComponent(const RigidBodyActorRes& rigidbody_ast, GObject* parent_object) :
RigidBodyComponent::RigidBodyComponent(const RigidBodyComponentRes& rigidbody_ast, GObject* parent_object) :
Component(parent_object)
{
const TransformComponent* parent_transform = m_parent_object->tryGetComponentConst(TransformComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Pilot
PhysicsActor* m_physics_actor {nullptr};

RigidBodyComponent() {}
RigidBodyComponent(const RigidBodyActorRes& rigidbody_ast, GObject* parent_object);
RigidBodyComponent(const RigidBodyComponentRes& rigidbody_ast, GObject* parent_object);
~RigidBodyComponent() override;

void tick(float delta_time) override {}
Expand Down
2 changes: 1 addition & 1 deletion engine/source/runtime/function/physics/physics_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Pilot

PhysicsActor* PhysicsSystem::createPhysicsActor(GObject* gobject,
const Transform& global_transform,
const RigidBodyActorRes& rigid_body_actor_res)
const RigidBodyComponentRes& rigid_body_actor_res)
{
PhysicsActor* actor = new PhysicsActor(gobject, global_transform);

Expand Down
2 changes: 1 addition & 1 deletion engine/source/runtime/function/physics/physics_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Pilot

PhysicsActor* createPhysicsActor(GObject* gobject,
const Transform& global_transform,
const RigidBodyActorRes& rigid_body_actor_res);
const RigidBodyComponentRes& rigid_body_actor_res);
void removePhyicsActor(PhysicsActor* gobject);

bool raycast(const Vector3& ray_start, const Vector3& ray_direction, Vector3& out_hit_position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace Pilot
REGISTER_COMPONENT(AnimationComponent, AnimationComponentRes, false);
REGISTER_COMPONENT(TransformComponent, Transform, false);
REGISTER_COMPONENT(MeshComponent, MeshComponentRes, true);
REGISTER_COMPONENT(RigidBodyComponent, RigidBodyActorRes, false);
REGISTER_COMPONENT(RigidBodyComponent, RigidBodyComponentRes, false);
REGISTER_COMPONENT(CameraComponent, CameraComponentRes, false);
REGISTER_COMPONENT(MotorComponent, MotorRes, false);
REGISTER_COMPONENT(MotorComponent, MotorComponentRes, false);
}

std::filesystem::path AssetManager::getFullPath(const std::string& relative_path) const
Expand Down
10 changes: 0 additions & 10 deletions engine/source/runtime/resource/res_type/components/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,4 @@ namespace Pilot
AnimationResult animation_result;
};

REFLECTION_TYPE(AnimationComponents)
CLASS(AnimationComponents, Fields)
{
REFLECTION_BODY(AnimationComponents);

public:
std::string schemaFile;
std::vector<AnimationComponentRes> components;
};

} // namespace Pilot
8 changes: 4 additions & 4 deletions engine/source/runtime/resource/res_type/components/motor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ namespace Pilot
Capsule m_capsule_shape;
};

REFLECTION_TYPE(MotorRes)
CLASS(MotorRes, WhiteListFields)
REFLECTION_TYPE(MotorComponentRes)
CLASS(MotorComponentRes, WhiteListFields)
{
REFLECTION_BODY(MotorRes);
REFLECTION_BODY(MotorComponentRes);

public:
~MotorRes() { PILOT_REFLECTION_DELETE(m_controller_config); }
~MotorComponentRes() { PILOT_REFLECTION_DELETE(m_controller_config); }

ControllerType m_controller_type {ControllerType::none};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ namespace Pilot
~RigidBodyShape() { PILOT_REFLECTION_DELETE(m_geometry); }
};

REFLECTION_TYPE(RigidBodyActorRes)
CLASS(RigidBodyActorRes, Fields)
REFLECTION_TYPE(RigidBodyComponentRes)
CLASS(RigidBodyComponentRes, Fields)
{
REFLECTION_BODY(RigidBodyActorRes);
REFLECTION_BODY(RigidBodyComponentRes);

public:
std::vector<RigidBodyShape> m_shapes;
Expand Down

0 comments on commit 3bf4b10

Please sign in to comment.