24#include <OgreCamera.h>
25#include <OgreBulletDynamicsCharacter.h>
26#include <OgreBulletCollisionsRay.h>
27#include <OgreBulletCollisionsCapsuleShape.h>
172 if (
GetSceneNode()->GetRawSceneNode()->numChildren() > 0)
190 for (
size_t i = 0; i <
Cameras.size(); i++)
219 vector.x = vector.x > 180 ? 270 : 90;
239 for (
size_t i = 0; i <
Cameras.size(); i++)
241 Cameras[i]->setOrientation(camrot);
255 Vector3 cameraposition = Vector3::ZERO;
274 dir =
Cameras[0]->getDerivedOrientation();
329 if (vector == Vector3::ZERO)
340 orientation =
Cameras[0]->getOrientation();
360 if (vector == Vector3::ZERO)
390 if (rotation == Vector3::ZERO)
394 Real xdeg = (float)Ogre::Math::RadiansToDegrees(rotation.x) *
speed;
395 Real ydeg = (float)Ogre::Math::RadiansToDegrees(rotation.y) *
speed;
396 Real zdeg = (float)Ogre::Math::RadiansToDegrees(rotation.z) *
speed;
416 for (
size_t i = 0; i <
Cameras.size(); i++)
429 Cameras[i]->setOrientation(rot);
567 int width = camera->
GetOgreCamera()->getViewport()->getActualWidth();
568 int height = camera->
GetOgreCamera()->getViewport()->getActualHeight();
570 if (width == 0 || height == 0)
574 if (center_only ==
false)
576 x = (float)camera->
mouse_x / (
float)width * scale;
577 y = (float)camera->
mouse_y / (
float)height * scale;
611 result = pos.distance(hit_pos);
616 if (hit ==
false || hit_only ==
true)
649 if (mesh_parent->
GetType() ==
"ButtonPanel")
655 if (callpanel->
GetType() ==
"CallStation")
656 mesh_parent = callpanel;
665 if (ctrl ==
true && alt ==
true && shift ==
false && right ==
false)
668 if (wall && obj->
GetType() ==
"Wall")
670 std::string type = mesh_parent->
GetType();
671 if (type ==
"Floor" || type ==
"ElevatorCar" || type ==
"Shaft" || type ==
"Stairwell" || type ==
"SBS")
684 mesh_parent->
OnClick(pos, shift, ctrl, alt, right);
724 if (mesh_parent->
GetType() ==
"Mesh" || mesh_parent->
GetType() ==
"SceneNode")
781 unsigned long timing;
786 Real delta = timing / 1000.0;
800 Ogre::SceneNode *
node =
mCharacter->getLastCollision()->getRootNode();
803 int instance = 0, number = 0;
916 for (
size_t i = 0; i < 3; i++)
932 for (
size_t i = 0; i < 3; i++)
951 if (save_value ==
true)
956 if (camera_only ==
false)
997 if (angle > 0 && angle < 179.63)
1002 for (
size_t i = 0; i <
Cameras.size(); i++)
1015 return (
float)(
Cameras[0]->getFOVy().valueDegrees() *
Cameras[0]->getAspectRatio());
1041 for (
size_t i = 0; i <
Cameras.size(); i++)
1044 Cameras[i]->setPolygonMode(Ogre::PM_SOLID);
1046 Cameras[i]->setPolygonMode(Ogre::PM_WIREFRAME);
1048 Cameras[i]->setPolygonMode(Ogre::PM_POINTS);
1119 for (
size_t i = 0; i <
Cameras.size(); i++)
1151 for (
size_t i = 0; i <
Cameras.size(); i++)
1176 if (disable_current ==
true && origfloor)
1270 hit =
sbs->
HitBeam(ray, 2.0, mesh, wall, hit_position);
1365 if (cameras.empty())
1368 if (cameras[0]->isAttached() ==
true)
1373 for (
size_t i = 0; i <
Cameras.size(); i++)
1375 Cameras[i]->setNearClipDistance(0.1);
1388 if (init_state ==
true)
1401 if (init_state ==
true)
1418 if (
Cameras[0]->isAttached() ==
false)
1421 for (
size_t i = 0; i <
Cameras.size(); i++)
1434 mCharacter->updateTransform(
true,
false,
false);
1443 mCharacter->updateTransform(
false,
true,
false);
1474 if (set_floor ==
true)
1520 Vector3 destination (X, Y, Z);
1531 if (key_down ==
true)
1547 for (
size_t i = 0; i <
Cameras.size(); i++)
1549 Cameras[i]->setOrientation(orientation);
1560 if (
vehicle && value ==
false)
1570 for (
size_t i = 0; i <
Cameras.size(); i++)
1577 else if (value ==
true)
1592 ReportError(
"AttachToVehicle: No vehicles found");
1602 if (mesh_parent->
GetType() ==
"Vehicle")
1622 ReportError(
"AttachToVehicle: No vehicles found");
std::string object_cmd_processed
void InterpolateMovement(Real delta)
void SetStartRotation(const Vector3 &rotation)
Real cfg_walk_maxspeed_mult
void Strafe(Real speed=1.0)
void ShowDebugShape(bool value)
std::string CurrentFloorID
Vector3 prev_accum_movement
bool Move(Vector3 vector, Real speed=1.0, bool flip=true)
void SetMaxRenderDistance(Real value)
bool MovePosition(Vector3 vector, Real speed=1.0)
Quaternion old_character_orientation
Vector3 GetStartDirection()
void Binoculars(bool value)
void AttachToVehicle(bool value)
void SetStartDirection(const Vector3 &direction)
std::string GetClickedWallName()
void SetGravity(Real gravity, bool save_value=true, bool camera_only=true)
OgreBulletCollisions::CollisionShape * mShape
std::vector< Ogre::Camera * > Cameras
void GetDirection(Vector3 &front, Vector3 &top, bool global=false)
void SetCameraState(const CameraState &state, bool set_floor=true)
void FreelookMove(const Vector3 &rotation)
Real cfg_rotate_accelerate
void Teleport(Real X, Real Y, Real Z)
void Drive(bool left, bool right, bool down, bool up, bool key_down)
void SetPosition(const Vector3 &position)
int GetClickedObjectLine()
void RotateLocal(const Vector3 &position, Real speed=1.0)
void GotoFloor(int floor, bool disable_current=true)
void SetViewMode(int mode)
bool IsMeshVisible(MeshObject *mesh)
Quaternion prev_orientation
void Turn(Real speed=1.0)
void SetToStartDirection()
void SetRotation(const Vector3 &rotation)
Ogre::Camera * GetOgreCamera(int index=0)
void SetToStartPosition(bool disable_current_floor)
void SetOrientation(const Quaternion &orientation)
void SetFOVAngle(Real angle)
std::string GetClickedObjectCommandP()
Object * GetMeshParent(Object *object)
CameraState GetCameraState()
Real ClickedObject(Camera *camera, bool shift, bool ctrl, bool alt, bool right, Real scale, bool center_only=false, bool hit_only=false)
bool IsDynamicMeshVisible(DynamicMesh *mesh, int mesh_index)
void SetDirection(const Vector3 &direction)
void Step(Real speed=1.0)
Vector3 GetPosition(bool relative=false)
void SetToStartRotation()
std::string GetClickedMeshName()
OgreBulletDynamics::CharacterController * mCharacter
void AttachModel(Model *model)
void Float(Real speed=1.0)
void Look(Real speed=1.0)
Vector3 GetStartRotation()
void Spin(Real speed=1.0)
bool Attach(std::vector< Ogre::Camera * > &cameras, bool init_state=true)
Vector3 desired_angle_velocity
Real GetMaxRenderDistance()
void EnableGravity(bool value)
void OnRotate(bool parent)
void Rotate(const Vector3 &position, Real speed=1.0)
int GetClickedObjectNumber()
Real cfg_walk_maxspeed_multreal
void EnableCollisions(bool value)
Quaternion old_camera_orientation
std::string GetClickedObjectCommand()
bool IsVisible(MeshObject *client=0)
void EnableAll(bool value)
bool Check(Vector3 position)
void UpdateFloorIndicators(int elevator)
Real GetBase(bool relative=false)
void EnableGroup(bool value)
bool IsVisible(Ogre::Camera *camera)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
void NotifyRotate(bool parent=false)
virtual Vector3 GetPosition(bool relative=false)
void NotifyMove(bool parent=false)
SceneNode * GetSceneNode()
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
Quaternion GetOrientation(bool relative=false)
virtual Vector3 GetRotation()
std::string command_processed
const std::string & GetType()
virtual void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
virtual void OnUnclick(bool right)
std::string ProcessFullName(std::string name, int &instance, int &object_number, bool strip_number=false)
unsigned int SmoothFrames
Shaft * GetShaft(int number)
Ogre::SceneManager * mSceneManager
Elevator * GetElevator(int number)
void EnableBuildings(bool value)
bool HitBeam(const Ray &ray, Real max_distance, MeshObject *&mesh, Wall *&wall, Vector3 &hit_position)
Vector3 ToGlobal(const Vector3 &position)
Real GetConfigFloat(const std::string &key, Real default_value)
unsigned long GetAverageTime()
unsigned long GetElapsedTime()
bool IsValidFloor(int floor)
Floor * GetFloor(int number)
Stairwell * GetStairwell(int number)
void EnableLandscape(bool value)
void EnableSkybox(bool value)
int GetFloorNumber(Real altitude, int lastfloor=0, bool checklastfloor=false)
OgreBulletDynamics::DynamicsWorld * mWorld
Real ToLocal(Real remote_value)
bool GetConfigBool(const std::string &key, bool default_value)
void EnableExternal(bool value)
Vector3 FromGlobal(const Vector3 &position)
Real ToRemote(Real local_value)
unsigned long GetRunTime()
ElevatorManager * GetElevatorManager()
Object * GetObject(int number)
bool DeleteObject(Object *object)
void DetachObject(Ogre::MovableObject *object)
void SetPosition(const Vector3 &position)
Ogre::SceneNode * GetRawSceneNode()
void AttachObject(Ogre::MovableObject *object)
Vector3 GetPosition(bool relative=false)
void Check(Vector3 position, int current_floor)
void Check(Vector3 position, int current_floor, int previous_floor)
void KeyReleased(bool left, bool right, bool down, bool up)
void AttachCamera(bool value)
void KeyPressed(bool left, bool right, bool down, bool up)
Ogre::Quaternion Quaternion
std::string ToString(int number)
#define SBS_PROFILE(name)
#define SBS_PROFILE_MAIN(name)
Vector3 desired_angle_velocity