mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-07 08:20:13 +02:00
rename voxels and particles scripting interfaces
This commit is contained in:
parent
5057517b78
commit
651d2d0c81
11 changed files with 65 additions and 68 deletions
|
@ -32,12 +32,12 @@ void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr&
|
||||||
// PACKET_TYPE_JURISDICTION, first byte is the node type...
|
// PACKET_TYPE_JURISDICTION, first byte is the node type...
|
||||||
switch (dataByteArray[headerBytes]) {
|
switch (dataByteArray[headerBytes]) {
|
||||||
case NODE_TYPE_VOXEL_SERVER:
|
case NODE_TYPE_VOXEL_SERVER:
|
||||||
_scriptEngine.getVoxelScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
_scriptEngine.getVoxelsScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
||||||
(unsigned char*) dataByteArray.data(),
|
(unsigned char*) dataByteArray.data(),
|
||||||
dataByteArray.size());
|
dataByteArray.size());
|
||||||
break;
|
break;
|
||||||
case NODE_TYPE_PARTICLE_SERVER:
|
case NODE_TYPE_PARTICLE_SERVER:
|
||||||
_scriptEngine.getParticleScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
_scriptEngine.getParticlesScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
||||||
(unsigned char*) dataByteArray.data(),
|
(unsigned char*) dataByteArray.data(),
|
||||||
dataByteArray.size());
|
dataByteArray.size());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
#include <ScriptEngine.h>
|
#include <ScriptEngine.h>
|
||||||
#include <ThreadedAssignment.h>
|
#include <ThreadedAssignment.h>
|
||||||
|
|
||||||
#include <VoxelScriptingInterface.h>
|
|
||||||
#include <ParticleScriptingInterface.h>
|
|
||||||
|
|
||||||
class Agent : public ThreadedAssignment {
|
class Agent : public ThreadedAssignment {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4455,8 +4455,8 @@ void Application::loadScript() {
|
||||||
|
|
||||||
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
||||||
// we can use the same ones from the application.
|
// we can use the same ones from the application.
|
||||||
scriptEngine->getVoxelScriptingInterface()->setPacketSender(&_voxelEditSender);
|
scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
|
||||||
scriptEngine->getParticleScriptingInterface()->setPacketSender(&_particleEditSender);
|
scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
|
||||||
|
|
||||||
QThread* workerThread = new QThread(this);
|
QThread* workerThread = new QThread(this);
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
#include <SharedUtil.h> // usecTimestampNow()
|
#include <SharedUtil.h> // usecTimestampNow()
|
||||||
#include <Octree.h>
|
#include <Octree.h>
|
||||||
|
|
||||||
#include <VoxelScriptingInterface.h>
|
#include <VoxelsScriptingInterface.h>
|
||||||
#include "ParticleScriptingInterface.h"
|
#include "ParticlesScriptingInterface.h"
|
||||||
|
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
|
|
||||||
uint32_t Particle::_nextID = 0;
|
uint32_t Particle::_nextID = 0;
|
||||||
VoxelScriptingInterface* Particle::_voxelScriptingInterface = NULL;
|
VoxelsScriptingInterface* Particle::_voxelsScriptingInterface = NULL;
|
||||||
ParticleScriptingInterface* Particle::_particlesScriptingInterface = NULL;
|
ParticlesScriptingInterface* Particle::_particlesScriptingInterface = NULL;
|
||||||
|
|
||||||
|
|
||||||
Particle::Particle(glm::vec3 position, float radius, rgbColor color, glm::vec3 velocity, glm::vec3 gravity,
|
Particle::Particle(glm::vec3 position, float radius, rgbColor color, glm::vec3 velocity, glm::vec3 gravity,
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <OctreePacketData.h>
|
#include <OctreePacketData.h>
|
||||||
|
|
||||||
class VoxelScriptingInterface;
|
class VoxelsScriptingInterface;
|
||||||
class ParticleScriptingInterface;
|
class ParticlesScriptingInterface;
|
||||||
|
|
||||||
|
|
||||||
const uint32_t NEW_PARTICLE = 0xFFFFFFFF;
|
const uint32_t NEW_PARTICLE = 0xFFFFFFFF;
|
||||||
|
@ -121,18 +121,18 @@ public:
|
||||||
// similar to assignment/copy, but it handles keeping lifetime accurate
|
// similar to assignment/copy, but it handles keeping lifetime accurate
|
||||||
void copyChangedProperties(const Particle& other);
|
void copyChangedProperties(const Particle& other);
|
||||||
|
|
||||||
static VoxelScriptingInterface* getVoxelsScriptingInterface() { return _voxelScriptingInterface; }
|
static VoxelsScriptingInterface* getVoxelsScriptingInterface() { return _voxelsScriptingInterface; }
|
||||||
static ParticleScriptingInterface* getParticlesScriptingInterface() { return _particlesScriptingInterface; }
|
static ParticlesScriptingInterface* getParticlesScriptingInterface() { return _particlesScriptingInterface; }
|
||||||
|
|
||||||
static void setVoxelsScriptingInterface(VoxelScriptingInterface* interface)
|
static void setVoxelsScriptingInterface(VoxelsScriptingInterface* interface)
|
||||||
{ _voxelScriptingInterface = interface; }
|
{ _voxelsScriptingInterface = interface; }
|
||||||
|
|
||||||
static void setParticlesScriptingInterface(ParticleScriptingInterface* interface)
|
static void setParticlesScriptingInterface(ParticlesScriptingInterface* interface)
|
||||||
{ _particlesScriptingInterface = interface; }
|
{ _particlesScriptingInterface = interface; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static VoxelScriptingInterface* _voxelScriptingInterface;
|
static VoxelsScriptingInterface* _voxelsScriptingInterface;
|
||||||
static ParticleScriptingInterface* _particlesScriptingInterface;
|
static ParticlesScriptingInterface* _particlesScriptingInterface;
|
||||||
|
|
||||||
void runUpdateScript();
|
void runUpdateScript();
|
||||||
static QScriptValue vec3toScriptValue(QScriptEngine *engine, const glm::vec3 &vec3);
|
static QScriptValue vec3toScriptValue(QScriptEngine *engine, const glm::vec3 &vec3);
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
//
|
//
|
||||||
// ParticleScriptingInterface.cpp
|
// ParticlesScriptingInterface.cpp
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 12/6/13
|
// Created by Brad Hefta-Gaub on 12/6/13
|
||||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "ParticleScriptingInterface.h"
|
#include "ParticlesScriptingInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ParticleScriptingInterface::queueParticleMessage(PACKET_TYPE packetType, ParticleDetail& particleDetails) {
|
void ParticlesScriptingInterface::queueParticleMessage(PACKET_TYPE packetType, ParticleDetail& particleDetails) {
|
||||||
getParticlePacketSender()->queueParticleEditMessages(packetType, 1, &particleDetails);
|
getParticlePacketSender()->queueParticleEditMessages(packetType, 1, &particleDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ParticleScriptingInterface::queueParticleAdd(glm::vec3 position, float radius,
|
unsigned int ParticlesScriptingInterface::queueParticleAdd(glm::vec3 position, float radius,
|
||||||
xColor color, glm::vec3 velocity, glm::vec3 gravity, float damping, bool inHand, QString script) {
|
xColor color, glm::vec3 velocity, glm::vec3 gravity, float damping, bool inHand, QString script) {
|
||||||
|
|
||||||
// The application will keep track of creatorTokenID
|
// The application will keep track of creatorTokenID
|
||||||
|
@ -34,7 +34,7 @@ unsigned int ParticleScriptingInterface::queueParticleAdd(glm::vec3 position, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ParticleScriptingInterface::queueParticleEdit(unsigned int particleID, glm::vec3 position, float radius,
|
void ParticlesScriptingInterface::queueParticleEdit(unsigned int particleID, glm::vec3 position, float radius,
|
||||||
xColor color, glm::vec3 velocity, glm::vec3 gravity, float damping, bool inHand, QString script) {
|
xColor color, glm::vec3 velocity, glm::vec3 gravity, float damping, bool inHand, QString script) {
|
||||||
|
|
||||||
// setup a ParticleDetail struct with the data
|
// setup a ParticleDetail struct with the data
|
|
@ -1,13 +1,13 @@
|
||||||
//
|
//
|
||||||
// ParticleScriptingInterface.h
|
// ParticlesScriptingInterface.h
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 12/6/13
|
// Created by Brad Hefta-Gaub on 12/6/13
|
||||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef __hifi__ParticleScriptingInterface__
|
#ifndef __hifi__ParticlesScriptingInterface__
|
||||||
#define __hifi__ParticleScriptingInterface__
|
#define __hifi__ParticlesScriptingInterface__
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
#include "ParticleEditPacketSender.h"
|
#include "ParticleEditPacketSender.h"
|
||||||
|
|
||||||
/// handles scripting of Particle commands from JS passed to assigned clients
|
/// handles scripting of Particle commands from JS passed to assigned clients
|
||||||
class ParticleScriptingInterface : public OctreeScriptingInterface {
|
class ParticlesScriptingInterface : public OctreeScriptingInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ParticleEditPacketSender* getParticlePacketSender() const { return (ParticleEditPacketSender*)getPacketSender(); }
|
ParticleEditPacketSender* getParticlePacketSender() const { return (ParticleEditPacketSender*)getPacketSender(); }
|
||||||
|
@ -38,4 +38,4 @@ private:
|
||||||
uint32_t _nextCreatorTokenID;
|
uint32_t _nextCreatorTokenID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__ParticleScriptingInterface__) */
|
#endif /* defined(__hifi__ParticlesScriptingInterface__) */
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Agent.cpp
|
// ScriptEngine.cpp
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 12/14/13.
|
// Created by Brad Hefta-Gaub on 12/14/13.
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
#include "ScriptEngine.h"
|
#include "ScriptEngine.h"
|
||||||
|
|
||||||
int ScriptEngine::_scriptNumber = 1;
|
int ScriptEngine::_scriptNumber = 1;
|
||||||
VoxelScriptingInterface ScriptEngine::_voxelScriptingInterface;
|
VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface;
|
||||||
ParticleScriptingInterface ScriptEngine::_particleScriptingInterface;
|
ParticlesScriptingInterface ScriptEngine::_particlesScriptingInterface;
|
||||||
|
|
||||||
|
|
||||||
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems,
|
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems,
|
||||||
|
@ -49,11 +49,11 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems,
|
||||||
|
|
||||||
// hook up our interfaces
|
// hook up our interfaces
|
||||||
if (!Particle::getVoxelsScriptingInterface()) {
|
if (!Particle::getVoxelsScriptingInterface()) {
|
||||||
Particle::setVoxelsScriptingInterface(getVoxelScriptingInterface());
|
Particle::setVoxelsScriptingInterface(getVoxelsScriptingInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Particle::getParticlesScriptingInterface()) {
|
if (!Particle::getParticlesScriptingInterface()) {
|
||||||
Particle::setParticlesScriptingInterface(getParticleScriptingInterface());
|
Particle::setParticlesScriptingInterface(getParticlesScriptingInterface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ void ScriptEngine::run() {
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
QScriptEngine engine;
|
QScriptEngine engine;
|
||||||
|
|
||||||
_voxelScriptingInterface.init();
|
_voxelsScriptingInterface.init();
|
||||||
_particleScriptingInterface.init();
|
_particlesScriptingInterface.init();
|
||||||
|
|
||||||
// register meta-type for glm::vec3 conversions
|
// register meta-type for glm::vec3 conversions
|
||||||
registerMetaTypes(&engine);
|
registerMetaTypes(&engine);
|
||||||
|
@ -95,10 +95,10 @@ void ScriptEngine::run() {
|
||||||
QScriptValue agentValue = engine.newQObject(this);
|
QScriptValue agentValue = engine.newQObject(this);
|
||||||
engine.globalObject().setProperty("Agent", agentValue);
|
engine.globalObject().setProperty("Agent", agentValue);
|
||||||
|
|
||||||
QScriptValue voxelScripterValue = engine.newQObject(&_voxelScriptingInterface);
|
QScriptValue voxelScripterValue = engine.newQObject(&_voxelsScriptingInterface);
|
||||||
engine.globalObject().setProperty("Voxels", voxelScripterValue);
|
engine.globalObject().setProperty("Voxels", voxelScripterValue);
|
||||||
|
|
||||||
QScriptValue particleScripterValue = engine.newQObject(&_particleScriptingInterface);
|
QScriptValue particleScripterValue = engine.newQObject(&_particlesScriptingInterface);
|
||||||
engine.globalObject().setProperty("Particles", particleScripterValue);
|
engine.globalObject().setProperty("Particles", particleScripterValue);
|
||||||
|
|
||||||
if (_controllerScriptingInterface) {
|
if (_controllerScriptingInterface) {
|
||||||
|
@ -112,8 +112,8 @@ void ScriptEngine::run() {
|
||||||
const unsigned int VISUAL_DATA_CALLBACK_USECS = (1.0 / 60.0) * 1000 * 1000;
|
const unsigned int VISUAL_DATA_CALLBACK_USECS = (1.0 / 60.0) * 1000 * 1000;
|
||||||
|
|
||||||
// let the VoxelPacketSender know how frequently we plan to call it
|
// let the VoxelPacketSender know how frequently we plan to call it
|
||||||
_voxelScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS);
|
_voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS);
|
||||||
_particleScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS);
|
_particlesScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS);
|
||||||
|
|
||||||
//qDebug() << "Script:\n" << _scriptContents << "\n";
|
//qDebug() << "Script:\n" << _scriptContents << "\n";
|
||||||
|
|
||||||
|
@ -147,29 +147,29 @@ void ScriptEngine::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool willSendVisualDataCallBack = false;
|
bool willSendVisualDataCallBack = false;
|
||||||
if (_voxelScriptingInterface.getVoxelPacketSender()->serversExist()) {
|
if (_voxelsScriptingInterface.getVoxelPacketSender()->serversExist()) {
|
||||||
// allow the scripter's call back to setup visual data
|
// allow the scripter's call back to setup visual data
|
||||||
willSendVisualDataCallBack = true;
|
willSendVisualDataCallBack = true;
|
||||||
|
|
||||||
// release the queue of edit voxel messages.
|
// release the queue of edit voxel messages.
|
||||||
_voxelScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages();
|
_voxelsScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages();
|
||||||
|
|
||||||
// since we're in non-threaded mode, call process so that the packets are sent
|
// since we're in non-threaded mode, call process so that the packets are sent
|
||||||
if (!_voxelScriptingInterface.getVoxelPacketSender()->isThreaded()) {
|
if (!_voxelsScriptingInterface.getVoxelPacketSender()->isThreaded()) {
|
||||||
_voxelScriptingInterface.getVoxelPacketSender()->process();
|
_voxelsScriptingInterface.getVoxelPacketSender()->process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_particleScriptingInterface.getParticlePacketSender()->serversExist()) {
|
if (_particlesScriptingInterface.getParticlePacketSender()->serversExist()) {
|
||||||
// allow the scripter's call back to setup visual data
|
// allow the scripter's call back to setup visual data
|
||||||
willSendVisualDataCallBack = true;
|
willSendVisualDataCallBack = true;
|
||||||
|
|
||||||
// release the queue of edit voxel messages.
|
// release the queue of edit voxel messages.
|
||||||
_particleScriptingInterface.getParticlePacketSender()->releaseQueuedMessages();
|
_particlesScriptingInterface.getParticlePacketSender()->releaseQueuedMessages();
|
||||||
|
|
||||||
// since we're in non-threaded mode, call process so that the packets are sent
|
// since we're in non-threaded mode, call process so that the packets are sent
|
||||||
if (!_particleScriptingInterface.getParticlePacketSender()->isThreaded()) {
|
if (!_particlesScriptingInterface.getParticlePacketSender()->isThreaded()) {
|
||||||
_particleScriptingInterface.getParticlePacketSender()->process();
|
_particlesScriptingInterface.getParticlePacketSender()->process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
#include <AbstractMenuInterface.h>
|
#include <AbstractMenuInterface.h>
|
||||||
#include <ParticleScriptingInterface.h>
|
#include <ParticlesScriptingInterface.h>
|
||||||
#include <VoxelScriptingInterface.h>
|
#include <VoxelsScriptingInterface.h>
|
||||||
#include "AbstractControllerScriptingInterface.h"
|
#include "AbstractControllerScriptingInterface.h"
|
||||||
|
|
||||||
const QString NO_SCRIPT("");
|
const QString NO_SCRIPT("");
|
||||||
|
@ -31,11 +31,11 @@ public:
|
||||||
|
|
||||||
~ScriptEngine();
|
~ScriptEngine();
|
||||||
|
|
||||||
/// Access the VoxelScriptingInterface in order to initialize it with a custom packet sender and jurisdiction listener
|
/// Access the VoxelsScriptingInterface in order to initialize it with a custom packet sender and jurisdiction listener
|
||||||
VoxelScriptingInterface* getVoxelScriptingInterface() { return &_voxelScriptingInterface; }
|
VoxelsScriptingInterface* getVoxelsScriptingInterface() { return &_voxelsScriptingInterface; }
|
||||||
|
|
||||||
/// Access the ParticleScriptingInterface in order to initialize it with a custom packet sender and jurisdiction listener
|
/// Access the ParticlesScriptingInterface in order to initialize it with a custom packet sender and jurisdiction listener
|
||||||
ParticleScriptingInterface* getParticleScriptingInterface() { return &_particleScriptingInterface; }
|
ParticlesScriptingInterface* getParticlesScriptingInterface() { return &_particlesScriptingInterface; }
|
||||||
|
|
||||||
/// sets the script contents, will return false if failed, will fail if script is already running
|
/// sets the script contents, will return false if failed, will fail if script is already running
|
||||||
bool setScriptContents(const QString& scriptContents);
|
bool setScriptContents(const QString& scriptContents);
|
||||||
|
@ -58,8 +58,8 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static VoxelScriptingInterface _voxelScriptingInterface;
|
static VoxelsScriptingInterface _voxelsScriptingInterface;
|
||||||
static ParticleScriptingInterface _particleScriptingInterface;
|
static ParticlesScriptingInterface _particlesScriptingInterface;
|
||||||
AbstractControllerScriptingInterface* _controllerScriptingInterface;
|
AbstractControllerScriptingInterface* _controllerScriptingInterface;
|
||||||
bool _wantMenuItems;
|
bool _wantMenuItems;
|
||||||
QString _scriptMenuName;
|
QString _scriptMenuName;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
//
|
//
|
||||||
// VoxelScriptingInterface.cpp
|
// VoxelsScriptingInterface.cpp
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Stephen Birarda on 9/17/13.
|
// Created by Stephen Birarda on 9/17/13.
|
||||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "VoxelScriptingInterface.h"
|
#include "VoxelsScriptingInterface.h"
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
void VoxelsScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
||||||
getVoxelPacketSender()->queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
|
getVoxelPacketSender()->queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue) {
|
void VoxelsScriptingInterface::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};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float sca
|
||||||
queueVoxelAdd(PACKET_TYPE_VOXEL_SET, addVoxelDetail);
|
queueVoxelAdd(PACKET_TYPE_VOXEL_SET, addVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z, float scale,
|
void VoxelsScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z, float scale,
|
||||||
uchar red, uchar green, uchar blue) {
|
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};
|
||||||
|
@ -29,7 +29,7 @@ void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z
|
||||||
queueVoxelAdd(PACKET_TYPE_VOXEL_SET_DESTRUCTIVE, addVoxelDetail);
|
queueVoxelAdd(PACKET_TYPE_VOXEL_SET_DESTRUCTIVE, addVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float scale) {
|
void VoxelsScriptingInterface::queueVoxelDelete(float x, float y, float z, float scale) {
|
||||||
|
|
||||||
// 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};
|
|
@ -1,13 +1,13 @@
|
||||||
//
|
//
|
||||||
// VoxelScriptingInterface.h
|
// VoxelsScriptingInterface.h
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Stephen Birarda on 9/17/13.
|
// Created by Stephen Birarda on 9/17/13.
|
||||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef __hifi__VoxelScriptingInterface__
|
#ifndef __hifi__VoxelsScriptingInterface__
|
||||||
#define __hifi__VoxelScriptingInterface__
|
#define __hifi__VoxelsScriptingInterface__
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
#include "VoxelEditPacketSender.h"
|
#include "VoxelEditPacketSender.h"
|
||||||
|
|
||||||
/// handles scripting of voxel commands from JS passed to assigned clients
|
/// handles scripting of voxel commands from JS passed to assigned clients
|
||||||
class VoxelScriptingInterface : public OctreeScriptingInterface {
|
class VoxelsScriptingInterface : public OctreeScriptingInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VoxelEditPacketSender* getVoxelPacketSender() { return (VoxelEditPacketSender*)getPacketSender(); }
|
VoxelEditPacketSender* getVoxelPacketSender() { return (VoxelEditPacketSender*)getPacketSender(); }
|
||||||
|
@ -56,4 +56,4 @@ private:
|
||||||
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__VoxelScriptingInterface__) */
|
#endif /* defined(__hifi__VoxelsScriptingInterface__) */
|
Loading…
Reference in a new issue