<commit_before>// For conditions of distribution and use, see copyright notice in license.txt

#pragma once

#include "PhysicsModuleApi.h"
#include "IModule.h"
#include "SceneFwd.h"

#include <set>
#include <QObject>

namespace Ogre
{
    class Mesh;
}

class btVector3;
class btTriangleMesh;
class QScriptEngine;
class EC_RigidBody;

#ifdef PROFILING
class QTreeWidgetItem;
#endif

namespace Physics
{

struct ConvexHullSet;
class PhysicsWorld;

/// Provides physics rendering by utilizing Bullet.
class PHYSICS_MODULE_API PhysicsModule : public IModule
{
    Q_OBJECT
    
public:
    PhysicsModule();
    virtual ~PhysicsModule();

    void Load();
    void Initialize();
    void Update(f64 frametime);
    void Uninitialize();
   
    /// Get a Bullet triangle mesh corresponding to an Ogre mesh.
    /** If already has been generated, returns the previously created one */
    boost::shared_ptr<btTriangleMesh> GetTriangleMeshFromOgreMesh(Ogre::Mesh* mesh);

    /// Get a Bullet convex hull set (using minimum recursion, not very accurate but fast) corresponding to an Ogre mesh.
    /** If already has been generated, returns the previously created one */
    boost::shared_ptr<ConvexHullSet> GetConvexHullSetFromOgreMesh(Ogre::Mesh* mesh);

public slots:
    /// Toggles physics debug geometry
    void ToggleDebugGeometry();

    /// Stops physics for all physics worlds
    void StopPhysics();

    /// Starts physics for all physics worlds
    void StartPhysics();
    
    /// Set default physics update rate for new physics worlds
    void SetDefaultPhysicsUpdatePeriod(float updatePeriod);
    
    /// Set default physics max substeps for new physics worlds
    void SetDefaultMaxSubSteps(int steps);
    
    /// Return default physics update rate for new physics worlds
    float GetDefaultPhysicsUpdatePeriod() const { return defaultPhysicsUpdatePeriod_; }
    
    /// Return default physics max substeps for new physics worlds
    int GetDefaultMaxSubSteps() const { return defaultMaxSubSteps_; }

    /// Autoassigns static rigid bodies with collision meshes to visible meshes<commit_msg>PhysicsModule: expose defaultPhysicsUpdatePeriod and defaultMaxSubSteps as Qt properties.<commit_after>// For conditions of distribution and use, see copyright notice in license.txt

#pragma once

#include "PhysicsModuleApi.h"
#include "IModule.h"
#include "SceneFwd.h"

#include <set>
#include <QObject>

namespace Ogre
{
    class Mesh;
}

class btTriangleMesh;
class QScriptEngine;

#ifdef PROFILING
class QTreeWidgetItem;
#endif

namespace Physics
{

struct ConvexHullSet;
class PhysicsWorld;

/// Provides physics rendering by utilizing Bullet.
class PHYSICS_MODULE_API PhysicsModule : public IModule
{
    Q_OBJECT
    Q_PROPERTY(float defaultPhysicsUpdatePeriod READ DefaultPhysicsUpdatePeriod WRITE SetDefaultPhysicsUpdatePeriod)
    Q_PROPERTY(int defaultMaxSubSteps READ DefaultMaxSubSteps WRITE SetDefaultMaxSubSteps)

public:
    PhysicsModule();
    virtual ~PhysicsModule();

    void Load();
    void Initialize();
    void Update(f64 frametime);
    void Uninitialize();
   
    /// Get a Bullet triangle mesh corresponding to an Ogre mesh.
    /** If already has been generated, returns the previously created one */
    boost::shared_ptr<btTriangleMesh> GetTriangleMeshFromOgreMesh(Ogre::Mesh* mesh);

    /// Get a Bullet convex hull set (using minimum recursion, not very accurate but fast) corresponding to an Ogre mesh.
    /** If already has been generated, returns the previously created one */
    boost::shared_ptr<ConvexHullSet> GetConvexHullSetFromOgreMesh(Ogre::Mesh* mesh);

    /// Set default physics update rate for new physics worlds
    void SetDefaultPhysicsUpdatePeriod(float updatePeriod);

    /// Return default physics update rate for new physics worlds
    float DefaultPhysicsUpdatePeriod() const { return defaultPhysicsUpdatePeriod_; }

    /// Set default physics max substeps for new physics worlds
    void SetDefaultMaxSubSteps(int steps);

    /// Return default physics max substeps for new physics worlds
    int DefaultMaxSubSteps() const { return defaultMaxSubSteps_; }

public slots:
    /// Toggles physics debug geometry
    void ToggleDebugGeometry();

    /// Stops physics for all physics worlds
    void StopPhysics();

    /// Starts physics for all physics worlds
    void StartPhysics();

    /// Autoassigns static rigid bodies with collision meshes to visible meshes
{'fraction_non_alphanumeric': 0.07205584327854087, 'fraction_numerical': 0.001125872551227201, 'mean_word_length': 3.996625421822272, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7472178', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1180, 'n_words': 440}