mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
unblock socket receive in Agent, add destructive voxel add to VS scripting
This commit is contained in:
parent
23e7278be5
commit
04c4dabd3d
4 changed files with 34 additions and 2 deletions
|
@ -23,6 +23,8 @@ void Agent::run() {
|
||||||
NodeList::getInstance()->setOwnerType(NODE_TYPE_AGENT);
|
NodeList::getInstance()->setOwnerType(NODE_TYPE_AGENT);
|
||||||
NodeList::getInstance()->setNodeTypesOfInterest(&NODE_TYPE_VOXEL_SERVER, 1);
|
NodeList::getInstance()->setNodeTypesOfInterest(&NODE_TYPE_VOXEL_SERVER, 1);
|
||||||
|
|
||||||
|
NodeList::getInstance()->getNodeSocket()->setBlocking(false);
|
||||||
|
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
|
|
||||||
// figure out the URL for the script for this agent assignment
|
// figure out the URL for the script for this agent assignment
|
||||||
|
@ -83,7 +85,7 @@ void Agent::run() {
|
||||||
// flush the voxel packet queue
|
// flush the voxel packet queue
|
||||||
voxelScripter.getVoxelPacketSender()->process();
|
voxelScripter.getVoxelPacketSender()->process();
|
||||||
|
|
||||||
if (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)) {
|
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)) {
|
||||||
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,9 @@ void childClient() {
|
||||||
nodeList->setOwnerType(NODE_TYPE_UNASSIGNED);
|
nodeList->setOwnerType(NODE_TYPE_UNASSIGNED);
|
||||||
nodeList->reset();
|
nodeList->reset();
|
||||||
|
|
||||||
|
// set the NodeList socket back to blocking
|
||||||
|
nodeList->getNodeSocket()->setBlocking(true);
|
||||||
|
|
||||||
// reset the logging target to the the CHILD_TARGET_NAME
|
// reset the logging target to the the CHILD_TARGET_NAME
|
||||||
Logging::setTargetName(CHILD_TARGET_NAME);
|
Logging::setTargetName(CHILD_TARGET_NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,23 @@
|
||||||
|
|
||||||
#include "VoxelScriptingInterface.h"
|
#include "VoxelScriptingInterface.h"
|
||||||
|
|
||||||
|
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
||||||
|
_voxelPacketSender.sendVoxelEditMessage(addPacketType, addVoxelDetails);
|
||||||
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue) {
|
void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue) {
|
||||||
// setup a VoxelDetail struct with the data
|
// setup a VoxelDetail struct with the data
|
||||||
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||||
_voxelPacketSender.sendVoxelEditMessage(PACKET_TYPE_SET_VOXEL, addVoxelDetail);
|
|
||||||
|
// queue the packet
|
||||||
|
queueVoxelAdd(PACKET_TYPE_SET_VOXEL, addVoxelDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoxelScriptingInterface::queueDesctructiveVoxelAdd(float x, float y, float z, float scale,
|
||||||
|
uchar red, uchar green, uchar blue) {
|
||||||
|
// setup a VoxelDetail struct with the data
|
||||||
|
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||||
|
|
||||||
|
// queue the destructive add
|
||||||
|
queueVoxelAdd(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE, addVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,21 @@ public slots:
|
||||||
/// \param green the G value for RGB color of voxel
|
/// \param green the G value for RGB color of voxel
|
||||||
/// \param blue the B value for RGB color of voxel
|
/// \param blue the B value for RGB color of voxel
|
||||||
void queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue);
|
void queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue);
|
||||||
|
|
||||||
|
/// queues the destructive creation of a voxel which will be sent by calling process on the PacketSender
|
||||||
|
/// \param x the x-coordinate of the voxel (in VS space)
|
||||||
|
/// \param y the y-coordinate of the voxel (in VS space)
|
||||||
|
/// \param z the z-coordinate of the voxel (in VS space)
|
||||||
|
/// \param scale the scale of the voxel (in VS space)
|
||||||
|
/// \param red the R value for RGB color of voxel
|
||||||
|
/// \param green the G value for RGB color of voxel
|
||||||
|
/// \param blue the B value for RGB color of voxel
|
||||||
|
void queueDesctructiveVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue);
|
||||||
private:
|
private:
|
||||||
/// attached VoxelEditPacketSender that handles queuing and sending of packets to VS
|
/// attached VoxelEditPacketSender that handles queuing and sending of packets to VS
|
||||||
VoxelEditPacketSender _voxelPacketSender;
|
VoxelEditPacketSender _voxelPacketSender;
|
||||||
|
|
||||||
|
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__VoxelScriptingInterface__) */
|
#endif /* defined(__hifi__VoxelScriptingInterface__) */
|
||||||
|
|
Loading…
Reference in a new issue