mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:57:58 +02:00
updates to VoxelScriptingInterface for smarter packet sending
This commit is contained in:
parent
a771a5de07
commit
e8b0790b3e
3 changed files with 9 additions and 5 deletions
|
@ -138,7 +138,9 @@ void Agent::run() {
|
||||||
hasVoxelServer = true;
|
hasVoxelServer = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (hasVoxelServer) {
|
||||||
// allow the scripter's call back to setup visual data
|
// allow the scripter's call back to setup visual data
|
||||||
emit willSendVisualDataCallback();
|
emit willSendVisualDataCallback();
|
||||||
|
|
||||||
|
@ -147,6 +149,8 @@ void Agent::run() {
|
||||||
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
|
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();
|
voxelScripter.getVoxelPacketSender()->processWithoutSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "VoxelScriptingInterface.h"
|
#include "VoxelScriptingInterface.h"
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
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) {
|
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
|
// setup a VoxelDetail struct with data
|
||||||
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
||||||
|
|
||||||
_voxelPacketSender.sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, deleteVoxelDetail);
|
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
// 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 NUMBER_OF_CELLS = NUMBER_OF_CELLS_EACH_DIMENSION * NUMBER_OF_CELLS_EACH_DIMENSION;
|
||||||
|
|
||||||
var currentCells = [];
|
var currentCells = [];
|
||||||
var nextCells = [];
|
var nextCells = [];
|
||||||
|
|
||||||
var METER_LENGTH = 1 / TREE_SCALE;
|
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");
|
print("TREE_SCALE = " + TREE_SCALE + "\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue