Fix issue in Rocket.lua script.
[cafu-Engine.git] / Ca3DE / Ca3DEWorld.hpp
blob58251e2498bc17f400234d303341ba0c193c1401
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
7 #ifndef CAFU_CA3DECOMMONWORLD_HPP_INCLUDED
8 #define CAFU_CA3DECOMMONWORLD_HPP_INCLUDED
10 #include "Templates/Pointer.hpp"
11 #include "PhysicsWorld.hpp"
12 #include "../Common/World.hpp"
15 namespace cf { namespace ClipSys { class ClipWorldT; } }
16 namespace cf { namespace GameSys { class EntityT; } }
17 namespace cf { class UniScriptStateT; }
18 class EngineEntityT;
21 // Ca3DEWorldT implementiert die Eigenschaften, die eine CaServerWorld und eine CaClientWorld gemeinsam haben.
22 class Ca3DEWorldT
24 public:
26 Ca3DEWorldT(const char* FileName, ModelManagerT& ModelMan, cf::GuiSys::GuiResourcesT& GuiRes, bool InitForGraphics, WorldT::ProgressFunctionT ProgressFunction) /*throw (WorldT::LoadErrorT)*/;
27 ~Ca3DEWorldT();
29 const WorldT& GetWorld() const { return *m_World; }
31 /// Returns a "good" ambient light color for an arbitrary object (i.e. a model) of size Dimensions at Origin.
32 /// The return value is derived from the worlds lightmap information "close" to the Dimensions at Origin.
33 Vector3fT GetAmbientLightColorFromBB(const BoundingBox3T<double>& Dimensions, const VectorT& Origin) const;
36 protected:
38 /// Creates a new entity that is added to the m_EngineEntities array.
39 ///
40 /// - This is called in the constructor (and thus both on the client *and* the server, whenever a new world has
41 /// been loaded) with the parameters from the `.cw` world file.
42 /// - On the server, this method is also called if the Think() code auto-detects that an entity was newly created.
43 /// - Third, this is called by `ServerWorldT::InsertHumanPlayerEntity()` for creating human player entities for
44 /// newly joined clients or after a world-change for the existing clients.
45 void CreateNewEntityFromBasicInfo(IntrusivePtrT<cf::GameSys::EntityT> Ent, unsigned long CreationFrameNr);
47 const WorldT* m_World;
48 cf::ClipSys::ClipWorldT* m_ClipWorld;
49 PhysicsWorldT m_PhysicsWorld;
50 cf::UniScriptStateT* m_ScriptState;
51 IntrusivePtrT<cf::GameSys::WorldT> m_ScriptWorld; ///< The "script world" contains the entity hierarchy and their components.
52 ArrayT<EngineEntityT*> m_EngineEntities;
55 private:
57 Ca3DEWorldT(const Ca3DEWorldT&); ///< Use of the Copy Constructor is not allowed.
58 void operator = (const Ca3DEWorldT&); ///< Use of the Assignment Operator is not allowed.
61 #endif