Skip to content

Commit

Permalink
super-renamed stuff superquest superquest super...
Browse files Browse the repository at this point in the history
  • Loading branch information
disasteroftheuniverse committed Jan 2, 2020
1 parent 5597f3a commit ea832a4
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 160 deletions.
19 changes: 11 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
// \__/\__,_| .__/ \___|_| \___,_\ \__,_|\___|___/\__|
// |_|

require('./src/components/aframe-extra-utils');
require('./src/components/aframe-extra-collection');
require('./src/components/aframe-shader-extras');
require('./src/components/superquest-utils');
require('./src/components/superquest-extras-collection');
require('./src/components/superquest-shader-extras-collection');

require('./src/components/aframe-locomote-controls');
require('./src/components/aframe-google-poly');
require('./src/components/aframe-portals');
require('./src/components/superquest-teleporter-controls');
require('./src/components/superquest-google-poly');
require('./src/components/superquest-portals');

require('./src/components/aframe-oculus-quest-hands');
require('./src/physics/superquest-physics-lite');
require('./src/components/superquest-hands');

//not so super because I can't figure out how to access haptics anymore
//require('./src/components/aframe-oculus-quest-haptics');
//require('./src/components/hands');


Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,13 @@ module.exports = {
var dumpIntoConsole = function () {
el.addState('regulated');
};
AFRAME.utils.entity.onModel(el, dumpIntoConsole, comp);
},
tick: function () {
if (this.el.is('regulated')) {
this.el.object3D.position.clamp(this.data.min, this.data.max);
}
}
}),
log_object3D: AFRAME.registerComponent('log-object3d', {
init: function () {
AFRAME.utils.entity.onModel(this.el, this.log, this);
},
log: function () {
console.log(this.el.object3D);
}
}),
billboard: AFRAME.registerComponent('billboard', {
dependencies: ['rotation'],
schema: {
Expand All @@ -150,7 +141,6 @@ module.exports = {
init: function () {
this.tick = AFRAME.utils.throttleTick(this.tick, 20, this);
this.lookAtTarget = new THREE.Vector3();
//AFRAME.utils.entity.onModel(el, dumpIntoConsole, comp);
},
tick: function () {
if (this.el.object3DMap) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
}
}),
teleporter_controls: AFRAME.registerComponent('teleporter-controls', {
dependencies: ['position', 'rotation', 'scale', 'virtual-hand'],
dependencies: ['position', 'rotation', 'scale'],
schema: {
objects: {
type: 'string',
Expand Down Expand Up @@ -138,17 +138,19 @@ module.exports = {
this.__angleSolve.bind(this);
this.offsetScalar = this.__angleSolve(this.rayAim.z, this.rayAim.y, this.data.length);
this.seekTeleportDestination = this.seekTeleportDestination.bind(this);

this.el.addEventListener(this.data.startOn, this.__startHandler);
this.el.addEventListener(this.data.cancelOn, this.__cancelHandler);
this.el.addEventListener(this.data.moveOn, this.__moveHandler);

this.system.subscribe(this);
},
_create: function () {
var el = this.el;
var data = this.data;
var locomote = this;
locomote.rayOrigin = new THREE.Vector3(0, 0, 0);
locomote.rayAim = new THREE.Vector3(0, -1, -0.5).normalize();
locomote.rayAim = new THREE.Vector3(0, -0.125, -0.5).normalize();
this.beamEl = document.createElement('a-entity');
this.el.appendChild(this.beamEl);
this.beamEl.setAttribute('raycaster', {
Expand Down Expand Up @@ -213,6 +215,7 @@ module.exports = {
}
el.setObject3D('curve', locomote.curveObject);
el.object3DMap.curve.updateMatrixWorld(true);

AFRAME.utils.getGradientShader('teleportDestination').setValues({
depthTest: false,
depthWrite: false,
Expand All @@ -221,6 +224,7 @@ module.exports = {
side: THREE.DoubleSide,
blending: THREE.AdditiveBlending
});

locomote.destObject.visible = false;
locomote.curveObject.visible = false;
//el.sceneEl.object3D.add(locomote.destObject);
Expand All @@ -230,7 +234,7 @@ module.exports = {
locomote.destinationPoint = new THREE.Vector3();
locomote.midpoint = new THREE.Vector3();
locomote.startPoint = new THREE.Vector3();
locomote.humpOffset = new THREE.Vector3(0, 0.3, 0);
locomote.humpOffset = new THREE.Vector3(0, 0.01, 0);
},
__startHandler: function () {
this.system.toggleOtherHand(this);
Expand All @@ -255,13 +259,17 @@ module.exports = {
this.curveObject.visible = true;
},
_hideTeleportUI: function (cancel) {

if (cancel && cancel == true) {
this.hasDestination = null;
}

this.isTesting = null;

this.beamEl.setAttribute('raycaster', {
enabled: false
});

if (this.data.signal == true) {
//var l = this.collisionObjects.length;
for (var i = 0; i < this.numObjects; i++) {
Expand All @@ -270,19 +278,28 @@ module.exports = {
}, true);
}
}

this.curveObject.visible = false;
this.destObject.visible = false;
},
__cancelHandler: function () {
this._hideTeleportUI(true);



this._hideTeleportUI((this.data.moveOn === this.data.cancelOn) ? false : true);

},
__moveHandler: function () {
if (this.hasDestination) {
this.playerTeleportOffset.copy(this.data.camera.object3D.position);

this.playerTeleportDestination.sub(this.playerTeleportOffset);

this.playerTeleportDestination.setY(this.playerTeleportDestination.y + this.system.data.playerHeightOffset);

this.data.player.object3D.parent.worldToLocal(this.playerTeleportDestination);
this.data.player.object3D.position.copy(this.playerTeleportDestination);

this.raycaster.refreshObjects();
this.seekTeleportDestination();
if (this.data.signal == true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/*jshint esversion:6*/
/**
* Callback on 3d model loaded
*
* @param {HTMLElement} modelEl element of model
* @param {function} callback callback when loaded
* @param {object} context what 'this' is in this context
*
*/

AFRAME.utils.entity.onModel = function (modelEl, callback, context) {
if (context) {
callback = callback.bind(context);
Expand All @@ -25,16 +18,6 @@ AFRAME.utils.entity.onModel = function (modelEl, callback, context) {
modelEl.addEventListener('object3dset', waitForModel);
}
};

/**
* Callback on element loaded
*
* @param {HTMLElement} modelEl element of model
* @param {function} callback callback when loaded
* @param {object} context what 'this' is
*
*/

AFRAME.utils.entity.onObject3DAdded = function (el, name, callback, context, args) {
if (context) {
callback = callback.bind(context);
Expand Down Expand Up @@ -62,16 +45,6 @@ AFRAME.utils.entity.onObject3DAdded = function (el, name, callback, context, arg
el.addEventListener('object3dset', waitForCallback);
}
};

/**
* Callback on element loaded
*
* @param {HTMLElement} modelEl element of model
* @param {function} callback callback when loaded
* @param {object} context what 'this' is
*
*/

AFRAME.utils.entity.onLoad = function (modelEl, callback, context) {
if (context) {
callback = callback.bind(context);
Expand Down Expand Up @@ -143,13 +116,6 @@ AFRAME.utils.randomColor = function () {
}
return color;
};
/**
* Generate a random ID
*
* @param {number} length number of characters
* @returns {String} random string of 'length' length
*
*/
AFRAME.utils.makeId = function (length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
Expand All @@ -159,7 +125,6 @@ AFRAME.utils.makeId = function (length) {
}
return result;
};

AFRAME.utils.__helper__pool = {
__setDirection: {
__axis: new THREE.Vector3(),
Expand Down Expand Up @@ -202,7 +167,6 @@ AFRAME.utils.math = {
return v;
}
};

AFRAME.utils.getWhiteEnvironment = function () {
if (!AFRAME.utils.whiteEnvironment) {
var uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAMAAABFaP0WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/v7+////G/xoHAAAABBJREFUeNpiYGRkYGQECDAAABIABaUzXMUAAAAASUVORK5CYII=';
Expand Down Expand Up @@ -298,4 +262,12 @@ AFRAME.utils.getGradientShader = function (name, colorA, colorB) {
//if (extraConfig) {}
}
return AFRAME.utils.shaders[name];
};
};
AFRAME.registerComponent('log-object3d', {
init: function () {
AFRAME.utils.entity.onModel(this.el, this.log, this);
},
log: function () {
console.log(this.el.object3D);
}
});
12 changes: 0 additions & 12 deletions src/extras/README.md

This file was deleted.

0 comments on commit ea832a4

Please sign in to comment.