root/cafu/trunk/Games/GameWorld.hpp

Revision 457, 4.0 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_GAMESYS_GAMEWORLD_INTERFACE_HPP_INCLUDED
23#define CAFU_GAMESYS_GAMEWORLD_INTERFACE_HPP_INCLUDED
24
25
26class BaseEntityT;
27class CafuModelT;
28namespace cf { namespace ClipSys { class ClipWorldT; } }
29
30
31namespace cf
32{
33    namespace GameSys
34    {
35        /// The game world interface, specified as an ABC so that is can be used without linked (module-local) implementation.
36        /// The engine provides each entity that it creates with a pointer to an implementation of this interface
37        /// (as entities can be created on the client and the server side, there can be more than one implementation).
38        /// See the GameI::CreateBaseEntityFrom*() methods for the "source" of these pointers:
39        /// When one of these methods is called, a pointer to a GameWorldI is one of the parameters.
40        class GameWorldI
41        {
42            public:
43
44            /// The virtual destructor, so that derived classes can safely be deleted via a GameWorldI (base class) pointer.
45            /// However, with GameWorldIs that's never supposed to happen, so this destructor only exists to silence the g++ compiler warning.
46            virtual ~GameWorldI() { }
47
48            /// Returns the clip world for the Cafu world.
49            virtual cf::ClipSys::ClipWorldT& GetClipWorld()=0;
50
51            /// Returns a "good" ambient light color for an arbitrary object (i.e. a model) of size Dimensions at Origin.
52            /// The return value is derived from the worlds lightmap information "close" to the Dimensions at Origin.
53            virtual Vector3fT GetAmbientLightColorFromBB(const BoundingBox3T<double>& Dimensions, const VectorT& Origin) const=0;
54
55            /// Returns (a reference to) an array that contains the IDs of all entities that currently exist in the world.
56            virtual const ArrayT<unsigned long>& GetAllEntityIDs() const=0;
57
58            /// Returns a pointer to the entity with ID 'EntityID'.
59            /// NULL is returned if that entity does not exist.
60            virtual BaseEntityT* GetBaseEntityByID(unsigned long EntityID) const=0;
61
62            /// Creates a new entity from the given parameters.
63            /// The parameters are essentially what is also present in an editor map file.
64            /// Returns the ID of the new entity on success, 0xFFFFFFFF on failure.
65            virtual unsigned long CreateNewEntity(const std::map<std::string, std::string>& Properties, unsigned long CreationFrameNr, const VectorT& Origin)=0;
66
67            /// Removes the entity identified by 'EntityID' from the (server) world.
68            virtual void RemoveEntity(unsigned long EntityID)=0;
69
70            /// Returns a model for the given filename.
71            /// The returned model instance is managed by the GameWorldI implementation in a ModelManagerT,
72            /// thus the caller does not have to (and if fact, must not) delete the CafuModelT instance.
73            virtual const CafuModelT* GetModel(const std::string& FileName) const=0;
74        };
75    }
76}
77
78#endif
Note: See TracBrowser for help on using the browser.