Tab fixes.

This commit is contained in:
Andrzej Kapolka 2014-07-22 14:24:25 -07:00
parent be028c2b01
commit 7faf64c54a

View file

@ -25,110 +25,110 @@ function keyPressEvent(event) {
var choice = parseInt(event.text);
if (event.text == "1") {
currentSelection = 0;
print("light election = " + currentSelection);
currentSelection = 0;
print("light election = " + currentSelection);
}
else if (event.text == "2" ) {
currentSelection = 1;
print("light selection = " + currentSelection);
currentSelection = 1;
print("light selection = " + currentSelection);
}
else if (event.text == "3" ) {
currentSelection = 2;
print("light selection = " + currentSelection);
currentSelection = 2;
print("light selection = " + currentSelection);
}
else if (event.text == "4" ) {
currentSelection = 3;
print("light selection = " + currentSelection);
currentSelection = 3;
print("light selection = " + currentSelection);
}
else if (event.text == "5" ) {
localLightColors[currentSelection].x += changeDelta;
if ( localLightColors[currentSelection].x > 1.0) {
localLightColors[currentSelection].x = 0.0;
}
lightsDirty = true;
print("CHANGE RED light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
localLightColors[currentSelection].x += changeDelta;
if ( localLightColors[currentSelection].x > 1.0) {
localLightColors[currentSelection].x = 0.0;
}
lightsDirty = true;
print("CHANGE RED light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "6" ) {
localLightColors[currentSelection].y += changeDelta;
if ( localLightColors[currentSelection].y > 1.0) {
localLightColors[currentSelection].y = 0.0;
}
lightsDirty = true;
print("CHANGE GREEN light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
localLightColors[currentSelection].y += changeDelta;
if ( localLightColors[currentSelection].y > 1.0) {
localLightColors[currentSelection].y = 0.0;
}
lightsDirty = true;
print("CHANGE GREEN light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "7" ) {
localLightColors[currentSelection].z += changeDelta;
if ( localLightColors[currentSelection].z > 1.0) {
localLightColors[currentSelection].z = 0.0;
}
lightsDirty = true;
print("CHANGE BLUE light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
localLightColors[currentSelection].z += changeDelta;
if ( localLightColors[currentSelection].z > 1.0) {
localLightColors[currentSelection].z = 0.0;
}
lightsDirty = true;
print("CHANGE BLUE light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "8" ) {
localLightDirections[currentSelection].x += changeDelta;
if (localLightDirections[currentSelection].x > 1.0) {
localLightDirections[currentSelection].x = -1.0;
}
lightsDirty = true;
print("PLUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
localLightDirections[currentSelection].x += changeDelta;
if (localLightDirections[currentSelection].x > 1.0) {
localLightDirections[currentSelection].x = -1.0;
}
lightsDirty = true;
print("PLUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "9" ) {
localLightDirections[currentSelection].x -= changeDelta;
if (localLightDirections[currentSelection].x < -1.0) {
localLightDirections[currentSelection].x = 1.0;
}
lightsDirty = true;
print("MINUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
localLightDirections[currentSelection].x -= changeDelta;
if (localLightDirections[currentSelection].x < -1.0) {
localLightDirections[currentSelection].x = 1.0;
}
lightsDirty = true;
print("MINUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "0" ) {
localLightDirections[currentSelection].y += changeDelta;
if (localLightDirections[currentSelection].y > 1.0) {
localLightDirections[currentSelection].y = -1.0;
}
lightsDirty = true;
print("PLUS Y light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
localLightDirections[currentSelection].y += changeDelta;
if (localLightDirections[currentSelection].y > 1.0) {
localLightDirections[currentSelection].y = -1.0;
}
lightsDirty = true;
print("PLUS Y light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "-" ) {
localLightDirections[currentSelection].y -= changeDelta;
if (localLightDirections[currentSelection].y < -1.0) {
localLightDirections[currentSelection].y = 1.0;
}
lightsDirty = true;
print("MINUS Y light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
localLightDirections[currentSelection].y -= changeDelta;
if (localLightDirections[currentSelection].y < -1.0) {
localLightDirections[currentSelection].y = 1.0;
}
lightsDirty = true;
print("MINUS Y light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "," ) {
if (currentNumLights + 1 <= maxNumLights) {
++currentNumLights;
lightsDirty = true;
}
print("ADD LIGHT, number of lights " + currentNumLights);
if (currentNumLights + 1 <= maxNumLights) {
++currentNumLights;
lightsDirty = true;
}
print("ADD LIGHT, number of lights " + currentNumLights);
}
else if (event.text == "." ) {
if (currentNumLights - 1 >= 0 ) {
--currentNumLights;
lightsDirty = true;
}
print("REMOVE LIGHT, number of lights " + currentNumLights);
if (currentNumLights - 1 >= 0 ) {
--currentNumLights;
lightsDirty = true;
}
print("REMOVE LIGHT, number of lights " + currentNumLights);
}
}
function updateLocalLights()
{
if (lightsDirty) {
var localLights = [];
for (var i = 0; i < currentNumLights; i++) {
localLights.push({ direction: localLightDirections[i], color: localLightColors[i] });
}
AvatarManager.setLocalLights(localLights);
if (lightsDirty) {
var localLights = [];
for (var i = 0; i < currentNumLights; i++) {
localLights.push({ direction: localLightDirections[i], color: localLightColors[i] });
}
AvatarManager.setLocalLights(localLights);
lightsDirty = false;
}
}