more js changes for changes to camera interface

This commit is contained in:
Stephen Birarda 2014-11-04 10:41:36 -08:00
parent fe0d593ac4
commit 303e8f6da9
4 changed files with 19 additions and 19 deletions

View file

@ -23,7 +23,7 @@ var THRUST_CONTROLLER = 0;
var VIEW_CONTROLLER = 1; var VIEW_CONTROLLER = 1;
function checkCamera(deltaTime) { function checkCamera(deltaTime) {
if (Camera.getModeString() == "independent") { if (Camera.mode == "independent") {
var THRUST_MAG_UP = 800.0; var THRUST_MAG_UP = 800.0;
var THRUST_MAG_DOWN = 300.0; var THRUST_MAG_DOWN = 300.0;
var THRUST_MAG_FWD = 500.0; var THRUST_MAG_FWD = 500.0;
@ -102,19 +102,19 @@ function keyPressEvent(event) {
} }
if (event.text == "1") { if (event.text == "1") {
Camera.setMode("first person"); Camera.mode = "first person";
} }
if (event.text == "2") { if (event.text == "2") {
Camera.setMode("mirror"); Camera.mode = "mirror";
} }
if (event.text == "3") { if (event.text == "3") {
Camera.setMode("third person"); Camera.mode = "third person";
} }
if (event.text == "4") { if (event.text == "4") {
Camera.setMode("independent"); Camera.mode = "independent";
joysticksCaptured = true; joysticksCaptured = true;
Controller.captureJoystick(THRUST_CONTROLLER); Controller.captureJoystick(THRUST_CONTROLLER);
Controller.captureJoystick(VIEW_CONTROLLER); Controller.captureJoystick(VIEW_CONTROLLER);

View file

@ -20,15 +20,15 @@ var cameraLocations = [ {x: 7971.9, y: 241.3, z: 7304.1}, {x: 7973.0, y: 241.3,
var cameraLookAts = [ {x: 7971.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7971.3, y: 241.3, z: 7304.2} ]; var cameraLookAts = [ {x: 7971.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7971.3, y: 241.3, z: 7304.2} ];
function saveCameraState() { function saveCameraState() {
oldMode = Camera.getModeString(); oldMode = Camera.mode;
avatarPosition = MyAvatar.position; avatarPosition = MyAvatar.position;
Camera.setModeShiftPeriod(0.0); Camera.setModeShiftPeriod(0.0);
Camera.setMode("independent"); Camera.mode = "independent";
} }
function restoreCameraState() { function restoreCameraState() {
Camera.stopLooking(); Camera.stopLooking();
Camera.setMode(oldMode); Camera.mode = oldMode;
} }
function update(deltaTime) { function update(deltaTime) {
@ -52,7 +52,7 @@ function keyPressEvent(event) {
saveCameraState(); saveCameraState();
freeCamera = true; freeCamera = true;
} }
Camera.setMode("independent"); Camera.mode = "independent";
Camera.setPosition(cameraLocations[choice - 1]); Camera.setPosition(cameraLocations[choice - 1]);
Camera.keepLookingAt(cameraLookAts[choice - 1]); Camera.keepLookingAt(cameraLookAts[choice - 1]);
} }

View file

@ -20,15 +20,15 @@ var cameraLocations = [ {x: 8027.5, y: 237.5, z: 7305.7}, {x: 8027.5, y: 237.5,
var cameraLookAts = [ {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7305.7}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0} ]; var cameraLookAts = [ {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7305.7}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0}, {x: 8027.5, y: 237.5, z: 7304.0} ];
function saveCameraState() { function saveCameraState() {
oldMode = Camera.getMode(); oldMode = Camera.mode;
avatarPosition = MyAvatar.position; avatarPosition = MyAvatar.position;
Camera.setModeShiftPeriod(0.0); Camera.setModeShiftPeriod(0.0);
Camera.setMode("independent"); Camera.mode = "independent";
} }
function restoreCameraState() { function restoreCameraState() {
Camera.stopLooking(); Camera.stopLooking();
Camera.setMode(oldMode); Camera.mode = oldMode;
} }
function update(deltaTime) { function update(deltaTime) {
@ -52,7 +52,7 @@ function keyPressEvent(event) {
saveCameraState(); saveCameraState();
freeCamera = true; freeCamera = true;
} }
Camera.setMode("independent"); Camera.mode = "independent";
Camera.setPosition(cameraLocations[choice - 1]); Camera.setPosition(cameraLocations[choice - 1]);
Camera.keepLookingAt(cameraLookAts[choice - 1]); Camera.keepLookingAt(cameraLookAts[choice - 1]);
} }

View file

@ -88,8 +88,8 @@ CameraManager = function() {
that.focalPoint = focalPoint; that.focalPoint = focalPoint;
that.setFocalPoint(focalPoint); that.setFocalPoint(focalPoint);
that.previousCameraMode = Camera.getMode(); that.previousCameraMode = Camera.mode;
Camera.setMode("independent"); Camera.mode = "independent";
that.updateCamera(); that.updateCamera();
@ -102,7 +102,7 @@ CameraManager = function() {
that.mode = MODE_INACTIVE; that.mode = MODE_INACTIVE;
if (!ignoreCamera) { if (!ignoreCamera) {
Camera.setMode(that.previousCameraMode); Camera.mode = that.previousCameraMode;
} }
cameraTool.setVisible(false); cameraTool.setVisible(false);
} }
@ -271,7 +271,7 @@ CameraManager = function() {
} }
that.updateCamera = function() { that.updateCamera = function() {
if (!that.enabled || Camera.getMode() != "independent") return; if (!that.enabled || Camera.mode != "independent") return;
var yRot = Quat.angleAxis(that.yaw, { x: 0, y: 1, z: 0 }); var yRot = Quat.angleAxis(that.yaw, { x: 0, y: 1, z: 0 });
var xRot = Quat.angleAxis(that.pitch, { x: 1, y: 0, z: 0 }); var xRot = Quat.angleAxis(that.pitch, { x: 1, y: 0, z: 0 });
@ -300,7 +300,7 @@ CameraManager = function() {
// Ease the position and orbit of the camera // Ease the position and orbit of the camera
that.update = function(dt) { that.update = function(dt) {
if (Camera.getMode() != "independent") { if (Camera.mode != "independent") {
return; return;
} }
@ -350,7 +350,7 @@ CameraManager = function() {
Controller.keyReleaseEvent.connect(function (event) { Controller.keyReleaseEvent.connect(function (event) {
if (event.text == "ESC" && that.enabled) { if (event.text == "ESC" && that.enabled) {
Camera.setMode(lastAvatarCameraMode); Camera.mode = lastAvatarCameraMode;
cameraManager.disable(true); cameraManager.disable(true);
} }
}); });