Merge branch 'master' of https://github.com/erwincoumans/bullet3
This commit is contained in:
@@ -181,8 +181,17 @@ bool TcpNetworkedPhysicsProcessor::processCommand(const struct SharedMemoryComma
|
||||
}
|
||||
else
|
||||
{
|
||||
sz = sizeof(SharedMemoryCommand);
|
||||
data = (unsigned char*)&clientCmd;
|
||||
|
||||
if (clientCmd.m_type == CMD_REQUEST_VR_EVENTS_DATA)
|
||||
{
|
||||
sz = 3 * sizeof(int) + sizeof(smUint64_t) + 16;
|
||||
data = (unsigned char*)&clientCmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
sz = sizeof(SharedMemoryCommand);
|
||||
data = (unsigned char*)&clientCmd;
|
||||
}
|
||||
}
|
||||
|
||||
m_data->m_tcpSocket.Send((const uint8 *)data,sz);
|
||||
|
||||
@@ -5197,7 +5197,6 @@ bool PhysicsServerCommandProcessor::processSendDesiredStateCommand(const struct
|
||||
}
|
||||
|
||||
b3PluginArguments args;
|
||||
args.m_ints[0] = eSetPDControl;
|
||||
args.m_ints[1] = bodyUniqueId;
|
||||
//find the joint motors and apply the desired velocity and maximum force/torque
|
||||
{
|
||||
@@ -5250,6 +5249,11 @@ bool PhysicsServerCommandProcessor::processSendDesiredStateCommand(const struct
|
||||
args.m_ints[2] = link;
|
||||
args.m_numInts = 3;
|
||||
args.m_numFloats = 5;
|
||||
|
||||
args.m_ints[0] = eSetPDControl;
|
||||
if (args.m_floats[4] < B3_EPSILON) {
|
||||
args.m_ints[0] = eRemovePDControl;
|
||||
}
|
||||
m_data->m_pluginManager.executePluginCommand(m_data->m_pdControlPlugin, &args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ B3_SHARED_API int executePluginCommand_pdControlPlugin(struct b3PluginContext* c
|
||||
if (arguments->m_numInts != 3)
|
||||
return -1;
|
||||
|
||||
|
||||
switch (arguments->m_ints[0])
|
||||
{
|
||||
case eSetPDControl:
|
||||
|
||||
@@ -184,11 +184,16 @@ int main(int argc, char *argv[])
|
||||
cmdPtr = &cmd;
|
||||
cmd.m_type = *(int*)&bytesReceived[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (numBytesRec == sizeof(SharedMemoryCommand))
|
||||
{
|
||||
cmdPtr = (SharedMemoryCommand*)&bytesReceived[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdPtr = (SharedMemoryCommand*)&bytesReceived[0];
|
||||
}
|
||||
if (cmdPtr)
|
||||
{
|
||||
SharedMemoryStatus serverStatus;
|
||||
@@ -207,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (gVerboseNetworkMessagesServer)
|
||||
{
|
||||
printf("buffer.size = %d\n", buffer.size());
|
||||
//printf("buffer.size = %d\n", buffer.size());
|
||||
printf("serverStatus.m_numDataStreamBytes = %d\n", serverStatus.m_numDataStreamBytes);
|
||||
}
|
||||
if (hasStatus)
|
||||
@@ -234,25 +239,49 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
//create packetData with [int packetSizeInBytes, status, streamBytes)
|
||||
packetData.resize(4 + sizeof(SharedMemoryStatus) + serverStatus.m_numDataStreamBytes);
|
||||
int sz = packetData.size();
|
||||
int curPos = 0;
|
||||
|
||||
MySerializeInt(sz, &packetData[curPos]);
|
||||
curPos += 4;
|
||||
for (int i = 0; i < sizeof(SharedMemoryStatus); i++)
|
||||
if (cmdPtr->m_type == CMD_REQUEST_VR_EVENTS_DATA)
|
||||
{
|
||||
packetData[i + curPos] = statBytes[i];
|
||||
int headerSize = 16+5 * sizeof(int) + sizeof(smUint64_t) + sizeof(char*) + sizeof(b3VRControllerEvent)*serverStatus.m_sendVREvents.m_numVRControllerEvents;
|
||||
packetData.resize(4 + headerSize);
|
||||
int sz = packetData.size();
|
||||
int curPos = 0;
|
||||
MySerializeInt(sz, &packetData[curPos]);
|
||||
curPos += 4;
|
||||
for (int i = 0; i < headerSize; i++)
|
||||
{
|
||||
packetData[i + curPos] = statBytes[i];
|
||||
}
|
||||
curPos += headerSize;
|
||||
pClient->Send(&packetData[0], packetData.size());
|
||||
}
|
||||
curPos += sizeof(SharedMemoryStatus);
|
||||
|
||||
for (int i = 0; i < serverStatus.m_numDataStreamBytes; i++)
|
||||
else
|
||||
{
|
||||
packetData[i + curPos] = buffer[i];
|
||||
//create packetData with [int packetSizeInBytes, status, streamBytes)
|
||||
packetData.resize(4 + sizeof(SharedMemoryStatus) + serverStatus.m_numDataStreamBytes);
|
||||
int sz = packetData.size();
|
||||
int curPos = 0;
|
||||
|
||||
if (gVerboseNetworkMessagesServer)
|
||||
{
|
||||
//printf("buffer.size = %d\n", buffer.size());
|
||||
printf("serverStatus packed size = %d\n", sz);
|
||||
}
|
||||
|
||||
MySerializeInt(sz, &packetData[curPos]);
|
||||
curPos += 4;
|
||||
for (int i = 0; i < sizeof(SharedMemoryStatus); i++)
|
||||
{
|
||||
packetData[i + curPos] = statBytes[i];
|
||||
}
|
||||
curPos += sizeof(SharedMemoryStatus);
|
||||
|
||||
for (int i = 0; i < serverStatus.m_numDataStreamBytes; i++)
|
||||
{
|
||||
packetData[i + curPos] = buffer[i];
|
||||
}
|
||||
|
||||
pClient->Send(&packetData[0], packetData.size());
|
||||
}
|
||||
|
||||
pClient->Send( &packetData[0], packetData.size() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user