updates to VoxelScriptingInterface for smarter packet sending

This commit is contained in:
Stephen Birarda 2013-10-02 11:42:27 -07:00
parent a771a5de07
commit e8b0790b3e
3 changed files with 9 additions and 5 deletions

View file

@ -138,7 +138,9 @@ void Agent::run() {
hasVoxelServer = true;
}
}
} else {
}
if (hasVoxelServer) {
// allow the scripter's call back to setup visual data
emit willSendVisualDataCallback();
@ -147,6 +149,8 @@ void Agent::run() {
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
}
// flush the queue of packets and then process them so they are all sent off
voxelScripter.getVoxelPacketSender()->flushQueue();
voxelScripter.getVoxelPacketSender()->processWithoutSleep();
}

View file

@ -9,7 +9,7 @@
#include "VoxelScriptingInterface.h"
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
_voxelPacketSender.sendVoxelEditMessage(addPacketType, addVoxelDetails);
_voxelPacketSender.queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
}
void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue) {
@ -34,5 +34,5 @@ void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float
// setup a VoxelDetail struct with data
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
_voxelPacketSender.sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, deleteVoxelDetail);
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
}

View file

@ -2,14 +2,14 @@
// The following is an example of Conway's Game of Life (http://en.wikipedia.org/wiki/Conway's_Game_of_Life)
var NUMBER_OF_CELLS_EACH_DIMENSION = 32;
var NUMBER_OF_CELLS_EACH_DIMENSION = 64;
var NUMBER_OF_CELLS = NUMBER_OF_CELLS_EACH_DIMENSION * NUMBER_OF_CELLS_EACH_DIMENSION;
var currentCells = [];
var nextCells = [];
var METER_LENGTH = 1 / TREE_SCALE;
var cellScale = (8 * METER_LENGTH) / NUMBER_OF_CELLS_EACH_DIMENSION;
var cellScale = (NUMBER_OF_CELLS_EACH_DIMENSION * METER_LENGTH) / NUMBER_OF_CELLS_EACH_DIMENSION;
print("TREE_SCALE = " + TREE_SCALE + "\n");