Merge branch 'master' of https://github.com/highfidelity/hifi into inline-entity-scripts

This commit is contained in:
Howard Stearns 2015-05-11 09:35:31 -07:00
commit 17e3f3b48d
7 changed files with 46 additions and 19 deletions

View file

@ -1197,7 +1197,11 @@ PropertiesTool = function(opts) {
webView.eventBridge.webEventReceived.connect(function(data) { webView.eventBridge.webEventReceived.connect(function(data) {
data = JSON.parse(data); data = JSON.parse(data);
if (data.type == "update") { if (data.type == "print") {
if (data.message) {
print(data.message);
}
} else if (data.type == "update") {
selectionManager.saveProperties(); selectionManager.saveProperties();
if (selectionManager.selections.length > 1) { if (selectionManager.selections.length > 1) {
properties = { properties = {

View file

@ -27,6 +27,7 @@ var ANGULAR_DAMPING_RATE = 0.40;
var SCREEN_TO_METERS = 0.001; var SCREEN_TO_METERS = 0.001;
var currentPosition, currentVelocity, cameraEntityDistance, currentRotation; var currentPosition, currentVelocity, cameraEntityDistance, currentRotation;
var velocityTowardTarget, desiredVelocity, addedVelocity, newVelocity, dPosition, camYaw, distanceToTarget, targetPosition; var velocityTowardTarget, desiredVelocity, addedVelocity, newVelocity, dPosition, camYaw, distanceToTarget, targetPosition;
var originalGravity;
var shouldRotate = false; var shouldRotate = false;
var dQ, theta, axisAngle, dT; var dQ, theta, axisAngle, dT;
var angularVelocity = { var angularVelocity = {
@ -65,6 +66,7 @@ function mousePressEvent(event) {
grabbedEntity = intersection.entityID; grabbedEntity = intersection.entityID;
var props = Entities.getEntityProperties(grabbedEntity) var props = Entities.getEntityProperties(grabbedEntity)
isGrabbing = true; isGrabbing = true;
originalGravity = props.gravity;
targetPosition = props.position; targetPosition = props.position;
currentPosition = props.position; currentPosition = props.position;
currentVelocity = props.velocity; currentVelocity = props.velocity;
@ -96,6 +98,11 @@ function updateDropLine(position) {
function mouseReleaseEvent() { function mouseReleaseEvent() {
if (isGrabbing) { if (isGrabbing) {
isGrabbing = false; isGrabbing = false;
Entities.editEntity(grabbedEntity, {
gravity: originalGravity
});
Overlays.editOverlay(dropLine, { Overlays.editOverlay(dropLine, {
visible: false visible: false
}); });
@ -194,7 +201,7 @@ function update(deltaTime) {
newVelocity = Vec3.subtract(newVelocity, Vec3.multiply(newVelocity, DAMPING_RATE)); newVelocity = Vec3.subtract(newVelocity, Vec3.multiply(newVelocity, DAMPING_RATE));
// Update entity // Update entity
} else { } else {
newVelocity = entityProps.velocity; newVelocity = {x: 0, y: 0, z: 0};
} }
if (shouldRotate) { if (shouldRotate) {
angularVelocity = Vec3.subtract(angularVelocity, Vec3.multiply(angularVelocity, ANGULAR_DAMPING_RATE)); angularVelocity = Vec3.subtract(angularVelocity, Vec3.multiply(angularVelocity, ANGULAR_DAMPING_RATE));
@ -204,7 +211,8 @@ function update(deltaTime) {
Entities.editEntity(grabbedEntity, { Entities.editEntity(grabbedEntity, {
velocity: newVelocity, velocity: newVelocity,
angularVelocity: angularVelocity angularVelocity: angularVelocity,
gravity: {x: 0, y: 0, z: 0}
}) })
updateDropLine(targetPosition); updateDropLine(targetPosition);
} }
@ -215,4 +223,4 @@ Controller.mousePressEvent.connect(mousePressEvent);
Controller.mouseReleaseEvent.connect(mouseReleaseEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
Controller.keyPressEvent.connect(keyPressEvent); Controller.keyPressEvent.connect(keyPressEvent);
Controller.keyReleaseEvent.connect(keyReleaseEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent);
Script.update.connect(update); Script.update.connect(update);

View file

@ -18,6 +18,12 @@
els[i].setAttribute('disabled', 'disabled'); els[i].setAttribute('disabled', 'disabled');
} }
} }
function showElements(els, show) {
for (var i = 0; i < els.length; i++) {
els[i].style.display = (show) ? 'block' : 'none';
}
}
function createEmitCheckedPropertyUpdateFunction(propertyName) { function createEmitCheckedPropertyUpdateFunction(propertyName) {
return function() { return function() {
@ -504,6 +510,8 @@
elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z;
elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars;
showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox');
showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere');
} }
if (selected) { if (selected) {
@ -1117,7 +1125,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section skybox-section property">
<div class="label">Skybox Color</div> <div class="label">Skybox Color</div>
<div class="value"> <div class="value">
<div class="input-area">R <input class="coord" type='number' id="property-zone-skybox-color-red"></input></div> <div class="input-area">R <input class="coord" type='number' id="property-zone-skybox-color-red"></input></div>
@ -1125,13 +1133,13 @@
<div class="input-area">B <input class="coord" type='number' id="property-zone-skybox-color-blue"></input></div> <div class="input-area">B <input class="coord" type='number' id="property-zone-skybox-color-blue"></input></div>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section skybox-section property">
<div class="label">Skybox URL</div> <div class="label">Skybox URL</div>
<div class="value"> <div class="value">
<input type="text" id="property-zone-skybox-url" class="url"></input> <input type="text" id="property-zone-skybox-url" class="url"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Center</div> <div class="label">Atmosphere Center</div>
<div class="value"> <div class="value">
<div class="input-area">X <br><input class="coord" type='number' id="property-zone-atmosphere-center-x"></input></div> <div class="input-area">X <br><input class="coord" type='number' id="property-zone-atmosphere-center-x"></input></div>
@ -1139,31 +1147,31 @@
<div class="input-area">Z <br><input class="coord" type='number' id="property-zone-atmosphere-center-z"></input></div> <div class="input-area">Z <br><input class="coord" type='number' id="property-zone-atmosphere-center-z"></input></div>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Inner Radius</div> <div class="label">Atmosphere Inner Radius</div>
<div class="value"> <div class="value">
<input class="coord" type='number' id="property-zone-atmosphere-inner-radius" step="1"></input> <input class="coord" type='number' id="property-zone-atmosphere-inner-radius" step="1"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Outer Radius</div> <div class="label">Atmosphere Outer Radius</div>
<div class="value"> <div class="value">
<input class="coord" type='number' id="property-zone-atmosphere-outer-radius" step="1"></input> <input class="coord" type='number' id="property-zone-atmosphere-outer-radius" step="1"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Mie Scattering</div> <div class="label">Atmosphere Mie Scattering</div>
<div class="value"> <div class="value">
<input class="coord no-spin" type='number' id="property-zone-atmosphere-mie-scattering" min="0" max="0.5" step="any"></input> <input class="coord no-spin" type='number' id="property-zone-atmosphere-mie-scattering" min="0" max="0.5" step="any"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Rayleigh Scattering</div> <div class="label">Atmosphere Rayleigh Scattering</div>
<div class="value"> <div class="value">
<input class="coord no-spin" type='number' id="property-zone-atmosphere-rayleigh-scattering" min="0" max="0.5" step="any"></input> <input class="coord no-spin" type='number' id="property-zone-atmosphere-rayleigh-scattering" min="0" max="0.5" step="any"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property">
<div class="label">Atmosphere Scattering Wavelenghts</div> <div class="label">Atmosphere Scattering Wavelenghts</div>
<div class="value"> <div class="value">
<div class="input-area">X <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-x" min="0" max="1" step="any"></input></div> <div class="input-area">X <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-x" min="0" max="1" step="any"></input></div>
@ -1171,7 +1179,7 @@
<div class="input-area">Z <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-z" min="0" max="1" step="any"></input></div> <div class="input-area">Z <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-z" min="0" max="1" step="any"></input></div>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section atmosphere-section property" style="display:none">
<span class="label">Atmosphere Has Stars</span> <span class="label">Atmosphere Has Stars</span>
<span class="value"> <span class="value">
<input type='checkbox' id="property-zone-atmosphere-has-stars"> <input type='checkbox' id="property-zone-atmosphere-has-stars">

View file

@ -56,12 +56,12 @@ public:
glm::vec4 _borderColor{ 1.0f }; glm::vec4 _borderColor{ 1.0f };
uint32 _maxAnisotropy = 16; uint32 _maxAnisotropy = 16;
uint8 _filter = FILTER_MIN_MAG_POINT;
uint8 _comparisonFunc = ALWAYS;
uint8 _wrapModeU = WRAP_REPEAT; uint8 _wrapModeU = WRAP_REPEAT;
uint8 _wrapModeV = WRAP_REPEAT; uint8 _wrapModeV = WRAP_REPEAT;
uint8 _wrapModeW = WRAP_REPEAT; uint8 _wrapModeW = WRAP_REPEAT;
uint8 _filter = FILTER_MIN_MAG_POINT;
uint8 _comparisonFunc = ALWAYS;
uint8 _mipOffset = 0; uint8 _mipOffset = 0;
uint8 _minMip = 0; uint8 _minMip = 0;

View file

@ -241,7 +241,7 @@ float Resource::getLoadPriority() {
} }
void Resource::refresh() { void Resource::refresh() {
if (_reply == nullptr && !(_loaded || _failedToLoad)) { if (_reply && !(_loaded || _failedToLoad)) {
return; return;
} }
if (_reply) { if (_reply) {
@ -351,6 +351,7 @@ void Resource::maybeRefresh() {
QDateTime lastModifiedOld = metaData.lastModified(); QDateTime lastModifiedOld = metaData.lastModified();
if (lastModified.isValid() && lastModifiedOld.isValid() && if (lastModified.isValid() && lastModifiedOld.isValid() &&
lastModifiedOld == lastModified) { lastModifiedOld == lastModified) {
qCDebug(networking) << "Using cached version of" << _url.fileName();
// We don't need to update, return // We don't need to update, return
return; return;
} }

View file

@ -16,7 +16,7 @@
#include "OctreeConstants.h" #include "OctreeConstants.h"
#include "OctreeQuery.h" #include "OctreeQuery.h"
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPSSpin", DEFAULT_MAX_OCTREE_PPS); Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
OctreeQuery::OctreeQuery() { OctreeQuery::OctreeQuery() {
_maxOctreePPS = maxOctreePacketsPerSecond.get(); _maxOctreePPS = maxOctreePacketsPerSecond.get();

View file

@ -2068,6 +2068,12 @@ void Model::segregateMeshGroups() {
bool hasSpecular = mesh.hasSpecularTexture(); bool hasSpecular = mesh.hasSpecularTexture();
bool hasLightmap = mesh.hasEmissiveTexture(); bool hasLightmap = mesh.hasEmissiveTexture();
bool isSkinned = state.clusterMatrices.size() > 1; bool isSkinned = state.clusterMatrices.size() > 1;
bool wireframe = isWireframe();
if (wireframe) {
translucentMesh = hasTangents = hasSpecular = hasLightmap = isSkinned = false;
}
QString materialID; QString materialID;
// create a material name from all the parts. If there's one part, this will be a single material and its // create a material name from all the parts. If there's one part, this will be a single material and its
@ -2085,7 +2091,7 @@ void Model::segregateMeshGroups() {
qCDebug(renderutils) << "materialID:" << materialID << "parts:" << mesh.parts.size(); qCDebug(renderutils) << "materialID:" << materialID << "parts:" << mesh.parts.size();
} }
RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, isWireframe()); RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe);
// reuse or create the bucket corresponding to that key and insert the mesh as unsorted // reuse or create the bucket corresponding to that key and insert the mesh as unsorted
_renderBuckets[key.getRaw()]._unsortedMeshes.insertMulti(materialID, i); _renderBuckets[key.getRaw()]._unsortedMeshes.insertMulti(materialID, i);