Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / entity_cl.h
blobf2f99b347d937b749d5c3c110805c9410cb1be9d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2012 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
6 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // Copyright (C) 2013-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
8 //
9 // This program is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU Affero General Public License as
11 // published by the Free Software Foundation, either version 3 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU Affero General Public License for more details.
19 // You should have received a copy of the GNU Affero General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef CL_ENTITY_CL_H
25 #define CL_ENTITY_CL_H
28 /////////////
29 // Include //
30 /////////////
31 // Misc
32 #include "nel/misc/types_nl.h"
33 #include "nel/misc/stream.h"
34 #include "nel/misc/time_nl.h" // Define the TTime
35 #include "nel/misc/vector.h" // Define the CVector
36 #include "nel/misc/vectord.h" // Define the CVector
37 #include "nel/misc/matrix.h"
38 #include "nel/misc/sheet_id.h"
39 // Interface 3D
40 #include "nel/3d/u_instance.h"
41 #include "nel/3d/u_skeleton.h"
42 #include "nel/3d/u_visual_collision_entity.h"
43 #include "nel/3d/animation_time.h"
44 #include "nel/3d/logic_info.h"
45 #include "nel/3d/u_particle_system_instance.h"
46 // Pacs Interface.
47 #include "nel/pacs/u_move_primitive.h"
48 #include "nel/pacs/u_global_position.h"
49 // Game_Share
50 #include "game_share/properties.h"
51 #include "game_share/mode_and_behaviour.h"
52 #include "game_share/entity_types.h"
53 #include "game_share/body.h"
54 #include "game_share/hit_type.h"
55 #include "game_share/body.h"
56 #include "game_share/animal_status.h"
57 #include "game_share/pvp_mode.h"
58 #include "game_share/pvp_clan.h"
59 #include "game_share/mount_people.h"
60 #include "game_share/outpost.h"
61 // Sheets
62 #include "client_sheets/ground_fx_sheet.h"
63 // Client
64 #include "animation_type.h"
65 #include "string_manager_client.h"
66 // Stl
67 #include <string>
68 #include <list>
69 #include <map>
71 // The update clipped primitive mask
72 #define RZ_CLIPPED_UPDATE_TIME_MASK 0x7
74 // Size of the points bars
75 #define RZ_BARS_LENGTH 127
77 #define RZ_TIME_TO_BECOME_TRANSPARENT_IN_SECOND 0.25
79 #define TMP_DEBUG_GUIGUI
81 ///////////
82 // CLASS //
83 ///////////
84 namespace NL3D
86 class USkeleton;
87 class UPlayList;
88 class UParticleSystemInstance;
89 class UMaterial;
92 class CEntitySheet;
93 class CEntityCL;
94 struct CAttackInfo;
96 class CItemSheet;
98 namespace NLMISC{
99 class CCDBNodeLeaf;
100 class CCDBNodeBranch;
103 extern CLFECOMMON::TCLEntityId SlotUnderCursor;
106 * Implementation of NL3D::ILogicInfo
108 * \author Lionel Berenguier
109 * \author Nevrax France
110 * \date 2002
112 class CEntityLogicInfo3D : public NL3D::ILogicInfo
114 public:
115 /// My owner
116 CEntityCL *Self;
118 public:
119 /// retrieve light information for the entity skeleton
120 virtual void getStaticLightSetup(NLMISC::CRGBA sunAmbient, std::vector<NL3D::CPointLightInfluence> &pointLightList,
121 uint8 &sunContribution, NLMISC::CRGBA &localAmbient);
127 * Interface to manage an Entity in the client side.
129 * \author Guillaume PUZIN
130 * \author Nevrax France
131 * \date 2001
133 class CEntityCL : public NLMISC::IStreamable, public STRING_MANAGER::IStringWaitCallback
135 friend class CUpdateEntitiesColor;
137 public:
138 struct SInstanceCL
140 NL3D::UInstance Current; // Current instance
141 std::string CurrentName; // Current instance name
142 const CItemSheet *FXItemSheet;
143 std::vector<NL3D::UInstance> StaticFXs;
145 NL3D::UInstance Loading; // Instance loading (to avoid any artefact)
146 std::string LoadingName; // Loading instance name
148 std::string StickPoint;
149 sint TextureSet;
150 bool ApplyColor;
151 bool KeepHiddenWhenLoaded;
152 sint ACSkin, ACUser, ACHair, ACEyes;
154 // ------------------------------------------------------------------------
155 SInstanceCL()
157 Current = Loading = NULL;
158 FXItemSheet = NULL;
159 TextureSet = -1;
160 ApplyColor = false;
161 KeepHiddenWhenLoaded = false;
162 ACSkin = ACUser = ACHair = ACEyes = -1;
163 _Scale= NLMISC::CVector(1.f,1.f,1.f);
165 ~SInstanceCL()
167 releaseStaticFXs();
171 void selectTextureSet(uint8 value, bool async = true);
173 // show every static fxs
174 void showStaticFXs();
176 // hide every static fxs
177 void hideStaticFXs();
179 // Create the loading instance. return false if shapeName is not empty while still fails to load. else return true.
180 bool createLoading(const std::string &shapeName, const std::string &stickPoint=std::string(""), sint texture=-1, bool clearIfFail= true);
182 // Apply Colors
183 void setColors(sint skin, sint user, sint hair, sint eyes);
185 // Create the loading instance from the current instance and copy info from current instance to it
186 // If the loading instance already exist do not copy anything from current instance
187 NL3D::UInstance createLoadingFromCurrent();
189 // Update current instance from loading instance (set loading instance to null)
190 // Bind the loading instance to the skeleton
191 void updateCurrentFromLoading(NL3D::USkeleton skel);
193 void releaseStaticFXs();
195 // For Blink
196 void setEmissive(NLMISC::CRGBA emit);
197 void restoreEmissive();
199 // For MouseOver player (do it on Current)
200 void makeInstanceTransparent(uint8 opacity, uint8 opacityMin);
202 // replace diffuse for all material of this instance (not including alpha)
203 void setDiffuse(bool onOff, NLMISC::CRGBA diffuse);
205 // Setup the scale for the instance
206 void setScale(const NLMISC::CVector &scale);
207 const NLMISC::CVector &getScale() const {return _Scale;}
209 private:
210 // Wanted Scale
211 NLMISC::CVector _Scale;
214 public:
215 /// Constructor.
216 CEntityCL();
217 /// Destructor.
218 virtual ~CEntityCL();
220 /// Primitive type
221 enum TType
223 User = 0,
224 Player,
225 NPC,
226 Fauna,
227 Entity,
228 ForageSource,
229 TypeCount
230 } Type;
232 /// Return the entity Id (persistent as long as the entity is connected) (CLFECOMMON::INVALID_CLIENT_DATASET_INDEX for an invalid one).
233 const CLFECOMMON::TClientDataSetIndex &dataSetId() const {return _DataSetId;}
234 /// Set the entity Id (persistent as long as the entity is connected) (CLFECOMMON::INVALID_CLIENT_DATASET_INDEX for an invalid one).
235 void dataSetId(CLFECOMMON::TClientDataSetIndex dataSet);
237 /// Return the sheet Id of the entity.
238 const NLMISC::CSheetId &sheetId() const {return _SheetId;}
239 /// Set the sheet Id of the entity.
240 void sheetId(const NLMISC::CSheetId &id) {_SheetId = id;}
242 /// Return the persistent NPC alias of entity (0 if N/A).
243 uint32 npcAlias() const {return _NPCAlias; }
244 /// Set the persistent NPC alias of the entity.
245 void npcAlias(uint32 alias) {_NPCAlias = alias; }
247 /// Method to call to initialize all members of the right class.
248 virtual void initialize();
250 /// Build the entity from a sheet.
251 virtual bool build(const CEntitySheet *sheet) = 0;
253 /// Initialize properties of the entity (according to the class).
254 virtual void initProperties();
255 /** Initialize the primitive. Return 'true' if the primitive has been created.
256 * clipRadius/clipHeight, specify them if you want special clip values (different from collision ones)
258 bool initPrimitive(float radius, float height, float length, float width, NLPACS::UMovePrimitive::TReaction reactionType, NLPACS::UMovePrimitive::TTrigger triggerType, NLPACS::UMovePrimitive::TCollisionMask occlusionMask, NLPACS::UMovePrimitive::TCollisionMask collisionMask, float clipRadius=0.f, float clipHeight=0.f);
261 * Update a visual property from the database.
262 * \param gameCycle : when this was sent.
263 * \param prop : the property to udapte.
265 void updateVisualProperty(const NLMISC::TGameCycle &gameCycle, const uint &prop, const NLMISC::TGameCycle &predictedInterval = 0);
267 /// Display the entity name.
268 virtual void displayName() {}
269 /// Display the Hp Modifiers
270 virtual void displayModifiers() {}
271 /// Draw Path
272 virtual void drawPath() {}
273 /// Draw the selection Box
274 virtual void drawBox() {}
276 /** Method called each frame to manage the entity before the collisions detection.
277 * \param time : current time of the frame.
278 * \parem target : pointer on the current entity target.
280 virtual void updatePreCollision(const NLMISC::TTime &/* time */, CEntityCL * /* target */) {}
281 /** Method called each frame to manage the entity after the collisions detection.
282 * \param time : current time of the frame.
283 * \parem target : pointer on the current entity target.
285 virtual void updatePostCollision(const NLMISC::TTime &/* time */, CEntityCL * /* target */) {}
286 /** Method called each frame to manage the entity after the clipping test if the primitive is visible.
287 * \param time : current time of the frame.
288 * \parem target : pointer on the current entity target.
290 virtual void updateVisible(const NLMISC::TTime &time, CEntityCL *target);
291 /** Method called to manage the entity after the clipping test if the primitive is clipped.
292 * This method is called regulary but not at each frame.
293 * \param time : current time of the frame.
294 * \parem target : pointer on the current entity target.
296 virtual void updateSomeClipped(const NLMISC::TTime &time, CEntityCL *target);
297 /** Method called to manage the entity after the clipping test if the primitive is clipped.
298 * This method is called at each frame.
299 * \param time : current time of the frame.
300 * \parem target : pointer on the current entity target.
302 virtual void updateClipped(const NLMISC::TTime &time, CEntityCL *target);
304 * Update the position of the entity after the motion.
305 * \param time : Time for the position of the entity after the motion.
306 * \param target : pointer on the current target.
308 virtual void updatePos(const NLMISC::TTime &/* time */, CEntityCL * /* target */) {}
309 /** Update the entity after the render like for the head offset.
311 virtual void updateVisiblePostPos(const NLMISC::TTime &time, CEntityCL *target);
312 /** Update the entity after the render like for the head offset.
314 virtual void updateVisiblePostRender() {}
315 /** Update all the entity after the render visible or not
317 virtual void updateAllPostRender() {}
320 * Add an instance to the list of instance composing the entity.
321 * \param shapeName : shape filename.
322 * \param stickPoint : Name of the bone to stick on.
323 * \param texture : texture to use (in multi texture) or -1 for default texture.
324 * \param instIdx : if not CEntityCL::BadIndex, the instance will replace the one at this index.
325 * \return uint32 : index of the instance created, or CEntityCL::BadIndex.
327 uint32 addInstance(const std::string &shapeName, const std::string &stickPoint = "", sint texture = -1, uint32 instIdx = BadIndex);
329 // Return true if the primitive is clipped by the camera
330 bool clipped (const std::vector<NLMISC::CPlane> &clippingPlanes, const NLMISC::CVector &camPos);
332 /** \name NAME
333 * Functions to manipulate the Name.
335 //@{
336 /// Return the Name of the entity. There may be a specification in it (guard, trader, etc ...). It is then surrounded by '$'
337 const std::string &getEntityName() const {return _EntityName;}
338 /// Return the title from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..)
339 static std::string getTitleFromName(const std::string &name);
340 /// Remove the specification from a name. The specification is surrounded by '$', and tells the title of the entity (guard, matis merchant, etc ..)
341 static std::string removeTitleFromName(const std::string &name);
342 /// Remove the shard from a name (if player from the same shard). The shard is surrounded by (), and tells the incoming shard of the entity (aniro, leanon etc...)
343 static std::string removeShardFromName(const std::string &name);
344 /// Remove both title and shard from name
345 static std::string removeTitleAndShardFromName(const std::string &name);
346 /// Change the entity name.
347 void setEntityName(const std::string &name);
348 /// Return a displayable name
349 std::string getDisplayName() const
351 return removeTitleAndShardFromName(_EntityName);
353 /// Return the Name ID of the entity.
354 uint32 getNameId() const {return _NameId;}
355 //@}
357 /// Return the entity permanent content texture name.
358 const std::string &getPermanentStatutIcon() const {return _PermanentStatutIcon;}
359 /// Change the entity permanent content texture name.
360 void setPermanentStatutIcon(const std::string &name) { _PermanentStatutIcon=name; }
363 /// Return the parent slot.
364 CLFECOMMON::TCLEntityId parent() {return _Parent;}
365 /// Set the parelt slot.
366 void parent(CLFECOMMON::TCLEntityId p);
367 // Add a new child pointer.
368 void addChild(CEntityCL *c);
369 // Remove a new child pointer.
370 void delChild(CEntityCL *c);
373 /// Is the entity able to fly.
374 void flyer(bool fly) {_Flyer = fly;}
375 bool flyer() {return _Flyer;}
378 * Set the skeleton for the entity or an empty string to remove a skeleton.
379 * \param filename : file with the skeleton to apply to the entity or empty string to remove a skeleton.
380 * \return USkeleton * : pointer on the skeleton handle or NULL.
382 NL3D::USkeleton *skeleton(const std::string &filename);
383 NL3D::USkeleton *skeleton() {return _Skeleton.empty()?NULL:&_Skeleton;}
385 void setStateFx(const std::string &name);
386 void removeStateFx();
387 const std::string &getStateFx() {return _StateFXName;};
388 /** To Inform about another (or self) entity removal (to remove from selection for example).
389 * \param slot : Slot of the entity that will be removed.
391 virtual void slotRemoved(const CLFECOMMON::TCLEntityId &/* slot */) {}
394 /// Return the current slot for the entity or CLFECOMMON::INVALID_SLOT if the entity is not in any slot.
395 const CLFECOMMON::TCLEntityId &slot() const {return _Slot;}
396 /// Set the current slot for the entity (CLFECOMMON::INVALID_SLOT for no slot).
397 void slot(const CLFECOMMON::TCLEntityId &s) {_Slot = s;}
400 /** \name TARGET
401 * Methods to manage the target.
403 //@{
404 /// Return the current target of the entity or CLFECOMMON::INVALID_SLOT.
405 const CLFECOMMON::TCLEntityId &targetSlot() const {return _TargetSlot;}
406 /// Set the current target of the entity (CLFECOMMON::INVALID_SLOT for no target).
407 void targetSlot(const CLFECOMMON::TCLEntityId &t) {_TargetSlot = t;}
408 /// get the most recent TargeSlot received in updateVisualProperty() (ie wihtout any LCT delay due to _Stages)
409 CLFECOMMON::TCLEntityId getTargetSlotNoLag() const {return _TargetSlotNoLag;}
410 /// dir to target
411 NLMISC::CVector dirToTarget() const;
412 //@}
414 /// Set the mode for the entity. return false if it will be impossible to set this mode.
415 virtual bool mode(MBEHAV::EMode m) {_Mode = m; return true;}
416 /// Return the entity mode.
417 virtual MBEHAV::EMode mode() const {return _Mode;}
420 /// Return the entity current behaviour.
421 MBEHAV::EBehaviour behaviour() const {return _CurrentBehaviour.Behaviour;}
424 * Show or Hide the entity.
425 * \param s : if 'true' = entity visible, else invisible.
427 void show(bool s);
429 void displayable(bool d);
430 bool displayable() const {return _Displayable;}
433 /** \name POSITION
434 * Functions to manage the entity position.
436 //@{
437 /// Return true if the entity has moved since last frame.
438 bool hasMoved() const {return _HasMoved;}
439 /// Return the last frame position.
440 const NLMISC::CVectorD &lastFramePos() const {return _LastFramePos;}
441 /// Return the last frame PACS position.
442 bool lastFramePACSPos(NLPACS::UGlobalPosition &result) const;
443 /// Return the current PACS position.
444 bool currentPACSPos(NLPACS::UGlobalPosition &result) const;
445 /// Get the entity position(const method).
446 const NLMISC::CVectorD &pos() const {return _Position;}
447 // Get the direction matrix
448 const NLMISC::CMatrix &dirMatrix() const {return _DirMatrix; }
449 /// Get a reference on the entity position(method not const).
450 NLMISC::CVectorD &pos() {return _Position;}
451 /// Get a reference on the entity position(method not const).
452 void pos(const NLMISC::CVectorD &vect);
453 /// Change the PACS position and the entity position too. This is slow, prefer pacsMove if you can.
454 void pacsPos(const NLMISC::CVectorD &vect, const NLPACS::UGlobalPosition &globPos = NLPACS::UGlobalPosition());
455 /// Move the PACS position and the entity position too. This is fast. The PACS position will be available after the PACS::evalCollsion call.
456 void pacsMove(const NLMISC::CVectorD &vect);
457 /** Update the PACS position after the evalCollision. The entity position is set too. This is fast.
458 * If the entity position is too far from its PACS position, setGlobalPosition is called.
459 * After this call, the position.z is valid.
461 virtual void pacsFinalizeMove();
462 /// Get the entity position and set all visual stuff with it.
463 virtual void updateDisplay(CEntityCL *parent = 0);
464 /// Set the cluster system for the current entity and all of its chidren.
465 void setClusterSystem(NL3D::UInstanceGroup *cluster);
466 // Get the current cluster system
467 NL3D::UInstanceGroup *getClusterSystem();
468 /// Choose the right cluster according to the entity position.
469 void updateCluster();
470 /// Snap the entity on the ground using the visual collision manager.
471 virtual void snapToGround();
472 //@}
475 /// Get the vector up of the entity (method const).
476 const NLMISC::CVector &up() const {return _Up;}
477 /// Set the vector up of the entity and normalize.
478 void up(const NLMISC::CVector &vect);
480 /// Get the front vector (const method).
481 const NLMISC::CVector &front() const {return _Front;}
482 /** Change the entity front vector.
483 * \param vect : new vector to use for the front.
484 * \param compute : adjust the param 'vect' to be valid or leave the old front unchanged if impossible.
485 * \param check : warning if the param 'vect' is not valid to be the front (vector Null) even with compute=true.
486 * \param forceTurn : set front even if the entity cannot turn
487 * \return bool : 'true' if the front has been filled, else 'false'.
489 bool front(const NLMISC::CVector &vect, bool compute=true, bool check=true, bool forceTurn=false);
490 /// Get the front Yaw angle (const method).
491 float frontYaw() const {return (float)atan2(front().y, front().x);}
493 /// Get the entity direction(this method is const).
494 const NLMISC::CVector &dir() const {return _Dir;}
495 /** Change the entity direction vector.
496 * \param vect : new vector to use for the direction.
497 * \param compute : adjust the param 'vect' to be valid or leave the old direction unchanged if impossible.
498 * \param check : warning if the param 'vect' is not valid to be the direction (vector Null) even with compute=true.
499 * \return bool : 'true' if the direction has been filled, else 'false'.
501 bool dir(const NLMISC::CVector &vect, bool compute=true, bool check=true);
504 * Method to get the position of the head (in the world).
505 * \param headPos: will be set with the head position if succeed.
506 * \return 'true' if the param has been updated.
507 * \warning this method do NOT check if there is a skeleton.
509 virtual bool getHeadPos(NLMISC::CVector &) {return false;}
511 /** \name BOX.
512 * Functions to manage the box around the entity.
514 //@{
516 * Set the box.
517 * \param box : an axis aligned bounding box to apply to the entity.
519 void box(const NLMISC::CAABBox &box);
521 * Return a box around the entity.
522 * \return CAABBox : an axis aligned bounding box around the entity.
524 const NLMISC::CAABBox &box() const {return _Aabbox;}
525 /// Return the selection box.
526 virtual const NLMISC::CAABBox &selectBox() {return _SelectBox;}
527 /// Return the local select box (not transformed in world). Scale is included
528 virtual const NLMISC::CAABBox &localSelectBox();
530 //@}
533 /** \name ENTITY PROPERTIES.
534 * Functions to manage the entity properties.
536 //@{
538 * Return a reference on properties.
539 * \return CProperties : properties of the entity.
541 CProperties &properties() {return _Properties;}
542 const CProperties &properties() const {return _Properties;}
543 //@}
546 /** \name COLLISION
547 * Methods to manage the primitive.
549 //@{
550 /// Create a primitive for the entity.
551 virtual void computePrimitive();
552 /// Remove the primitive from PACS
553 virtual void removePrimitive();
554 /** Get the primitive used for the entity.
555 * \return UMovePrimitive * : poiner on the primitive used for the entity.
557 const NLPACS::UMovePrimitive *getPrimitive() const {return _Primitive;}
558 NLPACS::UMovePrimitive *getPrimitive() {return _Primitive;}
560 /// Create the collision entity.
561 virtual void computeCollisionEntity();
562 /// Remove the collision entity.
563 void removeCollisionEntity();
564 /** Get a pointer on the collision entity (collision with the landscape)
565 * \return pointer on the collision entity
567 NL3D::UVisualCollisionEntity *getCollisionEntity() {return _CollisionEntity;}
568 /** Set the collision entity (collision with the landscape)
569 * \param pointer on the collision entity
571 void setCollisionEntity( NL3D::UVisualCollisionEntity * collisionEntity ) {_CollisionEntity = collisionEntity;}
572 //@}
574 /// Method to return the attack radius of an entity
575 virtual double attackRadius() const;
577 /** Return the position the attacker should have to combat according to the attack angle.
578 * \param ang : 0 = the front, >0 and <Pi = left side, <0 and >-Pi = right side.
580 virtual NLMISC::CVectorD getAttackerPos(double ang, double dist) const;
581 /// Return true if the opponent is well placed.
582 virtual bool isPlacedToFight(const NLMISC::CVectorD &/* posAtk */, const NLMISC::CVector &/* dirAtk */, double /* attackerRadius */) const {return false;}
584 /** Play an impact on the entity
585 * \param impactType : 0=magic, 1=melee
586 * \param type : see behaviour for spell
587 * \param intensity : see behaviour for spell
588 * \param id : see behaviour for spell
590 virtual void impact(uint /* impactType */, uint /* type */, uint /* id */, uint /* intensity */) {}
591 /** Try to play a melee impact on this entity.
593 virtual void meleeImpact(const CAttackInfo &/* attack */) {}
594 /** Play the magic impact on the entity
595 * \param type : type of the impact (host/good/neutral).
596 * \param intensity : intensity of the impact.
598 virtual void magicImpact(uint /* type */, uint /* intensity */) {}
600 /** \name DEBUG
601 * Methods only here for the debug.
603 //@{
604 /// Return number of stage remaining.
605 virtual uint nbStage() {return 0;}
607 /// Return the number of animation FXs remaining to remove.
608 virtual uint nbAnimFXToRemove() {return 0;}
610 /// Change the entity colors.
611 virtual void changeColors(sint /* userColor */, sint /* hair */, sint /* eyes */, sint /* part */) { }
612 /// Display Debug Information.
613 virtual void displayDebug(float x, float &y, float lineStep);
614 /// Display Debug Information for property stages
615 virtual void displayDebugPropertyStages(float x, float &y, float lineStep);
616 //@}
618 /// TEST
619 NL3D::UPlayList *playList() {return _PlayList;}
620 NL3D::UPlayList *facePlayList() {return _FacePlayList;}
622 /// Get a reference for all instances of the entity.
623 std::vector<SInstanceCL> &instances() {return _Instances;}
624 NL3D::UInstance instance() { return _Instance;}
627 * \param pos : result given in this variable. Only valid if return 'true'.
628 * \return bool : 'true' if the 'pos' has been filled.
630 virtual bool getNamePos(NLMISC::CVectorD &/* pos */) {return false;}
632 virtual bool getChestPos(NLMISC::CVectorD &/* pos */) const {return false;}
634 /// Return true if the character is currently dead.
635 virtual bool isDead() const {return (_Mode == MBEHAV::DEATH);}
636 /// Return true if the character is really dead. With no lag because of anim or LCT
637 virtual bool isReallyDead() const {return false;}
639 // Add hit points gain/lost by this entity.
640 void addHPOutput(sint16 hp, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20) _HPModifiers.push_back(CHPModifier(hp,color,dt));}
641 void addHPOutput(const std::string &text, NLMISC::CRGBA color, float dt=0.0f) { if(_HPModifiers.size()<20 && !text.empty()) _HPModifiers.push_back(CHPModifier(text,color,dt));}
643 /// Return the entity sheet scale. (return 1.0 if there is any problem).
644 virtual float getSheetScale() const {return 1.0f;}
645 /// Return the entity collision radius. (return 1.0 if there is any problem).
646 virtual float getSheetColRadius() const {return 0.5f;}
647 /// Return the entity scale. (return 1.0 if there is any problem).
648 virtual float getScale() const {return 1.0;}
649 // If entity is a mesh, then returns its default scale (value from export). Returns (1.f, 1.f, 1.f) of not a mesh or skinned
650 void getMeshDefaultScale(NLMISC::CVector &scale) const;
652 /// 'True' if the entity is displayed.
653 virtual bool isVisible() const {return false;}
654 /// (Re-)Build the playlist (Removing the old one too).
655 virtual void buildPlaylist() {}
658 /// Serialize entity.
659 void serial(NLMISC::IStream &f);
661 // return vector of ground fxs sorted by ground type, or NULL is ground fxs are not supported for the entity
662 virtual const std::vector<CGroundFXSheet> *getGroundFX() const { return NULL; }
664 // are ground fx supported by entity ?
665 virtual bool supportGroundFX() const { return false; }
667 // Was the entity clipped during the last frame ? This is updated during the call CEntityManager::updatePostCamera
668 bool getLastClip() const { return _Clipped; }
669 void setLastClip(bool lastClip) { _Clipped = lastClip; }
671 //--------------//
672 // ENTITY INFOS //
673 //--------------//
675 /// Return the entity speed
676 virtual double getSpeed() const {return 0.0;}
678 /// Return true if the current position is an indoor position.
679 bool indoor() const;
681 // Return true if this entity is a user
682 bool isUser () const { return Type == User; }
684 // Return true if this entity is a neutral entity.
685 virtual bool isNeutral () const { return false; }
686 // Return true if this entity is a user's friend.
687 virtual bool isFriend () const { return false; }
688 // Return true if this entity is a user's enemy.
689 virtual bool isEnemy () const { return false; }
690 // Return true if this entity is a user's ally.
691 virtual bool isAlly() const { return false; }
692 // Return true if this entity is neutral pvp.
693 virtual bool isNeutralPVP() const { return false; }
695 /// Return true if this player has the viewing properties of a friend (inscene bars...)
696 virtual bool isViewedAsFriend() const { return isNeutral() || isFriend() || isInTeam() || isInSameGuild() || isInSameLeague(); }
698 /// Return the People for the entity (unknown by default)
699 virtual EGSPD::CPeople::TPeople people() const;
700 virtual void setPeople(EGSPD::CPeople::TPeople people);
702 // todo handle NPC entities
703 // Return true if this entity is a NPC (not a fauna)
704 bool isNPC () const { return Type == NPC; }
706 // Return true if this entity can have missions icons (humanoid NPCs (including Karavan), Kami or Bot Object)
707 bool canHaveMissionIcon() const { return isNPC() || isKami() || isUnknownRace(); }
709 // Return true if this entity is a Kami
710 virtual bool isKami() const { return false; }
712 // Return true if this entity has Race set to Unknown
713 virtual bool isUnknownRace() const { return false; }
715 // Return true if this entity is a fauna (not a NPC)
716 bool isFauna () const { return Type == Fauna; }
718 // Return true if this entity is a AI (fauna or NPC)
719 bool isAI () const { return (Type == Fauna) || (Type == NPC); }
721 // Return true if this entity is a forage source
722 bool isForageSource() const { return Type == ForageSource; }
724 // Return true if this entity is a Player Character
725 bool isPlayer () const { return Type == Player; }
727 // Return true if this entity is the current user selection. NB: actually test UserEntity->selection() (ie not laggy!)
728 bool isTarget () const;
730 // Return true if this entity is under the cursor
731 bool isUnderCursor () const
733 return _Slot == SlotUnderCursor;
736 // Is a mission target
737 bool isMissionTarget () { return _MissionTarget; }
739 // Return true if this entity is in the user group
740 bool isInTeam () const { return _IsInTeam; }
742 // Return true if this entity is in the user guild
743 bool isInSameGuild () const;
745 // Return true if this entity is in the user league
746 bool isInSameLeague () const;
748 // Return true if this entity or the user is in a league
749 bool oneInLeague () const;
751 // Return true if this entity is a Mount owned by the User
752 bool isUserMount () const {return _IsUserMount;}
754 // Return true if this entity is a pack animal owned by the User
755 bool isUserPackAnimal () const {return _IsUserPackAnimal;}
757 // Return info on the guild
758 virtual uint32 getGuildNameID () const { return 0; }
759 virtual uint64 getGuildSymbol () const { return 0; }
761 virtual uint32 getEventFactionID() const { return 0; }
762 virtual uint16 getPvpMode() const { return PVP_MODE::None; }
763 virtual PVP_CLAN::TPVPClan getPvpClan() const { return PVP_CLAN::None; }
764 virtual uint32 getLeagueID() const { return 0; }
766 virtual uint16 getOutpostId() const { return 0; }
767 virtual OUTPOSTENUMS::TPVPSide getOutpostSide() const { return OUTPOSTENUMS::UnknownPVPSide; }
768 bool isAnOutpostEnemy() const;
769 bool isAnOutpostAlly() const;
771 /// Return the entity title
772 const std::string &getTitle() const
774 return _Title;
777 /// Return the entity tags
778 const std::string &getTag(uint8 id) const
780 if (_Tags.size() > id) {
781 return _Tags[id];
783 static const std::string empty;
784 return empty;
787 /// Return the raw unparsed entity title
788 const std::string &getTitleRaw() const
790 return _TitleRaw;
793 /// Return true if this entity has a reserved title
794 bool hasReservedTitle() const { return _HasReservedTitle; }
796 /// Return true if this entity can turn
797 bool canTurn() const { return _CanTurn; }
799 /// Get entity color
800 NLMISC::CRGBA getColor () const;
802 // Rebuild in scene interfaces
803 virtual void buildInSceneInterface ();
805 // enable display of in scene interface. This flag is 'anded' with the final value when calling 'mustShowInsceneInterface'
806 void enableInSceneInterface(bool enabled) { _InSceneInterfaceEnabled = enabled; }
808 // Update the mission target flag
809 void updateMissionTarget ();
811 // get the type of the ground below the entity
812 uint getGroundType() const;
814 virtual void makeTransparent(bool t);
815 virtual void makeTransparent(float factor);
816 virtual void setDiffuse(bool onOff, NLMISC::CRGBA diffuse);
819 static NLMISC::CCDBNodeLeaf *getOpacityDBNode();
820 static uint32 getOpacityMin();
821 static void setOpacityMin(uint32 value);
823 // Update the _IsInTeam flag
824 void updateIsInTeam ();
826 // update for isUserMount() and isUserPackAnimal()
827 void updateIsUserAnimal ();
829 // if a pack animal, return the animal status. 0 if not a pack animal
830 ANIMAL_STATUS::EAnimalStatus getPackAnimalStatus() const;
832 // if a pack animal, return the animal DB index
833 bool getPackAnimalIndexInDB(sint &dbIndex) const;
835 // remove all attached fx of that entity (so that they can be reloaded)
836 virtual void removeAllAttachedFX() {}
838 // get bone name from a part of the body (base implementation provides the base bones names)
839 virtual const char *getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TSide side) const;
840 // ...
841 virtual bool getBoneHeight(BODY::TBodyPart /* localisation */, BODY::TSide /* side */, float &/* height */) const {return false;}
843 // true if the entity position is valid (related to network lag at creation time)
844 bool firstPositionReceived() const {return !_First_Pos;}
846 // VISUAL SELECTION
848 // Start a new visual selection
849 void visualSelectionStart();
851 // Stop the visual selection
852 void visualSelectionStop();
854 // true if the entity allow to cast a shadowMap (eg: false for userentity in some case). Default to ClientCFG value
855 virtual bool canCastShadowMap() const;
857 // call when want to update the CastShadowMap flags of skeleton/instance
858 void updateCastShadowMap();
860 /// \name Static properties (according to entity type / sheet)
861 //@{
862 // display the entity in the radar
863 bool getDisplayInRadar() const {return _DisplayInRadar;}
864 // name is displayed if (_Sheet->DisplayOSD && DisplayName)
865 bool getDisplayOSDName() const {return _DisplayOSDName;}
866 // bars are displayed if (_Sheet->DisplayOSD && DisplayBars)
867 bool getDisplayOSDBars() const {return _DisplayOSDBars;}
868 // even if ClientCfg.ShowNameUnderCursor==false, force OSD to display when under cursor (not if _Sheet->DisplayOSD=false)
869 bool getDisplayOSDForceOver() const {return _DisplayOSDForceOver;}
870 // the user can traverse this entity after some "force time"
871 bool getTraversable() const {return _Traversable;}
872 //@}
875 // set ordering layer (for sorting with transparent surfaces)
876 void setOrderingLayer(uint layer);
877 // reset all sound anim id this entity may own
878 virtual void resetAllSoundAnimId() {}
880 // force to evaluate entity & ancestor anim (and snap to ground if necessary)
881 void forceEvalAnim();
883 bool isAsyncLoading() const;
884 protected:
885 enum { BadIndex = 0xFFFFFFFF };
887 // Entity Id (CLFECOMMON::INVALID_CLIENT_DATASET_INDEX for an invalid one)
888 CLFECOMMON::TClientDataSetIndex _DataSetId;
889 // Sheet Id of the entity.
890 NLMISC::CSheetId _SheetId;
891 // Persistent NPC Alias of the entity
892 uint32 _NPCAlias;
893 // Local DB Branch for this entity
894 class NLMISC::CCDBNodeBranch *_DBEntry;
895 // Playlist
896 NL3D::UPlayList *_PlayList;
897 NL3D::UPlayList *_FacePlayList;
898 // Collision entity used to test collision with landscape
899 NL3D::UVisualCollisionEntity *_CollisionEntity;
900 // Entity skeleton
901 NL3D::USkeleton _Skeleton;
902 /// Slot of the entity.
903 CLFECOMMON::TCLEntityId _Slot;
904 // Slot of the target or CLFECOMMON::INVALID_SLOT if there is no target.
905 CLFECOMMON::TCLEntityId _TargetSlot;
906 // same, but see getTargetSlotNoLag()
907 CLFECOMMON::TCLEntityId _TargetSlotNoLag;
909 // Temp Debug GUIGUI
910 #ifdef TMP_DEBUG_GUIGUI
911 // Theoretical Position
912 NLMISC::CVectorD _TheoreticalPosition;
913 // Theoretical Orientation (last orientation received).
914 float _TheoreticalOrientation;
915 #endif // TMP_DEBUG_GUIGUI
917 // Current entity position.
918 NLMISC::CVectorD _Position;
919 // Useful to limit some noise on positions.
920 NLMISC::CVectorD _PositionLimiter;
921 // Last Frame Position
922 NLMISC::CVectorD _LastFramePos;
923 // Last Frame PACS Position
924 NLPACS::UGlobalPosition _LastFramePACSPos;
925 // Current mode
926 MBEHAV::EMode _Mode;
927 // Theoretical Current Mode (could be different from the current mode).
928 MBEHAV::EMode _TheoreticalMode;
929 // Current behaviour
930 MBEHAV::CBehaviour _CurrentBehaviour;
931 // Flags to know what is possible to do with the entity (selectable, liftable, etc.).
932 CProperties _Properties;
933 // Current Name for the entity
934 std::string _EntityName;
935 // Current entity title
936 std::string _Title;
937 // Current entity tags
938 std::vector<std::string> _Tags;
939 // Current entity title string id
940 std::string _TitleRaw;
941 // Current permanent content symbol for the entity
942 std::string _PermanentStatutIcon;
943 // Has reserved title?
944 bool _HasReservedTitle;
946 // Extended Name
947 std::string _NameEx;
948 // String ID
949 uint32 _NameId;
950 // Primitive used for the collision in PACS
951 NLPACS::UMovePrimitive *_Primitive;
952 // 3D Logic info for light request.
953 CEntityLogicInfo3D _LogicInfo3D;
954 // Box around the entity.
955 NLMISC::CAABBox _Aabbox;
956 // Sphere around the entity for 3D clipping (Local to Entity Pos).
957 float _ClipRadius; // Radius of the clip sphere
958 float _ClipDeltaZ; // DeltaZ of the sphere center to ground (different from clipradius)
960 /// Parent Slot or CLFECOMMON::INVALID_SLOT if there is no parent.
961 CLFECOMMON::TCLEntityId _Parent;
962 /// List of children.
963 typedef std::list<CEntityCL *> TChildren;
964 TChildren _Children;
965 /// 3D mesh if the entity has no skeleton.
966 NL3D::UInstance _Instance;
968 /// Meshes to bind to the skeleton if the entity has one.
969 std::vector<SInstanceCL> _Instances;
971 // Orientation of the entity.
972 NLMISC::CVector _Front;
973 // Entity Up.
974 NLMISC::CVector _Up;
975 // Angle to be linked to the target.
976 double _TargetAngle;
977 // Current direction for the entity.
978 NLMISC::CVector _Dir;
979 // Matrix of the entity direction.
980 NLMISC::CMatrix _DirMatrix;
981 // The final PACS position
982 NLMISC::CVectorD _FinalPacsPos;
983 /// The last successfully retrieved position as a vector
984 NLMISC::CVectorD _LastRetrievedPosition;
985 /// The last successfully retrieved position as a pacs position
986 NLPACS::UGlobalPosition _LastRetrievedPacsPosition;
987 // Box around the entity.
988 NLMISC::CAABBox _SelectBox;
989 // Local selection box
990 NLMISC::CAABBox _LocalSelectBox;
991 // List of modifiers taken by this entity.
992 class CHPModifier
994 public:
995 CHPModifier() {}
996 virtual ~CHPModifier() {}
997 CHPModifier (sint16 value, NLMISC::CRGBA color, float dt) : Value(value), Color(color), DeltaT(dt) {}
998 CHPModifier (const std::string &text, NLMISC::CRGBA color, float dt) : Text(text), Color(color), DeltaT(dt) {}
1000 sint16 Value; // If Text.empty(), take the Value
1001 std::string Text;
1002 NLMISC::CRGBA Color;
1003 float DeltaT;
1005 std::list<CHPModifier> _HPModifiers;
1007 class HPMD : public CHPModifier
1009 public:
1010 double Time;
1011 // DeltaZ between pos() and namePos(). computed only one time
1012 float DeltaZ;
1013 HPMD()
1015 DeltaZ= -FLT_MAX;
1018 std::list<HPMD> _HPDisplayed;
1020 // The transparency factor
1021 float _TranspFactor; // 0 - opaque 1 - transparent
1023 // Entities color
1024 static NLMISC::CRGBA _EntitiesColor[TypeCount];
1025 static NLMISC::CRGBA _DeadColor;
1026 static NLMISC::CRGBA _TargetColor;
1027 static NLMISC::CRGBA _GroupColor;
1028 static NLMISC::CRGBA _GuildColor;
1029 static NLMISC::CRGBA _UserMountColor;
1030 static NLMISC::CRGBA _UserPackAnimalColor;
1031 // colors for PvP
1032 static NLMISC::CRGBA _PvpEnemyColor;
1033 static NLMISC::CRGBA _PvpNeutralColor;
1034 static NLMISC::CRGBA _PvpAllyInTeamColor;
1035 static NLMISC::CRGBA _PvpAllyInLeagueColor;
1036 static NLMISC::CRGBA _PvpAllyColor;
1037 // colors for GM players
1038 static NLMISC::CRGBA _GMTitleColor[CHARACTER_TITLE::EndGmTitle - CHARACTER_TITLE::BeginGmTitle + 1];
1040 /// invalid gm title id
1041 static uint8 _InvalidGMTitleCode;
1043 // true if all instances are not loaded.
1044 bool _AsyncTextureLoading : 1;
1045 // true if the lod Texture Need to be recomputed
1046 bool _LodTextureDirty : 1;
1047 // True as long as the entity has not received any position.
1048 bool _First_Pos : 1;
1050 bool _MountRdy : 1; // obsolete
1051 // Id the entity a flyer (NO SNAP TO GROUND)
1052 bool _Flyer : 1;
1053 // Set global position not done for this entity
1054 bool _SetGlobalPositionDone : 1;
1055 // Snap to ground not done for this entity
1056 bool _SnapToGroundDone : 1;
1057 // Do we have to display or not this entity.
1058 bool _Displayable : 1;
1059 // Was the entity visible during the last frame ? This is updated during the call to CEntityManager::updatePostCamera
1060 bool _Clipped : 1;
1061 // Has the entity moved this fram ?
1062 bool _HasMoved : 1;
1063 // The entity is a mission target
1064 bool _MissionTarget : 1;
1065 // The entity is in the team of the player
1066 bool _IsInTeam : 1;
1067 // The entity is the User's mount
1068 bool _IsUserMount : 1;
1069 // The entity is a User's pack animal
1070 bool _IsUserPackAnimal : 1;
1071 // Indicate that some of _Instances have enableCastShadowMap(true) set
1072 bool _SomeInstanceCastShadowMap : 1;
1073 // Is this the First Position Managed ?
1074 bool _FirstPosManaged : 1;
1076 // display the entity in the radar
1077 bool _DisplayInRadar : 1;
1078 // name is displayed if (_Sheet->DisplayOSD && DisplayName)
1079 bool _DisplayOSDName : 1;
1080 // bars are displayed if (_Sheet->DisplayOSD && DisplayBars)
1081 bool _DisplayOSDBars : 1;
1082 // even if ClientCfg.ShowNameUnderCursor==false, force OSD to display when under cursor (not if _Sheet->DisplayOSD=false)
1083 bool _DisplayOSDForceOver : 1;
1084 // the user can traverse this entity after some "force time"
1085 bool _Traversable : 1;
1086 // The entity can turn
1087 bool _CanTurn : 1;
1088 // The entity must not be clipped by camera
1089 bool _ForbidClipping : 1;
1090 // bkup state for setVisualSelectionBlink
1091 bool _VisualSelectionBlinked : 1;
1092 // OSD enabled ?
1093 bool _InSceneInterfaceEnabled : 1;
1095 // The groundType cache
1096 mutable uint32 _GroundTypeCache;
1097 mutable NLMISC::CVectorD _GroundTypeCachePos;
1099 NL3D::UParticleSystemInstance _SelectionFX;
1100 NL3D::UParticleSystemInstance _MouseOverFX;
1101 NL3D::UParticleSystemInstance _StateFX;
1102 std::string _StateFXName;
1104 /// gamemaster title code of the entity, if any
1105 uint _GMTitle;
1107 // Shadow Stuff
1108 float _ShadowMapZDirClamp;
1109 float _ShadowMapMaxDepth;
1110 sint64 _ShadowMapPropertyLastUpdate;
1112 // Visual selection stuff
1113 sint64 _VisualSelectionTime;
1115 // for localSelectBox() computing
1116 sint64 _LastLocalSelectBoxComputeTime;
1118 static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _OpacityMinNodeLeaf;
1119 static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _ShowReticleLeaf;
1121 protected:
1123 * Change the box position.
1124 * \param pos contains the new box position.
1126 void posBox(const NLMISC::CVector &pos);
1128 /// Update Entity Position.
1129 virtual void updateVisualPropertyPos (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */, const NLMISC::TGameCycle &/* pI */) {}
1130 /// Update Entity Orientation.
1131 virtual void updateVisualPropertyOrient (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1132 /// Update Entity Behaviour.
1133 virtual void updateVisualPropertyBehaviour (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1134 /// Update Entity Name.
1135 virtual void updateVisualPropertyName (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1136 /// Update Entity Target.
1137 virtual void updateVisualPropertyTarget (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1138 /// Update Entity Mode.
1139 virtual void updateVisualPropertyMode (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1140 /// Update Entity Visual Property A
1141 virtual void updateVisualPropertyVpa (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1142 /// Update Entity Visual Property B
1143 virtual void updateVisualPropertyVpb (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1144 /// Update Entity Visual Property C
1145 virtual void updateVisualPropertyVpc (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1146 /// Update Entity Mount
1147 virtual void updateVisualPropertyEntityMounted(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1148 /// Update Entity Rider
1149 virtual void updateVisualPropertyRiderEntity (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1150 /// Update Entity Bars
1151 virtual void updateVisualPropertyBars (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1152 virtual void updateVisualPropertyGuildSymbol (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1153 virtual void updateVisualPropertyGuildNameID (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1154 virtual void updateVisualPropertyEventFactionID (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1155 virtual void updateVisualPropertyPvpMode (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1156 virtual void updateVisualPropertyPvpClan (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1157 virtual void updateVisualPropertyOwnerPeople (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1158 virtual void updateVisualPropertyOutpostInfos (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1161 /// Update Entity State
1162 virtual void updateVisualPropertyStatus (const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1163 /// Target lists
1164 virtual void updateVisualPropertyTargetList(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */, uint /* listIndex */) {}
1165 /// Visual FX
1166 virtual void updateVisualPropertyVisualFX(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) {}
1167 /// Update vprop contextual attributes
1168 virtual void updateVisualPropertyContextual(const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
1170 /// Return true if the in-scene interface must be shown
1171 bool mustShowInsceneInterface( bool enabledInSheet ) const;
1173 /** Return the instance from its index.
1174 * \param idx : index of the instance.
1175 * \return SInstanceCL * : pointer on the instance associated to the index or 0 if idx has no instance.
1177 SInstanceCL *idx2Inst(uint idx);
1179 // Initialize the Object with this function for all constructors.
1180 void init();
1182 // hide the entity Skin (all entity instances).
1183 void hideSkin();
1185 // called each frame to update some shadowmap properties according to position of player
1186 void updateShadowMapProperties();
1188 // virtual for special PlayerCL _Face mgt
1189 virtual void doSetVisualSelectionBlink(bool bOnOff, NLMISC::CRGBA emitColor);
1192 public:
1193 // Make the selection blinking
1194 void setVisualSelectionBlink(bool bOnOff, NLMISC::CRGBA emitColor)
1196 // if already disabled, no need
1197 // NB: cannot do this if both true, since emitColor may not be the same (emitColor caching not interesting...)
1198 if(!bOnOff && !_VisualSelectionBlinked)
1199 return;
1200 doSetVisualSelectionBlink(bOnOff, emitColor);
1201 // cache
1202 _VisualSelectionBlinked= bOnOff;
1204 /** \name 3D System
1205 * Methods to manage basics 3D systems
1207 //@{
1208 /** update the display of the AsyncTexture of the entity. called in updateDisplay()
1209 * Deriver: See CPlayerCL implementation
1210 * \return distance from entity to camera computed (helper for deriver)
1212 virtual float updateAsyncTexture();
1213 /// Update the Lod Texture When needed
1214 virtual void updateLodTexture();
1215 //@}
1217 // Read/Write Variables from/to the stream.
1218 virtual void readWrite(NLMISC::IStream &f);
1219 // To call after a read from a stream to re-initialize the entity.
1220 virtual void load();
1222 private:
1224 // Override for string reception callback
1225 virtual void onStringAvailable(uint stringId, const std::string &value);
1230 #endif // CL_ENTITY_CL_H
1232 /* End of entity_cl.h */