Added broadcast state
This commit is contained in:
		
							parent
							
								
									10c6ab3794
								
							
						
					
					
						commit
						2134d64c80
					
				| @ -43,6 +43,15 @@ void NetworkSync::ReceiveNetworkId() { | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void NetworkSync::BroadcastState(Roboid *roboid) | ||||||
|  | { | ||||||
|  |   // if (roboid->updated == false)
 | ||||||
|  |   //   return;
 | ||||||
|  | 
 | ||||||
|  |   SendPose(roboid); | ||||||
|  |   BroadcastPerception(roboid); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void NetworkSync::NewObject(InterestingThing* thing) { | void NetworkSync::NewObject(InterestingThing* thing) { | ||||||
|   if (thing == nullptr || thing->networkId != 0x00) |   if (thing == nullptr || thing->networkId != 0x00) | ||||||
|     return; |     return; | ||||||
| @ -201,6 +210,13 @@ void NetworkSync::PublishClient() { | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void NetworkSync::BroadcastPerception(Roboid *roboid) { | ||||||
|  |   if (roboid->perception == nullptr) | ||||||
|  |     return; | ||||||
|  |      | ||||||
|  |   PublishTrackedObjects(roboid, roboid->perception->GetTrackedObjects()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void NetworkSync::PublishTrackedObjects(Roboid* roboid, | void NetworkSync::PublishTrackedObjects(Roboid* roboid, | ||||||
|                                         InterestingThing** objects) { |                                         InterestingThing** objects) { | ||||||
|   if (networkId == 0)  // We're not connected to a site yet
 |   if (networkId == 0)  // We're not connected to a site yet
 | ||||||
|  | |||||||
| @ -58,6 +58,8 @@ class NetworkSync { | |||||||
| 
 | 
 | ||||||
|   void ReceiveNetworkId(); |   void ReceiveNetworkId(); | ||||||
| 
 | 
 | ||||||
|  |   void BroadcastState(Roboid* roboid); | ||||||
|  | 
 | ||||||
|   void SendInvestigate(InterestingThing* thing); |   void SendInvestigate(InterestingThing* thing); | ||||||
| 
 | 
 | ||||||
|   void SendPoseMsg(Buffer sendBuffer, Roboid* roboid); |   void SendPoseMsg(Buffer sendBuffer, Roboid* roboid); | ||||||
| @ -65,6 +67,7 @@ class NetworkSync { | |||||||
|   // void PublishNewObject();
 |   // void PublishNewObject();
 | ||||||
|   void PublishRelativeThing(Thing* thing, bool recurse = false); |   void PublishRelativeThing(Thing* thing, bool recurse = false); | ||||||
| 
 | 
 | ||||||
|  |   void BroadcastPerception(Roboid *roboid); | ||||||
|   void PublishTrackedObjects(Roboid* roboid, InterestingThing** objects); |   void PublishTrackedObjects(Roboid* roboid, InterestingThing** objects); | ||||||
| 
 | 
 | ||||||
|   virtual void SendPosition(Vector3 worldPosition) {}; |   virtual void SendPosition(Vector3 worldPosition) {}; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Pascal Serrarens
						Pascal Serrarens