Add infos into target window
[ryzomcore.git] / ryzom / client / src / r2 / displayer_visual_activity_sequence.h
blob290c62309806116dd945e40d5d7cbc6ef5123995
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program 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 Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef R2_DISPLAYER_VISUAL_ACTIVITY_SEQUENCE_H
18 #define R2_DISPLAYER_VISUAL_ACTIVITY_SEQUENCE_H
20 #include "displayer_visual.h"
21 #include "../decal.h"
22 #include "editor.h"
23 #include "nel/misc/line.h"
25 #include "../interface_v3/group_map.h"
28 namespace NLMISC
30 class CLine;
33 namespace R2
36 class CDisplayerVisualActivitySequence : public CDisplayerVisual, public CEditor::IInstanceObserver,
37 public CGroupMap::IDeco
39 public:
40 NLMISC_DECLARE_CLASS(R2::CDisplayerVisualActivitySequence);
41 CDisplayerVisualActivitySequence();
42 ~CDisplayerVisualActivitySequence();
43 // from CDisplayerVisual
44 virtual bool isSelectable() const { return false; }
45 virtual void onAttrModified(const std::string &attrName, sint32 attrIndex);
46 virtual void onPostRender();
47 virtual void onPreRender();
48 virtual void updateWorldPos();
49 virtual void setActive(bool active);
50 virtual bool getActive() const;
51 private:
52 bool _AddedToWorldMap;
53 bool _Touched;
54 bool _Active;
55 std::vector<CDecal::TSmartPtr> _Decals;
56 std::vector<CCtrlQuad *> _WorldMapEdges;
57 std::vector<CEditor::TInstanceObserverHandle> _ObserverHandles;
58 // need to know when one of the component world pos is changed (no notification message reach us if
59 // word pos update is due to a parent)
60 // TODO : add a 'world pos changed' event...
61 struct CWorldPosCache
63 CDisplayerVisual::TRefPtr DV;
64 NLMISC::CVector2f WorldPos2f;
66 std::vector<CWorldPosCache> _WPCache;
67 std::vector<NLMISC::CLine> _FootSteps;
68 NLMISC::CRGBA _DecalColor;
69 // keep list of primitives traversed by this sequence
70 // allows to know when to update us if visibility of one of the primitive has changed
71 struct CTraversedPrimInfo
73 CDisplayerVisual::TRefPtr PrimDisplay;
74 bool Visible;
76 std::vector<CTraversedPrimInfo> _TraversedPrimInfos;
77 protected:
78 void touch();
79 void update();
80 void clear(bool wantRemoveFromWorldMap = true);
81 void addFootSteps(const NLMISC::CLine &line);
82 void addWanderSteps(const NLMISC::CVector &pos);
83 void setWorldMapColor(NLMISC::CRGBA color);
84 void setWorldMapNumEdges(uint count);
85 CDisplayerVisual *getParentDV() const;
86 // from CEditor::IInstanceObserver
87 virtual void onInstanceCreated(CInstance &instance);
88 virtual void onInstanceErased(CInstance &instance);
89 virtual void onAttrModified(CInstance &instance, const std::string &attrName, sint32 attrIndex);
90 protected:
91 // from CGroupMap::IDeco
92 virtual void onAdd(CGroupMap &owner);
93 virtual void onRemove(CGroupMap &owner);
94 virtual void onPreRender(CGroupMap &owner);
95 virtual void onUpdate(CGroupMap &owner);
96 // return true if visible
97 // if entiyDV == groupDV, then an ungrouped entity, else the group an its entity
98 bool isVisible(CDisplayerVisual *groupDV, CDisplayerVisual *entityDV);
99 // get visual displayer of parent group, or return the entity if not grouped
100 CDisplayerVisual *getPossibleGroupDV(CDisplayerVisual *entityDV);
102 void removeFromWorldMap();
105 } // R2
107 #endif