Benchmark03_MoleculeLogic.h 833 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include <Urho3D/Scene/LogicComponent.h>
  5. #include <Urho3D/Base/PrimitiveTypes.h>
  6. namespace U3D = Urho3D;
  7. using namespace Urho3D::PrimitiveTypes;
  8. class Benchmark03_MoleculeLogic : public U3D::LogicComponent
  9. {
  10. public:
  11. URHO3D_OBJECT(Benchmark03_MoleculeLogic, LogicComponent);
  12. private:
  13. i32 moleculeType_;
  14. U3D::Vector2 velocity_;
  15. U3D::Vector2 force_;
  16. public:
  17. explicit Benchmark03_MoleculeLogic(U3D::Context* context);
  18. void SetParameters(i32 moleculeType);
  19. i32 GetMoleculeType() const { return moleculeType_; }
  20. // Update the velocity of this molecule
  21. void Update(float timeStep) override;
  22. // Move this molecule only after updating the velocities of all molecules
  23. void PostUpdate(float timeStep) override;
  24. };