mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
cleanup constructors
This commit is contained in:
parent
4fbb4b240e
commit
cfa618d694
10 changed files with 47 additions and 50 deletions
|
@ -15,7 +15,14 @@
|
|||
|
||||
OctreeQueryNode::OctreeQueryNode() :
|
||||
_viewSent(false),
|
||||
_octreePacket(new unsigned char[MAX_PACKET_SIZE]),
|
||||
_octreePacketAt(_octreePacket),
|
||||
_octreePacketAvailableBytes(MAX_PACKET_SIZE),
|
||||
_octreePacketWaiting(false),
|
||||
_lastOctreePacket(new unsigned char[MAX_PACKET_SIZE]),
|
||||
_lastOctreePacketLength(0),
|
||||
_duplicatePacketCount(0),
|
||||
_firstSuppressedPacket(usecTimestampNow()),
|
||||
_maxSearchLevel(1),
|
||||
_maxLevelReachedInLastSearch(1),
|
||||
_lastTimeBagEmpty(0),
|
||||
|
@ -27,14 +34,9 @@ OctreeQueryNode::OctreeQueryNode() :
|
|||
_lastClientBoundaryLevelAdjust(0),
|
||||
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||
_lodChanged(false),
|
||||
_lodInitialized(false)
|
||||
_lodInitialized(false),
|
||||
_sequenceNumber(0)
|
||||
{
|
||||
_octreePacket = new unsigned char[MAX_PACKET_SIZE];
|
||||
_octreePacketAt = _octreePacket;
|
||||
_lastOctreePacket = new unsigned char[MAX_PACKET_SIZE];
|
||||
_lastOctreePacketLength = 0;
|
||||
_duplicatePacketCount = 0;
|
||||
_sequenceNumber = 0;
|
||||
}
|
||||
|
||||
OctreeQueryNode::~OctreeQueryNode() {
|
||||
|
|
|
@ -16,13 +16,12 @@
|
|||
#include "JurisdictionListener.h"
|
||||
|
||||
JurisdictionListener::JurisdictionListener(NodeType_t type) :
|
||||
_nodeType(type),
|
||||
_packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
|
||||
{
|
||||
_nodeType = type;
|
||||
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to
|
||||
|
||||
connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled);
|
||||
//qDebug("JurisdictionListener::JurisdictionListener(NodeType_t type=%c)", type);
|
||||
|
||||
// tell our NodeList we want to hear about nodes with our node type
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(type);
|
||||
|
@ -35,8 +34,6 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) {
|
|||
}
|
||||
|
||||
bool JurisdictionListener::queueJurisdictionRequest() {
|
||||
//qDebug() << "JurisdictionListener::queueJurisdictionRequest()";
|
||||
|
||||
static unsigned char buffer[MAX_PACKET_SIZE];
|
||||
unsigned char* bufferOut = &buffer[0];
|
||||
ssize_t sizeOut = populatePacketHeader(reinterpret_cast<char*>(bufferOut), PacketTypeJurisdictionRequest);
|
||||
|
@ -71,7 +68,6 @@ void JurisdictionListener::processPacket(const SharedNodePointer& sendingNode, c
|
|||
}
|
||||
|
||||
bool JurisdictionListener::process() {
|
||||
//qDebug() << "JurisdictionListener::process()";
|
||||
bool continueProcessing = isStillRunning();
|
||||
|
||||
// If we're still running, and we don't have any requests waiting to be sent, then queue our jurisdiction requests
|
||||
|
@ -80,7 +76,6 @@ bool JurisdictionListener::process() {
|
|||
}
|
||||
|
||||
if (continueProcessing) {
|
||||
//qDebug() << "JurisdictionListener::process() calling _packetSender.process()";
|
||||
continueProcessing = _packetSender.process();
|
||||
}
|
||||
if (continueProcessing) {
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NodeType_t type) :
|
||||
ReceivedPacketProcessor(),
|
||||
_jurisdictionMap(map),
|
||||
_nodeType(type),
|
||||
_packetSender(JurisdictionSender::DEFAULT_PACKETS_PER_SECOND)
|
||||
{
|
||||
_nodeType = type;
|
||||
}
|
||||
|
||||
JurisdictionSender::~JurisdictionSender() {
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
#include "OctreeEditPacketSender.h"
|
||||
|
||||
|
||||
EditPacketBuffer::EditPacketBuffer(PacketType type, unsigned char* buffer, ssize_t length, QUuid nodeUUID) {
|
||||
_nodeUUID = nodeUUID;
|
||||
_currentType = type;
|
||||
_currentSize = length;
|
||||
EditPacketBuffer::EditPacketBuffer(PacketType type, unsigned char* buffer, ssize_t length, QUuid nodeUUID) :
|
||||
_nodeUUID(nodeUUID),
|
||||
_currentType(type),
|
||||
_currentSize(length)
|
||||
{
|
||||
memcpy(_currentBuffer, buffer, length);
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ OctreePersistThread::OctreePersistThread(Octree* tree, const QString& filename,
|
|||
_filename(filename),
|
||||
_persistInterval(persistInterval),
|
||||
_initialLoadComplete(false),
|
||||
_loadTimeUSecs(0) {
|
||||
_loadTimeUSecs(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool OctreePersistThread::process() {
|
||||
|
|
|
@ -20,23 +20,22 @@
|
|||
|
||||
const int samples = 100;
|
||||
OctreeSceneStats::OctreeSceneStats() :
|
||||
_elapsedAverage(samples),
|
||||
_isReadyToSend(false),
|
||||
_isStarted(false),
|
||||
_lastFullElapsed(0),
|
||||
_elapsedAverage(samples),
|
||||
_bitsPerOctreeAverage(samples),
|
||||
_lastFullTotalEncodeTime(0),
|
||||
_incomingPacket(0),
|
||||
_incomingBytes(0),
|
||||
_incomingWastedBytes(0),
|
||||
_incomingLastSequence(0),
|
||||
_incomingOutOfOrder(0),
|
||||
_incomingLikelyLost(0),
|
||||
_incomingFlightTimeAverage(samples),
|
||||
_jurisdictionRoot(NULL)
|
||||
{
|
||||
reset();
|
||||
_isReadyToSend = false;
|
||||
_isStarted = false;
|
||||
_lastFullTotalEncodeTime = 0;
|
||||
_lastFullElapsed = 0;
|
||||
_incomingPacket = 0;
|
||||
_incomingBytes = 0;
|
||||
_incomingWastedBytes = 0;
|
||||
_incomingLastSequence = 0;
|
||||
_incomingOutOfOrder = 0;
|
||||
_incomingLikelyLost = 0;
|
||||
|
||||
}
|
||||
|
||||
// copy constructor
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
|
||||
OctreeScriptingInterface::OctreeScriptingInterface(OctreeEditPacketSender* packetSender,
|
||||
JurisdictionListener* jurisdictionListener) :
|
||||
_packetSender(NULL),
|
||||
_jurisdictionListener(NULL),
|
||||
_packetSender(packetSender),
|
||||
_jurisdictionListener(jurisdictionListener),
|
||||
_managedPacketSender(false),
|
||||
_managedJurisdictionListener(false),
|
||||
_initialized(false)
|
||||
{
|
||||
setPacketSender(packetSender);
|
||||
setJurisdictionListener(jurisdictionListener);
|
||||
}
|
||||
|
||||
OctreeScriptingInterface::~OctreeScriptingInterface() {
|
||||
|
|
|
@ -12,11 +12,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
// These are some useful utilities that vec3 is missing
|
||||
void printVec3(const char* name, const glm::vec3& v) {
|
||||
printf("%s x=%f y=%f z=%f\n", name, v.x, v.y, v.z);
|
||||
}
|
||||
|
||||
void Plane::set3Points(const glm::vec3 &v1, const glm::vec3 &v2, const glm::vec3 &v3) {
|
||||
glm::vec3 linev1v2, linev1v3;
|
||||
|
||||
|
|
|
@ -44,22 +44,28 @@ static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* eng
|
|||
|
||||
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString,
|
||||
AbstractControllerScriptingInterface* controllerScriptingInterface) :
|
||||
|
||||
_scriptContents(scriptContents),
|
||||
_isFinished(false),
|
||||
_isRunning(false),
|
||||
_isInitialized(false),
|
||||
_engine(),
|
||||
_isAvatar(false),
|
||||
_avatarIdentityTimer(NULL),
|
||||
_avatarBillboardTimer(NULL),
|
||||
_avatarData(NULL)
|
||||
_timerFunctionMap(),
|
||||
_controllerScriptingInterface(controllerScriptingInterface),
|
||||
_avatarData(NULL),
|
||||
_wantMenuItems(wantMenuItems),
|
||||
_scriptMenuName(),
|
||||
_fileNameString(fileNameString),
|
||||
_quatLibrary(),
|
||||
_vec3Library()
|
||||
{
|
||||
_scriptContents = scriptContents;
|
||||
_isFinished = false;
|
||||
_isRunning = false;
|
||||
_isInitialized = false;
|
||||
_fileNameString = fileNameString;
|
||||
|
||||
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||
const char* scriptMenuName = fileNameAscii.data();
|
||||
|
||||
// some clients will use these menu features
|
||||
_wantMenuItems = wantMenuItems;
|
||||
if (!fileNameString.isEmpty()) {
|
||||
_scriptMenuName = "Stop ";
|
||||
_scriptMenuName.append(scriptMenuName);
|
||||
|
@ -69,7 +75,6 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, co
|
|||
_scriptMenuName.append(_scriptNumber);
|
||||
}
|
||||
_scriptNumber++;
|
||||
_controllerScriptingInterface = controllerScriptingInterface;
|
||||
}
|
||||
|
||||
ScriptEngine::~ScriptEngine() {
|
||||
|
|
|
@ -96,13 +96,14 @@ private:
|
|||
|
||||
static VoxelsScriptingInterface _voxelsScriptingInterface;
|
||||
static ParticlesScriptingInterface _particlesScriptingInterface;
|
||||
static int _scriptNumber;
|
||||
|
||||
AbstractControllerScriptingInterface* _controllerScriptingInterface;
|
||||
AudioScriptingInterface _audioScriptingInterface;
|
||||
AvatarData* _avatarData;
|
||||
bool _wantMenuItems;
|
||||
QString _scriptMenuName;
|
||||
QString _fileNameString;
|
||||
static int _scriptNumber;
|
||||
Quat _quatLibrary;
|
||||
Vec3 _vec3Library;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue