Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ObjectEntry.h
Go to the documentation of this file.
1 /* Copyright (C) 2013 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_OBJECTENTRY
19 #define INCLUDED_OBJECTENTRY
20 
21 class CModelAbstract;
22 class CSkeletonAnim;
23 class CObjectBase;
24 class CObjectManager;
25 class CSimulation2;
26 struct SPropPoint;
27 
28 #include <map>
29 #include <set>
30 #include <vector>
31 
32 #include "lib/file/vfs/vfs_path.h"
33 #include "ps/CStr.h"
34 #include "ps/Overlay.h"
35 
36 #include "graphics/ObjectBase.h"
37 
39 {
41 
42 public:
43  CObjectEntry(CObjectBase* base, CSimulation2& simulation);
44  ~CObjectEntry();
45 
46  // Construct this actor, using the specified variation selections
47  bool BuildVariation(const std::vector<std::set<CStr> >& selections,
48  const std::vector<u8>& variationKey, CObjectManager& objectManager);
49 
50  // Base actor. Contains all the things that don't change between
51  // different variations of the actor.
53 
54  // samplers list
55  std::vector<CObjectBase::Samp> m_Samplers;
56  // model name
58  // colour (used when doing alpha-channel colouring, but not doing player-colour)
60  // (probable TODO: make colour a per-model thing, rather than per-objectEntry,
61  // so we can have lots of colour variations without wasting memory on
62  // lots of objectEntries)
63 
64  std::wstring m_ProjectileModelName;
65 
66  // Returns a randomly-chosen animation matching the given name.
67  // If none is found, returns NULL.
68  CSkeletonAnim* GetRandomAnimation(const CStr& animationName) const;
69 
70  // Returns all the animations matching the given name.
71  std::vector<CSkeletonAnim*> GetAnimations(const CStr& animationName) const;
72 
73  // corresponding model
75 
76  // Whether this object is outdated, due to hotloading of its base object.
77  // (If true then CObjectManager won't reuse this object from its cache.)
78  bool m_Outdated;
79 
80 private:
82 
83  typedef std::multimap<CStr, CSkeletonAnim*> SkeletonAnimMap;
85  // TODO: something more memory-efficient than storing loads of similar strings for each unit?
86 };
87 
88 
89 #endif
bool BuildVariation(const std::vector< std::set< CStr > > &selections, const std::vector< u8 > &variationKey, CObjectManager &objectManager)
Definition: ObjectEntry.cpp:57
Describes the position of a prop point within its parent model.
Definition: ModelDef.h:48
std::wstring m_ProjectileModelName
Definition: ObjectEntry.h:64
Definition: Overlay.h:34
CObjectBase * m_Base
Definition: ObjectEntry.h:52
std::vector< CObjectBase::Samp > m_Samplers
Definition: ObjectEntry.h:55
Public API for simulation system.
Definition: Simulation2.h:46
Definition: path.h:75
VfsPath m_ModelName
Definition: ObjectEntry.h:57
CSkeletonAnim * GetRandomAnimation(const CStr &animationName) const
CColor m_Color
Definition: ObjectEntry.h:59
SkeletonAnimMap m_Animations
Definition: ObjectEntry.h:84
CObjectEntry(CObjectBase *base, CSimulation2 &simulation)
Definition: ObjectEntry.cpp:42
std::multimap< CStr, CSkeletonAnim * > SkeletonAnimMap
Definition: ObjectEntry.h:83
Abstract base class for graphical objects that are used by units, or as props attached to other CMode...
Definition: ModelAbstract.h:36
std::vector< CSkeletonAnim * > GetAnimations(const CStr &animationName) const
CModelAbstract * m_Model
Definition: ObjectEntry.h:74
NONCOPYABLE(CObjectEntry)
CSimulation2 & m_Simulation
Definition: ObjectEntry.h:81
bool m_Outdated
Definition: ObjectEntry.h:78