@@ -91,22 +91,82 @@ namespace Util {
9191 }
9292 };
9393
94+ template <> struct SerializeTraits <std::vector<BoneMod>> {
95+ static void Write ( Writer& stream, const std::vector<BoneMod>& boneMods ) {
96+ stream.WriteSize ( boneMods.size () );
97+ stream.WriteData ( boneMods.data (), boneMods.size () * sizeof ( BoneMod ) );
98+ }
99+
100+ static std::vector<BoneMod> Read ( Reader& stream ) {
101+ std::vector<BoneMod> boneMods;
102+ const size_t size = stream.ReadSize <BoneMod>();
103+ boneMods.resize ( size );
104+ stream.ReadData ( boneMods.data (), size * sizeof ( BoneMod ) );
105+ return boneMods;
106+ }
107+ };
108+
94109 // Use that bone optimization for refEntity_t
95110 template <> struct SerializeTraits <refEntity_t> {
96111 static void Write (Writer& stream, const refEntity_t& ent)
97112 {
98- stream.WriteData (&ent, offsetof (refEntity_t, skeleton));
99- stream.Write <refSkeleton_t>(ent.skeleton );
113+ stream.WriteData (&ent, offsetof (refEntity_t, tag));
114+ stream.Write <std::string>( ent.tag );
115+ stream.Write <std::vector<BoneMod>>( ent.boneMods );
100116 }
117+
101118 static refEntity_t Read (Reader& stream)
102119 {
103120 refEntity_t ent;
104- stream.ReadData (&ent, offsetof (refEntity_t, skeleton));
105- ent.skeleton = stream.Read <refSkeleton_t>();
121+ stream.ReadData (&ent, offsetof (refEntity_t, tag));
122+ ent.tag = stream.Read <std::string>();
123+ ent.boneMods = stream.Read <std::vector<BoneMod>>();
124+ return ent;
125+ }
126+ };
127+
128+ template <> struct SerializeTraits <EntityUpdate> {
129+ static void Write ( Writer& stream, const EntityUpdate& ent ) {
130+ stream.Write <refEntity_t>( ent.ent );
131+ stream.Write <uint16_t >( ent.id );
132+ }
133+
134+ static EntityUpdate Read ( Reader& stream ) {
135+ EntityUpdate ent;
136+ ent.ent = stream.Read <refEntity_t>();
137+ ent.id = stream.Read <uint16_t >();
106138 return ent;
107139 }
108140 };
109141
142+ template <> struct SerializeTraits <LerpTagUpdate> {
143+ static void Write ( Writer& stream, const LerpTagUpdate& tag ) {
144+ stream.Write <std::string>( tag.tag );
145+ stream.Write <uint16_t >( tag.id );
146+ }
147+
148+ static LerpTagUpdate Read ( Reader& stream ) {
149+ LerpTagUpdate tag;
150+ tag.tag = stream.Read <std::string>();
151+ tag.id = stream.Read <uint16_t >();
152+ return tag;
153+ }
154+ };
155+
156+ template <> struct SerializeTraits <LerpTagSync> {
157+ static void Write ( Writer& stream, const LerpTagSync& tag ) {
158+ stream.Write <orientation_t >( tag.entityOrientation );
159+ stream.Write <orientation_t >( tag.orientation );
160+ }
161+
162+ static LerpTagSync Read ( Reader& stream ) {
163+ LerpTagSync tag;
164+ tag.entityOrientation = stream.Read <orientation_t >();
165+ tag.orientation = stream.Read <orientation_t >();
166+ return tag;
167+ }
168+ };
169+
110170 template <>
111171 struct SerializeTraits <Color::Color> {
112172 static void Write (Writer& stream, const Color::Color& value)
@@ -168,6 +228,8 @@ enum cgameImport_t
168228 CG_R_REGISTERFONT,
169229 CG_R_CLEARSCENE,
170230 CG_R_ADDREFENTITYTOSCENE,
231+ CG_R_SYNCREFENTITIES,
232+ CG_R_SYNCLERPTAGS,
171233 CG_R_ADDPOLYTOSCENE,
172234 CG_R_ADDPOLYSTOSCENE,
173235 CG_R_ADDLIGHTTOSCENE,
@@ -181,7 +243,6 @@ enum cgameImport_t
181243 CG_R_DRAWSTRETCHPIC,
182244 CG_R_DRAWROTATEDPIC,
183245 CG_R_MODELBOUNDS,
184- CG_R_LERPTAG,
185246 CG_R_REMAP_SHADER,
186247 CG_R_BATCHINPVS,
187248 CG_R_REGISTERANIMATION,
@@ -325,10 +386,6 @@ namespace Render {
325386 IPC::Message<IPC::Id<VM::QVM, CG_R_MODELBOUNDS>, int >,
326387 IPC::Reply<std::array<float , 3 >, std::array<float , 3 >>
327388 >;
328- using LerpTagMsg = IPC::SyncMessage<
329- IPC::Message<IPC::Id<VM::QVM, CG_R_LERPTAG>, refEntity_t, std::string, int >,
330- IPC::Reply<orientation_t , int >
331- >;
332389 using RemapShaderMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_REMAP_SHADER>, std::string, std::string, std::string>;
333390 // TODO not a renderer call, handle in CM in the VM?
334391 using BatchInPVSMsg = IPC::SyncMessage<
@@ -381,6 +438,11 @@ namespace Render {
381438 using ScissorSetMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_SCISSOR_SET>, int , int , int , int >;
382439 using ClearSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_CLEARSCENE>>;
383440 using AddRefEntityToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDREFENTITYTOSCENE>, refEntity_t>;
441+ using SyncRefEntitiesMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_SYNCREFENTITIES>, std::vector<EntityUpdate>>;
442+ using SyncLerpTagsMsg = IPC::SyncMessage<IPC::Message<IPC::Id<VM::QVM, CG_R_SYNCLERPTAGS>,
443+ std::vector<LerpTagUpdate>>,
444+ IPC::Reply<std::vector<LerpTagSync>>
445+ >;
384446 using AddPolyToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDPOLYTOSCENE>, int , std::vector<polyVert_t>>;
385447 using AddPolysToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDPOLYSTOSCENE>, int , std::vector<polyVert_t>, int , int >;
386448 using AddLightToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDLIGHTTOSCENE>, std::array<float , 3 >, float , float , float , float , int >;
0 commit comments