mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
commit
d416f33e67
7 changed files with 181 additions and 86 deletions
|
@ -11,7 +11,7 @@
|
|||
var count = 0;
|
||||
var stopAfter = 100;
|
||||
|
||||
var modelProperties = {
|
||||
var modelPropertiesA = {
|
||||
position: { x: 1, y: 1, z: 1 },
|
||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
|
@ -21,6 +21,18 @@ var modelProperties = {
|
|||
lifetime: 20
|
||||
};
|
||||
|
||||
var modelPropertiesB = {
|
||||
position: { x: 1, y: 1.5, z: 1 },
|
||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius : 0.25,
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
lifetime: 20
|
||||
};
|
||||
|
||||
var ballProperties = {
|
||||
position: { x: 1, y: 0.5, z: 1 },
|
||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||
|
@ -31,7 +43,8 @@ var ballProperties = {
|
|||
lifetime: 20
|
||||
};
|
||||
|
||||
var modelParticleID = Particles.addParticle(modelProperties);
|
||||
var modelAParticleID = Particles.addParticle(modelPropertiesA);
|
||||
var modelBParticleID = Particles.addParticle(modelPropertiesB);
|
||||
var ballParticleID = Particles.addParticle(ballProperties);
|
||||
|
||||
function endAfterAWhile() {
|
||||
|
|
|
@ -17,7 +17,8 @@ var invaderStepsPerCycle = 120; // the number of update steps it takes then inva
|
|||
var invaderStepOfCycle = 0; // current iteration in the cycle
|
||||
var invaderMoveDirection = 1; // 1 for moving to right, -1 for moving to left
|
||||
|
||||
var itemLifetimes = 60 * 2; // 2 minutes
|
||||
// game length...
|
||||
var itemLifetimes = 60; // 1 minute
|
||||
|
||||
|
||||
// position the game to be basically near the avatar running the game...
|
||||
|
@ -51,7 +52,8 @@ var gameAt = { x: gameAtX, y: gameAtY, z: gameAtZ };
|
|||
var middleX = gameAt.x + (gameSize.x/2);
|
||||
var middleY = gameAt.y + (gameSize.y/2);
|
||||
|
||||
var shipSize = 0.2;
|
||||
var invaderSize = 0.4;
|
||||
var shipSize = 0.25;
|
||||
var missileSize = 0.1;
|
||||
var myShip;
|
||||
var myShipProperties;
|
||||
|
@ -88,16 +90,56 @@ var currentMoveSound = 0;
|
|||
var numberOfSounds = 4;
|
||||
var stepsPerSound = invaderStepsPerCycle / numberOfSounds;
|
||||
|
||||
// if you set this to false, sounds will come from the location of particles instead of the player's head
|
||||
var soundInMyHead = true;
|
||||
|
||||
// models...
|
||||
var invaderModels = new Array();
|
||||
invaderModels[0] = {
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-large-purple.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
};
|
||||
invaderModels[1] = {
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-large-cyan.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
};
|
||||
invaderModels[2] = {
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-medium-cyan.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
};
|
||||
invaderModels[3] = {
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-medium-green.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
};
|
||||
invaderModels[4] = {
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-small-green.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
};
|
||||
|
||||
|
||||
|
||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
||||
//modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/invader.svo",
|
||||
// "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/spaceInvader3.fbx"
|
||||
|
||||
function initializeMyShip() {
|
||||
myShipProperties = {
|
||||
position: { x: middleX , y: gameAt.y, z: gameAt.z },
|
||||
velocity: { x: 0, y: 0, z: 0 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius: shipSize,
|
||||
color: { red: 0, green: 255, blue: 0 },
|
||||
lifetime: itemLifetimes
|
||||
};
|
||||
position: { x: middleX , y: gameAt.y, z: gameAt.z },
|
||||
velocity: { x: 0, y: 0, z: 0 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius: shipSize,
|
||||
color: { red: 0, green: 255, blue: 0 },
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/myCannon16x16.svo",
|
||||
modelScale: 450,
|
||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||
lifetime: itemLifetimes
|
||||
};
|
||||
myShip = Particles.addParticle(myShipProperties);
|
||||
}
|
||||
|
||||
|
@ -131,9 +173,11 @@ function initializeInvaders() {
|
|||
velocity: { x: 0, y: 0, z: 0 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius: shipSize,
|
||||
radius: invaderSize,
|
||||
color: { red: 255, green: 0, blue: 0 },
|
||||
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
||||
modelURL: invaderModels[row].modelURL,
|
||||
modelScale: invaderModels[row].modelScale,
|
||||
modelTranslation: invaderModels[row].modelTranslation,
|
||||
lifetime: itemLifetimes
|
||||
});
|
||||
|
||||
|
@ -171,8 +215,14 @@ function update() {
|
|||
if (invaderStepOfCycle % stepsPerSound == 0) {
|
||||
// play the move sound
|
||||
var options = new AudioInjectionOptions();
|
||||
options.position = getInvaderPosition(invadersPerRow / 2, numberOfRows / 2);
|
||||
options.volume = 10.0;
|
||||
if (soundInMyHead) {
|
||||
options.position = { x: MyAvatar.position.x + 0.0,
|
||||
y: MyAvatar.position.y + 0.1,
|
||||
z: MyAvatar.position.z + 0.0 };
|
||||
} else {
|
||||
options.position = getInvaderPosition(invadersPerRow / 2, numberOfRows / 2);
|
||||
}
|
||||
options.volume = 1.0;
|
||||
Audio.playSound(moveSounds[currentMoveSound], options);
|
||||
|
||||
// get ready for next move sound
|
||||
|
@ -274,7 +324,13 @@ function fireMissile() {
|
|||
});
|
||||
|
||||
var options = new AudioInjectionOptions();
|
||||
options.position = missilePosition;
|
||||
if (soundInMyHead) {
|
||||
options.position = { x: MyAvatar.position.x + 0.0,
|
||||
y: MyAvatar.position.y + 0.1,
|
||||
z: MyAvatar.position.z + 0.0 };
|
||||
} else {
|
||||
options.position = missilePosition;
|
||||
}
|
||||
options.volume = 1.0;
|
||||
Audio.playSound(shootSound, options);
|
||||
|
||||
|
@ -318,8 +374,13 @@ function deleteIfInvader(possibleInvaderParticle) {
|
|||
|
||||
// play the hit sound
|
||||
var options = new AudioInjectionOptions();
|
||||
var invaderPosition = getInvaderPosition(row, column);
|
||||
options.position = invaderPosition;
|
||||
if (soundInMyHead) {
|
||||
options.position = { x: MyAvatar.position.x + 0.0,
|
||||
y: MyAvatar.position.y + 0.1,
|
||||
z: MyAvatar.position.z + 0.0 };
|
||||
} else {
|
||||
options.position = getInvaderPosition(row, column);
|
||||
}
|
||||
options.volume = 1.0;
|
||||
Audio.playSound(hitSound, options);
|
||||
}
|
||||
|
@ -346,4 +407,6 @@ Particles.particleCollisionWithParticle.connect(particleCollisionWithParticle);
|
|||
initializeMyShip();
|
||||
initializeInvaders();
|
||||
|
||||
// shut down the game after 1 minute
|
||||
var gameTimer = Script.setTimeout(endGame, itemLifetimes * 1000);
|
||||
|
||||
|
|
|
@ -84,12 +84,11 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg
|
|||
const float alpha = 1.0f;
|
||||
|
||||
Model* model = getModel(particle.getModelURL());
|
||||
|
||||
glm::vec3 translationAdjustment = particle.getModelTranslation();
|
||||
|
||||
glm::vec3 translationAdjustment = particle.getModelTranslation() * radius;
|
||||
|
||||
// set the position
|
||||
glm::vec3 translation(position.x, position.y, position.z);
|
||||
model->setTranslation(translation + translationAdjustment);
|
||||
glm::vec3 translation = position + translationAdjustment;
|
||||
model->setTranslation(translation);
|
||||
|
||||
// set the rotation
|
||||
glm::quat rotation = particle.getModelRotation();
|
||||
|
@ -100,14 +99,20 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg
|
|||
const float MODEL_SCALE = 0.00575f;
|
||||
glm::vec3 scale(1.0f,1.0f,1.0f);
|
||||
|
||||
// TODO: There is some kind of a bug in packing of the particle packets which is causing modelscale to
|
||||
// sometimes be garbage.
|
||||
float modelScale = 2.0f; /// particle.getModelScale()
|
||||
float modelScale = particle.getModelScale();
|
||||
model->setScale(scale * MODEL_SCALE * radius * modelScale);
|
||||
|
||||
model->simulate(0.0f);
|
||||
model->render(alpha); // TODO: should we allow particles to have alpha on their models?
|
||||
|
||||
const bool wantDebugSphere = false;
|
||||
if (wantDebugSphere) {
|
||||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
glutWireSphere(radius, 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
} else {
|
||||
glPushMatrix();
|
||||
|
|
|
@ -1632,7 +1632,18 @@ FBXGeometry readSVO(const QByteArray& model) {
|
|||
|
||||
VoxelTree tree;
|
||||
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS);
|
||||
tree.readBitstreamToTree((unsigned char*)model.data(), model.size(), args);
|
||||
|
||||
unsigned char* dataAt = (unsigned char*)model.data();
|
||||
size_t dataSize = model.size();
|
||||
|
||||
if (tree.getWantSVOfileVersions()) {
|
||||
// skip the type/version
|
||||
dataAt += sizeof(PacketType);
|
||||
dataSize -= sizeof(PacketType);
|
||||
dataAt += sizeof(PacketVersion);
|
||||
dataSize -= sizeof(PacketVersion);
|
||||
}
|
||||
tree.readBitstreamToTree(dataAt, dataSize, args);
|
||||
tree.recurseTreeWithOperation(addMeshVoxelsOperation, &mesh);
|
||||
|
||||
geometry.meshes.append(mesh);
|
||||
|
|
|
@ -190,6 +190,12 @@ bool Particle::appendParticleData(OctreePacketData* packetData) const {
|
|||
success = packetData->appendRawData((const unsigned char*)qPrintable(_modelURL), modelURLLength);
|
||||
}
|
||||
}
|
||||
|
||||
// modelScale
|
||||
if (success) {
|
||||
success = packetData->appendValue(getModelScale());
|
||||
}
|
||||
|
||||
// modelTranslation
|
||||
if (success) {
|
||||
success = packetData->appendValue(getModelTranslation());
|
||||
|
@ -198,11 +204,6 @@ bool Particle::appendParticleData(OctreePacketData* packetData) const {
|
|||
if (success) {
|
||||
success = packetData->appendValue(getModelRotation());
|
||||
}
|
||||
// modelScale
|
||||
if (success) {
|
||||
success = packetData->appendValue(getModelScale());
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -319,6 +320,11 @@ int Particle::readParticleDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += modelURLLength;
|
||||
bytesRead += modelURLLength;
|
||||
|
||||
// modelScale
|
||||
memcpy(&_modelScale, dataAt, sizeof(_modelScale));
|
||||
dataAt += sizeof(_modelScale);
|
||||
bytesRead += sizeof(_modelScale);
|
||||
|
||||
// modelTranslation
|
||||
memcpy(&_modelTranslation, dataAt, sizeof(_modelTranslation));
|
||||
dataAt += sizeof(_modelTranslation);
|
||||
|
@ -329,11 +335,6 @@ int Particle::readParticleDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += bytes;
|
||||
bytesRead += bytes;
|
||||
|
||||
// modelScale
|
||||
memcpy(&_modelScale, dataAt, sizeof(_modelScale));
|
||||
dataAt += sizeof(_modelScale);
|
||||
bytesRead += sizeof(_modelScale);
|
||||
|
||||
//printf("Particle::readParticleDataFromBuffer()... "); debugDump();
|
||||
}
|
||||
return bytesRead;
|
||||
|
@ -498,6 +499,13 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
|
|||
processedBytes += modelURLLength;
|
||||
}
|
||||
|
||||
// modelScale
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_SCALE) == CONTAINS_MODEL_SCALE)) {
|
||||
memcpy(&newParticle._modelScale, dataAt, sizeof(newParticle._modelScale));
|
||||
dataAt += sizeof(newParticle._modelScale);
|
||||
processedBytes += sizeof(newParticle._modelScale);
|
||||
}
|
||||
|
||||
// modelTranslation
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_TRANSLATION) == CONTAINS_MODEL_TRANSLATION)) {
|
||||
memcpy(&newParticle._modelTranslation, dataAt, sizeof(newParticle._modelTranslation));
|
||||
|
@ -512,13 +520,6 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
|
|||
processedBytes += bytes;
|
||||
}
|
||||
|
||||
// modelScale
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_SCALE) == CONTAINS_MODEL_SCALE)) {
|
||||
memcpy(&newParticle._modelScale, dataAt, sizeof(newParticle._modelScale));
|
||||
dataAt += sizeof(newParticle._modelScale);
|
||||
processedBytes += sizeof(newParticle._modelScale);
|
||||
}
|
||||
|
||||
const bool wantDebugging = false;
|
||||
if (wantDebugging) {
|
||||
qDebug("Particle::fromEditPacket()...");
|
||||
|
@ -696,6 +697,14 @@ bool Particle::encodeParticleEditMessageDetails(PacketType command, ParticleID i
|
|||
sizeOut += urlLength;
|
||||
}
|
||||
|
||||
// modelScale
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_SCALE) == CONTAINS_MODEL_SCALE)) {
|
||||
float modelScale = properties.getModelScale();
|
||||
memcpy(copyAt, &modelScale, sizeof(modelScale));
|
||||
copyAt += sizeof(modelScale);
|
||||
sizeOut += sizeof(modelScale);
|
||||
}
|
||||
|
||||
// modelTranslation
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_TRANSLATION) == CONTAINS_MODEL_TRANSLATION)) {
|
||||
glm::vec3 modelTranslation = properties.getModelTranslation(); // should this be relative to TREE_SCALE??
|
||||
|
@ -711,14 +720,6 @@ bool Particle::encodeParticleEditMessageDetails(PacketType command, ParticleID i
|
|||
sizeOut += bytes;
|
||||
}
|
||||
|
||||
// modelScale
|
||||
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_SCALE) == CONTAINS_MODEL_SCALE)) {
|
||||
float modelScale = properties.getModelScale();
|
||||
memcpy(copyAt, &modelScale, sizeof(modelScale));
|
||||
copyAt += sizeof(modelScale);
|
||||
sizeOut += sizeof(modelScale);
|
||||
}
|
||||
|
||||
bool wantDebugging = false;
|
||||
if (wantDebugging) {
|
||||
printf("encodeParticleEditMessageDetails()....\n");
|
||||
|
@ -931,9 +932,9 @@ ParticleProperties::ParticleProperties() :
|
|||
_inHand(false),
|
||||
_shouldDie(false),
|
||||
_modelURL(""),
|
||||
_modelScale(DEFAULT_MODEL_SCALE),
|
||||
_modelTranslation(DEFAULT_MODEL_TRANSLATION),
|
||||
_modelRotation(DEFAULT_MODEL_ROTATION),
|
||||
_modelScale(DEFAULT_MODEL_SCALE),
|
||||
|
||||
_id(UNKNOWN_PARTICLE_ID),
|
||||
_idSet(false),
|
||||
|
@ -950,9 +951,9 @@ ParticleProperties::ParticleProperties() :
|
|||
_inHandChanged(false),
|
||||
_shouldDieChanged(false),
|
||||
_modelURLChanged(false),
|
||||
_modelScaleChanged(false),
|
||||
_modelTranslationChanged(false),
|
||||
_modelRotationChanged(false),
|
||||
_modelScaleChanged(false),
|
||||
_defaultSettings(true)
|
||||
{
|
||||
}
|
||||
|
@ -1004,6 +1005,10 @@ uint16_t ParticleProperties::getChangedBits() const {
|
|||
changedBits += CONTAINS_MODEL_URL;
|
||||
}
|
||||
|
||||
if (_modelScaleChanged) {
|
||||
changedBits += CONTAINS_MODEL_SCALE;
|
||||
}
|
||||
|
||||
if (_modelTranslationChanged) {
|
||||
changedBits += CONTAINS_MODEL_TRANSLATION;
|
||||
}
|
||||
|
@ -1012,10 +1017,6 @@ uint16_t ParticleProperties::getChangedBits() const {
|
|||
changedBits += CONTAINS_MODEL_ROTATION;
|
||||
}
|
||||
|
||||
if (_modelScaleChanged) {
|
||||
changedBits += CONTAINS_MODEL_SCALE;
|
||||
}
|
||||
|
||||
return changedBits;
|
||||
}
|
||||
|
||||
|
@ -1045,14 +1046,14 @@ QScriptValue ParticleProperties::copyToScriptValue(QScriptEngine* engine) const
|
|||
|
||||
properties.setProperty("modelURL", _modelURL);
|
||||
|
||||
properties.setProperty("modelScale", _modelScale);
|
||||
|
||||
QScriptValue modelTranslation = vec3toScriptValue(engine, _modelTranslation);
|
||||
properties.setProperty("modelTranslation", modelTranslation);
|
||||
|
||||
QScriptValue modelRotation = quatToScriptValue(engine, _modelRotation);
|
||||
properties.setProperty("modelRotation", modelRotation);
|
||||
|
||||
properties.setProperty("modelScale", _modelScale);
|
||||
|
||||
|
||||
if (_idSet) {
|
||||
properties.setProperty("id", _id);
|
||||
|
@ -1203,7 +1204,17 @@ void ParticleProperties::copyFromScriptValue(const QScriptValue &object) {
|
|||
_modelURLChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QScriptValue modelScale = object.property("modelScale");
|
||||
if (modelScale.isValid()) {
|
||||
float newModelScale;
|
||||
newModelScale = modelScale.toVariant().toFloat();
|
||||
if (_defaultSettings || newModelScale != _modelScale) {
|
||||
_modelScale = newModelScale;
|
||||
_modelScaleChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
QScriptValue modelTranslation = object.property("modelTranslation");
|
||||
if (modelTranslation.isValid()) {
|
||||
QScriptValue x = modelTranslation.property("x");
|
||||
|
@ -1241,16 +1252,6 @@ void ParticleProperties::copyFromScriptValue(const QScriptValue &object) {
|
|||
}
|
||||
}
|
||||
|
||||
QScriptValue modelScale = object.property("modelScale");
|
||||
if (modelScale.isValid()) {
|
||||
float newModelScale;
|
||||
newModelScale = modelScale.toVariant().toFloat();
|
||||
if (_defaultSettings || newModelScale != _modelScale) {
|
||||
_modelScale = newModelScale;
|
||||
_modelScaleChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
_lastEdited = usecTimestampNow();
|
||||
}
|
||||
|
||||
|
@ -1310,6 +1311,11 @@ void ParticleProperties::copyToParticle(Particle& particle) const {
|
|||
particle.setModelURL(_modelURL);
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (_modelScaleChanged) {
|
||||
particle.setModelScale(_modelScale);
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (_modelTranslationChanged) {
|
||||
particle.setModelTranslation(_modelTranslation);
|
||||
|
@ -1321,11 +1327,6 @@ void ParticleProperties::copyToParticle(Particle& particle) const {
|
|||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (_modelScaleChanged) {
|
||||
particle.setModelScale(_modelScale);
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (somethingChanged) {
|
||||
bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
|
@ -1350,9 +1351,9 @@ void ParticleProperties::copyFromParticle(const Particle& particle) {
|
|||
_inHand = particle.getInHand();
|
||||
_shouldDie = particle.getShouldDie();
|
||||
_modelURL = particle.getModelURL();
|
||||
_modelScale = particle.getModelScale();
|
||||
_modelTranslation = particle.getModelTranslation();
|
||||
_modelRotation = particle.getModelRotation();
|
||||
_modelScale = particle.getModelScale();
|
||||
|
||||
_id = particle.getID();
|
||||
_idSet = true;
|
||||
|
@ -1368,9 +1369,9 @@ void ParticleProperties::copyFromParticle(const Particle& particle) {
|
|||
_inHandChanged = false;
|
||||
_shouldDieChanged = false;
|
||||
_modelURLChanged = false;
|
||||
_modelScaleChanged = false;
|
||||
_modelTranslationChanged = false;
|
||||
_modelRotationChanged = false;
|
||||
_modelScaleChanged = false;
|
||||
_defaultSettings = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,9 +88,9 @@ public:
|
|||
bool getInHand() const { return _inHand; }
|
||||
bool getShouldDie() const { return _shouldDie; }
|
||||
const QString& getModelURL() const { return _modelURL; }
|
||||
float getModelScale() const { return _modelScale; }
|
||||
const glm::vec3& getModelTranslation() const { return _modelTranslation; }
|
||||
const glm::quat& getModelRotation() const { return _modelRotation; }
|
||||
float getModelScale() const { return _modelScale; }
|
||||
|
||||
quint64 getLastEdited() const { return _lastEdited; }
|
||||
uint16_t getChangedBits() const;
|
||||
|
@ -113,10 +113,10 @@ public:
|
|||
|
||||
// model related properties
|
||||
void setModelURL(const QString& url) { _modelURL = url; _modelURLChanged = true; }
|
||||
void setModelScale(float scale) { _modelScale = scale; _modelScaleChanged = true; }
|
||||
void setModelTranslation(const glm::vec3& translation) { _modelTranslation = translation;
|
||||
_modelTranslationChanged = true; }
|
||||
void setModelRotation(const glm::quat& rotation) { _modelRotation = rotation; _modelRotationChanged = true; }
|
||||
void setModelScale(float scale) { _modelScale = scale; _modelScaleChanged = true; }
|
||||
|
||||
/// used by ParticleScriptingInterface to return ParticleProperties for unknown particles
|
||||
void setIsUnknownID() { _id = UNKNOWN_PARTICLE_ID; _idSet = true; }
|
||||
|
@ -133,9 +133,9 @@ private:
|
|||
bool _inHand;
|
||||
bool _shouldDie;
|
||||
QString _modelURL;
|
||||
float _modelScale;
|
||||
glm::vec3 _modelTranslation;
|
||||
glm::quat _modelRotation;
|
||||
float _modelScale;
|
||||
|
||||
uint32_t _id;
|
||||
bool _idSet;
|
||||
|
@ -152,9 +152,9 @@ private:
|
|||
bool _inHandChanged;
|
||||
bool _shouldDieChanged;
|
||||
bool _modelURLChanged;
|
||||
bool _modelScaleChanged;
|
||||
bool _modelTranslationChanged;
|
||||
bool _modelRotationChanged;
|
||||
bool _modelScaleChanged;
|
||||
bool _defaultSettings;
|
||||
};
|
||||
Q_DECLARE_METATYPE(ParticleProperties);
|
||||
|
@ -227,9 +227,9 @@ public:
|
|||
// model related properties
|
||||
bool hasModel() const { return !_modelURL.isEmpty(); }
|
||||
const QString& getModelURL() const { return _modelURL; }
|
||||
float getModelScale() const { return _modelScale; }
|
||||
const glm::vec3& getModelTranslation() const { return _modelTranslation; }
|
||||
const glm::quat& getModelRotation() const { return _modelRotation; }
|
||||
float getModelScale() const { return _modelScale; }
|
||||
|
||||
ParticleID getParticleID() const { return ParticleID(getID(), getCreatorTokenID(), getID() != UNKNOWN_PARTICLE_ID); }
|
||||
ParticleProperties getProperties() const;
|
||||
|
@ -277,9 +277,9 @@ public:
|
|||
|
||||
// model related properties
|
||||
void setModelURL(const QString& url) { _modelURL = url; }
|
||||
void setModelScale(float scale) { _modelScale = scale; }
|
||||
void setModelTranslation(const glm::vec3& translation) { _modelTranslation = translation; }
|
||||
void setModelRotation(const glm::quat& rotation) { _modelRotation = rotation; }
|
||||
void setModelScale(float scale) { _modelScale = scale; }
|
||||
|
||||
void setProperties(const ParticleProperties& properties);
|
||||
|
||||
|
@ -344,9 +344,9 @@ protected:
|
|||
|
||||
// model related items
|
||||
QString _modelURL;
|
||||
float _modelScale;
|
||||
glm::vec3 _modelTranslation;
|
||||
glm::quat _modelRotation;
|
||||
float _modelScale;
|
||||
|
||||
uint32_t _creatorTokenID;
|
||||
bool _newlyCreated;
|
||||
|
|
|
@ -44,6 +44,8 @@ int packArithmeticallyCodedValue(int value, char* destination) {
|
|||
|
||||
PacketVersion versionForPacketType(PacketType type) {
|
||||
switch (type) {
|
||||
case PacketTypeParticleData:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue