Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
ICmpUnitRenderer.h
Go to the documentation of this file.
1/* Copyright (C) 2020 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_ICMPMODELRENDERER
19#define INCLUDED_ICMPMODELRENDERER
20
22
23#include <vector>
24
25class CUnit;
26class CBoundingSphere;
27class CVector3D;
28
30{
31public:
32 /**
33 * External identifiers for models.
34 * (This is a struct rather than a raw u32 for type-safety.)
35 */
36 struct tag_t
37 {
38 tag_t() : n(0) {}
39 explicit tag_t(u32 n) : n(n) {}
40 bool valid() const { return n != 0; }
41
43 };
44
45 enum
46 {
47 ACTOR_ONLY = 1 << 0,
49 };
50
51 virtual tag_t AddUnit(CEntityHandle entity, CUnit* unit, const CBoundingSphere& boundsApprox, int flags) = 0;
52
53 virtual void RemoveUnit(tag_t tag) = 0;
54
55 virtual void UpdateUnit(tag_t tag, CUnit* unit, const CBoundingSphere& boundsApprox) = 0;
56
57 virtual void UpdateUnitPos(tag_t tag, bool inWorld, const CVector3D& pos0, const CVector3D& pos1) = 0;
58
59 /**
60 * Return a list of visual entities along with their center point.
61 * Visual means they have an associated actor and a visual component,
62 * but they could still be hiden in the fog of war for a specific player,
63 * for example.
64 * NOTE: It's generally faster to do a lot of ray intersection tests than
65 * querying a lot of entities for component interfaces and doing these types
66 * of tests first.
67 */
68 virtual void PickAllEntitiesAtPoint(std::vector<std::pair<CEntityHandle, CVector3D> >& outEntities,
69 const CVector3D& origin, const CVector3D& dir,
70 bool allowEditorSelectables) const = 0;
71
72 /**
73 * Returns the frame offset from the last Interpolate message.
74 */
75 virtual float GetFrameOffset() const = 0;
76
77 /**
78 * Toggle the rendering of debug info.
79 */
80 virtual void SetDebugOverlay(bool enabled) = 0;
81
82 DECLARE_INTERFACE_TYPE(UnitRenderer)
83};
84
85#endif // INCLUDED_ICMPMODELRENDERER
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
Definition: BoundingSphere.h:26
Object wrapping an entity_id_t, with a SEntityComponentCache to support fast QueryInterface() / CmpPt...
Definition: Entity.h:80
Definition: Unit.h:38
Definition: Vector3D.h:31
Definition: ICmpUnitRenderer.h:30
virtual void SetDebugOverlay(bool enabled)=0
Toggle the rendering of debug info.
virtual void UpdateUnit(tag_t tag, CUnit *unit, const CBoundingSphere &boundsApprox)=0
virtual void PickAllEntitiesAtPoint(std::vector< std::pair< CEntityHandle, CVector3D > > &outEntities, const CVector3D &origin, const CVector3D &dir, bool allowEditorSelectables) const =0
Return a list of visual entities along with their center point.
virtual void RemoveUnit(tag_t tag)=0
virtual void UpdateUnitPos(tag_t tag, bool inWorld, const CVector3D &pos0, const CVector3D &pos1)=0
@ VISIBLE_IN_ATLAS_ONLY
Definition: ICmpUnitRenderer.h:48
@ ACTOR_ONLY
Definition: ICmpUnitRenderer.h:47
virtual tag_t AddUnit(CEntityHandle entity, CUnit *unit, const CBoundingSphere &boundsApprox, int flags)=0
virtual float GetFrameOffset() const =0
Returns the frame offset from the last Interpolate message.
Definition: IComponent.h:33
External identifiers for models.
Definition: ICmpUnitRenderer.h:37
u32 n
Definition: ICmpUnitRenderer.h:42
tag_t()
Definition: ICmpUnitRenderer.h:38
bool valid() const
Definition: ICmpUnitRenderer.h:40
tag_t(u32 n)
Definition: ICmpUnitRenderer.h:39
uint32_t u32
Definition: types.h:39