From 3f5cd0237d351556d0d9106e801a9d063df3e569 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 10 Nov 2015 17:29:15 -0800 Subject: [PATCH] Added header to dynamicLoader and removed files that are not ready for merging --- examples/marketplace/dynamicLoader.js | 14 ++++ examples/marketplace/marketplaceSpawner.js | 82 ---------------------- examples/marketplace/modelSwap.js | 41 ----------- 3 files changed, 14 insertions(+), 123 deletions(-) delete mode 100644 examples/marketplace/marketplaceSpawner.js delete mode 100644 examples/marketplace/modelSwap.js diff --git a/examples/marketplace/dynamicLoader.js b/examples/marketplace/dynamicLoader.js index bc7f4f5fb9..674b6e86cd 100644 --- a/examples/marketplace/dynamicLoader.js +++ b/examples/marketplace/dynamicLoader.js @@ -1,3 +1,17 @@ +// +// dynamicLoader.js +// examples +// +// Created by Eric Levin on 11/10/2015. +// Copyright 2013 High Fidelity, Inc. +// +// This is script loads models from a specified directory +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html + + + var BASE_URL = "https://hifi-public.s3.amazonaws.com/"; var models = []; var floorPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));; diff --git a/examples/marketplace/marketplaceSpawner.js b/examples/marketplace/marketplaceSpawner.js deleted file mode 100644 index 6799ed63a3..0000000000 --- a/examples/marketplace/marketplaceSpawner.js +++ /dev/null @@ -1,82 +0,0 @@ -var floorPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));; -floorPosition.y = MyAvatar.position.y - 5; - -Script.include('../libraries/utils.js'); - -var entityScriptURL = Script.resolvePath("modelSwap.js"); - -var modelsToLoad = [{ - lowURL: "https://s3.amazonaws.com/hifi-public/ozan/3d_marketplace/sets/dojo/dojo_low.fbx", - highURL: "https://s3.amazonaws.com/hifi-public/ozan/3d_marketplace/sets/dojo/dojo_hi.fbx" -}, { - lowURL: "https://s3.amazonaws.com/hifi-public/ozan/3d_marketplace/sets/tuscany/tuscany_low.fbx", - highURL: "https://s3.amazonaws.com/hifi-public/ozan/3d_marketplace/sets/tuscany/tuscany_hi.fbx" -}]; - -var models = []; - -var floor = Entities.addEntity({ - type: "Model", - modelURL: "https://hifi-public.s3.amazonaws.com/ozan/3d_marketplace/props/floor/3d_mp_floor.fbx", - position: floorPosition, - shapeType: 'box', - dimensions: { - x: 1000, - y: 9, - z: 1000 - } -}); - -//Create grid -var modelParams = { - type: "Model", - dimensions: { - x: 31.85, - y: 7.75, - z: 54.51 - }, - script: entityScriptURL, - userData: JSON.stringify({ - grabbableKey: { - wantsTrigger: true - } - }) - -}; - -var modelPosition = { - x: floorPosition.x + 10, - y: floorPosition.y + 8.5, - z: floorPosition.z - 30 -}; -for (var i = 0; i < modelsToLoad.length; i++) { - modelParams.modelURL = modelsToLoad[i].lowURL; - modelParams.position = modelPosition; - var lowModel = Entities.addEntity(modelParams); - - modelParams.modelURL = modelsToLoad[i].highURL; - modelParams.visible = false; - modelParams.dimensions = Vec3.multiply(modelParams.dimensions, 0.5); - var highModel = Entities.addEntity(modelParams); - models.push({ - low: lowModel, - high: highModel - }); - // customKey, id, data - setEntityCustomData('modelCounterpart', lowModel, {modelCounterpartId: highModel}); - setEntityCustomData('modelCounterpart', highModel, {modelCounterpartId: lowModel}); - - modelPosition.z -= 60; -} - - - -function cleanup() { - Entities.deleteEntity(floor); - models.forEach(function(model) { - Entities.deleteEntity(model.low); - Entities.deleteEntity(model.high); - }); -} - -Script.scriptEnding.connect(cleanup); \ No newline at end of file diff --git a/examples/marketplace/modelSwap.js b/examples/marketplace/modelSwap.js deleted file mode 100644 index 29dbc84e98..0000000000 --- a/examples/marketplace/modelSwap.js +++ /dev/null @@ -1,41 +0,0 @@ -// When user holds down trigger on model for enough time, the model with do a cool animation and swap out with the low or high version of it - - - -(function() { - - var _this; - ModelSwaper = function() { - _this = this; - }; - - ModelSwaper.prototype = { - - startFarTrigger: function() { - print("START TRIGGER") - - //make self invisible and make the model's counterpart visible! - var dimensions = Entities.getEntityProperties(this.entityID, "dimensions").dimensions; - Entities.editEntity(this.entityID, { - visible: false, - dimensions: Vec3.multiply(dimensions, 0.5) - }); - dimensions = Entities.getEntityProperties(this.modelCounterpartId, "dimensions").dimensions; - Entities.editEntity(this.modelCounterpartId, { - visible: true, - dimensions: Vec3.multiply(dimensions, 2) - }); - - }, - - preload: function(entityID) { - this.entityID = entityID; - var props = Entities.getEntityProperties(this.entityID, ["userData"]); - this.modelCounterpartId = JSON.parse(props.userData).modelCounterpart.modelCounterpartId; - } - - }; - - // entity scripts always need to return a newly constructed object of our type - return new ModelSwaper(); -}); \ No newline at end of file