// Copyright (c) 2008-2023 the Urho3D project // License: MIT #pragma once #include "Sample.h" namespace Urho3D { class Node; class Scene; } /// Physics stress test example. /// This sample demonstrates: /// - Physics and rendering performance with a high (1000) moving object count /// - Using triangle meshes for collision /// - Optimizing physics simulation by leaving out collision event signaling class PhysicsStressTest : public Sample { URHO3D_OBJECT(PhysicsStressTest, Sample); public: /// Construct. explicit PhysicsStressTest(Context* context); /// Setup after engine initialization and before running the main loop. void Start() override; protected: /// Return XML patch instructions for screen joystick layout for a specific sample app, if any. String GetScreenJoystickPatchString() const override { return "" " " " Spawn" " " " " " " " " " " " " " " " Debug" " " " " " " " " " " " " ""; } private: /// Construct the scene content. void CreateScene(); /// Construct an instruction text to the UI. void CreateInstructions(); /// Set up a viewport for displaying the scene. void SetupViewport(); /// Subscribe to application-wide logic update and post-render update events. void SubscribeToEvents(); /// Read input and moves the camera. void MoveCamera(float timeStep); /// Spawn a physics object from the camera position. void SpawnObject(); /// Handle the logic update event. void HandleUpdate(StringHash eventType, VariantMap& eventData); /// Handle the post-render update event. void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData); /// Flag for drawing debug geometry. bool drawDebug_; };