83 std::string name =
"Shaft " +
ToString(number);
111 for (
size_t i = 0; i <
Levels.size(); i++)
138 for (
size_t i = 0; i <
Levels.size(); i++)
140 if (
Levels[i]->GetFloor() == floor)
189 if (
Levels[0]->GetMeshObject()->InBoundingBox(position,
false) ==
true)
192 bool result = (
Levels[0]->GetMeshObject()->HitBeam(position, Vector3::NEGATIVE_UNIT_Y, position.y - (
bottom - 1)) >= 0);
215 Real voffset1, voffset2;
217 if (relative ==
true)
241 voffset1 = startvoffset;
243 voffset2 = endvoffset;
245 if (relative ==
true)
248 floorptr->
Cut(
Vector3(start.x, voffset1, start.y),
Vector3(end.x, voffset2, end.y),
false,
true,
false);
263 if (relative ==
true)
291 if (
IsEven(range) ==
true)
294 int additionalfloors;
296 additionalfloors = (range - 1) / 2;
298 additionalfloors = 0;
303 if (floor - additionalfloors - 1 >=
startfloor && floor - additionalfloors - 1 <=
endfloor)
306 GetLevel(floor - additionalfloors - 1)->
Enabled(
false, EnableShaftDoors);
308 if (floor + additionalfloors + 1 >=
startfloor && floor + additionalfloors + 1 <=
endfloor)
311 GetLevel(floor + additionalfloors + 1)->
Enabled(
false, EnableShaftDoors);
316 for (
int i = floor - additionalfloors; i <= floor + additionalfloors; i++)
438 if (floor < startfloor || floor >
endfloor)
451 for (
size_t i = 0; i <
elevators.size(); i++)
464 for (
size_t i = 0; i <
elevators.size(); i++)
488 for (
size_t i = 0; i <
Levels.size(); i++)
698 for (
size_t i = 0; i < ControlArray.size(); i++)
702 ControlArray[i]->parent_deleting =
true;
703 delete ControlArray[i];
709 for (
size_t i = 0; i < TriggerArray.size(); i++)
713 TriggerArray[i]->parent_deleting =
true;
714 delete TriggerArray[i];
720 for (
size_t i = 0; i < ModelArray.size(); i++)
724 ModelArray[i]->parent_deleting =
true;
725 delete ModelArray[i];
731 for (
size_t i = 0; i < PrimArray.size(); i++)
735 PrimArray[i]->parent_deleting =
true;
742 for (
size_t i = 0; i < CustomObjectArray.size(); i++)
744 if (CustomObjectArray[i])
746 CustomObjectArray[i]->parent_deleting =
true;
747 delete CustomObjectArray[i];
749 CustomObjectArray[i] = 0;
753 for (
size_t i = 0; i < lights.size(); i++)
757 lights[i]->parent_deleting =
true;
764 for (
size_t i = 0; i < DoorArray.size(); i++)
768 DoorArray[i]->parent_deleting =
true;
775 for (
size_t i = 0; i < CameraTextureArray.size(); i++)
777 if (CameraTextureArray[i])
779 CameraTextureArray[i]->parent_deleting =
true;
780 delete CameraTextureArray[i];
782 CameraTextureArray[i] = 0;
790Wall*
Shaft::Level::AddWall(
const std::string &name,
const std::string &texture,
Real thickness,
Real x1,
Real z1,
Real x2,
Real z2,
Real height1,
Real height2,
Real voffset1,
Real voffset2,
Real tw,
Real th)
799 Wall *wall = mesh->CreateWallObject(name);
800 AddWall(wall, name, texture, thickness, x1, z1, x2, z2, height1, height2, voffset1, voffset2, tw, th);
804bool Shaft::Level::AddWall(
Wall *wall,
const std::string &name,
const std::string &texture,
Real thickness,
Real x1,
Real z1,
Real x2,
Real z2,
Real height1,
Real height2,
Real voffset1,
Real voffset2,
Real tw,
Real th)
810 return sbs->
AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height1, height2, voffset1, voffset2, tw, th,
true);
813Wall*
Shaft::Level::AddFloor(
const std::string &name,
const std::string &texture,
Real thickness,
Real x1,
Real z1,
Real x2,
Real z2,
Real voffset1,
Real voffset2,
bool reverse_axis,
bool texture_direction,
Real tw,
Real th,
bool legacy_behavior)
822 Wall *wall = mesh->CreateWallObject(name);
823 AddFloor(wall, name, texture, thickness, x1, z1, x2, z2, voffset1, voffset2, reverse_axis, texture_direction, tw, th, legacy_behavior);
827bool Shaft::Level::AddFloor(
Wall *wall,
const std::string &name,
const std::string &texture,
Real thickness,
Real x1,
Real z1,
Real x2,
Real z2,
Real voffset1,
Real voffset2,
bool reverse_axis,
bool texture_direction,
Real tw,
Real th,
bool legacy_behavior)
837 if (altitude + voffset1 < parent->
bottom)
838 parent->bottom = altitude + voffset1;
839 if (altitude + voffset2 < parent->
bottom)
840 parent->bottom = altitude + voffset2;
841 if (altitude + voffset1 > parent->top)
842 parent->top = altitude + voffset1;
843 if (altitude + voffset2 > parent->top)
844 parent->top = altitude + voffset2;
846 return sbs->
AddFloorMain(wall, name, texture, thickness, x1, z1, x2, z2, voffset1, voffset2, reverse_axis, texture_direction, tw, th,
true, legacy_behavior);
852 if (
IsEnabled() != value && parent->EnableCheck ==
false)
856 mesh->Enabled(value);
860 for (
size_t i = 0; i < DoorArray.size(); i++)
863 DoorArray[i]->Enabled(value);
867 for (
size_t i = 0; i < ControlArray.size(); i++)
870 ControlArray[i]->Enabled(value);
874 for (
size_t i = 0; i < TriggerArray.size(); i++)
877 TriggerArray[i]->Enabled(value);
881 for (
size_t i = 0; i < ModelArray.size(); i++)
884 ModelArray[i]->Enabled(value);
888 for (
size_t i = 0; i < PrimArray.size(); i++)
891 PrimArray[i]->Enabled(value);
895 for (
size_t i = 0; i < CustomObjectArray.size(); i++)
897 if (CustomObjectArray[i])
898 CustomObjectArray[i]->Enabled(value);
902 for (
size_t i = 0; i < lights.size(); i++)
905 lights[i]->Enabled(value);
908 if (EnableShaftDoors ==
true)
910 for (
size_t i = 0; i < parent->elevators.size(); i++)
915 for (
size_t j = 1; j <= elevator->
GetCarCount(); j++)
949 for (
size_t i = 0; i < mesh->Walls.size(); i++)
958 if (relative ==
true)
959 sbs->
GetUtility()->
Cut(mesh->Walls[i],
Vector3(start.x, start.y, start.z),
Vector3(end.x, end.y, end.z), cutwalls, cutfloors, checkwallnumber, reset);
961 sbs->
GetUtility()->
Cut(mesh->Walls[i],
Vector3(start.x -
GetPosition().x, start.y, start.z -
GetPosition().z),
Vector3(end.x -
GetPosition().x, end.y, end.z -
GetPosition().z), cutwalls, cutfloors, checkwallnumber, reset);
974 for (
size_t i = 0; i < lights.size(); i++)
976 if (lights[i] == light)
978 lights.erase(lights.begin() + i);
987 for (
size_t i = 0; i < ModelArray.size(); i++)
989 if (ModelArray[i] == model)
991 ModelArray.erase(ModelArray.begin() + i);
1000 for (
size_t i = 0; i < PrimArray.size(); i++)
1002 if (PrimArray[i] == prim)
1004 PrimArray.erase(PrimArray.begin() + i);
1013 for (
size_t i = 0; i < CustomObjectArray.size(); i++)
1015 if (CustomObjectArray[i] ==
object)
1017 CustomObjectArray.erase(CustomObjectArray.begin() + i);
1026 for (
size_t i = 0; i < ControlArray.size(); i++)
1028 if (ControlArray[i] == control)
1030 ControlArray.erase(ControlArray.begin() + i);
1039 for (
size_t i = 0; i < TriggerArray.size(); i++)
1041 if (TriggerArray[i] == trigger)
1043 TriggerArray.erase(TriggerArray.begin() + i);
1061 lights.emplace_back(light);
1067 for (
size_t i = 0; i < lights.size(); i++)
1069 if (lights[i]->
GetName() == name)
1075Model*
Shaft::Level::AddModel(
const std::string &name,
const std::string &filename,
bool center,
Vector3 position,
Vector3 rotation,
Real max_render_distance,
Real scale_multiplier,
bool enable_physics,
Real restitution,
Real friction,
Real mass)
1079 Model* model =
new Model(
this, name, filename, center, position, rotation, max_render_distance, scale_multiplier, enable_physics, restitution, friction, mass);
1085 ModelArray.emplace_back(model);
1096 for (
size_t i = 0; i < ModelArray.size(); i++)
1098 if (ModelArray[i] == model)
1102 ModelArray.emplace_back(model);
1109 PrimArray.emplace_back(prim);
1120 for (
size_t i = 0; i < PrimArray.size(); i++)
1122 if (PrimArray[i] == primitive)
1126 PrimArray.emplace_back(primitive);
1133 CustomObjectArray.emplace_back(
object);
1144 for (
size_t i = 0; i < CustomObjectArray.size(); i++)
1146 if (CustomObjectArray[i] ==
object)
1150 CustomObjectArray.emplace_back(
object);
1153Control*
Shaft::Level::AddControl(
const std::string &name,
const std::string &sound,
const std::string &direction,
Real CenterX,
Real CenterZ,
Real width,
Real height,
Real voffset,
int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
1157 std::vector<Action*> actionnull;
1158 Control* control =
new Control(
this, name,
false, sound, action_names, actionnull, textures, direction, width, height,
true, selection_position);
1159 control->
Move(CenterX, voffset, CenterZ);
1160 ControlArray.emplace_back(control);
1168 Trigger* trigger =
new Trigger(
this, name,
false, sound_file, area_min, area_max, action_names);
1169 TriggerArray.emplace_back(trigger);
1179 for (
size_t i = 0; i < ModelArray.size(); i++)
1182 return ModelArray[i];
1194 for (
size_t i = 0; i < PrimArray.size(); i++)
1197 return PrimArray[i];
1209 for (
size_t i = 0; i < CustomObjectArray.size(); i++)
1212 return CustomObjectArray[i];
1220 mesh->ReplaceTexture(oldtexture, newtexture);
1235Door*
Shaft::Level::AddDoor(std::string name,
const std::string &open_sound,
const std::string &close_sound,
bool open_state,
const std::string &texture,
const std::string &side_texture,
Real thickness,
const std::string &face_direction,
const std::string &open_direction,
bool rotate,
Real open_speed,
Real close_speed,
Real CenterX,
Real CenterZ,
Real width,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
1251 Real x1, z1, x2, z2;
1252 if (face_direction ==
"left" || face_direction ==
"right")
1256 z1 = CenterZ - (width / 2);
1257 z2 = CenterZ + (width / 2);
1261 x1 = CenterX - (width / 2);
1262 x2 = CenterX + (width / 2);
1269 if (face_direction ==
"left" || face_direction ==
"right")
1271 Cut(1,
Vector3(x1 - 0.5, voffset, z1),
Vector3(x2 + 0.5, voffset + height, z2),
true,
false, 1);
1276 Cut(1,
Vector3(x1, voffset, z1 - 0.5),
Vector3(x2, voffset + height, z2 + 0.5),
true,
false, 1);
1283 std::string num =
ToString((
int)DoorArray.size());
1285 name =
"Door " + num;
1287 Door* door =
new Door(
this, parent->GetDoorWrapper(), name, open_sound, close_sound, rotate);
1288 door->
CreateDoor(open_state, texture, side_texture, thickness, face_direction, open_direction, open_speed, close_speed, CenterX, CenterZ, width, height, floorptr->
GetBase(
true) + voffset, tw, th, side_tw, side_th);
1289 DoorArray.emplace_back(door);
1300 std::string num =
ToString((
int)DoorArray.size());
1302 name =
"Door " + num;
1304 Door* door =
new Door(
this, parent->GetDoorWrapper(), name, open_sound, close_sound, rotate);
1305 DoorArray.emplace_back(door);
1311 for (
size_t i = 0; i < DoorArray.size(); i++)
1313 if (DoorArray[i]->
GetName() == name)
1314 return DoorArray[i];
1322 for (
size_t i = 0; i < DoorArray.size(); i++)
1324 if (DoorArray[i] == door)
1326 DoorArray.erase(DoorArray.begin() + i);
1336 CameraTextureArray.emplace_back(cameratexture);
1337 return cameratexture;
1343 for (
size_t i = 0; i < CameraTextureArray.size(); i++)
1345 if (CameraTextureArray[i] == camtex)
1347 CameraTextureArray.erase(CameraTextureArray.begin() + i);
DoorWrapper * CreateDoor(bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
void Enabled(bool value, MeshObject *client=0)
void ShaftDoorsEnabled(int number, int floor, bool value)
std::vector< int > ServicedFloors
void ShaftDoorsEnabledRange(int number, int floor, int range)
ElevatorCar * GetCar(int number)
bool IsInGroup(int floor)
void Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber=0, bool prepare=false)
void EnableInterfloor(bool value)
Real GetBase(bool relative=false)
std::vector< Wall * > Walls
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
void SetName(const std::string &name)
virtual Vector3 GetPosition(bool relative=false)
SceneNode * GetSceneNode()
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
virtual void Move(const Vector3 &vector, Real speed=1.0, bool force=false)
void EnableLoop(bool value)
virtual void SetPosition(const Vector3 &position, bool relative=false, bool force=false)
virtual void SetPositionY(Real value, bool force=false)
Elevator * GetElevator(int number)
void EnableBuildings(bool value)
bool AddWallMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real altitude1, Real altitude2, Real tw, Real th, bool autosize, bool report=true)
void RemoveShaft(Shaft *shaft)
bool AddFloorMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real altitude1, Real altitude2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool autosize, bool legacy_behavior=false, bool report=true)
Floor * GetFloor(int number)
int ShaftOutsideDisplayRange
void EnableLandscape(bool value)
void EnableSkybox(bool value)
void EnableExternal(bool value)
void EnableFloorRange(int floor, int range, bool value, bool enablegroups, int shaftnumber=0, int stairsnumber=0)
void RemoveCustomObject(CustomObject *object)
Door * GetDoor(const std::string &name)
Primitive * GetPrimitive(std::string name)
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
void Enabled(bool value, bool EnableShaftDoors)
Control * AddControl(const std::string &name, const std::string &sound, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, int selection_position, std::vector< std::string > &action_names, std::vector< std::string > &textures)
CustomObject * GetCustomObject(std::string name)
void RemovePrimitive(Primitive *prim)
Model * GetModel(std::string name)
Primitive * AddPrimitive(const std::string &name)
Model * AddModel(const std::string &name, const std::string &filename, bool center, Vector3 position, Vector3 rotation, Real max_render_distance=0, Real scale_multiplier=1, bool enable_physics=false, Real restitution=0, Real friction=0, Real mass=0)
void RemoveCameraTexture(CameraTexture *camtex)
Wall * AddWall(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height1, Real height2, Real voffset1, Real voffset2, Real tw, Real th)
Trigger * AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector< std::string > &action_names)
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Wall * AddFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool legacy_behavior=false)
void RemoveLight(Light *light)
Light * AddLight(const std::string &name, int type)
Level(Shaft *parent, int number)
void RemoveModel(Model *model)
void RemoveControl(Control *control)
void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Light * GetLight(const std::string &name)
bool Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber=0)
void RemoveDoor(Door *door)
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
MeshObject * GetMeshObject()
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
void RemoveTrigger(Trigger *trigger)
Shaft(Object *parent, int number, Real CenterX, Real CenterZ, int startfloor, int endfloor)
bool IsInside(const Vector3 &position)
DynamicMesh * GetDynamicMesh()
void AddShowInterfloor(int floor)
std::vector< Level * > Levels
bool ShowFloorsFull_Enabled
void AddElevator(int number)
void RemoveElevator(int number)
std::vector< int > ShowFloorsList
void RemoveShowOutside(int floor)
void Report(const std::string &message)
DynamicMesh * dynamic_mesh
void RemoveShowInterfloor(int floor)
bool IsShowOutside(int floor)
bool IsShowInterfloor(int floor)
std::vector< int > elevators
void EnableWhole(bool value, bool EnableShaftDoors, bool force=false)
void CutFloors(bool relative, const Vector2 &start, const Vector2 &end, Real startvoffset, Real endvoffset)
void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
DynamicMesh * GetDoorWrapper()
void RemoveShowFloor(int floor)
void SetShowFull(bool value)
std::vector< int > ShowInterfloorsList
void Check(Vector3 position, int current_floor)
bool IsShowFloor(int floor)
bool IsValidFloor(int floor)
bool ReportError(const std::string &message)
void AddShowFloor(int floor)
DynamicMesh * ShaftDoorContainer
DynamicMesh * DoorWrapper
void EnableRange(int floor, int range, bool value, bool EnableShaftDoors)
std::vector< int > ShowOutsideList
void AddShowOutside(int floor)
Level * GetLevel(int floor)
Wall * AddDoorwayWalls(MeshObject *mesh, const std::string &wallname, const std::string &texture, Real tw, Real th)
void Cut(Wall *wall, Vector3 start, Vector3 end, bool cutwalls, bool cutfloors, int checkwallnumber=0, bool reset_check=true)
std::string TruncateNumber(float value, int decimals)
void SetCase(std::string &string, bool uppercase)
std::string ToString(int number)
std::string SetCaseCopy(std::string string, bool uppercase)
#define SBS_PROFILE(name)