00001 // 00002 // For Geometry Replication 00003 // (to use Spring as a simulation engine, with a separate machine being 00004 // the rendering engine) 00005 // 00006 00007 #ifndef GeometryReplicator_Header 00008 #define GeometryReplicator_Header 00009 00010 #include "socket.h" 00011 00012 // codes for formatting messages- GR_CODE always 00013 // is at beginning, followed by the appropriate 00014 // code for the type of data, then its encoding 00015 #define GR_CODE 0xe6 00016 #define GR_OBJECT 0x01 00017 #define GR_OBJ_ATTR 0x02 00018 #define GR_TEXTURE 0x03 00019 #define GR_NODE 0x10 00020 #define GR_FACE 0x70 00021 00022 class GeometryReplicator { 00023 enum { max_socks=10 }; 00024 int num_socks; 00025 Socket* socks[max_socks]; 00026 char machine_names[max_socks][80]; 00027 static void Connect_CB(int gr_p_in); 00028 public: 00029 GeometryReplicator(); 00030 GeometryReplicator(char* machine_name); 00031 ~GeometryReplicator(); 00032 static int debug; 00033 00034 void Connect(char* machine_name); 00035 int IsConnected(); 00036 void SendMessage(char* buf, int size); 00037 void Menu(); 00038 }; 00039 00040 inline int GeometryReplicator::IsConnected() 00041 { return(num_socks > 0); } 00042 00043 #endif
1.5.3