add ability to send a voxel in JS via VoxelScriptingInterface

This commit is contained in:
Stephen Birarda 2013-09-17 10:49:51 -07:00
parent df862c152b
commit a45d64a214
3 changed files with 18 additions and 18 deletions

View file

@ -23,7 +23,7 @@ Agent::Agent() :
void Agent::run(QUrl scriptURL) { void Agent::run(QUrl scriptURL) {
NodeList::getInstance()->setOwnerType(NODE_TYPE_AGENT); NodeList::getInstance()->setOwnerType(NODE_TYPE_AGENT);
NodeList::getInstance()->setNodeTypesOfInterest(&NODE_TYPE_AVATAR_MIXER, 1); NodeList::getInstance()->setNodeTypesOfInterest(&NODE_TYPE_VOXEL_SERVER, 1);
QNetworkAccessManager manager; QNetworkAccessManager manager;
@ -77,7 +77,7 @@ void Agent::run(QUrl scriptURL) {
// allow the scripter's call back to setup visual data // allow the scripter's call back to setup visual data
emit preSendCallback(); emit preSendCallback();
// flush the voxel packet queue // flush the voxel packet queue
voxelScripter.getVoxelPacketSender()->flushQueue(); voxelScripter.getVoxelPacketSender()->process();
if (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)) { if (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)) {
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes); NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);

View file

@ -11,5 +11,5 @@
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.queueVoxelEditMessages(PACKET_TYPE_SET_VOXEL, 1, &addVoxelDetail); _voxelPacketSender.sendVoxelEditMessage(PACKET_TYPE_SET_VOXEL, addVoxelDetail);
} }

View file

@ -172,21 +172,21 @@ int main(int argc, const char* argv[]) {
while (true) { while (true) {
::assignmentQueueMutex.lock(); // ::assignmentQueueMutex.lock();
// check if our audio-mixer or avatar-mixer are dead and we don't have existing assignments in the queue // // check if our audio-mixer or avatar-mixer are dead and we don't have existing assignments in the queue
// so we can add those assignments back to the front of the queue since they are high-priority // // so we can add those assignments back to the front of the queue since they are high-priority
if (!nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER) && // if (!nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER) &&
std::find(::assignmentQueue.begin(), assignmentQueue.end(), &avatarMixerAssignment) == ::assignmentQueue.end()) { // std::find(::assignmentQueue.begin(), assignmentQueue.end(), &avatarMixerAssignment) == ::assignmentQueue.end()) {
qDebug("Missing an avatar mixer and assignment not in queue. Adding.\n"); // qDebug("Missing an avatar mixer and assignment not in queue. Adding.\n");
::assignmentQueue.push_front(&avatarMixerAssignment); // ::assignmentQueue.push_front(&avatarMixerAssignment);
} // }
//
if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER) && // if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER) &&
std::find(::assignmentQueue.begin(), ::assignmentQueue.end(), &audioMixerAssignment) == ::assignmentQueue.end()) { // std::find(::assignmentQueue.begin(), ::assignmentQueue.end(), &audioMixerAssignment) == ::assignmentQueue.end()) {
qDebug("Missing an audio mixer and assignment not in queue. Adding.\n"); // qDebug("Missing an audio mixer and assignment not in queue. Adding.\n");
::assignmentQueue.push_front(&audioMixerAssignment); // ::assignmentQueue.push_front(&audioMixerAssignment);
} // }
::assignmentQueueMutex.unlock(); // ::assignmentQueueMutex.unlock();
while (nodeList->getNodeSocket()->receive((sockaddr *)&nodePublicAddress, packetData, &receivedBytes) && while (nodeList->getNodeSocket()->receive((sockaddr *)&nodePublicAddress, packetData, &receivedBytes) &&
packetVersionMatch(packetData)) { packetVersionMatch(packetData)) {