mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:49:12 +02:00
Merge pull request #1893 from birarda/master
fixes for assignment-client Agent
This commit is contained in:
commit
5fdec5a18d
3 changed files with 15 additions and 6 deletions
|
@ -23,8 +23,12 @@
|
||||||
#include "Agent.h"
|
#include "Agent.h"
|
||||||
|
|
||||||
Agent::Agent(const QByteArray& packet) :
|
Agent::Agent(const QByteArray& packet) :
|
||||||
ThreadedAssignment(packet)
|
ThreadedAssignment(packet),
|
||||||
|
_voxelEditSender(),
|
||||||
|
_particleEditSender()
|
||||||
{
|
{
|
||||||
|
_scriptEngine.getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
|
||||||
|
_scriptEngine.getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) {
|
void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) {
|
||||||
|
|
|
@ -15,9 +15,12 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
|
#include <ParticleEditPacketSender.h>
|
||||||
#include <ParticleTree.h>
|
#include <ParticleTree.h>
|
||||||
#include <ScriptEngine.h>
|
#include <ScriptEngine.h>
|
||||||
#include <ThreadedAssignment.h>
|
#include <ThreadedAssignment.h>
|
||||||
|
#include <VoxelEditPacketSender.h>
|
||||||
|
|
||||||
|
|
||||||
class Agent : public ThreadedAssignment {
|
class Agent : public ThreadedAssignment {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -39,6 +42,8 @@ signals:
|
||||||
private:
|
private:
|
||||||
ScriptEngine _scriptEngine;
|
ScriptEngine _scriptEngine;
|
||||||
ParticleTree _particleTree;
|
ParticleTree _particleTree;
|
||||||
|
VoxelEditPacketSender _voxelEditSender;
|
||||||
|
ParticleEditPacketSender _particleEditSender;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__Agent__) */
|
#endif /* defined(__hifi__Agent__) */
|
||||||
|
|
|
@ -8,11 +8,9 @@ var NUMBER_OF_CELLS = NUMBER_OF_CELLS_EACH_DIMENSION * NUMBER_OF_CELLS_EACH_DIME
|
||||||
var currentCells = [];
|
var currentCells = [];
|
||||||
var nextCells = [];
|
var nextCells = [];
|
||||||
|
|
||||||
var METER_LENGTH = 1 / TREE_SCALE;
|
var METER_LENGTH = 1;
|
||||||
var cellScale = (NUMBER_OF_CELLS_EACH_DIMENSION * 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");
|
|
||||||
|
|
||||||
// randomly populate the cell start values
|
// randomly populate the cell start values
|
||||||
for (var i = 0; i < NUMBER_OF_CELLS_EACH_DIMENSION; i++) {
|
for (var i = 0; i < NUMBER_OF_CELLS_EACH_DIMENSION; i++) {
|
||||||
// create the array to hold this row
|
// create the array to hold this row
|
||||||
|
@ -108,7 +106,7 @@ function sendNextCells() {
|
||||||
|
|
||||||
// queue a packet to add a voxel for the new cell
|
// queue a packet to add a voxel for the new cell
|
||||||
var color = (nextCells[i][j] == 1) ? 255 : 1;
|
var color = (nextCells[i][j] == 1) ? 255 : 1;
|
||||||
Voxels.queueDestructiveVoxelAdd(x, y, 0, cellScale, color, color, color);
|
Voxels.setVoxel(x, y, 0, cellScale, color, color, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,4 +126,6 @@ function step() {
|
||||||
sendNextCells();
|
sendNextCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
Agent.willSendVisualDataCallback.connect(step);
|
|
||||||
|
Script.willSendVisualDataCallback.connect(step);
|
||||||
|
Voxels.setPacketsPerSecond(200);
|
Loading…
Reference in a new issue