Merge branch 'master' into ping_pong_gun

This commit is contained in:
James B. Pollack 2015-10-05 10:54:21 -07:00
commit 588a256304
11 changed files with 44 additions and 28 deletions

View file

@ -264,7 +264,6 @@ var toolBar = (function () {
cameraManager.disable();
} else {
hasShownPropertiesTool = false;
cameraManager.enable();
entityListTool.setVisible(true);
gridTool.setVisible(true);
grid.setEnabled(true);
@ -675,15 +674,11 @@ function mouseMove(event) {
lastMousePosition = { x: event.x, y: event.y };
highlightEntityUnderCursor(lastMousePosition, false);
idleMouseTimerId = Script.setTimeout(handleIdleMouse, IDLE_MOUSE_TIMEOUT);
}
function handleIdleMouse() {
idleMouseTimerId = null;
if (isActive) {
highlightEntityUnderCursor(lastMousePosition, true);
}
}
function highlightEntityUnderCursor(position, accurateRay) {
@ -807,6 +802,7 @@ function mouseClickEvent(event) {
selectionDisplay.select(selectedEntityID, event);
if (Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)) {
cameraManager.enable();
cameraManager.focus(selectionManager.worldPosition,
selectionManager.worldDimensions,
Menu.isOptionChecked(MENU_EASE_ON_FOCUS));
@ -1147,6 +1143,7 @@ Controller.keyReleaseEvent.connect(function (event) {
} else if (event.text == "f") {
if (isActive) {
if (selectionManager.hasSelection()) {
cameraManager.enable();
cameraManager.focus(selectionManager.worldPosition,
selectionManager.worldDimensions,
Menu.isOptionChecked(MENU_EASE_ON_FOCUS));

View file

@ -56,7 +56,7 @@ EntityListTool = function(opts) {
var selectedIDs = [];
for (var i = 0; i < selectionManager.selections.length; i++) {
selectedIDs.push(selectionManager.selections[i].id); // ?
selectedIDs.push(selectionManager.selections[i].id);
}
var data = {
@ -77,6 +77,7 @@ EntityListTool = function(opts) {
}
selectionManager.setSelections(entityIDs);
if (data.focus) {
cameraManager.enable();
cameraManager.focus(selectionManager.worldPosition,
selectionManager.worldDimensions,
Menu.isOptionChecked(MENU_EASE_ON_FOCUS));

View file

@ -9,7 +9,7 @@
//
(function() {
(function () {
// Script.include("../libraries/utils.js");
//Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge
@ -33,19 +33,19 @@
var MIN_POINT_DISTANCE = 0.01;
var STROKE_WIDTH = 0.02;
this.setRightHand = function() {
this.setRightHand = function () {
this.hand = 'RIGHT';
}
this.setLeftHand = function() {
this.setLeftHand = function () {
this.hand = 'LEFT';
}
this.startNearGrab = function() {
this.startNearGrab = function () {
this.whichHand = this.hand;
}
this.toggleWithTriggerPressure = function() {
this.toggleWithTriggerPressure = function () {
var handClickString = this.whichHand + "_HAND_CLICK";
var handClick = Controller.findAction(handClickString);
@ -60,7 +60,7 @@
}
}
this.enableStream = function() {
this.enableStream = function () {
var position = Entities.getEntityProperties(this.entityId, "position").position;
var animationSettings = JSON.stringify({
fps: 30,
@ -85,6 +85,11 @@
particleRadius: 0.01,
radiusSpread: 0.005,
polarFinish: 0.05,
colorStart: {
red: 50,
green: 10,
blue: 150
},
color: {
red: 170,
green: 20,
@ -105,11 +110,11 @@
}
this.releaseGrab = function() {
this.releaseGrab = function () {
this.disableStream();
}
this.disableStream = function() {
this.disableStream = function () {
Entities.deleteEntity(this.paintStream);
this.paintStream = null;
this.spraying = false;
@ -117,7 +122,7 @@
}
this.continueNearGrab = function() {
this.continueNearGrab = function () {
this.toggleWithTriggerPressure();
@ -143,7 +148,7 @@
});
}
this.preload = function(entityId) {
this.preload = function (entityId) {
this.sprayVolume = 0.1;
this.spraying = false;
this.entityId = entityId;
@ -151,12 +156,9 @@
}
this.unload = function() {
this.unload = function () {
if (this.paintStream) {
Entities.deleteEntity(this.paintStream);
}
this.strokes.forEach(function(stroke) {
Entities.deleteEntity(stroke);
});
}
});
});

View file

@ -2764,12 +2764,19 @@ void Application::cameraMenuChanged() {
}
void Application::reloadResourceCaches() {
// Clear entities out of view frustum
_viewFrustum.setPosition(glm::vec3(0.0f, 0.0f, TREE_SCALE));
_viewFrustum.setOrientation(glm::quat());
queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions);
emptyLocalCache();
DependencyManager::get<AnimationCache>()->refreshAll();
DependencyManager::get<ModelCache>()->refreshAll();
DependencyManager::get<SoundCache>()->refreshAll();
DependencyManager::get<TextureCache>()->refreshAll();
DependencyManager::get<NodeList>()->reset(); // Force redownload of .fst models
}
void Application::rotationModeChanged() {

View file

@ -79,6 +79,7 @@ public:
glm::mat4 localToVoxelMatrix() const;
virtual ShapeType getShapeType() const;
virtual bool shouldBePhysical() const { return true; }
virtual bool isReadyToComputeShape();
virtual void computeShapeInfo(ShapeInfo& info);

View file

@ -52,6 +52,7 @@ public:
}
virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; }
virtual bool shouldBePhysical() const { return true; }
virtual void debugDump() const;

View file

@ -334,7 +334,7 @@ public:
bool getCollisionsWillMove() const { return _collisionsWillMove; }
void setCollisionsWillMove(bool value) { _collisionsWillMove = value; }
virtual bool shouldBePhysical() const { return !_ignoreForCollisions; }
virtual bool shouldBePhysical() const { return false; }
bool getLocked() const { return _locked; }
void setLocked(bool value) { _locked = value; }

View file

@ -466,5 +466,5 @@ QString ModelEntityItem::getAnimationSettings() const {
// virtual
bool ModelEntityItem::shouldBePhysical() const {
return EntityItem::shouldBePhysical() && getShapeType() != SHAPE_TYPE_NONE;
return getShapeType() != SHAPE_TYPE_NONE;
}

View file

@ -51,6 +51,7 @@ public:
}
virtual ShapeType getShapeType() const { return SHAPE_TYPE_SPHERE; }
virtual bool shouldBePhysical() const { return true; }
virtual bool supportsDetailedRayIntersection() const { return true; }
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,

View file

@ -596,6 +596,12 @@ QString EntityMotionState::getName() {
// virtual
int16_t EntityMotionState::computeCollisionGroup() {
if (!_entity) {
return COLLISION_GROUP_STATIC;
}
if (_entity->getIgnoreForCollisions()) {
return COLLISION_GROUP_COLLISIONLESS;
}
switch (computeObjectMotionType()){
case MOTION_TYPE_STATIC:
return COLLISION_GROUP_STATIC;

View file

@ -37,11 +37,11 @@ enum MotionStateType {
// The update flags trigger two varieties of updates: "hard" which require the body to be pulled
// and re-added to the physics engine and "easy" which just updates the body properties.
const uint32_t HARD_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_MOTION_TYPE | EntityItem::DIRTY_SHAPE);
const uint32_t HARD_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_MOTION_TYPE | EntityItem::DIRTY_SHAPE |
EntityItem::DIRTY_COLLISION_GROUP);
const uint32_t EASY_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_TRANSFORM | EntityItem::DIRTY_VELOCITIES |
EntityItem::DIRTY_MASS | EntityItem::DIRTY_COLLISION_GROUP |
EntityItem::DIRTY_MATERIAL | EntityItem::DIRTY_SIMULATOR_ID |
EntityItem::DIRTY_SIMULATOR_OWNERSHIP);
EntityItem::DIRTY_MASS | EntityItem::DIRTY_MATERIAL |
EntityItem::DIRTY_SIMULATOR_ID | EntityItem::DIRTY_SIMULATOR_OWNERSHIP);
// These are the set of incoming flags that the PhysicsEngine needs to hear about:
const uint32_t DIRTY_PHYSICS_FLAGS = (uint32_t)(HARD_DIRTY_PHYSICS_FLAGS | EASY_DIRTY_PHYSICS_FLAGS |