NAP
Public Member Functions | List of all members
OrbitControllerInstance Class Reference

#include <orbitcontroller.h>

Public Member Functions

 OrbitControllerInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
void enable (const glm::vec3 &cameraPos, const glm::vec3 &lookAtPos)
 
void enable (const glm::vec3 &lookAtPos)
 
void disable ()
 
const glm::vec3 getLookAtPos () const
 
CameraComponentInstancegetCameraComponent ()
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
virtual void update (double deltaTime)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Description

Instance part of the orbit controller. The controller is a perspective camera controller that rotates the camera around a target point. Left mouse button to rotate, right mouse button to zoom in and out on the target. Requires a nap::PointerInputComponent and nap::TransformComponent to be present on the same entity.

Inheritance diagram for OrbitControllerInstance:
[legend]
Collaboration diagram for OrbitControllerInstance:
[legend]

Constructor & Destructor Documentation

◆ OrbitControllerInstance()

OrbitControllerInstance ( EntityInstance entity,
Component resource 
)

Member Function Documentation

◆ disable()

void disable ( )

Disable responding to input for this controller.

◆ enable() [1/2]

void enable ( const glm::vec3 &  cameraPos,
const glm::vec3 &  lookAtPos 
)

Enable responding to input for this controller. Set translate and look-at position.

Parameters
cameraPosWorldspace camera position to set.
lookAtPosWorldspace position to target.

◆ enable() [2/2]

void enable ( const glm::vec3 &  lookAtPos)

Enable this controller using the given look-at position.

Parameters
lookAtPosposition to look at.

◆ getCameraComponent()

CameraComponentInstance& getCameraComponent ( )
Returns
The perspective camera component that we are controlling.

◆ getLookAtPos()

const glm::vec3 getLookAtPos ( ) const
Returns
the current position the camera controlled by the orbit controller looks at.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialize this ComponentInstance

Reimplemented from ComponentInstance.