mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:56:50 +02:00
Merge remote-tracking branch 'upstream/master' into plugins
This commit is contained in:
commit
e651c722c3
27 changed files with 756 additions and 718 deletions
|
@ -325,8 +325,7 @@ void OctreeQueryNode::updateLastKnownViewFrustum() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// save that we know the view has been sent.
|
// save that we know the view has been sent.
|
||||||
quint64 now = usecTimestampNow();
|
setLastTimeBagEmpty();
|
||||||
setLastTimeBagEmpty(now); // is this what we want? poor names
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
bool moveShouldDump() const;
|
bool moveShouldDump() const;
|
||||||
|
|
||||||
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
||||||
void setLastTimeBagEmpty(quint64 lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; }
|
void setLastTimeBagEmpty() { _lastTimeBagEmpty = _sceneSendStartTime; }
|
||||||
|
|
||||||
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
||||||
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
||||||
|
@ -99,6 +99,8 @@ public:
|
||||||
unsigned int getlastOctreePacketLength() const { return _lastOctreePacketLength; }
|
unsigned int getlastOctreePacketLength() const { return _lastOctreePacketLength; }
|
||||||
int getDuplicatePacketCount() const { return _duplicatePacketCount; }
|
int getDuplicatePacketCount() const { return _duplicatePacketCount; }
|
||||||
|
|
||||||
|
void sceneStart(quint64 sceneSendStartTime) { _sceneSendStartTime = sceneSendStartTime; }
|
||||||
|
|
||||||
void nodeKilled();
|
void nodeKilled();
|
||||||
void forceNodeShutdown();
|
void forceNodeShutdown();
|
||||||
bool isShuttingDown() const { return _isShuttingDown; }
|
bool isShuttingDown() const { return _isShuttingDown; }
|
||||||
|
@ -158,6 +160,8 @@ private:
|
||||||
|
|
||||||
SentPacketHistory _sentPacketHistory;
|
SentPacketHistory _sentPacketHistory;
|
||||||
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
||||||
|
|
||||||
|
quint64 _sceneSendStartTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeQueryNode_h
|
#endif // hifi_OctreeQueryNode_h
|
||||||
|
|
|
@ -343,8 +343,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
|
|
||||||
if (!viewFrustumChanged && !nodeData->getWantDelta()) {
|
if (!viewFrustumChanged && !nodeData->getWantDelta()) {
|
||||||
// only set our last sent time if we weren't resetting due to frustum change
|
// only set our last sent time if we weren't resetting due to frustum change
|
||||||
quint64 now = usecTimestampNow();
|
nodeData->setLastTimeBagEmpty();
|
||||||
nodeData->setLastTimeBagEmpty(now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// track completed scenes and send out the stats packet accordingly
|
// track completed scenes and send out the stats packet accordingly
|
||||||
|
@ -369,8 +368,10 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// TODO: add these to stats page
|
// TODO: add these to stats page
|
||||||
//::startSceneSleepTime = _usleepTime;
|
//::startSceneSleepTime = _usleepTime;
|
||||||
|
|
||||||
|
nodeData->sceneStart(usecTimestampNow() - CHANGE_FUDGE);
|
||||||
// start tracking our stats
|
// start tracking our stats
|
||||||
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, _myServer->getOctree()->getRoot(), _myServer->getJurisdiction());
|
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged,
|
||||||
|
_myServer->getOctree()->getRoot(), _myServer->getJurisdiction());
|
||||||
|
|
||||||
// This is the start of "resending" the scene.
|
// This is the start of "resending" the scene.
|
||||||
bool dontRestartSceneOnMove = false; // this is experimental
|
bool dontRestartSceneOnMove = false; // this is experimental
|
||||||
|
@ -561,6 +562,13 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (somethingToSend) {
|
||||||
|
qDebug() << "Hit PPS Limit, packetsSentThisInterval =" << packetsSentThisInterval
|
||||||
|
<< " maxPacketsPerInterval = " << maxPacketsPerInterval
|
||||||
|
<< " clientMaxPacketsPerInterval = " << clientMaxPacketsPerInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Here's where we can/should allow the server to send other data...
|
// Here's where we can/should allow the server to send other data...
|
||||||
// send the environment packet
|
// send the environment packet
|
||||||
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
||||||
|
|
|
@ -254,12 +254,15 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#' + Settings.FORM_ID).on('click', '#' + Settings.DISCONNECT_ACCOUNT_BTN_ID, function(e){
|
$('#' + Settings.FORM_ID).on('click', '#' + Settings.DISCONNECT_ACCOUNT_BTN_ID, function(e){
|
||||||
|
$(this).blur();
|
||||||
disonnectHighFidelityAccount();
|
disonnectHighFidelityAccount();
|
||||||
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#' + Settings.FORM_ID).on('click', '#' + Settings.CONNECT_ACCOUNT_BTN_ID, function(e){
|
$('#' + Settings.FORM_ID).on('click', '#' + Settings.CONNECT_ACCOUNT_BTN_ID, function(e){
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
prepareAccessTokenPrompt();
|
prepareAccessTokenPrompt();
|
||||||
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
var panelsSource = $('#panels-template').html()
|
var panelsSource = $('#panels-template').html()
|
||||||
|
@ -345,7 +348,7 @@ function disonnectHighFidelityAccount() {
|
||||||
+ "</br></br>This could cause your domain to appear offline and no longer be reachable via any place names.",
|
+ "</br></br>This could cause your domain to appear offline and no longer be reachable via any place names.",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
html: true,
|
html: true,
|
||||||
showCancelButton: true,
|
showCancelButton: true
|
||||||
}, function(){
|
}, function(){
|
||||||
// we need to post to settings to clear the access-token
|
// we need to post to settings to clear the access-token
|
||||||
$(Settings.ACCESS_TOKEN_SELECTOR).val('').change();
|
$(Settings.ACCESS_TOKEN_SELECTOR).val('').change();
|
||||||
|
|
|
@ -104,6 +104,9 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
|
||||||
|
|
||||||
// write the new settings to the json file
|
// write the new settings to the json file
|
||||||
persistToFile();
|
persistToFile();
|
||||||
|
|
||||||
|
// reload the master and user config so that the merged config is right
|
||||||
|
_configMap.loadMasterAndUserConfig(argumentList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@ Script.load("controllers/hydra/hydraMove.js");
|
||||||
Script.load("inspect.js");
|
Script.load("inspect.js");
|
||||||
Script.load("lobby.js");
|
Script.load("lobby.js");
|
||||||
Script.load("notifications.js");
|
Script.load("notifications.js");
|
||||||
Script.load("look.js");
|
|
||||||
Script.load("users.js");
|
Script.load("users.js");
|
||||||
Script.load("grab.js");
|
Script.load("grab.js");
|
||||||
|
Script.load("pointer.js");
|
||||||
|
|
|
@ -762,7 +762,7 @@ function mouseClickEvent(event) {
|
||||||
selectionManager.addEntity(foundEntity, true);
|
selectionManager.addEntity(foundEntity, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
print("Model selected: " + foundEntity.id);
|
print("Model selected: " + foundEntity);
|
||||||
selectionDisplay.select(selectedEntityID, event);
|
selectionDisplay.select(selectedEntityID, event);
|
||||||
|
|
||||||
if (Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)) {
|
if (Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)) {
|
||||||
|
@ -1201,7 +1201,7 @@ PropertiesTool = function(opts) {
|
||||||
var selections = [];
|
var selections = [];
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var entity = {};
|
var entity = {};
|
||||||
entity.id = selectionManager.selections[i].id;
|
entity.id = selectionManager.selections[i];
|
||||||
entity.properties = Entities.getEntityProperties(selectionManager.selections[i]);
|
entity.properties = Entities.getEntityProperties(selectionManager.selections[i]);
|
||||||
entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
|
entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
|
||||||
selections.push(entity);
|
selections.push(entity);
|
||||||
|
@ -1251,7 +1251,7 @@ PropertiesTool = function(opts) {
|
||||||
var dY = grid.getOrigin().y - (selectionManager.worldPosition.y - selectionManager.worldDimensions.y / 2),
|
var dY = grid.getOrigin().y - (selectionManager.worldPosition.y - selectionManager.worldDimensions.y / 2),
|
||||||
var diff = { x: 0, y: dY, z: 0 };
|
var diff = { x: 0, y: dY, z: 0 };
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
|
var properties = selectionManager.savedProperties[selectionManager.selections[i]];
|
||||||
var newPosition = Vec3.sum(properties.position, diff);
|
var newPosition = Vec3.sum(properties.position, diff);
|
||||||
Entities.editEntity(selectionManager.selections[i], {
|
Entities.editEntity(selectionManager.selections[i], {
|
||||||
position: newPosition,
|
position: newPosition,
|
||||||
|
@ -1264,7 +1264,7 @@ PropertiesTool = function(opts) {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
|
var properties = selectionManager.savedProperties[selectionManager.selections[i]];
|
||||||
var bottomY = properties.boundingBox.center.y - properties.boundingBox.dimensions.y / 2;
|
var bottomY = properties.boundingBox.center.y - properties.boundingBox.dimensions.y / 2;
|
||||||
var dY = grid.getOrigin().y - bottomY;
|
var dY = grid.getOrigin().y - bottomY;
|
||||||
var diff = { x: 0, y: dY, z: 0 };
|
var diff = { x: 0, y: dY, z: 0 };
|
||||||
|
@ -1280,7 +1280,7 @@ PropertiesTool = function(opts) {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
|
var properties = selectionManager.savedProperties[selectionManager.selections[i]];
|
||||||
var naturalDimensions = properties.naturalDimensions;
|
var naturalDimensions = properties.naturalDimensions;
|
||||||
|
|
||||||
// If any of the natural dimensions are not 0, resize
|
// If any of the natural dimensions are not 0, resize
|
||||||
|
@ -1302,7 +1302,7 @@ PropertiesTool = function(opts) {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
|
var properties = selectionManager.savedProperties[selectionManager.selections[i]];
|
||||||
Entities.editEntity(selectionManager.selections[i], {
|
Entities.editEntity(selectionManager.selections[i], {
|
||||||
dimensions: Vec3.multiply(multiplier, properties.dimensions),
|
dimensions: Vec3.multiply(multiplier, properties.dimensions),
|
||||||
});
|
});
|
||||||
|
@ -1314,7 +1314,7 @@ PropertiesTool = function(opts) {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
selectionManager.saveProperties();
|
selectionManager.saveProperties();
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
|
var properties = selectionManager.savedProperties[selectionManager.selections[i]];
|
||||||
if (properties.type == "Zone") {
|
if (properties.type == "Zone") {
|
||||||
var centerOfZone = properties.boundingBox.center;
|
var centerOfZone = properties.boundingBox.center;
|
||||||
var atmosphereCenter = { x: centerOfZone.x,
|
var atmosphereCenter = { x: centerOfZone.x,
|
||||||
|
|
|
@ -287,6 +287,18 @@
|
||||||
allSections.push(elWebSections);
|
allSections.push(elWebSections);
|
||||||
var elWebSourceURL = document.getElementById("property-web-source-url");
|
var elWebSourceURL = document.getElementById("property-web-source-url");
|
||||||
|
|
||||||
|
var elParticleSections = document.querySelectorAll(".particle-section");
|
||||||
|
allSections.push(elParticleSections);
|
||||||
|
var elParticleMaxParticles = document.getElementById("property-particle-maxparticles");
|
||||||
|
var elParticleLifeSpan = document.getElementById("property-particle-lifespan");
|
||||||
|
var elParticleEmitRate = document.getElementById("property-particle-emit-rate");
|
||||||
|
var elParticleEmitDirectionX = document.getElementById("property-particle-emit-direction-x");
|
||||||
|
var elParticleEmitDirectionY = document.getElementById("property-particle-emit-direction-y");
|
||||||
|
var elParticleEmitDirectionZ = document.getElementById("property-particle-emit-direction-z");
|
||||||
|
var elParticleEmitStrength = document.getElementById("property-particle-emit-strength");
|
||||||
|
var elParticleLocalGravity = document.getElementById("property-particle-localgravity");
|
||||||
|
var elParticleRadius = document.getElementById("property-particle-radius");
|
||||||
|
|
||||||
var elTextSections = document.querySelectorAll(".text-section");
|
var elTextSections = document.querySelectorAll(".text-section");
|
||||||
allSections.push(elTextSections);
|
allSections.push(elTextSections);
|
||||||
var elTextText = document.getElementById("property-text-text");
|
var elTextText = document.getElementById("property-text-text");
|
||||||
|
@ -455,7 +467,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.type == "Box" || properties.type == "Sphere") {
|
if (properties.type == "Box" || properties.type == "Sphere" || properties.type == "ParticleEffect") {
|
||||||
elColorSection.style.display = 'block';
|
elColorSection.style.display = 'block';
|
||||||
elColorRed.value = properties.color.red;
|
elColorRed.value = properties.color.red;
|
||||||
elColorGreen.value = properties.color.green;
|
elColorGreen.value = properties.color.green;
|
||||||
|
@ -465,7 +477,7 @@
|
||||||
elColorSection.style.display = 'none';
|
elColorSection.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.type == "Model") {
|
if (properties.type == "Model" || properties.type == "ParticleEffect") {
|
||||||
for (var i = 0; i < elModelSections.length; i++) {
|
for (var i = 0; i < elModelSections.length; i++) {
|
||||||
elModelSections[i].style.display = 'block';
|
elModelSections[i].style.display = 'block';
|
||||||
}
|
}
|
||||||
|
@ -562,6 +574,20 @@
|
||||||
|
|
||||||
showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox');
|
showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox');
|
||||||
showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere');
|
showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere');
|
||||||
|
} else if (properties.type == "ParticleEffect") {
|
||||||
|
for (var i = 0; i < elParticleSections.length; i++) {
|
||||||
|
elParticleSections[i].style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
elParticleMaxParticles.value = properties.maxParticles;
|
||||||
|
elParticleLifeSpan.value = properties.lifespan.toFixed(2);
|
||||||
|
elParticleEmitRate.value = properties.emitRate.toFixed(1);
|
||||||
|
elParticleEmitDirectionX.value = properties.emitDirection.x.toFixed(2);
|
||||||
|
elParticleEmitDirectionY.value = properties.emitDirection.y.toFixed(2);
|
||||||
|
elParticleEmitDirectionZ.value = properties.emitDirection.z.toFixed(2);
|
||||||
|
elParticleEmitStrength.value = properties.emitStrength.toFixed(2);
|
||||||
|
elParticleLocalGravity.value = properties.localGravity.toFixed(2);
|
||||||
|
elParticleRadius.value = properties.particleRadius.toFixed(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
@ -679,6 +705,18 @@
|
||||||
|
|
||||||
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
|
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
|
||||||
|
|
||||||
|
elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles'));
|
||||||
|
elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan'));
|
||||||
|
elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate'));
|
||||||
|
var particleEmitDirectionChangeFunction = createEmitVec3PropertyUpdateFunctionWithMultiplier(
|
||||||
|
'emitDirection', elParticleEmitDirectionX, elParticleEmitDirectionY, elParticleEmitDirectionZ, DEGREES_TO_RADIANS);
|
||||||
|
elParticleEmitDirectionX.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||||
|
elParticleEmitDirectionY.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||||
|
elParticleEmitDirectionZ.addEventListener('change', particleEmitDirectionChangeFunction);
|
||||||
|
elParticleEmitStrength.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitStrength'));
|
||||||
|
elParticleLocalGravity.addEventListener('change', createEmitNumberPropertyUpdateFunction('localGravity'));
|
||||||
|
elParticleRadius.addEventListener('change', createEmitNumberPropertyUpdateFunction('particleRadius'));
|
||||||
|
|
||||||
elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL'));
|
elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL'));
|
||||||
elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType'));
|
elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType'));
|
||||||
elCompoundShapeURL.addEventListener('change', createEmitTextPropertyUpdateFunction('compoundShapeURL'));
|
elCompoundShapeURL.addEventListener('change', createEmitTextPropertyUpdateFunction('compoundShapeURL'));
|
||||||
|
@ -1070,6 +1108,51 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Max Particles</div>
|
||||||
|
<div class="value">
|
||||||
|
<input type='number' id="property-particle-maxparticles" min="0" max="2048" step="1"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Life Span</div>
|
||||||
|
<div class="value">
|
||||||
|
<input type='number' id="property-particle-lifespan" min="0" step="0.1"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Emission Rate</div>
|
||||||
|
<div class="value">
|
||||||
|
<input type='number' id="property-particle-emit-rate" min="0" step="0.5"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Emission Direction</div>
|
||||||
|
<div class="value">
|
||||||
|
<div class="input-area">X <input class="coord" type='number' id="property-particle-emit-direction-x"></input></div>
|
||||||
|
<div class="input-area">Y <input class="coord" type='number' id="property-particle-emit-direction-y"></input></div>
|
||||||
|
<div class="input-area">Z <input class="coord" type='number' id="property-particle-emit-direction-z"></input></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Emission Strength</div>
|
||||||
|
<div class="value">
|
||||||
|
<input type='number' id="property-particle-emit-strength" min="0" step="0.1"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Local Gravity</div>
|
||||||
|
<div class="value">
|
||||||
|
<input class="coord" type='number' id="property-particle-localgravity" step="0.05"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="particle-section property">
|
||||||
|
<div class="label">Particle Radius</div>
|
||||||
|
<div class="value">
|
||||||
|
<input class="coord" type='number' id="property-particle-radius" min="0" step="0.005"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="model-section property">
|
<div class="model-section property">
|
||||||
<div class="label">Model URL</div>
|
<div class="label">Model URL</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
|
|
|
@ -25,8 +25,18 @@ var ALTITUDE_RATE = 200.0;
|
||||||
var RADIUS_RATE = 1.0 / 100.0;
|
var RADIUS_RATE = 1.0 / 100.0;
|
||||||
var PAN_RATE = 50.0;
|
var PAN_RATE = 50.0;
|
||||||
|
|
||||||
var Y_AXIS = { x: 0, y: 1, z: 0 };
|
var Y_AXIS = {
|
||||||
var X_AXIS = { x: 1, y: 0, z: 0 };
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var X_AXIS = {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var LOOK_AT_TIME = 500;
|
||||||
|
|
||||||
var alt = false;
|
var alt = false;
|
||||||
var shift = false;
|
var shift = false;
|
||||||
|
@ -34,6 +44,7 @@ var control = false;
|
||||||
|
|
||||||
var isActive = false;
|
var isActive = false;
|
||||||
|
|
||||||
|
var oldMode = Camera.mode;
|
||||||
var noMode = 0;
|
var noMode = 0;
|
||||||
var orbitMode = 1;
|
var orbitMode = 1;
|
||||||
var radialMode = 2;
|
var radialMode = 2;
|
||||||
|
@ -46,9 +57,21 @@ var mouseLastX = 0;
|
||||||
var mouseLastY = 0;
|
var mouseLastY = 0;
|
||||||
|
|
||||||
|
|
||||||
var center = { x: 0, y: 0, z: 0 };
|
var center = {
|
||||||
var position = { x: 0, y: 0, z: 0 };
|
x: 0,
|
||||||
var vector = { x: 0, y: 0, z: 0 };
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var position = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var vector = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
var radius = 0.0;
|
var radius = 0.0;
|
||||||
var azimuth = 0.0;
|
var azimuth = 0.0;
|
||||||
var altitude = 0.0;
|
var altitude = 0.0;
|
||||||
|
@ -56,244 +79,262 @@ var altitude = 0.0;
|
||||||
var avatarPosition;
|
var avatarPosition;
|
||||||
var avatarOrientation;
|
var avatarOrientation;
|
||||||
|
|
||||||
|
var rotatingTowardsTarget = false;
|
||||||
|
var targetCamOrientation;
|
||||||
|
var oldPosition, oldOrientation;
|
||||||
|
|
||||||
|
|
||||||
function orientationOf(vector) {
|
function orientationOf(vector) {
|
||||||
var direction,
|
var direction,
|
||||||
yaw,
|
yaw,
|
||||||
pitch;
|
pitch;
|
||||||
|
|
||||||
direction = Vec3.normalize(vector);
|
direction = Vec3.normalize(vector);
|
||||||
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||||
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||||
return Quat.multiply(yaw, pitch);
|
return Quat.multiply(yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function handleRadialMode(dx, dy) {
|
function handleRadialMode(dx, dy) {
|
||||||
azimuth += dx / AZIMUTH_RATE;
|
azimuth += dx / AZIMUTH_RATE;
|
||||||
radius += radius * dy * RADIUS_RATE;
|
radius += radius * dy * RADIUS_RATE;
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector = { x: (Math.cos(altitude) * Math.cos(azimuth)) * radius,
|
vector = {
|
||||||
y: Math.sin(altitude) * radius,
|
x: (Math.cos(altitude) * Math.cos(azimuth)) * radius,
|
||||||
z: (Math.cos(altitude) * Math.sin(azimuth)) * radius };
|
y: Math.sin(altitude) * radius,
|
||||||
position = Vec3.sum(center, vector);
|
z: (Math.cos(altitude) * Math.sin(azimuth)) * radius
|
||||||
Camera.setPosition(position);
|
};
|
||||||
Camera.setOrientation(orientationOf(vector));
|
position = Vec3.sum(center, vector);
|
||||||
|
Camera.setPosition(position);
|
||||||
|
Camera.setOrientation(orientationOf(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleOrbitMode(dx, dy) {
|
function handleOrbitMode(dx, dy) {
|
||||||
azimuth += dx / AZIMUTH_RATE;
|
azimuth += dx / AZIMUTH_RATE;
|
||||||
altitude += dy / ALTITUDE_RATE;
|
altitude += dy / ALTITUDE_RATE;
|
||||||
if (altitude > PI / 2.0) {
|
if (altitude > PI / 2.0) {
|
||||||
altitude = PI / 2.0;
|
altitude = PI / 2.0;
|
||||||
}
|
}
|
||||||
if (altitude < -PI / 2.0) {
|
if (altitude < -PI / 2.0) {
|
||||||
altitude = -PI / 2.0;
|
altitude = -PI / 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector = { x:(Math.cos(altitude) * Math.cos(azimuth)) * radius,
|
vector = {
|
||||||
y:Math.sin(altitude) * radius,
|
x: (Math.cos(altitude) * Math.cos(azimuth)) * radius,
|
||||||
z:(Math.cos(altitude) * Math.sin(azimuth)) * radius };
|
y: Math.sin(altitude) * radius,
|
||||||
position = Vec3.sum(center, vector);
|
z: (Math.cos(altitude) * Math.sin(azimuth)) * radius
|
||||||
Camera.setPosition(position);
|
};
|
||||||
Camera.setOrientation(orientationOf(vector));
|
position = Vec3.sum(center, vector);
|
||||||
|
Camera.setPosition(position);
|
||||||
|
Camera.setOrientation(orientationOf(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function handlePanMode(dx, dy) {
|
function handlePanMode(dx, dy) {
|
||||||
var up = Quat.getUp(Camera.getOrientation());
|
var up = Quat.getUp(Camera.getOrientation());
|
||||||
var right = Quat.getRight(Camera.getOrientation());
|
var right = Quat.getRight(Camera.getOrientation());
|
||||||
var distance = Vec3.length(vector);
|
var distance = Vec3.length(vector);
|
||||||
|
|
||||||
var dv = Vec3.sum(Vec3.multiply(up, - distance * dy / PAN_RATE), Vec3.multiply(right, distance * dx / PAN_RATE));
|
var dv = Vec3.sum(Vec3.multiply(up, -distance * dy / PAN_RATE), Vec3.multiply(right, distance * dx / PAN_RATE));
|
||||||
|
|
||||||
center = Vec3.sum(center, dv);
|
center = Vec3.sum(center, dv);
|
||||||
position = Vec3.sum(position, dv);
|
position = Vec3.sum(position, dv);
|
||||||
|
|
||||||
Camera.setPosition(position);
|
Camera.setPosition(position);
|
||||||
Camera.setOrientation(orientationOf(vector));
|
Camera.setOrientation(orientationOf(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.mode;
|
oldMode = Camera.mode;
|
||||||
var oldPosition = Camera.getPosition();
|
oldPosition = Camera.getPosition();
|
||||||
Camera.mode = "independent";
|
oldOrientation = Camera.getOrientation();
|
||||||
Camera.setPosition(oldPosition);
|
|
||||||
|
Camera.mode = "independent";
|
||||||
|
Camera.setPosition(oldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCameraState() {
|
function restoreCameraState() {
|
||||||
Camera.mode = oldMode;
|
Camera.mode = oldMode;
|
||||||
|
Camera.setPosition(oldPosition);
|
||||||
|
Camera.setOrientation(oldOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModes() {
|
function handleModes() {
|
||||||
var newMode = (mode == noMode) ? noMode : detachedMode;
|
var newMode = (mode == noMode) ? noMode : detachedMode;
|
||||||
if (alt) {
|
if (alt) {
|
||||||
if (control) {
|
if (control) {
|
||||||
if (shift) {
|
if (shift) {
|
||||||
newMode = panningMode;
|
newMode = panningMode;
|
||||||
} else {
|
} else {
|
||||||
newMode = orbitMode;
|
newMode = orbitMode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newMode = radialMode;
|
newMode = radialMode;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if entering detachMode
|
// if entering detachMode
|
||||||
if (newMode == detachedMode && mode != detachedMode) {
|
if (newMode == detachedMode && mode != detachedMode) {
|
||||||
avatarPosition = MyAvatar.position;
|
avatarPosition = MyAvatar.position;
|
||||||
avatarOrientation = MyAvatar.orientation;
|
avatarOrientation = MyAvatar.orientation;
|
||||||
}
|
}
|
||||||
// if leaving detachMode
|
// if leaving detachMode
|
||||||
if (mode == detachedMode && newMode == detachedMode &&
|
if (mode == detachedMode && newMode == detachedMode &&
|
||||||
(avatarPosition.x != MyAvatar.position.x ||
|
(avatarPosition.x != MyAvatar.position.x ||
|
||||||
avatarPosition.y != MyAvatar.position.y ||
|
avatarPosition.y != MyAvatar.position.y ||
|
||||||
avatarPosition.z != MyAvatar.position.z ||
|
avatarPosition.z != MyAvatar.position.z ||
|
||||||
avatarOrientation.x != MyAvatar.orientation.x ||
|
avatarOrientation.x != MyAvatar.orientation.x ||
|
||||||
avatarOrientation.y != MyAvatar.orientation.y ||
|
avatarOrientation.y != MyAvatar.orientation.y ||
|
||||||
avatarOrientation.z != MyAvatar.orientation.z ||
|
avatarOrientation.z != MyAvatar.orientation.z ||
|
||||||
avatarOrientation.w != MyAvatar.orientation.w)) {
|
avatarOrientation.w != MyAvatar.orientation.w)) {
|
||||||
newMode = noMode;
|
newMode = noMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == noMode && newMode != noMode && Camera.mode == "independent") {
|
if (mode == noMode && newMode != noMode && Camera.mode == "independent") {
|
||||||
newMode = noMode;
|
newMode = noMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if leaving noMode
|
// if leaving noMode
|
||||||
if (mode == noMode && newMode != noMode) {
|
if (mode == noMode && newMode != noMode) {
|
||||||
saveCameraState();
|
saveCameraState();
|
||||||
}
|
}
|
||||||
// if entering noMode
|
// if entering noMode
|
||||||
if (newMode == noMode && mode != noMode) {
|
if (newMode == noMode && mode != noMode) {
|
||||||
restoreCameraState();
|
restoreCameraState();
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = newMode;
|
mode = newMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyPressEvent(event) {
|
function keyPressEvent(event) {
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
if (event.text == "ALT") {
|
if (event.text == "ALT") {
|
||||||
alt = true;
|
alt = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
if (event.text == "CONTROL") {
|
if (event.text == "CONTROL") {
|
||||||
control = true;
|
control = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
if (event.text == "SHIFT") {
|
if (event.text == "SHIFT") {
|
||||||
shift = true;
|
shift = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
handleModes();
|
handleModes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyReleaseEvent(event) {
|
function keyReleaseEvent(event) {
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
if (event.text == "ALT") {
|
if (event.text == "ALT") {
|
||||||
alt = false;
|
alt = false;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
mode = noMode;
|
||||||
if (event.text == "CONTROL") {
|
restoreCameraState();
|
||||||
control = false;
|
}
|
||||||
changed = true;
|
if (event.text == "CONTROL") {
|
||||||
}
|
control = false;
|
||||||
if (event.text == "SHIFT") {
|
changed = true;
|
||||||
shift = false;
|
}
|
||||||
changed = true;
|
if (event.text == "SHIFT") {
|
||||||
}
|
shift = false;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
handleModes();
|
handleModes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
if (alt && !isActive) {
|
if (alt && !isActive) {
|
||||||
mouseLastX = event.x;
|
mouseLastX = event.x;
|
||||||
mouseLastY = event.y;
|
mouseLastY = event.y;
|
||||||
|
|
||||||
// Compute trajectories related values
|
// Compute trajectories related values
|
||||||
var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
|
var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
|
||||||
var modelIntersection = Entities.findRayIntersection(pickRay);
|
var modelIntersection = Entities.findRayIntersection(pickRay, true);
|
||||||
|
|
||||||
position = Camera.getPosition();
|
position = Camera.getPosition();
|
||||||
|
|
||||||
var avatarTarget = MyAvatar.getTargetAvatarPosition();
|
var avatarTarget = MyAvatar.getTargetAvatarPosition();
|
||||||
|
|
||||||
|
|
||||||
var distance = -1;
|
var distance = -1;
|
||||||
var string;
|
var string;
|
||||||
|
|
||||||
if (modelIntersection.intersects && modelIntersection.accurate) {
|
if (modelIntersection.intersects && modelIntersection.accurate) {
|
||||||
distance = modelIntersection.distance;
|
distance = modelIntersection.distance;
|
||||||
center = modelIntersection.properties.position;
|
center = modelIntersection.intersection;
|
||||||
string = "Inspecting model";
|
string = "Inspecting model";
|
||||||
}
|
//We've selected our target, now orbit towards it automatically
|
||||||
|
rotatingTowardsTarget = true;
|
||||||
|
//calculate our target cam rotation
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
rotatingTowardsTarget = false;
|
||||||
|
}, LOOK_AT_TIME);
|
||||||
|
|
||||||
if ((distance == -1 || Vec3.length(Vec3.subtract(avatarTarget, position)) < distance) &&
|
vector = Vec3.subtract(position, center);
|
||||||
(avatarTarget.x != 0 || avatarTarget.y != 0 || avatarTarget.z != 0)) {
|
targetCamOrientation = orientationOf(vector);
|
||||||
distance = Vec3.length(Vec3.subtract(avatarTarget, position));
|
radius = Vec3.length(vector);
|
||||||
center = avatarTarget;
|
azimuth = Math.atan2(vector.z, vector.x);
|
||||||
string = "Inspecting avatar";
|
altitude = Math.asin(vector.y / Vec3.length(vector));
|
||||||
}
|
|
||||||
|
|
||||||
if (distance == -1) {
|
isActive = true;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vector = Vec3.subtract(position, center);
|
|
||||||
radius = Vec3.length(vector);
|
|
||||||
azimuth = Math.atan2(vector.z, vector.x);
|
|
||||||
altitude = Math.asin(vector.y / Vec3.length(vector));
|
|
||||||
|
|
||||||
print(string);
|
|
||||||
isActive = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseReleaseEvent(event) {
|
function mouseReleaseEvent(event) {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseMoveEvent(event) {
|
function mouseMoveEvent(event) {
|
||||||
if (isActive && mode != noMode) {
|
if (isActive && mode != noMode && !rotatingTowardsTarget) {
|
||||||
if (mode == radialMode) {
|
if (mode == radialMode) {
|
||||||
handleRadialMode(event.x - mouseLastX, event.y - mouseLastY);
|
handleRadialMode(event.x - mouseLastX, event.y - mouseLastY);
|
||||||
}
|
|
||||||
if (mode == orbitMode) {
|
|
||||||
handleOrbitMode(event.x - mouseLastX, event.y - mouseLastY);
|
|
||||||
}
|
|
||||||
if (mode == panningMode) {
|
|
||||||
handlePanMode(event.x - mouseLastX, event.y - mouseLastY);
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseLastX = event.x;
|
|
||||||
mouseLastY = event.y;
|
|
||||||
}
|
}
|
||||||
|
if (mode == orbitMode) {
|
||||||
|
handleOrbitMode(event.x - mouseLastX, event.y - mouseLastY);
|
||||||
|
}
|
||||||
|
if (mode == panningMode) {
|
||||||
|
handlePanMode(event.x - mouseLastX, event.y - mouseLastY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mouseLastX = event.x;
|
||||||
|
mouseLastY = event.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
handleModes();
|
handleModes();
|
||||||
|
if (rotatingTowardsTarget) {
|
||||||
|
rotateTowardsTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rotateTowardsTarget() {
|
||||||
|
var newOrientation = Quat.mix(Camera.getOrientation(), targetCamOrientation, .1);
|
||||||
|
Camera.setOrientation(newOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
if (mode != noMode) {
|
if (mode != noMode) {
|
||||||
restoreCameraState();
|
restoreCameraState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
|
183
examples/look.js
183
examples/look.js
|
@ -1,183 +0,0 @@
|
||||||
//
|
|
||||||
// look.js
|
|
||||||
// examples
|
|
||||||
//
|
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// This is an example script that demonstrates use of the Controller class
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
var wantDebugging = false;
|
|
||||||
|
|
||||||
|
|
||||||
// Configuration
|
|
||||||
var TOUCH_YAW_SCALE = -0.25;
|
|
||||||
var TOUCH_PITCH_SCALE = -12.5;
|
|
||||||
var FIXED_TOUCH_TIMESTEP = 0.016;
|
|
||||||
|
|
||||||
var MOUSE_YAW_SCALE = -0.25;
|
|
||||||
var MOUSE_PITCH_SCALE = -12.5;
|
|
||||||
var FIXED_MOUSE_TIMESTEP = 0.016;
|
|
||||||
|
|
||||||
// Mouse Data
|
|
||||||
var alwaysLook = false; // if you want the mouse look to happen only when you click, change this to false
|
|
||||||
var isMouseDown = false;
|
|
||||||
var lastTouchX = 0;
|
|
||||||
var lastTouchY = 0;
|
|
||||||
var yawFromTouch = 0;
|
|
||||||
var pitchFromTouch = 0;
|
|
||||||
|
|
||||||
// Touch Data
|
|
||||||
var TIME_BEFORE_GENERATED_END_TOUCH_EVENT = 50; // ms
|
|
||||||
var startedTouching = false;
|
|
||||||
var lastTouchEvent = 0;
|
|
||||||
var lastMouseX = 0;
|
|
||||||
var lastMouseY = 0;
|
|
||||||
var yawFromMouse = 0;
|
|
||||||
var pitchFromMouse = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Mouse Events
|
|
||||||
function mousePressEvent(event) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("mousePressEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
}
|
|
||||||
if (event.isRightButton) {
|
|
||||||
isMouseDown = true;
|
|
||||||
lastMouseX = event.x;
|
|
||||||
lastMouseY = event.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function mouseReleaseEvent(event) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("mouseReleaseEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
}
|
|
||||||
isMouseDown = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mouseMoveEvent(event) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("mouseMoveEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alwaysLook || isMouseDown) {
|
|
||||||
yawFromMouse += ((event.x - lastMouseX) * MOUSE_YAW_SCALE * FIXED_MOUSE_TIMESTEP);
|
|
||||||
pitchFromMouse += ((event.y - lastMouseY) * MOUSE_PITCH_SCALE * FIXED_MOUSE_TIMESTEP);
|
|
||||||
lastMouseX = event.x;
|
|
||||||
lastMouseY = event.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Touch Events
|
|
||||||
function touchBeginEvent(event) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("touchBeginEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
}
|
|
||||||
lastTouchX = event.x;
|
|
||||||
lastTouchY = event.y;
|
|
||||||
yawFromTouch = 0;
|
|
||||||
pitchFromTouch = 0;
|
|
||||||
startedTouching = true;
|
|
||||||
var d = new Date();
|
|
||||||
lastTouchEvent = d.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
function touchEndEvent(event) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
if (event) {
|
|
||||||
print("touchEndEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
} else {
|
|
||||||
print("touchEndEvent generated");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startedTouching = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function touchUpdateEvent(event) {
|
|
||||||
// print("TOUCH UPDATE");
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("touchUpdateEvent event.x,y=" + event.x + ", " + event.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!startedTouching) {
|
|
||||||
// handle Qt 5.4.x bug where we get touch update without a touch begin event
|
|
||||||
touchBeginEvent(event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
yawFromTouch += ((event.x - lastTouchX) * TOUCH_YAW_SCALE * FIXED_TOUCH_TIMESTEP);
|
|
||||||
pitchFromTouch += ((event.y - lastTouchY) * TOUCH_PITCH_SCALE * FIXED_TOUCH_TIMESTEP);
|
|
||||||
lastTouchX = event.x;
|
|
||||||
lastTouchY = event.y;
|
|
||||||
var d = new Date();
|
|
||||||
lastTouchEvent = d.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function update(deltaTime) {
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("update()...");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startedTouching) {
|
|
||||||
var d = new Date();
|
|
||||||
var sinceLastTouch = d.getTime() - lastTouchEvent;
|
|
||||||
if (sinceLastTouch > TIME_BEFORE_GENERATED_END_TOUCH_EVENT) {
|
|
||||||
touchEndEvent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yawFromTouch != 0 || yawFromMouse != 0) {
|
|
||||||
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollRadians(0, yawFromTouch + yawFromMouse, 0));
|
|
||||||
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("changing orientation"
|
|
||||||
+ " [old]MyAvatar.orientation="+MyAvatar.orientation.x + "," + MyAvatar.orientation.y + ","
|
|
||||||
+ MyAvatar.orientation.z + "," + MyAvatar.orientation.w
|
|
||||||
+ " newOrientation="+newOrientation.x + "," + newOrientation.y + "," + newOrientation.z + "," + newOrientation.w);
|
|
||||||
}
|
|
||||||
|
|
||||||
MyAvatar.orientation = newOrientation;
|
|
||||||
yawFromTouch = 0;
|
|
||||||
yawFromMouse = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pitchFromTouch != 0 || pitchFromMouse != 0) {
|
|
||||||
var newPitch = MyAvatar.headPitch + pitchFromTouch + pitchFromMouse;
|
|
||||||
|
|
||||||
if (wantDebugging) {
|
|
||||||
print("changing pitch [old]MyAvatar.headPitch="+MyAvatar.headPitch+ " newPitch="+newPitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
MyAvatar.headPitch = newPitch;
|
|
||||||
pitchFromTouch = 0;
|
|
||||||
pitchFromMouse = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Map the mouse events to our functions
|
|
||||||
Controller.mousePressEvent.connect(mousePressEvent);
|
|
||||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
|
||||||
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
|
||||||
|
|
||||||
// Map the mouse events to our functions
|
|
||||||
Controller.touchBeginEvent.connect(touchBeginEvent);
|
|
||||||
Controller.touchUpdateEvent.connect(touchUpdateEvent);
|
|
||||||
Controller.touchEndEvent.connect(touchEndEvent);
|
|
||||||
|
|
||||||
// disable the standard application for mouse events
|
|
||||||
Controller.captureTouchEvents();
|
|
||||||
|
|
||||||
function scriptEnding() {
|
|
||||||
// re-enabled the standard application for mouse events
|
|
||||||
Controller.releaseTouchEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
// would be nice to change to update
|
|
||||||
Script.update.connect(update);
|
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
|
|
@ -1,77 +1,99 @@
|
||||||
|
|
||||||
var lineEntityID = null;
|
var lineEntityID = null;
|
||||||
var lineIsRezzed = false;
|
var lineIsRezzed = false;
|
||||||
|
var altHeld = false;
|
||||||
|
var lineCreated = false;
|
||||||
|
|
||||||
function nearLinePoint(targetPosition) {
|
function nearLinePoint(targetPosition) {
|
||||||
var handPosition = MyAvatar.getRightPalmPosition();
|
var handPosition = MyAvatar.getRightPalmPosition();
|
||||||
var along = Vec3.subtract(targetPosition, handPosition);
|
var along = Vec3.subtract(targetPosition, handPosition);
|
||||||
along = Vec3.normalize(along);
|
along = Vec3.normalize(along);
|
||||||
along = Vec3.multiply(along, 0.4);
|
along = Vec3.multiply(along, 0.4);
|
||||||
return Vec3.sum(handPosition, along);
|
return Vec3.sum(handPosition, along);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeLine() {
|
function removeLine() {
|
||||||
if (lineIsRezzed) {
|
if (lineIsRezzed) {
|
||||||
Entities.deleteEntity(lineEntityID);
|
Entities.deleteEntity(lineEntityID);
|
||||||
lineEntityID = null;
|
lineEntityID = null;
|
||||||
lineIsRezzed = false;
|
lineIsRezzed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createOrUpdateLine(event) {
|
function createOrUpdateLine(event) {
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
||||||
var props = Entities.getEntityProperties(intersection.entityID);
|
var props = Entities.getEntityProperties(intersection.entityID);
|
||||||
|
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
var dim = Vec3.subtract(intersection.intersection, nearLinePoint(intersection.intersection));
|
var dim = Vec3.subtract(intersection.intersection, nearLinePoint(intersection.intersection));
|
||||||
if (lineIsRezzed) {
|
if (lineIsRezzed) {
|
||||||
Entities.editEntity(lineEntityID, {
|
Entities.editEntity(lineEntityID, {
|
||||||
position: nearLinePoint(intersection.intersection),
|
position: nearLinePoint(intersection.intersection),
|
||||||
dimensions: dim,
|
dimensions: dim,
|
||||||
lifetime: 15 + props.lifespan // renew lifetime
|
lifetime: 15 + props.lifespan // renew lifetime
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
lineIsRezzed = true;
|
|
||||||
lineEntityID = Entities.addEntity({
|
|
||||||
type: "Line",
|
|
||||||
position: nearLinePoint(intersection.intersection),
|
|
||||||
dimensions: dim,
|
|
||||||
color: { red: 255, green: 255, blue: 255 },
|
|
||||||
lifetime: 15 // if someone crashes while pointing, don't leave the line there forever.
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
removeLine();
|
lineIsRezzed = true;
|
||||||
|
lineEntityID = Entities.addEntity({
|
||||||
|
type: "Line",
|
||||||
|
position: nearLinePoint(intersection.intersection),
|
||||||
|
dimensions: dim,
|
||||||
|
color: {
|
||||||
|
red: 255,
|
||||||
|
green: 255,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
lifetime: 15 // if someone crashes while pointing, don't leave the line there forever.
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
removeLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
if (!event.isLeftButton) {
|
if (!event.isLeftButton || altHeld) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||||
createOrUpdateLine(event);
|
createOrUpdateLine(event);
|
||||||
}
|
lineCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function mouseMoveEvent(event) {
|
function mouseMoveEvent(event) {
|
||||||
createOrUpdateLine(event);
|
createOrUpdateLine(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function mouseReleaseEvent(event) {
|
function mouseReleaseEvent(event) {
|
||||||
if (!event.isLeftButton) {
|
if (!lineCreated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Controller.mouseMoveEvent.disconnect(mouseMoveEvent);
|
Controller.mouseMoveEvent.disconnect(mouseMoveEvent);
|
||||||
removeLine();
|
removeLine();
|
||||||
|
lineCreated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyPressEvent(event) {
|
||||||
|
if (event.text == "ALT") {
|
||||||
|
altHeld = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyReleaseEvent(event) {
|
||||||
|
if (event.text == "ALT") {
|
||||||
|
altHeld = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(mousePressEvent);
|
Controller.mousePressEvent.connect(mousePressEvent);
|
||||||
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
||||||
|
|
||||||
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
|
@ -38,6 +38,7 @@ static const QString DDE_PROGRAM_PATH = "/dde.app/Contents/MacOS/dde";
|
||||||
static const QStringList DDE_ARGUMENTS = QStringList()
|
static const QStringList DDE_ARGUMENTS = QStringList()
|
||||||
<< "--udp=" + DDE_SERVER_ADDR.toString() + ":" + QString::number(DDE_SERVER_PORT)
|
<< "--udp=" + DDE_SERVER_ADDR.toString() + ":" + QString::number(DDE_SERVER_PORT)
|
||||||
<< "--receiver=" + QString::number(DDE_CONTROL_PORT)
|
<< "--receiver=" + QString::number(DDE_CONTROL_PORT)
|
||||||
|
<< "--facedet_interval=500" // ms
|
||||||
<< "--headless";
|
<< "--headless";
|
||||||
|
|
||||||
static const int NUM_EXPRESSIONS = 46;
|
static const int NUM_EXPRESSIONS = 46;
|
||||||
|
|
|
@ -1017,6 +1017,14 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
glLineWidth(1.0f);
|
glLineWidth(1.0f);
|
||||||
glPointSize(1.0f);
|
glPointSize(1.0f);
|
||||||
|
|
||||||
|
// Determine whether to compute timing details
|
||||||
|
bool shouldDisplayTimingDetail = Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||||
|
Stats::getInstance()->isExpanded();
|
||||||
|
if (shouldDisplayTimingDetail != PerformanceTimer::isActive()) {
|
||||||
|
PerformanceTimer::setActive(shouldDisplayTimingDetail);
|
||||||
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
|
||||||
// let's set horizontal offset to give stats some margin to mirror
|
// let's set horizontal offset to give stats some margin to mirror
|
||||||
int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
|
int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
|
||||||
|
|
|
@ -59,6 +59,7 @@ JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
|
||||||
connect(_scriptEngine, SIGNAL(evaluationFinished(QScriptValue, bool)),
|
connect(_scriptEngine, SIGNAL(evaluationFinished(QScriptValue, bool)),
|
||||||
this, SLOT(handleEvalutationFinished(QScriptValue, bool)));
|
this, SLOT(handleEvalutationFinished(QScriptValue, bool)));
|
||||||
connect(_scriptEngine, SIGNAL(printedMessage(const QString&)), this, SLOT(handlePrint(const QString&)));
|
connect(_scriptEngine, SIGNAL(printedMessage(const QString&)), this, SLOT(handlePrint(const QString&)));
|
||||||
|
connect(_scriptEngine, SIGNAL(errorMessage(const QString&)), this, SLOT(handleError(const QString&)));
|
||||||
|
|
||||||
resizeTextInput();
|
resizeTextInput();
|
||||||
}
|
}
|
||||||
|
@ -96,6 +97,10 @@ void JSConsole::handleEvalutationFinished(QScriptValue result, bool isException)
|
||||||
appendMessage(gutter, resultStr);
|
appendMessage(gutter, resultStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JSConsole::handleError(const QString& message) {
|
||||||
|
appendMessage(GUTTER_ERROR, "<span style='" + RESULT_ERROR_STYLE + "'>" + message.toHtmlEscaped() + "</span>");
|
||||||
|
}
|
||||||
|
|
||||||
void JSConsole::handlePrint(const QString& message) {
|
void JSConsole::handlePrint(const QString& message) {
|
||||||
appendMessage("", message);
|
appendMessage("", message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ protected slots:
|
||||||
void resizeTextInput();
|
void resizeTextInput();
|
||||||
void handleEvalutationFinished(QScriptValue result, bool isException);
|
void handleEvalutationFinished(QScriptValue result, bool isException);
|
||||||
void handlePrint(const QString& message);
|
void handlePrint(const QString& message);
|
||||||
|
void handleError(const QString& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void appendMessage(const QString& gutter, const QString& message);
|
void appendMessage(const QString& gutter, const QString& message);
|
||||||
|
|
|
@ -224,9 +224,10 @@ void Stats::display(
|
||||||
lines = 5;
|
lines = 5;
|
||||||
int columnOneWidth = _generalStatsWidth;
|
int columnOneWidth = _generalStatsWidth;
|
||||||
|
|
||||||
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
|
bool performanceTimerIsActive = PerformanceTimer::isActive();
|
||||||
|
bool displayPerf = _expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails);
|
||||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
|
if (displayPerf && performanceTimerIsActive) {
|
||||||
|
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
|
||||||
|
|
||||||
columnOneWidth = _generalStatsWidth + _pingStatsWidth + _geoStatsWidth; // 3 columns wide...
|
columnOneWidth = _generalStatsWidth + _pingStatsWidth + _geoStatsWidth; // 3 columns wide...
|
||||||
// we will also include room for 1 line per timing record and a header of 4 lines
|
// we will also include room for 1 line per timing record and a header of 4 lines
|
||||||
|
@ -276,7 +277,7 @@ void Stats::display(
|
||||||
|
|
||||||
|
|
||||||
// TODO: the display of these timing details should all be moved to JavaScript
|
// TODO: the display of these timing details should all be moved to JavaScript
|
||||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
|
if (displayPerf && performanceTimerIsActive) {
|
||||||
bool onlyDisplayTopTen = Menu::getInstance()->isOptionChecked(MenuOption::OnlyDisplayTopTen);
|
bool onlyDisplayTopTen = Menu::getInstance()->isOptionChecked(MenuOption::OnlyDisplayTopTen);
|
||||||
// Timing details...
|
// Timing details...
|
||||||
verticalOffset += STATS_PELS_PER_LINE * 4; // skip 3 lines to be under the other columns
|
verticalOffset += STATS_PELS_PER_LINE * 4; // skip 3 lines to be under the other columns
|
||||||
|
|
|
@ -27,6 +27,8 @@ public:
|
||||||
static void drawBackground(unsigned int rgba, int x, int y, int width, int height);
|
static void drawBackground(unsigned int rgba, int x, int y, int width, int height);
|
||||||
|
|
||||||
void toggleExpanded();
|
void toggleExpanded();
|
||||||
|
bool isExpanded() { return _expanded; }
|
||||||
|
|
||||||
void checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset);
|
void checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset);
|
||||||
void resetWidth(int width, int horizontalOffset);
|
void resetWidth(int width, int horizontalOffset);
|
||||||
void display(const float* color, int horizontalOffset, float fps, int inPacketsPerSecond, int outPacketsPerSecond,
|
void display(const float* color, int horizontalOffset, float fps, int inPacketsPerSecond, int outPacketsPerSecond,
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Don't respond to small continuous contacts.
|
// Don't respond to small continuous contacts.
|
||||||
const float COLLISION_MINUMUM_PENETRATION = 0.005;
|
const float COLLISION_MINUMUM_PENETRATION = 0.005f;
|
||||||
if ((collision.type != CONTACT_EVENT_TYPE_START) && (glm::length(collision.penetration) < COLLISION_MINUMUM_PENETRATION)) {
|
if ((collision.type != CONTACT_EVENT_TYPE_START) && (glm::length(collision.penetration) < COLLISION_MINUMUM_PENETRATION)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
|
|
||||||
const float DPI = 30.47;
|
const float DPI = 30.47f;
|
||||||
const float METERS_TO_INCHES = 39.3701;
|
const float METERS_TO_INCHES = 39.3701f;
|
||||||
|
|
||||||
EntityItem* RenderableWebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItem* RenderableWebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return new RenderableWebEntityItem(entityID, properties);
|
return new RenderableWebEntityItem(entityID, properties);
|
||||||
|
|
|
@ -35,76 +35,76 @@ EntityPropertyList PROP_LAST_ITEM = (EntityPropertyList)(PROP_AFTER_LAST_ITEM -
|
||||||
|
|
||||||
EntityItemProperties::EntityItemProperties() :
|
EntityItemProperties::EntityItemProperties() :
|
||||||
|
|
||||||
CONSTRUCT_PROPERTY(visible, ENTITY_ITEM_DEFAULT_VISIBLE),
|
CONSTRUCT_PROPERTY(visible, ENTITY_ITEM_DEFAULT_VISIBLE),
|
||||||
CONSTRUCT_PROPERTY(position, 0),
|
CONSTRUCT_PROPERTY(position, 0),
|
||||||
CONSTRUCT_PROPERTY(dimensions, ENTITY_ITEM_DEFAULT_DIMENSIONS),
|
CONSTRUCT_PROPERTY(dimensions, ENTITY_ITEM_DEFAULT_DIMENSIONS),
|
||||||
CONSTRUCT_PROPERTY(rotation, ENTITY_ITEM_DEFAULT_ROTATION),
|
CONSTRUCT_PROPERTY(rotation, ENTITY_ITEM_DEFAULT_ROTATION),
|
||||||
CONSTRUCT_PROPERTY(density, ENTITY_ITEM_DEFAULT_DENSITY),
|
CONSTRUCT_PROPERTY(density, ENTITY_ITEM_DEFAULT_DENSITY),
|
||||||
CONSTRUCT_PROPERTY(velocity, ENTITY_ITEM_DEFAULT_VELOCITY),
|
CONSTRUCT_PROPERTY(velocity, ENTITY_ITEM_DEFAULT_VELOCITY),
|
||||||
CONSTRUCT_PROPERTY(gravity, ENTITY_ITEM_DEFAULT_GRAVITY),
|
CONSTRUCT_PROPERTY(gravity, ENTITY_ITEM_DEFAULT_GRAVITY),
|
||||||
CONSTRUCT_PROPERTY(acceleration, ENTITY_ITEM_DEFAULT_ACCELERATION),
|
CONSTRUCT_PROPERTY(acceleration, ENTITY_ITEM_DEFAULT_ACCELERATION),
|
||||||
CONSTRUCT_PROPERTY(damping, ENTITY_ITEM_DEFAULT_DAMPING),
|
CONSTRUCT_PROPERTY(damping, ENTITY_ITEM_DEFAULT_DAMPING),
|
||||||
CONSTRUCT_PROPERTY(restitution, ENTITY_ITEM_DEFAULT_RESTITUTION),
|
CONSTRUCT_PROPERTY(restitution, ENTITY_ITEM_DEFAULT_RESTITUTION),
|
||||||
CONSTRUCT_PROPERTY(friction, ENTITY_ITEM_DEFAULT_FRICTION),
|
CONSTRUCT_PROPERTY(friction, ENTITY_ITEM_DEFAULT_FRICTION),
|
||||||
CONSTRUCT_PROPERTY(lifetime, ENTITY_ITEM_DEFAULT_LIFETIME),
|
CONSTRUCT_PROPERTY(lifetime, ENTITY_ITEM_DEFAULT_LIFETIME),
|
||||||
CONSTRUCT_PROPERTY(script, ENTITY_ITEM_DEFAULT_SCRIPT),
|
CONSTRUCT_PROPERTY(script, ENTITY_ITEM_DEFAULT_SCRIPT),
|
||||||
CONSTRUCT_PROPERTY(collisionSoundURL, ENTITY_ITEM_DEFAULT_COLLISION_SOUND_URL),
|
CONSTRUCT_PROPERTY(collisionSoundURL, ENTITY_ITEM_DEFAULT_COLLISION_SOUND_URL),
|
||||||
CONSTRUCT_PROPERTY(color, ),
|
CONSTRUCT_PROPERTY(color, ),
|
||||||
CONSTRUCT_PROPERTY(modelURL, ""),
|
CONSTRUCT_PROPERTY(modelURL, ""),
|
||||||
CONSTRUCT_PROPERTY(compoundShapeURL, ""),
|
CONSTRUCT_PROPERTY(compoundShapeURL, ""),
|
||||||
CONSTRUCT_PROPERTY(animationURL, ""),
|
CONSTRUCT_PROPERTY(animationURL, ""),
|
||||||
CONSTRUCT_PROPERTY(animationFPS, ModelEntityItem::DEFAULT_ANIMATION_FPS),
|
CONSTRUCT_PROPERTY(animationFPS, ModelEntityItem::DEFAULT_ANIMATION_FPS),
|
||||||
CONSTRUCT_PROPERTY(animationFrameIndex, ModelEntityItem::DEFAULT_ANIMATION_FRAME_INDEX),
|
CONSTRUCT_PROPERTY(animationFrameIndex, ModelEntityItem::DEFAULT_ANIMATION_FRAME_INDEX),
|
||||||
CONSTRUCT_PROPERTY(animationIsPlaying, ModelEntityItem::DEFAULT_ANIMATION_IS_PLAYING),
|
CONSTRUCT_PROPERTY(animationIsPlaying, ModelEntityItem::DEFAULT_ANIMATION_IS_PLAYING),
|
||||||
CONSTRUCT_PROPERTY(registrationPoint, ENTITY_ITEM_DEFAULT_REGISTRATION_POINT),
|
CONSTRUCT_PROPERTY(registrationPoint, ENTITY_ITEM_DEFAULT_REGISTRATION_POINT),
|
||||||
CONSTRUCT_PROPERTY(angularVelocity, ENTITY_ITEM_DEFAULT_ANGULAR_VELOCITY),
|
CONSTRUCT_PROPERTY(angularVelocity, ENTITY_ITEM_DEFAULT_ANGULAR_VELOCITY),
|
||||||
CONSTRUCT_PROPERTY(angularDamping, ENTITY_ITEM_DEFAULT_ANGULAR_DAMPING),
|
CONSTRUCT_PROPERTY(angularDamping, ENTITY_ITEM_DEFAULT_ANGULAR_DAMPING),
|
||||||
CONSTRUCT_PROPERTY(ignoreForCollisions, ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS),
|
CONSTRUCT_PROPERTY(ignoreForCollisions, ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS),
|
||||||
CONSTRUCT_PROPERTY(collisionsWillMove, ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE),
|
CONSTRUCT_PROPERTY(collisionsWillMove, ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE),
|
||||||
CONSTRUCT_PROPERTY(isSpotlight, false),
|
CONSTRUCT_PROPERTY(isSpotlight, false),
|
||||||
CONSTRUCT_PROPERTY(intensity, 1.0f),
|
CONSTRUCT_PROPERTY(intensity, 1.0f),
|
||||||
CONSTRUCT_PROPERTY(exponent, 0.0f),
|
CONSTRUCT_PROPERTY(exponent, 0.0f),
|
||||||
CONSTRUCT_PROPERTY(cutoff, ENTITY_ITEM_DEFAULT_CUTOFF),
|
CONSTRUCT_PROPERTY(cutoff, ENTITY_ITEM_DEFAULT_CUTOFF),
|
||||||
CONSTRUCT_PROPERTY(locked, ENTITY_ITEM_DEFAULT_LOCKED),
|
CONSTRUCT_PROPERTY(locked, ENTITY_ITEM_DEFAULT_LOCKED),
|
||||||
CONSTRUCT_PROPERTY(textures, ""),
|
CONSTRUCT_PROPERTY(textures, ""),
|
||||||
CONSTRUCT_PROPERTY(animationSettings, ""),
|
CONSTRUCT_PROPERTY(animationSettings, ""),
|
||||||
CONSTRUCT_PROPERTY(userData, ENTITY_ITEM_DEFAULT_USER_DATA),
|
CONSTRUCT_PROPERTY(userData, ENTITY_ITEM_DEFAULT_USER_DATA),
|
||||||
CONSTRUCT_PROPERTY(simulatorID, ENTITY_ITEM_DEFAULT_SIMULATOR_ID),
|
CONSTRUCT_PROPERTY(simulatorID, ENTITY_ITEM_DEFAULT_SIMULATOR_ID),
|
||||||
CONSTRUCT_PROPERTY(text, TextEntityItem::DEFAULT_TEXT),
|
CONSTRUCT_PROPERTY(text, TextEntityItem::DEFAULT_TEXT),
|
||||||
CONSTRUCT_PROPERTY(lineHeight, TextEntityItem::DEFAULT_LINE_HEIGHT),
|
CONSTRUCT_PROPERTY(lineHeight, TextEntityItem::DEFAULT_LINE_HEIGHT),
|
||||||
CONSTRUCT_PROPERTY(textColor, TextEntityItem::DEFAULT_TEXT_COLOR),
|
CONSTRUCT_PROPERTY(textColor, TextEntityItem::DEFAULT_TEXT_COLOR),
|
||||||
CONSTRUCT_PROPERTY(backgroundColor, TextEntityItem::DEFAULT_BACKGROUND_COLOR),
|
CONSTRUCT_PROPERTY(backgroundColor, TextEntityItem::DEFAULT_BACKGROUND_COLOR),
|
||||||
CONSTRUCT_PROPERTY(shapeType, SHAPE_TYPE_NONE),
|
CONSTRUCT_PROPERTY(shapeType, SHAPE_TYPE_NONE),
|
||||||
CONSTRUCT_PROPERTY(maxParticles, ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES),
|
CONSTRUCT_PROPERTY(maxParticles, ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES),
|
||||||
CONSTRUCT_PROPERTY(lifespan, ParticleEffectEntityItem::DEFAULT_LIFESPAN),
|
CONSTRUCT_PROPERTY(lifespan, ParticleEffectEntityItem::DEFAULT_LIFESPAN),
|
||||||
CONSTRUCT_PROPERTY(emitRate, ParticleEffectEntityItem::DEFAULT_EMIT_RATE),
|
CONSTRUCT_PROPERTY(emitRate, ParticleEffectEntityItem::DEFAULT_EMIT_RATE),
|
||||||
CONSTRUCT_PROPERTY(emitDirection, ParticleEffectEntityItem::DEFAULT_EMIT_DIRECTION),
|
CONSTRUCT_PROPERTY(emitDirection, ParticleEffectEntityItem::DEFAULT_EMIT_DIRECTION),
|
||||||
CONSTRUCT_PROPERTY(emitStrength, ParticleEffectEntityItem::DEFAULT_EMIT_STRENGTH),
|
CONSTRUCT_PROPERTY(emitStrength, ParticleEffectEntityItem::DEFAULT_EMIT_STRENGTH),
|
||||||
CONSTRUCT_PROPERTY(localGravity, ParticleEffectEntityItem::DEFAULT_LOCAL_GRAVITY),
|
CONSTRUCT_PROPERTY(localGravity, ParticleEffectEntityItem::DEFAULT_LOCAL_GRAVITY),
|
||||||
CONSTRUCT_PROPERTY(particleRadius, ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS),
|
CONSTRUCT_PROPERTY(particleRadius, ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS),
|
||||||
CONSTRUCT_PROPERTY(marketplaceID, ENTITY_ITEM_DEFAULT_MARKETPLACE_ID),
|
CONSTRUCT_PROPERTY(marketplaceID, ENTITY_ITEM_DEFAULT_MARKETPLACE_ID),
|
||||||
CONSTRUCT_PROPERTY(keyLightColor, ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR),
|
CONSTRUCT_PROPERTY(keyLightColor, ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR),
|
||||||
CONSTRUCT_PROPERTY(keyLightIntensity, ZoneEntityItem::DEFAULT_KEYLIGHT_INTENSITY),
|
CONSTRUCT_PROPERTY(keyLightIntensity, ZoneEntityItem::DEFAULT_KEYLIGHT_INTENSITY),
|
||||||
CONSTRUCT_PROPERTY(keyLightAmbientIntensity, ZoneEntityItem::DEFAULT_KEYLIGHT_AMBIENT_INTENSITY),
|
CONSTRUCT_PROPERTY(keyLightAmbientIntensity, ZoneEntityItem::DEFAULT_KEYLIGHT_AMBIENT_INTENSITY),
|
||||||
CONSTRUCT_PROPERTY(keyLightDirection, ZoneEntityItem::DEFAULT_KEYLIGHT_DIRECTION),
|
CONSTRUCT_PROPERTY(keyLightDirection, ZoneEntityItem::DEFAULT_KEYLIGHT_DIRECTION),
|
||||||
CONSTRUCT_PROPERTY(name, ENTITY_ITEM_DEFAULT_NAME),
|
CONSTRUCT_PROPERTY(name, ENTITY_ITEM_DEFAULT_NAME),
|
||||||
CONSTRUCT_PROPERTY(backgroundMode, BACKGROUND_MODE_INHERIT),
|
CONSTRUCT_PROPERTY(backgroundMode, BACKGROUND_MODE_INHERIT),
|
||||||
CONSTRUCT_PROPERTY(sourceUrl, ""),
|
CONSTRUCT_PROPERTY(sourceUrl, ""),
|
||||||
|
|
||||||
_id(UNKNOWN_ENTITY_ID),
|
_id(UNKNOWN_ENTITY_ID),
|
||||||
_idSet(false),
|
_idSet(false),
|
||||||
_lastEdited(0),
|
_lastEdited(0),
|
||||||
_created(UNKNOWN_CREATED_TIME),
|
_created(UNKNOWN_CREATED_TIME),
|
||||||
_type(EntityTypes::Unknown),
|
_type(EntityTypes::Unknown),
|
||||||
|
|
||||||
_glowLevel(0.0f),
|
_glowLevel(0.0f),
|
||||||
_localRenderAlpha(1.0f),
|
_localRenderAlpha(1.0f),
|
||||||
|
|
||||||
_glowLevelChanged(false),
|
_glowLevelChanged(false),
|
||||||
_localRenderAlphaChanged(false),
|
_localRenderAlphaChanged(false),
|
||||||
|
|
||||||
_defaultSettings(true),
|
_defaultSettings(true),
|
||||||
_naturalDimensions(1.0f, 1.0f, 1.0f)
|
_naturalDimensions(1.0f, 1.0f, 1.0f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void EntityItemProperties::setLastEdited(quint64 usecTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* shapeTypeNames[] = {"none", "box", "sphere", "ellipsoid", "plane", "compound", "capsule-x",
|
const char* shapeTypeNames[] = {"none", "box", "sphere", "ellipsoid", "plane", "compound", "capsule-x",
|
||||||
"capsule-y", "capsule-z", "cylinder-x", "cylinder-y", "cylinder-z"};
|
"capsule-y", "capsule-z", "cylinder-x", "cylinder-y", "cylinder-z"};
|
||||||
|
|
||||||
QHash<QString, ShapeType> stringToShapeTypeLookup;
|
QHash<QString, ShapeType> stringToShapeTypeLookup;
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
||||||
int propertyCount = 0;
|
int propertyCount = 0;
|
||||||
|
|
||||||
bool headerFits = successIDFits && successTypeFits && successLastEditedFits
|
bool headerFits = successIDFits && successTypeFits && successLastEditedFits
|
||||||
&& successLastUpdatedFits && successPropertyFlagsFits;
|
&& successLastUpdatedFits && successPropertyFlagsFits;
|
||||||
|
|
||||||
int startOfEntityItemData = packetData->getUncompressedByteOffset();
|
int startOfEntityItemData = packetData->getUncompressedByteOffset();
|
||||||
|
|
||||||
|
@ -706,6 +706,11 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getType() == EntityTypes::ParticleEffect) {
|
if (properties.getType() == EntityTypes::ParticleEffect) {
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_FPS, properties.getAnimationFPS());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_FRAME_INDEX, properties.getAnimationFrameIndex());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_PLAYING, properties.getAnimationIsPlaying());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, properties.getAnimationSettings());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, properties.getTextures());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, properties.getMaxParticles());
|
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, properties.getMaxParticles());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, properties.getLifespan());
|
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, properties.getLifespan());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, properties.getEmitRate());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, properties.getEmitRate());
|
||||||
|
@ -746,7 +751,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
||||||
encodedPropertyFlags = propertyFlags;
|
encodedPropertyFlags = propertyFlags;
|
||||||
int newPropertyFlagsLength = encodedPropertyFlags.length();
|
int newPropertyFlagsLength = encodedPropertyFlags.length();
|
||||||
packetData->updatePriorBytes(propertyFlagsOffset,
|
packetData->updatePriorBytes(propertyFlagsOffset,
|
||||||
(const unsigned char*)encodedPropertyFlags.constData(), encodedPropertyFlags.length());
|
(const unsigned char*)encodedPropertyFlags.constData(), encodedPropertyFlags.length());
|
||||||
|
|
||||||
// if the size of the PropertyFlags shrunk, we need to shift everything down to front of packet.
|
// if the size of the PropertyFlags shrunk, we need to shift everything down to front of packet.
|
||||||
if (newPropertyFlagsLength < oldPropertyFlagsLength) {
|
if (newPropertyFlagsLength < oldPropertyFlagsLength) {
|
||||||
|
@ -940,6 +945,12 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getType() == EntityTypes::ParticleEffect) {
|
if (properties.getType() == EntityTypes::ParticleEffect) {
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANIMATION_FPS, float, setAnimationFPS);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANIMATION_FRAME_INDEX, float, setAnimationFrameIndex);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANIMATION_PLAYING, bool, setAnimationIsPlaying);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures);
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MAX_PARTICLES, float, setMaxParticles);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MAX_PARTICLES, float, setMaxParticles);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFESPAN, float, setLifespan);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFESPAN, float, setLifespan);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_RATE, float, setEmitRate);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_RATE, float, setEmitRate);
|
||||||
|
|
|
@ -87,49 +87,50 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
|
|
||||||
QString nameForPacketType(PacketType packetType) {
|
QString nameForPacketType(PacketType packetType) {
|
||||||
switch (packetType) {
|
switch (packetType) {
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnknown);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnknown);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeStunResponse);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeStunResponse);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainList);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainList);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypePing);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypePing);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypePingReply);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypePingReply);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeKillAvatar);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeKillAvatar);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarData);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarData);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeInjectAudio);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeInjectAudio);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeMixedAudio);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeMixedAudio);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeMicrophoneAudioNoEcho);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeMicrophoneAudioNoEcho);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeMicrophoneAudioWithEcho);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeMicrophoneAudioWithEcho);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeBulkAvatarData);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeBulkAvatarData);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeSilentAudioFrame);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeSilentAudioFrame);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEnvironmentData);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEnvironmentData);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainListRequest);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainListRequest);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeRequestAssignment);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeRequestAssignment);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeCreateAssignment);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeCreateAssignment);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainConnectionDenied);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainConnectionDenied);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeMuteEnvironment);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeMuteEnvironment);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioStreamStats);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioStreamStats);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDataServerConfirm);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDataServerConfirm);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeStats);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeStats);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeJurisdiction);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeJurisdiction);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeJurisdictionRequest);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeJurisdictionRequest);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarIdentity);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarIdentity);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarBillboard);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeAvatarBillboard);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainConnectRequest);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainConnectRequest);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainServerRequireDTLS);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeDomainServerRequireDTLS);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeNodeJsonStats);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeNodeJsonStats);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityQuery);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityQuery);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityData);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityData);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityErase);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityErase);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeDataNack);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeDataNack);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeStopNode);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeStopNode);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioEnvironment);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioEnvironment);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEditNack);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEditNack);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeSignedTransactionPayment);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeSignedTransactionPayment);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeIceServerHeartbeat);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeIceServerHeartbeat);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeIceServerHeartbeatResponse);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeIceServerHeartbeatResponse);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnverifiedPing);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnverifiedPing);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnverifiedPingReply);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeUnverifiedPingReply);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityAdd);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityAdd);
|
||||||
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEdit);
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEdit);
|
||||||
|
PACKET_TYPE_NAME_LOOKUP(PacketTypeParticleEntitiesFix);
|
||||||
default:
|
default:
|
||||||
return QString("Type: ") + QString::number((int)packetType);
|
return QString("Type: ") + QString::number((int)packetType);
|
||||||
}
|
}
|
||||||
|
@ -169,10 +170,10 @@ int populatePacketHeaderWithUUID(char* packet, PacketType packetType, const QUui
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
||||||
// Pack zeros for the number of bytes that the sequence number requires.
|
// Pack zeros for the number of bytes that the sequence number requires.
|
||||||
// The LimitedNodeList will handle packing in the sequence number when sending out the packet.
|
// The LimitedNodeList will handle packing in the sequence number when sending out the packet.
|
||||||
memset(position, 0, sizeof(PacketSequenceNumber));
|
memset(position, 0, sizeof(PacketSequenceNumber));
|
||||||
position += sizeof(PacketSequenceNumber);
|
position += sizeof(PacketSequenceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the number of bytes written for pointer pushing
|
// return the number of bytes written for pointer pushing
|
||||||
|
|
|
@ -79,7 +79,8 @@ enum PacketType {
|
||||||
PacketTypeIceServerHeartbeat, // 50
|
PacketTypeIceServerHeartbeat, // 50
|
||||||
PacketTypeIceServerHeartbeatResponse,
|
PacketTypeIceServerHeartbeatResponse,
|
||||||
PacketTypeUnverifiedPing,
|
PacketTypeUnverifiedPing,
|
||||||
PacketTypeUnverifiedPingReply
|
PacketTypeUnverifiedPingReply,
|
||||||
|
PacketTypeParticleEntitiesFix
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef char PacketVersion;
|
typedef char PacketVersion;
|
||||||
|
@ -90,17 +91,17 @@ const PacketSequenceNumber DEFAULT_SEQUENCE_NUMBER = 0;
|
||||||
typedef std::map<PacketType, PacketSequenceNumber> PacketTypeSequenceMap;
|
typedef std::map<PacketType, PacketSequenceNumber> PacketTypeSequenceMap;
|
||||||
|
|
||||||
const QSet<PacketType> NON_VERIFIED_PACKETS = QSet<PacketType>()
|
const QSet<PacketType> NON_VERIFIED_PACKETS = QSet<PacketType>()
|
||||||
<< PacketTypeDomainServerRequireDTLS << PacketTypeDomainConnectRequest
|
<< PacketTypeDomainServerRequireDTLS << PacketTypeDomainConnectRequest
|
||||||
<< PacketTypeDomainList << PacketTypeDomainListRequest << PacketTypeDomainConnectionDenied
|
<< PacketTypeDomainList << PacketTypeDomainListRequest << PacketTypeDomainConnectionDenied
|
||||||
<< PacketTypeCreateAssignment << PacketTypeRequestAssignment << PacketTypeStunResponse
|
<< PacketTypeCreateAssignment << PacketTypeRequestAssignment << PacketTypeStunResponse
|
||||||
<< PacketTypeNodeJsonStats << PacketTypeEntityQuery
|
<< PacketTypeNodeJsonStats << PacketTypeEntityQuery
|
||||||
<< PacketTypeOctreeDataNack << PacketTypeEntityEditNack
|
<< PacketTypeOctreeDataNack << PacketTypeEntityEditNack
|
||||||
<< PacketTypeIceServerHeartbeat << PacketTypeIceServerHeartbeatResponse
|
<< PacketTypeIceServerHeartbeat << PacketTypeIceServerHeartbeatResponse
|
||||||
<< PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply << PacketTypeStopNode
|
<< PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply << PacketTypeStopNode
|
||||||
<< PacketTypeDomainServerPathQuery << PacketTypeDomainServerPathResponse;
|
<< PacketTypeDomainServerPathQuery << PacketTypeDomainServerPathResponse;
|
||||||
|
|
||||||
const QSet<PacketType> SEQUENCE_NUMBERED_PACKETS = QSet<PacketType>()
|
const QSet<PacketType> SEQUENCE_NUMBERED_PACKETS = QSet<PacketType>()
|
||||||
<< PacketTypeAvatarData;
|
<< PacketTypeAvatarData;
|
||||||
|
|
||||||
const int NUM_BYTES_MD5_HASH = 16;
|
const int NUM_BYTES_MD5_HASH = 16;
|
||||||
const int NUM_STATIC_HEADER_BYTES = sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID;
|
const int NUM_STATIC_HEADER_BYTES = sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID;
|
||||||
|
@ -179,5 +180,6 @@ const PacketVersion VERSION_ENTITIES_HAVE_LINE_TYPE = 24;
|
||||||
const PacketVersion VERSION_ENTITIES_HAVE_COLLISION_SOUND_URL = 25;
|
const PacketVersion VERSION_ENTITIES_HAVE_COLLISION_SOUND_URL = 25;
|
||||||
const PacketVersion VERSION_ENTITIES_HAVE_FRICTION = 26;
|
const PacketVersion VERSION_ENTITIES_HAVE_FRICTION = 26;
|
||||||
const PacketVersion VERSION_NO_ENTITY_ID_SWAP = 27;
|
const PacketVersion VERSION_NO_ENTITY_ID_SWAP = 27;
|
||||||
|
const PacketVersion VERSION_ENTITIES_PARTICLE_FIX = 28;
|
||||||
|
|
||||||
#endif // hifi_PacketHeaders_h
|
#endif // hifi_PacketHeaders_h
|
||||||
|
|
|
@ -34,9 +34,9 @@ const float VIEW_FRUSTUM_FOV_OVERSEND = 60.0f;
|
||||||
// These are guards to prevent our voxel tree recursive routines from spinning out of control
|
// These are guards to prevent our voxel tree recursive routines from spinning out of control
|
||||||
const int UNREASONABLY_DEEP_RECURSION = 29; // use this for something that you want to be shallow, but not spin out
|
const int UNREASONABLY_DEEP_RECURSION = 29; // use this for something that you want to be shallow, but not spin out
|
||||||
const int DANGEROUSLY_DEEP_RECURSION = 200; // use this for something that needs to go deeper
|
const int DANGEROUSLY_DEEP_RECURSION = 200; // use this for something that needs to go deeper
|
||||||
const float SCALE_AT_UNREASONABLY_DEEP_RECURSION = (1.0f / powf(2.0f, UNREASONABLY_DEEP_RECURSION));
|
const float SCALE_AT_UNREASONABLY_DEEP_RECURSION = (TREE_SCALE / powf(2.0f, UNREASONABLY_DEEP_RECURSION));
|
||||||
const float SCALE_AT_DANGEROUSLY_DEEP_RECURSION = (1.0f / powf(2.0f, DANGEROUSLY_DEEP_RECURSION));
|
const float SCALE_AT_DANGEROUSLY_DEEP_RECURSION = (TREE_SCALE / powf(2.0f, DANGEROUSLY_DEEP_RECURSION));
|
||||||
const float SMALLEST_REASONABLE_OCTREE_ELEMENT_SCALE = SCALE_AT_UNREASONABLY_DEEP_RECURSION * 2.0f; // 0.00006103515 meter ~1/10,0000th
|
const float SMALLEST_REASONABLE_OCTREE_ELEMENT_SCALE = SCALE_AT_UNREASONABLY_DEEP_RECURSION * 2.0f; // 0.00001525878 meter ~1/10,0000th
|
||||||
|
|
||||||
const int DEFAULT_MAX_OCTREE_PPS = 600; // the default maximum PPS we think any octree based server should send to a client
|
const int DEFAULT_MAX_OCTREE_PPS = 600; // the default maximum PPS we think any octree based server should send to a client
|
||||||
|
|
||||||
|
|
|
@ -79,26 +79,47 @@ void PerformanceTimerRecord::tallyResult(const quint64& now) {
|
||||||
// PerformanceTimer
|
// PerformanceTimer
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
std::atomic<bool> PerformanceTimer::_isActive(false);
|
||||||
QHash<QThread*, QString> PerformanceTimer::_fullNames;
|
QHash<QThread*, QString> PerformanceTimer::_fullNames;
|
||||||
QMap<QString, PerformanceTimerRecord> PerformanceTimer::_records;
|
QMap<QString, PerformanceTimerRecord> PerformanceTimer::_records;
|
||||||
|
|
||||||
|
|
||||||
PerformanceTimer::PerformanceTimer(const QString& name) :
|
PerformanceTimer::PerformanceTimer(const QString& name) {
|
||||||
_start(0),
|
if (_isActive) {
|
||||||
_name(name)
|
_name = name;
|
||||||
{
|
QString& fullName = _fullNames[QThread::currentThread()];
|
||||||
QString& fullName = _fullNames[QThread::currentThread()];
|
fullName.append("/");
|
||||||
fullName.append("/");
|
fullName.append(_name);
|
||||||
fullName.append(_name);
|
_start = usecTimestampNow();
|
||||||
_start = usecTimestampNow();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceTimer::~PerformanceTimer() {
|
PerformanceTimer::~PerformanceTimer() {
|
||||||
quint64 elapsedusec = (usecTimestampNow() - _start);
|
if (_isActive && _start != 0) {
|
||||||
QString& fullName = _fullNames[QThread::currentThread()];
|
quint64 elapsedusec = (usecTimestampNow() - _start);
|
||||||
PerformanceTimerRecord& namedRecord = _records[fullName];
|
QString& fullName = _fullNames[QThread::currentThread()];
|
||||||
namedRecord.accumulateResult(elapsedusec);
|
PerformanceTimerRecord& namedRecord = _records[fullName];
|
||||||
fullName.resize(fullName.size() - (_name.size() + 1));
|
namedRecord.accumulateResult(elapsedusec);
|
||||||
|
fullName.resize(fullName.size() - (_name.size() + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool PerformanceTimer::isActive() {
|
||||||
|
return _isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void PerformanceTimer::setActive(bool active) {
|
||||||
|
if (active != _isActive) {
|
||||||
|
_isActive.store(active);
|
||||||
|
if (!active) {
|
||||||
|
_fullNames.clear();
|
||||||
|
_records.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "PerformanceTimer has been turned" << ((active) ? "on" : "off");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
#include "SimpleMovingAverage.h"
|
#include "SimpleMovingAverage.h"
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -76,14 +77,18 @@ public:
|
||||||
PerformanceTimer(const QString& name);
|
PerformanceTimer(const QString& name);
|
||||||
~PerformanceTimer();
|
~PerformanceTimer();
|
||||||
|
|
||||||
|
static bool isActive();
|
||||||
|
static void setActive(bool active);
|
||||||
|
|
||||||
static const PerformanceTimerRecord& getTimerRecord(const QString& name) { return _records[name]; };
|
static const PerformanceTimerRecord& getTimerRecord(const QString& name) { return _records[name]; };
|
||||||
static const QMap<QString, PerformanceTimerRecord>& getAllTimerRecords() { return _records; };
|
static const QMap<QString, PerformanceTimerRecord>& getAllTimerRecords() { return _records; };
|
||||||
static void tallyAllTimerRecords();
|
static void tallyAllTimerRecords();
|
||||||
static void dumpAllTimerRecords();
|
static void dumpAllTimerRecords();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
quint64 _start;
|
quint64 _start = 0;
|
||||||
QString _name;
|
QString _name;
|
||||||
|
static std::atomic<bool> _isActive;
|
||||||
static QHash<QThread*, QString> _fullNames;
|
static QHash<QThread*, QString> _fullNames;
|
||||||
static QMap<QString, PerformanceTimerRecord> _records;
|
static QMap<QString, PerformanceTimerRecord> _records;
|
||||||
};
|
};
|
||||||
|
|
|
@ -255,27 +255,27 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) :
|
||||||
vHacdDepth = parser.value(vHacdDepthOption).toInt();
|
vHacdDepth = parser.value(vHacdDepthOption).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
float vHacdAlpha = 0.05;
|
float vHacdAlpha = 0.05f;
|
||||||
if (parser.isSet(vHacdAlphaOption)) {
|
if (parser.isSet(vHacdAlphaOption)) {
|
||||||
vHacdAlpha = parser.value(vHacdAlphaOption).toFloat();
|
vHacdAlpha = parser.value(vHacdAlphaOption).toFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
float vHacdBeta = 0.05;
|
float vHacdBeta = 0.05f;
|
||||||
if (parser.isSet(vHacdBetaOption)) {
|
if (parser.isSet(vHacdBetaOption)) {
|
||||||
vHacdBeta = parser.value(vHacdBetaOption).toFloat();
|
vHacdBeta = parser.value(vHacdBetaOption).toFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
float vHacdGamma = 0.00125;
|
float vHacdGamma = 0.00125f;
|
||||||
if (parser.isSet(vHacdGammaOption)) {
|
if (parser.isSet(vHacdGammaOption)) {
|
||||||
vHacdGamma = parser.value(vHacdGammaOption).toFloat();
|
vHacdGamma = parser.value(vHacdGammaOption).toFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
float vHacdDelta = 0.05;
|
float vHacdDelta = 0.05f;
|
||||||
if (parser.isSet(vHacdDeltaOption)) {
|
if (parser.isSet(vHacdDeltaOption)) {
|
||||||
vHacdDelta = parser.value(vHacdDeltaOption).toFloat();
|
vHacdDelta = parser.value(vHacdDeltaOption).toFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
float vHacdConcavity = 0.0025;
|
float vHacdConcavity = 0.0025f;
|
||||||
if (parser.isSet(vHacdConcavityOption)) {
|
if (parser.isSet(vHacdConcavityOption)) {
|
||||||
vHacdConcavity = parser.value(vHacdConcavityOption).toFloat();
|
vHacdConcavity = parser.value(vHacdConcavityOption).toFloat();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue