Planeshift
pseffectanchorsocket.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PS_EFFECT_ANCHOR_SOCKET_HEADER
21 #define PS_EFFECT_ANCHOR_SOCKET_HEADER
22 
23 #include "pseffectanchor.h"
24 
25 struct iSpriteCal3DState;
26 struct iSpriteCal3DSocket;
27 
33 {
34 public:
35 
38 
39  // inheritted function overloads
40  bool Load(iDocumentNode* node);
41  bool Create(const csVector3 &offset, iMeshWrapper* posAttach, bool rotateWithMesh = false);
42  bool Update(csTicks elapsed);
43  psEffectAnchor* Clone() const;
44 
45  // these functions are overridden, because the parent mesh takes care of position/sectoring
46  // we want to override these functions, because the default behaviour is for the effect to manage it
47  void SetRotBase(const csMatrix3 & /*newRotBase*/) {}
48  void SetPosition(const csVector3 & /*basePos*/, iSector* /*sector*/, const csMatrix3 & /*transf*/) {}
49  void SetPosition(const csVector3 & /*basePos*/, iSectorList* /*sectors*/, const csMatrix3 & /*transf*/) {}
50 
54  const csString &GetSocketName() const
55  {
56  return socketName;
57  }
58 
62  void SetSocket(const char* name);
63 
64 private:
65 
66  csString socketName;
67  iSpriteCal3DSocket* socket;
68  size_t meshID;
69  csVector3 initPos;
70  csRef<iSpriteCal3DState> cal3d;
71 };
72 
75 #endif
bool Create(const csVector3 &offset, iMeshWrapper *posAttach, bool rotateWithMesh=false)
Creates the effect anchor.
bool rotateWithMesh
Whether the anchor should rotate with the mesh. This is so effects can stay aligned, e.g. flame sword.
bool Load(iDocumentNode *node)
Loads the effect anchors from an xml node.
psEffectAnchor * Clone() const
Clones the effect anchor.
void SetSocket(const char *name)
Sets the socket where this anchor is attached.
const csString & GetSocketName() const
Gets the name of the socket where this anchor is attached.
bool Update(csTicks elapsed)
Updates the effect anchor – called every frame.
void SetRotBase(const csMatrix3 &)
Sets the base rotation matrix of the effect anchor.
void SetPosition(const csVector3 &, iSectorList *, const csMatrix3 &)
Sets a new position for the effect anchor.
void SetPosition(const csVector3 &, iSector *, const csMatrix3 &)
Sets a new position for the effect anchor.
Effect anchors provide a base location / anchor point for all effect objs.