Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include <dtEntity/defaultentitysystem.h>
|
||||
#include <dtEntity/inputinterface.h>
|
||||
#include <dtEntityOSG/cameracomponent.h>
|
||||
#include "cameraviewposition.h"
|
||||
#include <functional>
|
||||
|
||||
namespace VCtrl
|
||||
{
|
||||
class OrthoMotionModelComponent final
|
||||
: public dtEntity::Component
|
||||
, public dtEntity::InputCallbackInterface
|
||||
{
|
||||
public:
|
||||
static const dtEntity::ComponentType TYPE;
|
||||
static const dtEntity::StringId ContextIdId;
|
||||
static const dtEntity::StringId EnabledId;
|
||||
|
||||
|
||||
OrthoMotionModelComponent();
|
||||
|
||||
dtEntity::ComponentType GetType() const override { return TYPE; }
|
||||
|
||||
virtual bool IsInstanceOf(dtEntity::ComponentType id) const
|
||||
{
|
||||
return (id == TYPE);
|
||||
}
|
||||
|
||||
void OnAddedToEntity(dtEntity::Entity &entity) override;
|
||||
void OnRemovedFromEntity(dtEntity::Entity &entity) override;
|
||||
|
||||
void Finished() override;
|
||||
void Tick(float dt);
|
||||
|
||||
unsigned int GetContextId() const { return mContextId.Get(); }
|
||||
void SetContextId(unsigned int i) { mContextId.Set(i); }
|
||||
|
||||
bool MouseButtonUp(int button, bool handled, unsigned int contextid) override;
|
||||
bool MouseButtonDown(int button, bool handled, unsigned int contextid) override;
|
||||
bool MouseWheel(int dir, bool handled, unsigned int contextid) override;
|
||||
bool MouseMove(float x, float y, bool handled, unsigned int contextid) override;
|
||||
void MouseEnterLeave(bool, unsigned int) override {}
|
||||
|
||||
void performZoom(int dir, const osg::Vec2& zoompoint);
|
||||
|
||||
dtEntityOSG::CameraComponent *GetCamera() const { return mCamera; }
|
||||
|
||||
|
||||
// First parameter: contextID as returned by OrthoMotionModelComponent::GetContextId
|
||||
std::function<void(unsigned int, const BuildingViewer::CameraViewPosition &)> m_callbackCamPosChanged;
|
||||
|
||||
private:
|
||||
bool m_mouseMovedWhileLeftButtonPressed;
|
||||
|
||||
dtEntity::IntProperty mContextId;
|
||||
dtEntity::BoolProperty mEnabled;
|
||||
dtEntityOSG::CameraComponent *mCamera = nullptr;
|
||||
dtEntity::Entity *mEntity = nullptr;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class OrthoMotionModelSystem final
|
||||
: public dtEntity::DefaultEntitySystem<OrthoMotionModelComponent>
|
||||
{
|
||||
using BaseClass = dtEntity::DefaultEntitySystem<OrthoMotionModelComponent>;
|
||||
|
||||
public:
|
||||
|
||||
static const dtEntity::ComponentType TYPE;
|
||||
|
||||
explicit OrthoMotionModelSystem(dtEntity::EntityManager &em);
|
||||
|
||||
void OnRemoveFromEntityManager(dtEntity::EntityManager &) override;
|
||||
|
||||
private:
|
||||
|
||||
void Tick(const dtEntity::Message &m);
|
||||
dtEntity::MessageFunctor mTickFunctor;
|
||||
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user