Take out getter for avatar's hash key.

This commit is contained in:
TonyPeng 2014-07-16 10:08:49 -07:00
parent 7e23ca1738
commit 7aae85833b
3 changed files with 8 additions and 18 deletions

View file

@ -17,6 +17,7 @@ var currentSelection = 0;
var currentNumLights = 1;
var maxNumLights = 2;
var currentNumAvatars = 0;
var changeDelta = 0.1;
function keyPressEvent(event) {
@ -39,7 +40,7 @@ function keyPressEvent(event) {
print("light selection = " + currentSelection);
}
else if (event.text == "5" ) {
localLightColors[currentSelection].x += 0.01;
localLightColors[currentSelection].x += changeDelta;
if ( localLightColors[currentSelection].x > 1.0) {
localLightColors[currentSelection].x = 0.0;
}
@ -48,7 +49,7 @@ function keyPressEvent(event) {
print("CHANGE RED light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "6" ) {
localLightColors[currentSelection].y += 0.01;
localLightColors[currentSelection].y += changeDelta;
if ( localLightColors[currentSelection].y > 1.0) {
localLightColors[currentSelection].y = 0.0;
}
@ -57,7 +58,7 @@ function keyPressEvent(event) {
print("CHANGE GREEN light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "7" ) {
localLightColors[currentSelection].z += 0.01;
localLightColors[currentSelection].z += changeDelta;
if ( localLightColors[currentSelection].z > 1.0) {
localLightColors[currentSelection].z = 0.0;
}
@ -66,7 +67,7 @@ function keyPressEvent(event) {
print("CHANGE BLUE light " + currentSelection + " color (" + localLightColors[currentSelection].x + ", " + localLightColors[currentSelection].y + ", " + localLightColors[currentSelection].z + " )" );
}
else if (event.text == "8" ) {
localLightDirections[currentSelection].x += 0.01;
localLightDirections[currentSelection].x += changeDelta;
if (localLightDirections[currentSelection].x > 1.0) {
localLightDirections[currentSelection].x = -1.0;
}
@ -75,7 +76,7 @@ function keyPressEvent(event) {
print("PLUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "9" ) {
localLightDirections[currentSelection].x -= 0.01;
localLightDirections[currentSelection].x -= changeDelta;
if (localLightDirections[currentSelection].x < -1.0) {
localLightDirections[currentSelection].x = 1.0;
}
@ -84,7 +85,7 @@ function keyPressEvent(event) {
print("MINUS X light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "0" ) {
localLightDirections[currentSelection].y += 0.01;
localLightDirections[currentSelection].y += changeDelta;
if (localLightDirections[currentSelection].y > 1.0) {
localLightDirections[currentSelection].y = -1.0;
}
@ -93,7 +94,7 @@ function keyPressEvent(event) {
print("PLUS Y light " + currentSelection + " direction (" + localLightDirections[currentSelection].x + ", " + localLightDirections[currentSelection].y + ", " + localLightDirections[currentSelection].z + " )" );
}
else if (event.text == "-" ) {
localLightDirections[currentSelection].y -= 0.01;
localLightDirections[currentSelection].y -= changeDelta;
if (localLightDirections[currentSelection].y < -1.0) {
localLightDirections[currentSelection].y = 1.0;
}
@ -143,8 +144,6 @@ function updateLocalLights()
if (numAvatars != currentNumAvatars) {
for (var i = 0; i < numAvatars; i++) {
var id = AvatarManager.getAvatarHashKey(i);
var numLights = AvatarManager.getNumLightsInAvatar(i);
// check if new avatar has lights

View file

@ -214,11 +214,3 @@ int AvatarManager::getNumLightsInAvatar(int avatarIndex) {
int AvatarManager::getNumAvatars() {
return _avatarHash.count();
}
QString AvatarManager::getAvatarHashKey(int index) {
QString id = ((_avatarHash.keys())[index]).toString();
std::string idString = id.toStdString();
return id;
}

View file

@ -44,7 +44,6 @@ public slots:
void addAvatarLocalLight(int avatarIndex);
int getNumLightsInAvatar(int avatarIndex);
int getNumAvatars();
QString getAvatarHashKey(int index);
private:
AvatarManager(const AvatarManager& other);