Updates to component classes -

Shift from ghosted components to entity-managed for networking
Initial implementation of Systems through the Mesh Component
This commit is contained in:
Areloch 2018-01-28 14:57:02 -06:00
parent ae5a43de70
commit 68efd8e22a
15 changed files with 706 additions and 312 deletions

View file

@ -58,7 +58,27 @@ private:
Vector<Component*> mComponents;
Vector<Component*> mToLoadComponents;
//Bit of helper data to let us track and manage the adding, removal and updating of networked components
struct NetworkedComponent
{
U32 componentIndex;
enum UpdateState
{
None,
Adding,
Removing,
Updating
};
UpdateState updateState;
U32 updateMaskBits;
};
Vector<NetworkedComponent> mNetworkedComponents;
U32 mComponentNetMask;
bool mStartComponentUpdate;
@ -69,10 +89,12 @@ private:
bool mInitialized;
String mTags;
Signal< void(Component*) > onComponentAdded;
Signal< void(Component*) > onComponentRemoved;
Signal< void(MatrixF*) > onTransformSet;
S32 mLifetimeMS;
protected:
@ -105,10 +127,12 @@ public:
{
TransformMask = Parent::NextFreeMask << 0,
BoundsMask = Parent::NextFreeMask << 1,
ComponentsMask = Parent::NextFreeMask << 2,
NoWarpMask = Parent::NextFreeMask << 3,
NamespaceMask = Parent::NextFreeMask << 4,
NextFreeMask = Parent::NextFreeMask << 5
ComponentsUpdateMask = Parent::NextFreeMask << 2,
AddComponentsMask = Parent::NextFreeMask << 3,
RemoveComponentsMask = Parent::NextFreeMask << 4,
NoWarpMask = Parent::NextFreeMask << 5,
NamespaceMask = Parent::NextFreeMask << 6,
NextFreeMask = Parent::NextFreeMask << 7
};
StateDelta mDelta;
@ -116,6 +140,8 @@ public:
Move lastMove;
S32 mStartTimeMS;
//
Entity();
~Entity();
@ -163,6 +189,9 @@ public:
/// @param client Client that is now controlling this object
virtual void setControllingClient(GameConnection *client);
//
//Networking
//
// NetObject
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *conn, BitStream *stream);
@ -170,6 +199,8 @@ public:
void setComponentsDirty();
void setComponentDirty(Component *comp, bool forceUpdate = false);
void setComponentNetMask(Component* comp, U32 mask);
//Components
virtual bool deferAddingComponents() const { return true; }