Merge branch 'master' into 20073
|
@ -1,4 +1,4 @@
|
||||||
The project embraces distributed development and if you'd like to help, we'll pay you -- find out more at Worklist.net. If you find a small bug and have a fix, pull requests are welcome. If you'd like to get paid for your work, make sure you report the bug via a job on Worklist.net.
|
The project embraces distributed development and if you'd like to help, we'll pay you -- find out more at [Worklist.net](https://worklist.net). If you find a small bug and have a fix, pull requests are welcome. If you'd like to get paid for your work, make sure you report the bug via a job on Worklist.net.
|
||||||
|
|
||||||
We're hiring! We're looking for skilled developers; send your resume to hiring@highfidelity.io
|
We're hiring! We're looking for skilled developers; send your resume to hiring@highfidelity.io
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Contributing
|
||||||
git checkout -b new_branch_name
|
git checkout -b new_branch_name
|
||||||
```
|
```
|
||||||
4. Code
|
4. Code
|
||||||
* Follow the [coding standard](https://github.com/highfidelity/hifi/wiki/Coding-Standard)
|
* Follow the [coding standard](http://docs.highfidelity.io/v1.0/docs/coding-standard)
|
||||||
5. Commit
|
5. Commit
|
||||||
* Use [well formed commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
* Use [well formed commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||||
6. Update your branch
|
6. Update your branch
|
||||||
|
@ -38,11 +38,11 @@ Contributing
|
||||||
|
|
||||||
Reporting Bugs
|
Reporting Bugs
|
||||||
===
|
===
|
||||||
1. Always update to the latest code on master, it is possible the bug has already been fixed!
|
1. Always update to the latest code on master, we make many merges every day and it is possible the bug has already been fixed!
|
||||||
2. Search the [repository issues](https://github.com/highfidelity/hifi/issues) to make sure that somebody has not already reported the same bug.
|
2. Search jobs [on Worklist](https://worklist.net) to make sure that somebody has not already reported the same bug.
|
||||||
3. Open an [issue on GitHub](https://github.com/highfidelity/hifi/issues) including information about your system and how to reproduce the bug.
|
3. Add a [job on Worklist](https://worklist.net/job/add) including information about your system and how to reproduce the bug.
|
||||||
|
|
||||||
Requesting a feature
|
Requesting a feature
|
||||||
===
|
===
|
||||||
1. Search the [repository issues](https://github.com/highfidelity/hifi/issues) to make sure that somebody has not already requested the same feature. If you find a matching request, feel free to add any additional comments to the existing issue.
|
1. Search the [the Worklist](https://worklist.net) to make sure that somebody has not already requested the same feature. If you find a matching request, feel free to add any additional comments to the existing issue.
|
||||||
2. Submit an [issue on GitHub](https://github.com/highfidelity/hifi/issues) that is tagged as a feature.
|
2. Add a [job on Worklist](https://worklist.net/job/add) that is labeled as a Feature (and select any other appropriate Labels) and includes a detailed description of your request.
|
||||||
|
|
|
@ -3,10 +3,10 @@ lab experimenting with Virtual Worlds and VR.
|
||||||
|
|
||||||
In this repository you'll find the source to many of the components in our
|
In this repository you'll find the source to many of the components in our
|
||||||
alpha-stage virtual world. The project embraces distributed development
|
alpha-stage virtual world. The project embraces distributed development
|
||||||
and if you'd like to help, we'll pay you -- find out more at Worklist.net.
|
and if you'd like to help, we'll pay you -- find out more at [Worklist.net](https://worklist.net).
|
||||||
If you find a small bug and have a fix, pull requests are welcome. If you'd
|
If you find a small bug and have a fix, pull requests are welcome. If you'd
|
||||||
like to get paid for your work, make sure you report the bug via a job on
|
like to get paid for your work, make sure you report the bug via a job on
|
||||||
Worklist.net.
|
[Worklist.net](https://worklist.net).
|
||||||
|
|
||||||
We're hiring! We're looking for skilled developers;
|
We're hiring! We're looking for skilled developers;
|
||||||
send your resume to hiring@highfidelity.io
|
send your resume to hiring@highfidelity.io
|
||||||
|
@ -14,6 +14,10 @@ send your resume to hiring@highfidelity.io
|
||||||
##### Chat with us
|
##### Chat with us
|
||||||
Come chat with us in [our Gitter](http://gitter.im/highfidelity/hifi) if you have any questions or just want to say hi!
|
Come chat with us in [our Gitter](http://gitter.im/highfidelity/hifi) if you have any questions or just want to say hi!
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
=========
|
||||||
|
Documentation is available at [docs.highfidelity.io](http://docs.highfidelity.io), if something is missing, please suggest it via a new job on Worklist (add to the hifi-docs project).
|
||||||
|
|
||||||
Build Instructions
|
Build Instructions
|
||||||
=========
|
=========
|
||||||
All information required to build is found in the [build guide](BUILD.md).
|
All information required to build is found in the [build guide](BUILD.md).
|
||||||
|
|
|
@ -206,7 +206,7 @@ void Agent::run() {
|
||||||
scriptURL = QUrl(_payload);
|
scriptURL = QUrl(_payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkReply *reply = networkAccessManager.get(QNetworkRequest(scriptURL));
|
QNetworkReply *reply = networkAccessManager.get(QNetworkRequest(scriptURL));
|
||||||
|
|
||||||
QNetworkDiskCache* cache = new QNetworkDiskCache();
|
QNetworkDiskCache* cache = new QNetworkDiskCache();
|
||||||
|
|
|
@ -59,6 +59,7 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
||||||
const QString ASSIGNMENT_POOL_OPTION = "pool";
|
const QString ASSIGNMENT_POOL_OPTION = "pool";
|
||||||
const QString ASSIGNMENT_WALLET_DESTINATION_ID_OPTION = "wallet";
|
const QString ASSIGNMENT_WALLET_DESTINATION_ID_OPTION = "wallet";
|
||||||
const QString CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION = "a";
|
const QString CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION = "a";
|
||||||
|
const QString CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION = "p";
|
||||||
|
|
||||||
Assignment::Type requestAssignmentType = Assignment::AllTypes;
|
Assignment::Type requestAssignmentType = Assignment::AllTypes;
|
||||||
|
|
||||||
|
@ -87,17 +88,29 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
||||||
|
|
||||||
// create a NodeList as an unassigned client
|
// create a NodeList as an unassigned client
|
||||||
NodeList* nodeList = NodeList::createInstance(NodeType::Unassigned);
|
NodeList* nodeList = NodeList::createInstance(NodeType::Unassigned);
|
||||||
|
|
||||||
|
unsigned short assignmentServerPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||||
|
|
||||||
|
// check for an overriden assignment server port
|
||||||
|
if (argumentVariantMap.contains(CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION)) {
|
||||||
|
assignmentServerPort =
|
||||||
|
argumentVariantMap.value(CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION).toString().toUInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiSockAddr assignmentServerSocket(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME, assignmentServerPort);
|
||||||
|
|
||||||
// check for an overriden assignment server hostname
|
// check for an overriden assignment server hostname
|
||||||
if (argumentVariantMap.contains(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION)) {
|
if (argumentVariantMap.contains(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION)) {
|
||||||
_assignmentServerHostname = argumentVariantMap.value(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION).toString();
|
_assignmentServerHostname = argumentVariantMap.value(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION).toString();
|
||||||
|
|
||||||
// set the custom assignment socket on our NodeList
|
// change the hostname for our assignment server
|
||||||
HifiSockAddr customAssignmentSocket = HifiSockAddr(_assignmentServerHostname, DEFAULT_DOMAIN_SERVER_PORT);
|
assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerSocket.getPort());
|
||||||
|
|
||||||
nodeList->setAssignmentServerSocket(customAssignmentSocket);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeList->setAssignmentServerSocket(assignmentServerSocket);
|
||||||
|
|
||||||
|
qDebug() << "Assignment server socket is" << assignmentServerSocket;
|
||||||
|
|
||||||
// call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required
|
// call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required
|
||||||
qDebug() << "Waiting for assignment -" << _requestAssignment;
|
qDebug() << "Waiting for assignment -" << _requestAssignment;
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,6 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(AudioMixerClientData* l
|
||||||
const float ZERO_DB = 1.0f;
|
const float ZERO_DB = 1.0f;
|
||||||
const float NEGATIVE_ONE_DB = 0.891f;
|
const float NEGATIVE_ONE_DB = 0.891f;
|
||||||
const float NEGATIVE_THREE_DB = 0.708f;
|
const float NEGATIVE_THREE_DB = 0.708f;
|
||||||
const float NEGATIVE_SIX_DB = 0.501f;
|
|
||||||
|
|
||||||
const float FILTER_GAIN_AT_0 = ZERO_DB; // source is in front
|
const float FILTER_GAIN_AT_0 = ZERO_DB; // source is in front
|
||||||
const float FILTER_GAIN_AT_90 = NEGATIVE_ONE_DB; // source is incident to left or right ear
|
const float FILTER_GAIN_AT_90 = NEGATIVE_ONE_DB; // source is incident to left or right ear
|
||||||
|
|
|
@ -940,7 +940,7 @@ void OctreeServer::run() {
|
||||||
qDebug("--statusHost=%s", statusHost);
|
qDebug("--statusHost=%s", statusHost);
|
||||||
_statusHost = statusHost;
|
_statusHost = statusHost;
|
||||||
} else {
|
} else {
|
||||||
_statusHost = QHostAddress(getHostOrderLocalAddress()).toString();
|
_statusHost = getLocalAddress().toString();
|
||||||
}
|
}
|
||||||
qDebug("statusHost=%s", qPrintable(_statusHost));
|
qDebug("statusHost=%s", qPrintable(_statusHost));
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,14 @@
|
||||||
"label": "None: use the network information I have entered for this domain at data.highfidelity.io"
|
"label": "None: use the network information I have entered for this domain at data.highfidelity.io"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "local_port",
|
||||||
|
"label": "Local UDP Port",
|
||||||
|
"help": "This is the local port your domain-server binds to for UDP connections.<br/>Depending on your router, this may need to be changed to run multiple full automatic networking domain-servers in the same network.",
|
||||||
|
"default": "40102",
|
||||||
|
"type": "int",
|
||||||
|
"advanced": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -59,10 +67,69 @@
|
||||||
"label": "Audio",
|
"label": "Audio",
|
||||||
"assignment-types": [0],
|
"assignment-types": [0],
|
||||||
"settings": [
|
"settings": [
|
||||||
|
{
|
||||||
|
"name": "zones",
|
||||||
|
"type": "table",
|
||||||
|
"label": "Zones",
|
||||||
|
"help": "In this table you can define a set of zones in which you can specify various audio properties.",
|
||||||
|
"numbered": false,
|
||||||
|
"key": {
|
||||||
|
"name": "name",
|
||||||
|
"label": "Name",
|
||||||
|
"placeholder": "Zone name"
|
||||||
|
},
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "x_range",
|
||||||
|
"label": "X range",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "0-16384"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "y_range",
|
||||||
|
"label": "Y range",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "0-16384"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "z_range",
|
||||||
|
"label": "Z range",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "0-16384"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attenuation_coefficients",
|
||||||
|
"type": "table",
|
||||||
|
"label": "Attenuation Coefficients",
|
||||||
|
"help": "In this table you can set custom attenuation coefficients between audio zones",
|
||||||
|
"numbered": false,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "source",
|
||||||
|
"label": "Source",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "Zone_A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "listener",
|
||||||
|
"label": "Listener",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "Zone_B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "coefficient",
|
||||||
|
"label": "Attenuation coefficient",
|
||||||
|
"can_set": true,
|
||||||
|
"placeholder": "0.18"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "enable_filter",
|
"name": "enable_filter",
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"label": "Enable Positional Filter",
|
"label": "Positional filter",
|
||||||
"help": "positional audio stream uses lowpass filter",
|
"help": "positional audio stream uses lowpass filter",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
@ -74,11 +141,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "attenuation_per_doubling_in_distance",
|
"name": "attenuation_per_doubling_in_distance",
|
||||||
"label": "Attenuattion per doubling in distance",
|
"label": "Attenuation per doubling in distance",
|
||||||
"help": "Factor between 0.0 and 1.0 (0.0: No attenuation, 1.0: extreme attenuation)",
|
"help": "Factor between 0.0 and 1.0 (0.0: No attenuation, 1.0: extreme attenuation)",
|
||||||
"placeholder": "0.18",
|
"placeholder": "0.18",
|
||||||
"default": "0.18",
|
"default": "0.18",
|
||||||
"advanced": true
|
"advanced": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dynamic_jitter_buffer",
|
"name": "dynamic_jitter_buffer",
|
||||||
|
|
0
domain-server/resources/web/assignment/js/ace/ace.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/mode-javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/snippets/javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/theme-twilight.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/worker-javascript.js
Executable file → Normal file
|
@ -74,3 +74,18 @@ span.port {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.buttons {
|
||||||
|
width: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.buttons .glyphicon {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.new-row {
|
||||||
|
color: #3c763d;
|
||||||
|
background-color: #dff0d8;
|
||||||
|
}
|
||||||
|
|
601
domain-server/resources/web/css/sweet-alert.css
Executable file
|
@ -0,0 +1,601 @@
|
||||||
|
.sweet-overlay {
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: none;
|
||||||
|
z-index: 1000; }
|
||||||
|
|
||||||
|
.sweet-alert {
|
||||||
|
background-color: white;
|
||||||
|
font-family: sans-serif;
|
||||||
|
width: 478px;
|
||||||
|
padding: 17px;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
position: fixed;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
margin-left: -256px;
|
||||||
|
margin-top: -200px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: none;
|
||||||
|
z-index: 2000; }
|
||||||
|
@media all and (max-width: 540px) {
|
||||||
|
.sweet-alert {
|
||||||
|
width: auto;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
left: 15px;
|
||||||
|
right: 15px; } }
|
||||||
|
.sweet-alert h2 {
|
||||||
|
color: #575757;
|
||||||
|
font-size: 30px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: none;
|
||||||
|
position: relative; }
|
||||||
|
.sweet-alert p {
|
||||||
|
color: #797979;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 300;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
line-height: normal; }
|
||||||
|
.sweet-alert button {
|
||||||
|
background-color: #AEDEF4;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 500;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px 32px;
|
||||||
|
margin: 26px 5px 0 5px;
|
||||||
|
cursor: pointer; }
|
||||||
|
.sweet-alert button:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
|
||||||
|
.sweet-alert button:hover {
|
||||||
|
background-color: #a1d9f2; }
|
||||||
|
.sweet-alert button:active {
|
||||||
|
background-color: #81ccee; }
|
||||||
|
.sweet-alert button.cancel {
|
||||||
|
background-color: #D0D0D0; }
|
||||||
|
.sweet-alert button.cancel:hover {
|
||||||
|
background-color: #c8c8c8; }
|
||||||
|
.sweet-alert button.cancel:active {
|
||||||
|
background-color: #b6b6b6; }
|
||||||
|
.sweet-alert button.cancel:focus {
|
||||||
|
box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; }
|
||||||
|
.sweet-alert[data-has-cancel-button=false] button {
|
||||||
|
box-shadow: none !important; }
|
||||||
|
.sweet-alert .icon {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
border: 4px solid gray;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 20px auto;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: content-box; }
|
||||||
|
.sweet-alert .icon.error {
|
||||||
|
border-color: #F27474; }
|
||||||
|
.sweet-alert .icon.error .x-mark {
|
||||||
|
position: relative;
|
||||||
|
display: block; }
|
||||||
|
.sweet-alert .icon.error .line {
|
||||||
|
position: absolute;
|
||||||
|
height: 5px;
|
||||||
|
width: 47px;
|
||||||
|
background-color: #F27474;
|
||||||
|
display: block;
|
||||||
|
top: 37px;
|
||||||
|
border-radius: 2px; }
|
||||||
|
.sweet-alert .icon.error .line.left {
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
left: 17px; }
|
||||||
|
.sweet-alert .icon.error .line.right {
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
right: 16px; }
|
||||||
|
.sweet-alert .icon.warning {
|
||||||
|
border-color: #F8BB86; }
|
||||||
|
.sweet-alert .icon.warning .body {
|
||||||
|
position: absolute;
|
||||||
|
width: 5px;
|
||||||
|
height: 47px;
|
||||||
|
left: 50%;
|
||||||
|
top: 10px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-left: -2px;
|
||||||
|
background-color: #F8BB86; }
|
||||||
|
.sweet-alert .icon.warning .dot {
|
||||||
|
position: absolute;
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-left: -3px;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 10px;
|
||||||
|
background-color: #F8BB86; }
|
||||||
|
.sweet-alert .icon.info {
|
||||||
|
border-color: #C9DAE1; }
|
||||||
|
.sweet-alert .icon.info::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 5px;
|
||||||
|
height: 29px;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 17px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-left: -2px;
|
||||||
|
background-color: #C9DAE1; }
|
||||||
|
.sweet-alert .icon.info::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-left: -3px;
|
||||||
|
top: 19px;
|
||||||
|
background-color: #C9DAE1; }
|
||||||
|
.sweet-alert .icon.success {
|
||||||
|
border-color: #A5DC86; }
|
||||||
|
.sweet-alert .icon.success::before, .sweet-alert .icon.success::after {
|
||||||
|
content: '';
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
width: 60px;
|
||||||
|
height: 120px;
|
||||||
|
background: white;
|
||||||
|
transform: rotate(45deg); }
|
||||||
|
.sweet-alert .icon.success::before {
|
||||||
|
border-radius: 120px 0 0 120px;
|
||||||
|
top: -7px;
|
||||||
|
left: -33px;
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform-origin: 60px 60px;
|
||||||
|
transform-origin: 60px 60px; }
|
||||||
|
.sweet-alert .icon.success::after {
|
||||||
|
border-radius: 0 120px 120px 0;
|
||||||
|
top: -11px;
|
||||||
|
left: 30px;
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform-origin: 0px 60px;
|
||||||
|
transform-origin: 0px 60px; }
|
||||||
|
.sweet-alert .icon.success .placeholder {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
border: 4px solid rgba(165, 220, 134, 0.2);
|
||||||
|
border-radius: 50%;
|
||||||
|
box-sizing: content-box;
|
||||||
|
position: absolute;
|
||||||
|
left: -4px;
|
||||||
|
top: -4px;
|
||||||
|
z-index: 2; }
|
||||||
|
.sweet-alert .icon.success .fix {
|
||||||
|
width: 5px;
|
||||||
|
height: 90px;
|
||||||
|
background-color: white;
|
||||||
|
position: absolute;
|
||||||
|
left: 28px;
|
||||||
|
top: 8px;
|
||||||
|
z-index: 1;
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg); }
|
||||||
|
.sweet-alert .icon.success .line {
|
||||||
|
height: 5px;
|
||||||
|
background-color: #A5DC86;
|
||||||
|
display: block;
|
||||||
|
border-radius: 2px;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2; }
|
||||||
|
.sweet-alert .icon.success .line.tip {
|
||||||
|
width: 25px;
|
||||||
|
left: 14px;
|
||||||
|
top: 46px;
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg); }
|
||||||
|
.sweet-alert .icon.success .line.long {
|
||||||
|
width: 47px;
|
||||||
|
right: 8px;
|
||||||
|
top: 38px;
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg); }
|
||||||
|
.sweet-alert .icon.custom {
|
||||||
|
background-size: contain;
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Animations
|
||||||
|
*/
|
||||||
|
@-webkit-keyframes showSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.7);
|
||||||
|
-webkit-transform: scale(0.7); }
|
||||||
|
45% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
-webkit-transform: scale(1.05); }
|
||||||
|
80% {
|
||||||
|
transform: scale(0.95);
|
||||||
|
-webkit-tranform: scale(0.95); }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); } }
|
||||||
|
@-moz-keyframes showSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.7);
|
||||||
|
-webkit-transform: scale(0.7); }
|
||||||
|
45% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
-webkit-transform: scale(1.05); }
|
||||||
|
80% {
|
||||||
|
transform: scale(0.95);
|
||||||
|
-webkit-tranform: scale(0.95); }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); } }
|
||||||
|
@keyframes showSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.7);
|
||||||
|
-webkit-transform: scale(0.7); }
|
||||||
|
45% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
-webkit-transform: scale(1.05); }
|
||||||
|
80% {
|
||||||
|
transform: scale(0.95);
|
||||||
|
-webkit-tranform: scale(0.95); }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); } }
|
||||||
|
@-webkit-keyframes hideSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); }
|
||||||
|
100% {
|
||||||
|
transform: scale(0.5);
|
||||||
|
-webkit-transform: scale(0.5); } }
|
||||||
|
@-moz-keyframes hideSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); }
|
||||||
|
100% {
|
||||||
|
transform: scale(0.5);
|
||||||
|
-webkit-transform: scale(0.5); } }
|
||||||
|
@keyframes hideSweetAlert {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1); }
|
||||||
|
100% {
|
||||||
|
transform: scale(0.5);
|
||||||
|
-webkit-transform: scale(0.5); } }
|
||||||
|
.showSweetAlert {
|
||||||
|
-webkit-animation: showSweetAlert 0.3s;
|
||||||
|
-moz-animation: showSweetAlert 0.3s;
|
||||||
|
animation: showSweetAlert 0.3s; }
|
||||||
|
|
||||||
|
.hideSweetAlert {
|
||||||
|
-webkit-animation: hideSweetAlert 0.2s;
|
||||||
|
-moz-animation: hideSweetAlert 0.2s;
|
||||||
|
animation: hideSweetAlert 0.2s; }
|
||||||
|
|
||||||
|
@-webkit-keyframes animateSuccessTip {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
54% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
70% {
|
||||||
|
width: 50px;
|
||||||
|
left: -8px;
|
||||||
|
top: 37px; }
|
||||||
|
84% {
|
||||||
|
width: 17px;
|
||||||
|
left: 21px;
|
||||||
|
top: 48px; }
|
||||||
|
100% {
|
||||||
|
width: 25px;
|
||||||
|
left: 14px;
|
||||||
|
top: 45px; } }
|
||||||
|
@-moz-keyframes animateSuccessTip {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
54% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
70% {
|
||||||
|
width: 50px;
|
||||||
|
left: -8px;
|
||||||
|
top: 37px; }
|
||||||
|
84% {
|
||||||
|
width: 17px;
|
||||||
|
left: 21px;
|
||||||
|
top: 48px; }
|
||||||
|
100% {
|
||||||
|
width: 25px;
|
||||||
|
left: 14px;
|
||||||
|
top: 45px; } }
|
||||||
|
@keyframes animateSuccessTip {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
54% {
|
||||||
|
width: 0;
|
||||||
|
left: 1px;
|
||||||
|
top: 19px; }
|
||||||
|
70% {
|
||||||
|
width: 50px;
|
||||||
|
left: -8px;
|
||||||
|
top: 37px; }
|
||||||
|
84% {
|
||||||
|
width: 17px;
|
||||||
|
left: 21px;
|
||||||
|
top: 48px; }
|
||||||
|
100% {
|
||||||
|
width: 25px;
|
||||||
|
left: 14px;
|
||||||
|
top: 45px; } }
|
||||||
|
@-webkit-keyframes animateSuccessLong {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
65% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
84% {
|
||||||
|
width: 55px;
|
||||||
|
right: 0px;
|
||||||
|
top: 35px; }
|
||||||
|
100% {
|
||||||
|
width: 47px;
|
||||||
|
right: 8px;
|
||||||
|
top: 38px; } }
|
||||||
|
@-moz-keyframes animateSuccessLong {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
65% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
84% {
|
||||||
|
width: 55px;
|
||||||
|
right: 0px;
|
||||||
|
top: 35px; }
|
||||||
|
100% {
|
||||||
|
width: 47px;
|
||||||
|
right: 8px;
|
||||||
|
top: 38px; } }
|
||||||
|
@keyframes animateSuccessLong {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
65% {
|
||||||
|
width: 0;
|
||||||
|
right: 46px;
|
||||||
|
top: 54px; }
|
||||||
|
84% {
|
||||||
|
width: 55px;
|
||||||
|
right: 0px;
|
||||||
|
top: 35px; }
|
||||||
|
100% {
|
||||||
|
width: 47px;
|
||||||
|
right: 8px;
|
||||||
|
top: 38px; } }
|
||||||
|
@-webkit-keyframes rotatePlaceholder {
|
||||||
|
0% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
5% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
12% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); }
|
||||||
|
100% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); } }
|
||||||
|
@-moz-keyframes rotatePlaceholder {
|
||||||
|
0% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
5% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
12% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); }
|
||||||
|
100% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); } }
|
||||||
|
@keyframes rotatePlaceholder {
|
||||||
|
0% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
5% {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
-webkit-transform: rotate(-45deg); }
|
||||||
|
12% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); }
|
||||||
|
100% {
|
||||||
|
transform: rotate(-405deg);
|
||||||
|
-webkit-transform: rotate(-405deg); } }
|
||||||
|
.animateSuccessTip {
|
||||||
|
-webkit-animation: animateSuccessTip 0.75s;
|
||||||
|
-moz-animation: animateSuccessTip 0.75s;
|
||||||
|
animation: animateSuccessTip 0.75s; }
|
||||||
|
|
||||||
|
.animateSuccessLong {
|
||||||
|
-webkit-animation: animateSuccessLong 0.75s;
|
||||||
|
-moz-animation: animateSuccessLong 0.75s;
|
||||||
|
animation: animateSuccessLong 0.75s; }
|
||||||
|
|
||||||
|
.icon.success.animate::after {
|
||||||
|
-webkit-animation: rotatePlaceholder 4.25s ease-in;
|
||||||
|
-moz-animation: rotatePlaceholder 4.25s ease-in;
|
||||||
|
animation: rotatePlaceholder 4.25s ease-in; }
|
||||||
|
|
||||||
|
@-webkit-keyframes animateErrorIcon {
|
||||||
|
0% {
|
||||||
|
transform: rotateX(100deg);
|
||||||
|
-webkit-transform: rotateX(100deg);
|
||||||
|
opacity: 0; }
|
||||||
|
100% {
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
-webkit-transform: rotateX(0deg);
|
||||||
|
opacity: 1; } }
|
||||||
|
@-moz-keyframes animateErrorIcon {
|
||||||
|
0% {
|
||||||
|
transform: rotateX(100deg);
|
||||||
|
-webkit-transform: rotateX(100deg);
|
||||||
|
opacity: 0; }
|
||||||
|
100% {
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
-webkit-transform: rotateX(0deg);
|
||||||
|
opacity: 1; } }
|
||||||
|
@keyframes animateErrorIcon {
|
||||||
|
0% {
|
||||||
|
transform: rotateX(100deg);
|
||||||
|
-webkit-transform: rotateX(100deg);
|
||||||
|
opacity: 0; }
|
||||||
|
100% {
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
-webkit-transform: rotateX(0deg);
|
||||||
|
opacity: 1; } }
|
||||||
|
.animateErrorIcon {
|
||||||
|
-webkit-animation: animateErrorIcon 0.5s;
|
||||||
|
-moz-animation: animateErrorIcon 0.5s;
|
||||||
|
animation: animateErrorIcon 0.5s; }
|
||||||
|
|
||||||
|
@-webkit-keyframes animateXMark {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
50% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
80% {
|
||||||
|
transform: scale(1.15);
|
||||||
|
-webkit-transform: scale(1.15);
|
||||||
|
margin-top: -6px; }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
margin-top: 0;
|
||||||
|
opacity: 1; } }
|
||||||
|
@-moz-keyframes animateXMark {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
50% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
80% {
|
||||||
|
transform: scale(1.15);
|
||||||
|
-webkit-transform: scale(1.15);
|
||||||
|
margin-top: -6px; }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
margin-top: 0;
|
||||||
|
opacity: 1; } }
|
||||||
|
@keyframes animateXMark {
|
||||||
|
0% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
50% {
|
||||||
|
transform: scale(0.4);
|
||||||
|
-webkit-transform: scale(0.4);
|
||||||
|
margin-top: 26px;
|
||||||
|
opacity: 0; }
|
||||||
|
80% {
|
||||||
|
transform: scale(1.15);
|
||||||
|
-webkit-transform: scale(1.15);
|
||||||
|
margin-top: -6px; }
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
margin-top: 0;
|
||||||
|
opacity: 1; } }
|
||||||
|
.animateXMark {
|
||||||
|
-webkit-animation: animateXMark 0.5s;
|
||||||
|
-moz-animation: animateXMark 0.5s;
|
||||||
|
animation: animateXMark 0.5s; }
|
||||||
|
|
||||||
|
/*@include keyframes(simpleRotate) {
|
||||||
|
0% { transform: rotateY(0deg); }
|
||||||
|
100% { transform: rotateY(-360deg); }
|
||||||
|
}
|
||||||
|
.simpleRotate {
|
||||||
|
@include animation('simpleRotate 0.75s');
|
||||||
|
}*/
|
||||||
|
@-webkit-keyframes pulseWarning {
|
||||||
|
0% {
|
||||||
|
border-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
border-color: #F8BB86; } }
|
||||||
|
@-moz-keyframes pulseWarning {
|
||||||
|
0% {
|
||||||
|
border-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
border-color: #F8BB86; } }
|
||||||
|
@keyframes pulseWarning {
|
||||||
|
0% {
|
||||||
|
border-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
border-color: #F8BB86; } }
|
||||||
|
.pulseWarning {
|
||||||
|
-webkit-animation: pulseWarning 0.75s infinite alternate;
|
||||||
|
-moz-animation: pulseWarning 0.75s infinite alternate;
|
||||||
|
animation: pulseWarning 0.75s infinite alternate; }
|
||||||
|
|
||||||
|
@-webkit-keyframes pulseWarningIns {
|
||||||
|
0% {
|
||||||
|
background-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
background-color: #F8BB86; } }
|
||||||
|
@-moz-keyframes pulseWarningIns {
|
||||||
|
0% {
|
||||||
|
background-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
background-color: #F8BB86; } }
|
||||||
|
@keyframes pulseWarningIns {
|
||||||
|
0% {
|
||||||
|
background-color: #F8D486; }
|
||||||
|
100% {
|
||||||
|
background-color: #F8BB86; } }
|
||||||
|
.pulseWarningIns {
|
||||||
|
-webkit-animation: pulseWarningIns 0.75s infinite alternate;
|
||||||
|
-moz-animation: pulseWarningIns 0.75s infinite alternate;
|
||||||
|
animation: pulseWarningIns 0.75s infinite alternate; }
|
|
@ -6,6 +6,7 @@
|
||||||
<!-- Bootstrap -->
|
<!-- Bootstrap -->
|
||||||
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
|
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
|
||||||
<link href="/css/style.css" rel="stylesheet" media="screen">
|
<link href="/css/style.css" rel="stylesheet" media="screen">
|
||||||
|
<link href="/css/sweet-alert.css" rel="stylesheet" media="screen">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default" role="navigation">
|
<nav class="navbar navbar-default" role="navigation">
|
||||||
|
|
0
domain-server/resources/web/js/form2js.min.js
vendored
Executable file → Normal file
|
@ -1,12 +1,22 @@
|
||||||
var Settings = {
|
var Settings = {
|
||||||
showAdvanced: false
|
showAdvanced: false,
|
||||||
|
ADVANCED_CLASS: 'advanced-setting',
|
||||||
|
TRIGGER_CHANGE_CLASS: 'trigger-change',
|
||||||
|
DATA_ROW_CLASS: 'value-row',
|
||||||
|
DATA_COL_CLASS: 'value-col',
|
||||||
|
ADD_ROW_BUTTON_CLASS: 'add-row',
|
||||||
|
ADD_ROW_SPAN_CLASSES: 'glyphicon glyphicon-plus add-row',
|
||||||
|
DEL_ROW_BUTTON_CLASS: 'del-row',
|
||||||
|
DEL_ROW_SPAN_CLASSES: 'glyphicon glyphicon-remove del-row',
|
||||||
|
TABLE_BUTTONS_CLASS: 'buttons',
|
||||||
|
NEW_ROW_CLASS: 'new-row'
|
||||||
};
|
};
|
||||||
|
|
||||||
var viewHelpers = {
|
var viewHelpers = {
|
||||||
getFormGroup: function(groupName, setting, values, isAdvanced, isLocked) {
|
getFormGroup: function(groupName, setting, values, isAdvanced, isLocked) {
|
||||||
setting_name = groupName + "." + setting.name
|
setting_name = groupName + "." + setting.name
|
||||||
|
|
||||||
form_group = "<div class='form-group" + (isAdvanced ? " advanced-setting" : "") + "'>"
|
form_group = "<div class='form-group " + (isAdvanced ? Settings.ADVANCED_CLASS : "") + "'>"
|
||||||
|
|
||||||
if (_.has(values, groupName) && _.has(values[groupName], setting.name)) {
|
if (_.has(values, groupName) && _.has(values[groupName], setting.name)) {
|
||||||
setting_value = values[groupName][setting.name]
|
setting_value = values[groupName][setting.name]
|
||||||
|
@ -21,14 +31,18 @@ var viewHelpers = {
|
||||||
label_class += ' locked'
|
label_class += ' locked'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common_attrs = " class='" + (setting.type !== 'checkbox' ? 'form-control' : '')
|
||||||
|
+ " " + Settings.TRIGGER_CHANGE_CLASS + "' data-short-name='" + setting.name + "' name='" + setting_name + "' "
|
||||||
|
|
||||||
if (setting.type === 'checkbox') {
|
if (setting.type === 'checkbox') {
|
||||||
form_group += "<label class='" + label_class + "'>" + setting.label + "</label>"
|
form_group += "<label class='" + label_class + "'>" + setting.label + "</label>"
|
||||||
form_group += "<div class='checkbox" + (isLocked ? " disabled" : "") + "'>"
|
form_group += "<div class='checkbox" + (isLocked ? " disabled" : "") + "'>"
|
||||||
form_group += "<label for='" + setting_name + "'>"
|
form_group += "<label for='" + setting_name + "'>"
|
||||||
form_group += "<input type='checkbox' name='" + setting_name + "' " +
|
form_group += "<input type='checkbox'" + common_attrs + (setting_value ? "checked" : "") + (isLocked ? " disabled" : "") + "/>"
|
||||||
(setting_value ? "checked" : "") + (isLocked ? " disabled" : "") + "/>"
|
|
||||||
form_group += " " + setting.help + "</label>";
|
form_group += " " + setting.help + "</label>";
|
||||||
form_group += "</div>"
|
form_group += "</div>"
|
||||||
|
} else if (setting.type === 'table') {
|
||||||
|
form_group += makeTable(setting, setting_name, setting_value);
|
||||||
} else {
|
} else {
|
||||||
input_type = _.has(setting, 'type') ? setting.type : "text"
|
input_type = _.has(setting, 'type') ? setting.type : "text"
|
||||||
|
|
||||||
|
@ -39,15 +53,20 @@ var viewHelpers = {
|
||||||
|
|
||||||
_.each(setting.options, function(option) {
|
_.each(setting.options, function(option) {
|
||||||
form_group += "<option value='" + option.value + "'" +
|
form_group += "<option value='" + option.value + "'" +
|
||||||
(option.value == setting_value ? 'selected' : '') + ">" + option.label + "</option>"
|
(option.value == setting_value ? 'selected' : '') + ">" + option.label + "</option>"
|
||||||
})
|
})
|
||||||
|
|
||||||
form_group += "</select>"
|
form_group += "</select>"
|
||||||
|
|
||||||
form_group += "<input type='hidden' name='" + setting_name + "' value='" + setting_value + "'>"
|
form_group += "<input type='hidden'" + common_attrs + "value='" + setting_value + "'>"
|
||||||
} else {
|
} else {
|
||||||
form_group += "<input type='" + input_type + "' class='form-control' name='" + setting_name +
|
|
||||||
"' placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
if (input_type == 'integer') {
|
||||||
|
input_type = "text"
|
||||||
|
}
|
||||||
|
|
||||||
|
form_group += "<input type='" + input_type + "'" + common_attrs +
|
||||||
|
"placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
||||||
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,18 +88,44 @@ $(document).ready(function(){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$('[data-clampedwidth]').each(function () {
|
$('[data-clampedwidth]').each(function () {
|
||||||
var elem = $(this);
|
var elem = $(this);
|
||||||
var parentPanel = elem.data('clampedwidth');
|
var parentPanel = elem.data('clampedwidth');
|
||||||
var resizeFn = function () {
|
var resizeFn = function () {
|
||||||
var sideBarNavWidth = $(parentPanel).width() - parseInt(elem.css('paddingLeft')) - parseInt(elem.css('paddingRight')) - parseInt(elem.css('marginLeft')) - parseInt(elem.css('marginRight')) - parseInt(elem.css('borderLeftWidth')) - parseInt(elem.css('borderRightWidth'));
|
var sideBarNavWidth = $(parentPanel).width() - parseInt(elem.css('paddingLeft')) - parseInt(elem.css('paddingRight')) - parseInt(elem.css('marginLeft')) - parseInt(elem.css('marginRight')) - parseInt(elem.css('borderLeftWidth')) - parseInt(elem.css('borderRightWidth'));
|
||||||
elem.css('width', sideBarNavWidth);
|
elem.css('width', sideBarNavWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
resizeFn();
|
resizeFn();
|
||||||
$(window).resize(resizeFn);
|
$(window).resize(resizeFn);
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#settings-form').on('click', '.' + Settings.ADD_ROW_BUTTON_CLASS, function(){
|
||||||
|
addTableRow(this);
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#settings-form').on('click', '.' + Settings.DEL_ROW_BUTTON_CLASS, function(){
|
||||||
|
deleteTableRow(this);
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#settings-form').on('change', 'input', function(){
|
$('#settings-form').on('keypress', 'table input', function(e){
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
// capture enter in table input
|
||||||
|
// if we have a sibling next to us that has an input, jump to it, otherwise check if we have a glyphicon for add to click
|
||||||
|
sibling = $(this).parent('td').next();
|
||||||
|
|
||||||
|
if (sibling.hasClass(Settings.DATA_COL_CLASS)) {
|
||||||
|
// set focus to next input
|
||||||
|
sibling.find('input').focus()
|
||||||
|
} else if (sibling.hasClass(Settings.TABLE_BUTTONS_CLASS)) {
|
||||||
|
sibling.find('.' + Settings.ADD_ROW_BUTTON_CLASS).click()
|
||||||
|
|
||||||
|
// set focus to the first input in the new row
|
||||||
|
$(this).closest('table').find('tr.inputs input:first').focus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#settings-form').on('change', '.' + Settings.TRIGGER_CHANGE_CLASS , function(){
|
||||||
// this input was changed, add the changed data attribute to it
|
// this input was changed, add the changed data attribute to it
|
||||||
$(this).attr('data-changed', true)
|
$(this).attr('data-changed', true)
|
||||||
|
|
||||||
|
@ -89,7 +134,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
$('#advanced-toggle-button').click(function(){
|
$('#advanced-toggle-button').click(function(){
|
||||||
Settings.showAdvanced = !Settings.showAdvanced
|
Settings.showAdvanced = !Settings.showAdvanced
|
||||||
var advancedSelector = $('.advanced-setting')
|
var advancedSelector = $('.' + Settings.ADVANCED_CLASS)
|
||||||
|
|
||||||
if (Settings.showAdvanced) {
|
if (Settings.showAdvanced) {
|
||||||
advancedSelector.show()
|
advancedSelector.show()
|
||||||
|
@ -107,7 +152,6 @@ $(document).ready(function(){
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#settings-form').on('change', 'select', function(){
|
$('#settings-form').on('change', 'select', function(){
|
||||||
console.log("Changed" + $(this))
|
|
||||||
$("input[name='" + $(this).attr('data-hidden-input') + "']").val($(this).val()).change()
|
$("input[name='" + $(this).attr('data-hidden-input') + "']").val($(this).val()).change()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -177,29 +221,126 @@ $('body').on('click', '.save-button', function(e){
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
showRestartModal();
|
showRestartModal();
|
||||||
} else {
|
} else {
|
||||||
showAlertMessage(SETTINGS_ERROR_MESSAGE, false);
|
showErrorMessage("Error", SETTINGS_ERROR_MESSAGE)
|
||||||
reloadSettings();
|
reloadSettings();
|
||||||
}
|
}
|
||||||
}).fail(function(){
|
}).fail(function(){
|
||||||
showAlertMessage(SETTINGS_ERROR_MESSAGE, false);
|
showErrorMessage("Error", SETTINGS_ERROR_MESSAGE)
|
||||||
reloadSettings();
|
reloadSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
function badgeSidebarForDifferences(changedInput) {
|
function makeTable(setting, setting_name, setting_value) {
|
||||||
|
var isArray = !_.has(setting, 'key')
|
||||||
|
|
||||||
|
var html = "<label class='control-label'>" + setting.label + "</label>"
|
||||||
|
html += "<span class='help-block'>" + setting.help + "</span>"
|
||||||
|
html += "<table class='table table-bordered' data-short-name='" + setting.name + "' name='" + setting_name
|
||||||
|
+ "' data-setting-type='" + (isArray ? 'array' : 'hash') + "'>"
|
||||||
|
|
||||||
|
// Column names
|
||||||
|
html += "<tr class='headers'>"
|
||||||
|
|
||||||
|
if (setting.numbered === true) {
|
||||||
|
html += "<td class='number'><strong>#</strong></td>" // Row number
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setting.key) {
|
||||||
|
html += "<td class='key'><strong>" + setting.key.label + "</strong></td>" // Key
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(setting.columns, function(col) {
|
||||||
|
html += "<td class='data'><strong>" + col.label + "</strong></td>" // Data
|
||||||
|
})
|
||||||
|
|
||||||
|
html += "<td class='buttons'><strong>+/-</strong></td></tr>"
|
||||||
|
|
||||||
|
// populate rows in the table from existing values
|
||||||
|
var row_num = 1
|
||||||
|
|
||||||
|
_.each(setting_value, function(row, indexOrName) {
|
||||||
|
html += "<tr class='" + Settings.DATA_ROW_CLASS + "'" + (isArray ? "" : "name='" + setting_name + "." + indexOrName + "'") + ">"
|
||||||
|
|
||||||
|
if (setting.numbered === true) {
|
||||||
|
html += "<td class='numbered'>" + row_num + "</td>"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setting.key) {
|
||||||
|
html += "<td class='key'>" + indexOrName + "</td>"
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(setting.columns, function(col) {
|
||||||
|
html += "<td class='" + Settings.DATA_COL_CLASS + "'>"
|
||||||
|
|
||||||
|
if (isArray) {
|
||||||
|
colIsArray = _.isArray(row)
|
||||||
|
colValue = colIsArray ? row : row[col.name]
|
||||||
|
html += colValue
|
||||||
|
|
||||||
|
// for arrays we add a hidden input to this td so that values can be posted appropriately
|
||||||
|
html += "<input type='hidden' name='" + setting_name + "[" + indexOrName + "]"
|
||||||
|
+ (colIsArray ? "" : "." + col.name) + "' value='" + colValue + "'/>"
|
||||||
|
} else if (row.hasOwnProperty(col.name)) {
|
||||||
|
html += row[col.name]
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</td>"
|
||||||
|
})
|
||||||
|
|
||||||
|
html += "<td class='buttons'><span class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></span></td>"
|
||||||
|
html += "</tr>"
|
||||||
|
|
||||||
|
row_num++
|
||||||
|
})
|
||||||
|
|
||||||
|
// populate inputs in the table for new values
|
||||||
|
html += makeTableInputs(setting)
|
||||||
|
html += "</table>"
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeTableInputs(setting) {
|
||||||
|
var html = "<tr class='inputs'>"
|
||||||
|
|
||||||
|
if (setting.numbered === true) {
|
||||||
|
html += "<td class='numbered'></td>"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setting.key) {
|
||||||
|
html += "<td class='key' name='" + setting.key.name + "'>\
|
||||||
|
<input type='text' class='form-control' placeholder='" + (_.has(setting.key, 'placeholder') ? setting.key.placeholder : "") + "' value=''>\
|
||||||
|
</td>"
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(setting.columns, function(col) {
|
||||||
|
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>\
|
||||||
|
<input type='text' class='form-control' placeholder='" + (col.key ? col.key : "") + "' value=''>\
|
||||||
|
</td>"
|
||||||
|
})
|
||||||
|
|
||||||
|
html += "<td class='buttons'><span class='glyphicon glyphicon-plus " + Settings.ADD_ROW_BUTTON_CLASS + "'></span></td>"
|
||||||
|
html += "</tr>"
|
||||||
|
|
||||||
|
return html
|
||||||
|
}
|
||||||
|
|
||||||
|
function badgeSidebarForDifferences(changedElement) {
|
||||||
// figure out which group this input is in
|
// figure out which group this input is in
|
||||||
var panelParentID = changedInput.closest('.panel').attr('id')
|
var panelParentID = changedElement.closest('.panel').attr('id')
|
||||||
|
|
||||||
// get a JSON representation of that section
|
// get a JSON representation of that section
|
||||||
var rootJSON = form2js(panelParentID, ".", false, cleanupFormValues, true);
|
var panelJSON = form2js(panelParentID, ".", false, cleanupFormValues, true)[panelParentID]
|
||||||
var panelJSON = rootJSON[panelParentID]
|
var initialPanelJSON = Settings.initialValues[panelParentID]
|
||||||
|
|
||||||
var badgeValue = 0
|
var badgeValue = 0
|
||||||
|
|
||||||
|
// badge for any settings we have that are not the same or are not present in initialValues
|
||||||
for (var setting in panelJSON) {
|
for (var setting in panelJSON) {
|
||||||
if (panelJSON[setting] != Settings.initialValues[panelParentID][setting]) {
|
if (!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
||||||
|
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting))) {
|
||||||
badgeValue += 1
|
badgeValue += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,6 +353,180 @@ function badgeSidebarForDifferences(changedInput) {
|
||||||
$("a[href='#" + panelParentID + "'] .badge").html(badgeValue);
|
$("a[href='#" + panelParentID + "'] .badge").html(badgeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addTableRow(add_glyphicon) {
|
||||||
|
var row = $(add_glyphicon).closest('tr')
|
||||||
|
|
||||||
|
var table = row.parents('table')
|
||||||
|
var isArray = table.data('setting-type') === 'array'
|
||||||
|
|
||||||
|
var columns = row.parent().children('.' + Settings.DATA_ROW_CLASS)
|
||||||
|
|
||||||
|
if (!isArray) {
|
||||||
|
// Check key spaces
|
||||||
|
var key = row.children(".key").children("input").val()
|
||||||
|
if (key.indexOf(' ') !== -1) {
|
||||||
|
showErrorMessage("Error", "Key contains spaces")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Check keys with the same name
|
||||||
|
var equals = false;
|
||||||
|
_.each(columns.children(".key"), function(element) {
|
||||||
|
if ($(element).text() === key) {
|
||||||
|
equals = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (equals) {
|
||||||
|
showErrorMessage("Error", "Two keys cannot be identical")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check empty fields
|
||||||
|
var empty = false;
|
||||||
|
_.each(row.children('.' + Settings.DATA_COL_CLASS + ' input'), function(element) {
|
||||||
|
if ($(element).val().length === 0) {
|
||||||
|
empty = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (empty) {
|
||||||
|
showErrorMessage("Error", "Empty field(s)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var input_clone = row.clone()
|
||||||
|
|
||||||
|
// Change input row to data row
|
||||||
|
var table = row.parents("table")
|
||||||
|
var setting_name = table.attr("name")
|
||||||
|
var full_name = setting_name + "." + key
|
||||||
|
row.addClass(Settings.DATA_ROW_CLASS + " " + Settings.NEW_ROW_CLASS)
|
||||||
|
row.removeClass("inputs")
|
||||||
|
|
||||||
|
_.each(row.children(), function(element) {
|
||||||
|
if ($(element).hasClass("numbered")) {
|
||||||
|
// Index row
|
||||||
|
var numbers = columns.children(".numbered")
|
||||||
|
if (numbers.length > 0) {
|
||||||
|
$(element).html(parseInt(numbers.last().text()) + 1)
|
||||||
|
} else {
|
||||||
|
$(element).html(1)
|
||||||
|
}
|
||||||
|
} else if ($(element).hasClass("buttons")) {
|
||||||
|
// Change buttons
|
||||||
|
var span = $(element).children("span")
|
||||||
|
span.removeClass(Settings.ADD_ROW_SPAN_CLASSES)
|
||||||
|
span.addClass(Settings.DEL_ROW_SPAN_CLASSES)
|
||||||
|
} else if ($(element).hasClass("key")) {
|
||||||
|
var input = $(element).children("input")
|
||||||
|
$(element).html(input.val())
|
||||||
|
input.remove()
|
||||||
|
} else if ($(element).hasClass(Settings.DATA_COL_CLASS)) {
|
||||||
|
// Hide inputs
|
||||||
|
var input = $(element).children("input")
|
||||||
|
input.attr("type", "hidden")
|
||||||
|
|
||||||
|
if (isArray) {
|
||||||
|
var row_index = row.siblings('.' + Settings.DATA_ROW_CLASS).length
|
||||||
|
var key = $(element).attr('name')
|
||||||
|
|
||||||
|
// are there multiple columns or just one?
|
||||||
|
// with multiple we have an array of Objects, with one we have an array of whatever the value type is
|
||||||
|
var num_columns = row.children('.' + Settings.DATA_COL_CLASS).length
|
||||||
|
input.attr("name", setting_name + "[" + row_index + "]" + (num_columns > 1 ? "." + key : ""))
|
||||||
|
} else {
|
||||||
|
input.attr("name", full_name + "." + $(element).attr("name"))
|
||||||
|
}
|
||||||
|
|
||||||
|
input.attr("data-changed", "true")
|
||||||
|
|
||||||
|
$(element).append(input.val())
|
||||||
|
} else {
|
||||||
|
console.log("Unknown table element")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
input_clone.find('input').each(function(){
|
||||||
|
$(this).val('')
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isArray) {
|
||||||
|
updateDataChangedForSiblingRows(row, true)
|
||||||
|
|
||||||
|
// the addition of any table row should remove the empty-array-row
|
||||||
|
row.siblings('.empty-array-row').remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
badgeSidebarForDifferences($(table))
|
||||||
|
|
||||||
|
row.parent().append(input_clone)
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteTableRow(delete_glyphicon) {
|
||||||
|
var row = $(delete_glyphicon).closest('tr')
|
||||||
|
|
||||||
|
var table = $(row).closest('table')
|
||||||
|
var isArray = table.data('setting-type') === 'array'
|
||||||
|
|
||||||
|
if (!isArray) {
|
||||||
|
// this is a hash row, so we empty it but leave the hidden input blank so it is cleared when we save
|
||||||
|
row.empty()
|
||||||
|
row.html("<input type='hidden' class='form-control' name='"
|
||||||
|
+ row.attr('name') + "' data-changed='true' value=''>");
|
||||||
|
} else {
|
||||||
|
if (table.find('.' + Settings.DATA_ROW_CLASS).length) {
|
||||||
|
updateDataChangedForSiblingRows(row)
|
||||||
|
|
||||||
|
// this isn't the last row - we can just remove it
|
||||||
|
row.remove()
|
||||||
|
} else {
|
||||||
|
// this is the last row, we can't remove it completely since we need to post an empty array
|
||||||
|
row.empty()
|
||||||
|
|
||||||
|
row.removeClass(Settings.DATA_ROW_CLASS).removeClass(Settings.NEW_ROW_CLASS)
|
||||||
|
row.addClass('empty-array-row')
|
||||||
|
|
||||||
|
row.html("<input type='hidden' class='form-control' name='" + table.attr("name").replace('[]', '')
|
||||||
|
+ "' data-changed='true' value=''>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we need to fire a change event on one of the remaining inputs so that the sidebar badge is updated
|
||||||
|
badgeSidebarForDifferences($(table))
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDataChangedForSiblingRows(row, forceTrue) {
|
||||||
|
// anytime a new row is added to an array we need to set data-changed for all sibling row inputs to true
|
||||||
|
// unless it matches the inital set of values
|
||||||
|
|
||||||
|
if (!forceTrue) {
|
||||||
|
// figure out which group this row is in
|
||||||
|
var panelParentID = row.closest('.panel').attr('id')
|
||||||
|
// get the short name for the setting from the table
|
||||||
|
var tableShortName = row.closest('table').data('short-name')
|
||||||
|
|
||||||
|
// get a JSON representation of that section
|
||||||
|
var panelSettingJSON = form2js(panelParentID, ".", false, cleanupFormValues, true)[panelParentID][tableShortName]
|
||||||
|
var initialPanelSettingJSON = Settings.initialValues[panelParentID][tableShortName]
|
||||||
|
|
||||||
|
// if they are equal, we don't need data-changed
|
||||||
|
isTrue = _.isEqual(panelSettingJSON, initialPanelSettingJSON)
|
||||||
|
} else {
|
||||||
|
isTrue = true
|
||||||
|
}
|
||||||
|
|
||||||
|
row.siblings('.' + Settings.DATA_ROW_CLASS).each(function(){
|
||||||
|
var hiddenInput = $(this).find('td.' + Settings.DATA_COL_CLASS + ' input')
|
||||||
|
if (isTrue) {
|
||||||
|
hiddenInput.attr('data-changed', isTrue)
|
||||||
|
} else {
|
||||||
|
hiddenInput.removeAttr('data-changed')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function showRestartModal() {
|
function showRestartModal() {
|
||||||
$('#restart-modal').modal({
|
$('#restart-modal').modal({
|
||||||
backdrop: 'static',
|
backdrop: 'static',
|
||||||
|
@ -237,7 +552,7 @@ function showRestartModal() {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupFormValues(node) {
|
function cleanupFormValues(node) {
|
||||||
if (node.type && node.type === 'checkbox') {
|
if (node.type && node.type === 'checkbox') {
|
||||||
return { name: node.name, value: node.checked ? true : false };
|
return { name: node.name, value: node.checked ? true : false };
|
||||||
} else {
|
} else {
|
||||||
|
@ -245,12 +560,8 @@ function cleanupFormValues(node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAlertMessage(message, isSuccess) {
|
function showErrorMessage(title, message) {
|
||||||
var alertBox = $('.alert');
|
swal(title, message)
|
||||||
alertBox.attr('class', 'alert');
|
|
||||||
alertBox.addClass(isSuccess ? 'alert-success' : 'alert-danger');
|
|
||||||
alertBox.html(message);
|
|
||||||
alertBox.fadeIn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseFromHighFidelityDomains(clickedButton) {
|
function chooseFromHighFidelityDomains(clickedButton) {
|
||||||
|
@ -292,7 +603,7 @@ function chooseFromHighFidelityDomains(clickedButton) {
|
||||||
modal_buttons["success"] = {
|
modal_buttons["success"] = {
|
||||||
label: 'Create new domain',
|
label: 'Create new domain',
|
||||||
callback: function() {
|
callback: function() {
|
||||||
window.open("https://data.highfidelity.io/domains", '_blank');
|
window.open("https://data.highfidelity.io/user/domains", '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
modal_body = "<p>You do not have any domains in your High Fidelity account." +
|
modal_body = "<p>You do not have any domains in your High Fidelity account." +
|
||||||
|
|
1
domain-server/resources/web/js/sweet-alert.min.js
vendored
Executable file
|
@ -1,5 +1,6 @@
|
||||||
<!--#include virtual="header.html"-->
|
<!--#include virtual="header.html"-->
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-10 col-md-offset-1">
|
<div class="col-md-10 col-md-offset-1">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="alert" style="display:none;"></div>
|
<div class="alert" style="display:none;"></div>
|
||||||
|
@ -76,6 +77,7 @@
|
||||||
<!--#include virtual="footer.html"-->
|
<!--#include virtual="footer.html"-->
|
||||||
<script src='/js/underscore-min.js'></script>
|
<script src='/js/underscore-min.js'></script>
|
||||||
<script src='/js/bootbox.min.js'></script>
|
<script src='/js/bootbox.min.js'></script>
|
||||||
|
<script src='/js/sweet-alert.min.js'></script>
|
||||||
<script src='/js/settings.js'></script>
|
<script src='/js/settings.js'></script>
|
||||||
<script src='/js/form2js.min.js'></script>
|
<script src='/js/form2js.min.js'></script>
|
||||||
<!--#include virtual="page-end.html"-->
|
<!--#include virtual="page-end.html"-->
|
|
@ -57,6 +57,10 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
setApplicationName("domain-server");
|
setApplicationName("domain-server");
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
|
|
||||||
|
// make sure we have a fresh AccountManager instance
|
||||||
|
// (need this since domain-server can restart itself and maintain static variables)
|
||||||
|
AccountManager::getInstance(true);
|
||||||
|
|
||||||
_settingsManager.setupConfigMap(arguments());
|
_settingsManager.setupConfigMap(arguments());
|
||||||
|
|
||||||
installNativeEventFilter(&_shutdownEventListener);
|
installNativeEventFilter(&_shutdownEventListener);
|
||||||
|
@ -82,10 +86,6 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
void DomainServer::restart() {
|
void DomainServer::restart() {
|
||||||
qDebug() << "domain-server is restarting.";
|
qDebug() << "domain-server is restarting.";
|
||||||
|
|
||||||
// make sure all static instances are reset
|
|
||||||
LimitedNodeList::getInstance()->reset();
|
|
||||||
AccountManager::getInstance(true);
|
|
||||||
|
|
||||||
exit(DomainServer::EXIT_CODE_REBOOT);
|
exit(DomainServer::EXIT_CODE_REBOOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,17 +189,20 @@ bool DomainServer::optionallySetupOAuth() {
|
||||||
|
|
||||||
const QString DOMAIN_CONFIG_ID_KEY = "id";
|
const QString DOMAIN_CONFIG_ID_KEY = "id";
|
||||||
|
|
||||||
|
const QString METAVERSE_AUTOMATIC_NETWORKING_KEY_PATH = "metaverse.automatic_networking";
|
||||||
|
const QString FULL_AUTOMATIC_NETWORKING_VALUE = "full";
|
||||||
|
const QString IP_ONLY_AUTOMATIC_NETWORKING_VALUE = "ip";
|
||||||
|
const QString DISABLED_AUTOMATIC_NETWORKING_VALUE = "disabled";
|
||||||
|
|
||||||
void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
|
|
||||||
const QString CUSTOM_PORT_OPTION = "port";
|
const QString CUSTOM_LOCAL_PORT_OPTION = "metaverse.local_port";
|
||||||
unsigned short domainServerPort = DEFAULT_DOMAIN_SERVER_PORT;
|
|
||||||
|
QVariant localPortValue = _settingsManager.valueOrDefaultValueForKeyPath(CUSTOM_LOCAL_PORT_OPTION);
|
||||||
|
unsigned short domainServerPort = (unsigned short) localPortValue.toUInt();
|
||||||
|
|
||||||
QVariantMap& settingsMap = _settingsManager.getSettingsMap();
|
QVariantMap& settingsMap = _settingsManager.getSettingsMap();
|
||||||
|
|
||||||
if (settingsMap.contains(CUSTOM_PORT_OPTION)) {
|
|
||||||
domainServerPort = (unsigned short) settingsMap.value(CUSTOM_PORT_OPTION).toUInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned short domainServerDTLSPort = 0;
|
unsigned short domainServerDTLSPort = 0;
|
||||||
|
|
||||||
if (_isUsingDTLS) {
|
if (_isUsingDTLS) {
|
||||||
|
@ -310,12 +313,7 @@ bool DomainServer::optionallySetupAssignmentPayment() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString FULL_AUTOMATIC_NETWORKING_VALUE = "full";
|
|
||||||
const QString IP_ONLY_AUTOMATIC_NETWORKING_VALUE = "ip";
|
|
||||||
const QString DISABLED_AUTOMATIC_NETWORKING_VALUE = "disabled";
|
|
||||||
|
|
||||||
void DomainServer::setupAutomaticNetworking() {
|
void DomainServer::setupAutomaticNetworking() {
|
||||||
const QString METAVERSE_AUTOMATIC_NETWORKING_KEY_PATH = "metaverse.automatic_networking";
|
|
||||||
|
|
||||||
if (!didSetupAccountManagerWithAccessToken()) {
|
if (!didSetupAccountManagerWithAccessToken()) {
|
||||||
qDebug() << "Cannot setup domain-server automatic networking without an access token.";
|
qDebug() << "Cannot setup domain-server automatic networking without an access token.";
|
||||||
|
@ -357,8 +355,12 @@ void DomainServer::setupAutomaticNetworking() {
|
||||||
connect(iceHeartbeatTimer, &QTimer::timeout, this, &DomainServer::performICEUpdates);
|
connect(iceHeartbeatTimer, &QTimer::timeout, this, &DomainServer::performICEUpdates);
|
||||||
iceHeartbeatTimer->start(ICE_HEARBEAT_INTERVAL_MSECS);
|
iceHeartbeatTimer->start(ICE_HEARBEAT_INTERVAL_MSECS);
|
||||||
|
|
||||||
// call our sendHeartbeaToIceServer immediately anytime a public address changes
|
// call our sendHeartbeaToIceServer immediately anytime a local or public socket changes
|
||||||
|
connect(nodeList, &LimitedNodeList::localSockAddrChanged, this, &DomainServer::sendHearbeatToIceServer);
|
||||||
connect(nodeList, &LimitedNodeList::publicSockAddrChanged, this, &DomainServer::sendHearbeatToIceServer);
|
connect(nodeList, &LimitedNodeList::publicSockAddrChanged, this, &DomainServer::sendHearbeatToIceServer);
|
||||||
|
|
||||||
|
// tell the data server which type of automatic networking we are using
|
||||||
|
updateNetworkingInfoWithDataServer(automaticNetworkValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// attempt to update our sockets now
|
// attempt to update our sockets now
|
||||||
|
@ -999,7 +1001,6 @@ void DomainServer::updateNetworkingInfoWithDataServer(const QString& newSetting,
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: have data-web respond with ice-server hostname to use
|
// todo: have data-web respond with ice-server hostname to use
|
||||||
const HifiSockAddr ICE_SERVER_SOCK_ADDR = HifiSockAddr("ice.highfidelity.io", ICE_SERVER_DEFAULT_PORT);
|
|
||||||
|
|
||||||
void DomainServer::performICEUpdates() {
|
void DomainServer::performICEUpdates() {
|
||||||
sendHearbeatToIceServer();
|
sendHearbeatToIceServer();
|
||||||
|
@ -1007,6 +1008,7 @@ void DomainServer::performICEUpdates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::sendHearbeatToIceServer() {
|
void DomainServer::sendHearbeatToIceServer() {
|
||||||
|
const HifiSockAddr ICE_SERVER_SOCK_ADDR = HifiSockAddr("ice.highfidelity.io", ICE_SERVER_DEFAULT_PORT);
|
||||||
LimitedNodeList::getInstance()->sendHeartbeatToIceServer(ICE_SERVER_SOCK_ADDR);
|
LimitedNodeList::getInstance()->sendHeartbeatToIceServer(ICE_SERVER_SOCK_ADDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,7 +1026,7 @@ void DomainServer::sendICEPingPackets() {
|
||||||
} else {
|
} else {
|
||||||
// send ping packets to this peer's interfaces
|
// send ping packets to this peer's interfaces
|
||||||
qDebug() << "Sending ping packets to establish connectivity with ICE peer with ID"
|
qDebug() << "Sending ping packets to establish connectivity with ICE peer with ID"
|
||||||
<< peer->getUUID();
|
<< peer->getUUID();
|
||||||
|
|
||||||
// send the ping packet to the local and public sockets for this node
|
// send the ping packet to the local and public sockets for this node
|
||||||
QByteArray localPingPacket = nodeList->constructPingPacket(PingType::Local, false);
|
QByteArray localPingPacket = nodeList->constructPingPacket(PingType::Local, false);
|
||||||
|
@ -1052,11 +1054,13 @@ void DomainServer::processICEHeartbeatResponse(const QByteArray& packet) {
|
||||||
while (!iceResponseStream.atEnd()) {
|
while (!iceResponseStream.atEnd()) {
|
||||||
iceResponseStream >> receivedPeer;
|
iceResponseStream >> receivedPeer;
|
||||||
|
|
||||||
if (!_connectingICEPeers.contains(receivedPeer.getUUID()) && !_connectedICEPeers.contains(receivedPeer.getUUID())) {
|
if (!_connectedICEPeers.contains(receivedPeer.getUUID())) {
|
||||||
qDebug() << "New peer requesting connection being added to hash -" << receivedPeer;
|
if (!_connectingICEPeers.contains(receivedPeer.getUUID())) {
|
||||||
|
qDebug() << "New peer requesting connection being added to hash -" << receivedPeer;
|
||||||
|
}
|
||||||
|
|
||||||
|
_connectingICEPeers[receivedPeer.getUUID()] = receivedPeer;
|
||||||
}
|
}
|
||||||
|
|
||||||
_connectingICEPeers[receivedPeer.getUUID()] = receivedPeer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ const QString SETTINGS_DESCRIPTION_RELATIVE_PATH = "/resources/describe-settings
|
||||||
const QString DESCRIPTION_SETTINGS_KEY = "settings";
|
const QString DESCRIPTION_SETTINGS_KEY = "settings";
|
||||||
const QString SETTING_DEFAULT_KEY = "default";
|
const QString SETTING_DEFAULT_KEY = "default";
|
||||||
const QString DESCRIPTION_NAME_KEY = "name";
|
const QString DESCRIPTION_NAME_KEY = "name";
|
||||||
|
const QString SETTING_DESCRIPTION_TYPE_KEY = "type";
|
||||||
|
|
||||||
DomainServerSettingsManager::DomainServerSettingsManager() :
|
DomainServerSettingsManager::DomainServerSettingsManager() :
|
||||||
_descriptionArray(),
|
_descriptionArray(),
|
||||||
|
@ -232,63 +233,95 @@ QJsonObject DomainServerSettingsManager::responseObjectForType(const QString& ty
|
||||||
return responseObject;
|
return responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DomainServerSettingsManager::settingExists(const QString& groupName, const QString& settingName,
|
||||||
|
const QJsonArray& descriptionArray, QJsonValue& settingDescription) {
|
||||||
|
foreach(const QJsonValue& groupValue, descriptionArray) {
|
||||||
|
QJsonObject groupObject = groupValue.toObject();
|
||||||
|
if (groupObject[DESCRIPTION_NAME_KEY].toString() == groupName) {
|
||||||
|
|
||||||
|
foreach(const QJsonValue& settingValue, groupObject[DESCRIPTION_SETTINGS_KEY].toArray()) {
|
||||||
|
QJsonObject settingObject = settingValue.toObject();
|
||||||
|
if (settingObject[DESCRIPTION_NAME_KEY].toString() == settingName) {
|
||||||
|
settingDescription = settingObject[SETTING_DEFAULT_KEY];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settingDescription = QJsonValue::Undefined;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const QString SETTING_DESCRIPTION_TYPE_KEY = "type";
|
void DomainServerSettingsManager::updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap& settingMap,
|
||||||
|
const QJsonValue& settingDescription) {
|
||||||
|
if (newValue.isString()) {
|
||||||
|
if (newValue.toString().isEmpty()) {
|
||||||
|
// this is an empty value, clear it in settings variant so the default is sent
|
||||||
|
settingMap.remove(key);
|
||||||
|
} else {
|
||||||
|
// make sure the resulting json value has the right type
|
||||||
|
const QString settingType = settingDescription.toObject()[SETTING_DESCRIPTION_TYPE_KEY].toString();
|
||||||
|
const QString INPUT_DOUBLE_TYPE = "double";
|
||||||
|
const QString INPUT_INTEGER_TYPE = "int";
|
||||||
|
|
||||||
|
if (settingType == INPUT_DOUBLE_TYPE) {
|
||||||
|
settingMap[key] = newValue.toString().toDouble();
|
||||||
|
} else if (settingType == INPUT_INTEGER_TYPE) {
|
||||||
|
settingMap[key] = newValue.toString().toInt();
|
||||||
|
} else {
|
||||||
|
settingMap[key] = newValue.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (newValue.isBool()) {
|
||||||
|
settingMap[key] = newValue.toBool();
|
||||||
|
} else if (newValue.isObject()) {
|
||||||
|
if (!settingMap.contains(key)) {
|
||||||
|
// we don't have a map below this key yet, so set it up now
|
||||||
|
settingMap[key] = QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingMap[key].data());
|
||||||
|
foreach(const QString childKey, newValue.toObject().keys()) {
|
||||||
|
updateSetting(childKey, newValue.toObject()[childKey], thisMap, settingDescription.toObject()[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settingMap[key].toMap().isEmpty()) {
|
||||||
|
// we've cleared all of the settings below this value, so remove this one too
|
||||||
|
settingMap.remove(key);
|
||||||
|
}
|
||||||
|
} else if (newValue.isArray()) {
|
||||||
|
// we just assume array is replacement
|
||||||
|
settingMap[key] = newValue.toArray().toVariantList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
||||||
QVariantMap& settingsVariant,
|
QVariantMap& settingsVariant,
|
||||||
QJsonArray descriptionArray) {
|
const QJsonArray& descriptionArray) {
|
||||||
foreach(const QString& key, postedObject.keys()) {
|
// Iterate on the setting groups
|
||||||
|
foreach(const QString& groupKey, postedObject.keys()) {
|
||||||
|
QJsonValue groupValue = postedObject[groupKey];
|
||||||
|
|
||||||
QJsonValue rootValue = postedObject[key];
|
if (!settingsVariant.contains(groupKey)) {
|
||||||
|
// we don't have a map below this key yet, so set it up now
|
||||||
|
settingsVariant[groupKey] = QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
// we don't continue if this key is not present in our descriptionObject
|
// Iterate on the settings
|
||||||
foreach(const QJsonValue& groupValue, descriptionArray) {
|
foreach(const QString& settingKey, groupValue.toObject().keys()) {
|
||||||
if (groupValue.toObject()[DESCRIPTION_NAME_KEY].toString() == key) {
|
QJsonValue settingValue = groupValue.toObject()[settingKey];
|
||||||
QJsonObject groupObject = groupValue.toObject();
|
|
||||||
if (rootValue.isString()) {
|
QJsonValue thisDescription;
|
||||||
if (rootValue.toString().isEmpty()) {
|
if (settingExists(groupKey, settingKey, descriptionArray, thisDescription)) {
|
||||||
// this is an empty value, clear it in settings variant so the default is sent
|
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingsVariant[groupKey].data());
|
||||||
settingsVariant.remove(key);
|
updateSetting(settingKey, settingValue, thisMap, thisDescription);
|
||||||
} else {
|
|
||||||
QString settingType = groupObject[SETTING_DESCRIPTION_TYPE_KEY].toString();
|
|
||||||
|
|
||||||
const QString INPUT_DOUBLE_TYPE = "double";
|
|
||||||
|
|
||||||
// make sure the resulting json value has the right type
|
|
||||||
|
|
||||||
if (settingType == INPUT_DOUBLE_TYPE) {
|
|
||||||
settingsVariant[key] = rootValue.toString().toDouble();
|
|
||||||
} else {
|
|
||||||
settingsVariant[key] = rootValue.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (rootValue.isBool()) {
|
|
||||||
settingsVariant[key] = rootValue.toBool();
|
|
||||||
} else if (rootValue.isObject()) {
|
|
||||||
// there's a JSON Object to explore, so attempt to recurse into it
|
|
||||||
QJsonObject nextDescriptionObject = groupObject;
|
|
||||||
|
|
||||||
if (nextDescriptionObject.contains(DESCRIPTION_SETTINGS_KEY)) {
|
|
||||||
if (!settingsVariant.contains(key)) {
|
|
||||||
// we don't have a map below this key yet, so set it up now
|
|
||||||
settingsVariant[key] = QVariantMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingsVariant[key].data());
|
|
||||||
|
|
||||||
recurseJSONObjectAndOverwriteSettings(rootValue.toObject(),
|
|
||||||
thisMap,
|
|
||||||
nextDescriptionObject[DESCRIPTION_SETTINGS_KEY].toArray());
|
|
||||||
|
|
||||||
if (thisMap.isEmpty()) {
|
|
||||||
// we've cleared all of the settings below this value, so remove this one too
|
|
||||||
settingsVariant.remove(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settingsVariant[groupKey].toMap().empty()) {
|
||||||
|
// we've cleared all of the settings below this value, so remove this one too
|
||||||
|
settingsVariant.remove(groupKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,11 @@ public:
|
||||||
private:
|
private:
|
||||||
QJsonObject responseObjectForType(const QString& typeValue, bool isAuthenticated = false);
|
QJsonObject responseObjectForType(const QString& typeValue, bool isAuthenticated = false);
|
||||||
void recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, QVariantMap& settingsVariant,
|
void recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, QVariantMap& settingsVariant,
|
||||||
QJsonArray descriptionArray);
|
const QJsonArray& descriptionArray);
|
||||||
|
bool settingExists(const QString& groupName, const QString& settingName,
|
||||||
|
const QJsonArray& descriptionArray, QJsonValue& settingDescription);
|
||||||
|
void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap& settingMap,
|
||||||
|
const QJsonValue& settingDescription);
|
||||||
void persistToFile();
|
void persistToFile();
|
||||||
|
|
||||||
QJsonArray _descriptionArray;
|
QJsonArray _descriptionArray;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// Set the following variables to the right value
|
// Set the following variables to the right value
|
||||||
var NUM_AC = 3; // This is the number of AC. Their ID need to be unique and between 0 (included) and NUM_AC (excluded)
|
var NUM_AC = 3; // This is the number of AC. Their ID need to be unique and between 0 (included) and NUM_AC (excluded)
|
||||||
var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (Default name is "ACx", x = ID + 1))
|
var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (Default name is "ACx", x = ID + 1))
|
||||||
|
@ -37,7 +39,7 @@ COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
||||||
|
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var TOOL_ICON_URL = "http://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/";
|
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
var ALPHA_ON = 1.0;
|
var ALPHA_ON = 1.0;
|
||||||
var ALPHA_OFF = 0.7;
|
var ALPHA_OFF = 0.7;
|
||||||
var COLOR_TOOL_BAR = { red: 0, green: 0, blue: 0 };
|
var COLOR_TOOL_BAR = { red: 0, green: 0, blue: 0 };
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// Set the following variables to the values needed
|
// Set the following variables to the values needed
|
||||||
var filename = "http://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/bartender.rec";
|
var filename = HIFI_PUBLIC_BUCKET + "ozan/bartender.rec";
|
||||||
var playFromCurrentLocation = true;
|
var playFromCurrentLocation = true;
|
||||||
var useDisplayName = true;
|
var useDisplayName = true;
|
||||||
var useAttachments = true;
|
var useAttachments = true;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
Script.include("libraries/toolBars.js");
|
Script.include("libraries/toolBars.js");
|
||||||
|
|
||||||
var recordingFile = "recording.rec";
|
var recordingFile = "recording.rec";
|
||||||
|
@ -22,7 +23,7 @@ function setPlayerOptions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var TOOL_ICON_URL = "http://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/";
|
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
var ALPHA_ON = 1.0;
|
var ALPHA_ON = 1.0;
|
||||||
var ALPHA_OFF = 0.7;
|
var ALPHA_OFF = 0.7;
|
||||||
var COLOR_ON = { red: 128, green: 0, blue: 0 };
|
var COLOR_ON = { red: 128, green: 0, blue: 0 };
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function length(v) {
|
function length(v) {
|
||||||
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
||||||
}
|
}
|
||||||
|
@ -26,28 +28,28 @@ function vMinus(a, b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The model file to be used for the guitar
|
// The model file to be used for the guitar
|
||||||
var guitarModel = "https://s3-us-west-1.amazonaws.com/highfidelity-public/models/attachments/guitar.fst";
|
var guitarModel = HIFI_PUBLIC_BUCKET + "models/attachments/guitar.fst";
|
||||||
|
|
||||||
// Load sounds that will be played
|
// Load sounds that will be played
|
||||||
|
|
||||||
var chords = new Array();
|
var chords = new Array();
|
||||||
// Nylon string guitar
|
// Nylon string guitar
|
||||||
chords[1] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
|
chords[1] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+A.raw");
|
||||||
chords[2] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw");
|
chords[2] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+B.raw");
|
||||||
chords[3] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw");
|
chords[3] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+E.raw");
|
||||||
chords[4] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+G.raw");
|
chords[4] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+G.raw");
|
||||||
|
|
||||||
// Electric guitar
|
// Electric guitar
|
||||||
chords[5] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw");
|
chords[5] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Metal+A+short.raw");
|
||||||
chords[6] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw");
|
chords[6] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Metal+B+short.raw");
|
||||||
chords[7] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw");
|
chords[7] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Metal+E+short.raw");
|
||||||
chords[8] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+G+short.raw");
|
chords[8] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Metal+G+short.raw");
|
||||||
|
|
||||||
// Steel Guitar
|
// Steel Guitar
|
||||||
chords[9] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+A.raw");
|
chords[9] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Steel+A.raw");
|
||||||
chords[10] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+B.raw");
|
chords[10] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Steel+B.raw");
|
||||||
chords[11] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+E.raw");
|
chords[11] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Steel+E.raw");
|
||||||
chords[12] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+G.raw");
|
chords[12] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Steel+G.raw");
|
||||||
|
|
||||||
var NUM_CHORDS = 4;
|
var NUM_CHORDS = 4;
|
||||||
var NUM_GUITARS = 3;
|
var NUM_GUITARS = 3;
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
|
var sound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
var CHANCE_OF_PLAYING_SOUND = 0.01;
|
var CHANCE_OF_PLAYING_SOUND = 0.01;
|
||||||
|
|
||||||
var FACTOR = 0.75;
|
var FACTOR = 0.75;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var delayScale = 100.0;
|
var delayScale = 100.0;
|
||||||
var fanoutScale = 10.0;
|
var fanoutScale = 10.0;
|
||||||
|
@ -94,7 +95,7 @@ var delaySlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: delayY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: delayY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -108,7 +109,7 @@ var delayThumb = Overlays.addOverlay("image", {
|
||||||
y: delayY + 9,
|
y: delayY + 9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 255, green: 0, blue: 0},
|
color: { red: 255, green: 0, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -132,7 +133,7 @@ var fanoutSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: fanoutY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: fanoutY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -146,7 +147,7 @@ var fanoutThumb = Overlays.addOverlay("image", {
|
||||||
y: fanoutY + 9,
|
y: fanoutY + 9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 255, green: 255, blue: 0},
|
color: { red: 255, green: 255, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -171,7 +172,7 @@ var speedSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: speedY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: speedY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -185,7 +186,7 @@ var speedThumb = Overlays.addOverlay("image", {
|
||||||
y: speedY+9,
|
y: speedY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 0, green: 255, blue: 0},
|
color: { red: 0, green: 255, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -210,7 +211,7 @@ var factorSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: factorY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: factorY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -224,7 +225,7 @@ var factorThumb = Overlays.addOverlay("image", {
|
||||||
y: factorY+9,
|
y: factorY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 0, green: 0, blue: 255},
|
color: { red: 0, green: 0, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -249,7 +250,7 @@ var localFactorSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: localFactorY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: localFactorY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -263,7 +264,7 @@ var localFactorThumb = Overlays.addOverlay("image", {
|
||||||
y: localFactorY+9,
|
y: localFactorY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 0, green: 128, blue: 128},
|
color: { red: 0, green: 128, blue: 128},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -288,7 +289,7 @@ var combFilterSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: combFilterY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: combFilterY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -302,7 +303,7 @@ var combFilterThumb = Overlays.addOverlay("image", {
|
||||||
y: combFilterY+9,
|
y: combFilterY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 128, green: 128, blue: 0},
|
color: { red: 128, green: 128, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -328,7 +329,7 @@ var reflectiveSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: reflectiveY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: reflectiveY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -342,7 +343,7 @@ var reflectiveThumb = Overlays.addOverlay("image", {
|
||||||
y: reflectiveY+9,
|
y: reflectiveY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -367,7 +368,7 @@ var diffusionSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: diffusionY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: diffusionY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -381,7 +382,7 @@ var diffusionThumb = Overlays.addOverlay("image", {
|
||||||
y: diffusionY+9,
|
y: diffusionY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 0, green: 255, blue: 255},
|
color: { red: 0, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -406,7 +407,7 @@ var absorptionSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: absorptionY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: absorptionY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -420,7 +421,7 @@ var absorptionThumb = Overlays.addOverlay("image", {
|
||||||
y: absorptionY+9,
|
y: absorptionY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 255, green: 0, blue: 255},
|
color: { red: 255, green: 0, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -445,7 +446,7 @@ var originalSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: originalY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: originalY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -459,7 +460,7 @@ var originalThumb = Overlays.addOverlay("image", {
|
||||||
y: originalY+9,
|
y: originalY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 128, green: 128, blue: 0},
|
color: { red: 128, green: 128, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -484,7 +485,7 @@ var echoesSlider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: echoesY, width: 150, height: sliderHeight},
|
bounds: { x: 100, y: echoesY, width: 150, height: sliderHeight},
|
||||||
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
subImage: { x: 46, y: 0, width: 200, height: 71 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -498,7 +499,7 @@ var echoesThumb = Overlays.addOverlay("image", {
|
||||||
y: echoesY+9,
|
y: echoesY+9,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 128, green: 128, blue: 0},
|
color: { red: 128, green: 128, blue: 0},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var SOUND_TRIGGER_CLEAR = 1000; // milliseconds
|
var SOUND_TRIGGER_CLEAR = 1000; // milliseconds
|
||||||
var SOUND_TRIGGER_DELAY = 200; // milliseconds
|
var SOUND_TRIGGER_DELAY = 200; // milliseconds
|
||||||
var soundExpiry = 0;
|
var soundExpiry = 0;
|
||||||
|
@ -20,28 +22,28 @@ audioOptions.volume = 0.5;
|
||||||
audioOptions.position = { x: 0, y: 0, z: 0 };
|
audioOptions.position = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
var hitSounds = new Array();
|
var hitSounds = new Array();
|
||||||
hitSounds[0] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit1.raw");
|
hitSounds[0] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit1.raw");
|
||||||
hitSounds[1] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit2.raw");
|
hitSounds[1] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit2.raw");
|
||||||
hitSounds[2] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit3.raw");
|
hitSounds[2] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit3.raw");
|
||||||
hitSounds[3] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit4.raw");
|
hitSounds[3] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit4.raw");
|
||||||
hitSounds[4] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit5.raw");
|
hitSounds[4] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit5.raw");
|
||||||
hitSounds[5] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit6.raw");
|
hitSounds[5] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit6.raw");
|
||||||
hitSounds[6] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit7.raw");
|
hitSounds[6] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit7.raw");
|
||||||
hitSounds[7] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit8.raw");
|
hitSounds[7] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit8.raw");
|
||||||
hitSounds[8] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit9.raw");
|
hitSounds[8] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit9.raw");
|
||||||
hitSounds[9] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit10.raw");
|
hitSounds[9] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit10.raw");
|
||||||
hitSounds[10] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit11.raw");
|
hitSounds[10] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit11.raw");
|
||||||
hitSounds[11] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit12.raw");
|
hitSounds[11] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit12.raw");
|
||||||
hitSounds[12] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit13.raw");
|
hitSounds[12] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit13.raw");
|
||||||
hitSounds[13] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit14.raw");
|
hitSounds[13] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit14.raw");
|
||||||
hitSounds[14] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit15.raw");
|
hitSounds[14] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit15.raw");
|
||||||
hitSounds[15] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit16.raw");
|
hitSounds[15] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit16.raw");
|
||||||
hitSounds[16] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit17.raw");
|
hitSounds[16] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit17.raw");
|
||||||
hitSounds[17] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit18.raw");
|
hitSounds[17] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit18.raw");
|
||||||
hitSounds[18] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit19.raw");
|
hitSounds[18] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit19.raw");
|
||||||
hitSounds[19] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit20.raw");
|
hitSounds[19] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit20.raw");
|
||||||
hitSounds[20] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit21.raw");
|
hitSounds[20] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit21.raw");
|
||||||
hitSounds[21] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Collisions-hitsandslaps/Hit22.raw");
|
hitSounds[21] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/Hit22.raw");
|
||||||
|
|
||||||
function playHitSound(mySessionID, theirSessionID, collision) {
|
function playHitSound(mySessionID, theirSessionID, collision) {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function getRandomFloat(min, max) {
|
function getRandomFloat(min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
@ -110,9 +112,9 @@ if (botNumber <= 20) {
|
||||||
|
|
||||||
// set the face model fst using the bot number
|
// set the face model fst using the bot number
|
||||||
// there is no need to change the body model - we're using the default
|
// there is no need to change the body model - we're using the default
|
||||||
Avatar.faceModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newFaceFilePrefix + ".fst";
|
Avatar.faceModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newFaceFilePrefix + ".fst";
|
||||||
Avatar.skeletonModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newBodyFilePrefix + ".fst";
|
Avatar.skeletonModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newBodyFilePrefix + ".fst";
|
||||||
Avatar.billboardURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/billboards/bot" + botNumber + ".png";
|
Avatar.billboardURL = HIFI_PUBLIC_BUCKET + "meshes/billboards/bot" + botNumber + ".png";
|
||||||
|
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
Agent.isListeningToAudioStream = true;
|
Agent.isListeningToAudioStream = true;
|
||||||
|
@ -223,7 +225,7 @@ function loadSounds() {
|
||||||
"Walken1.raw", "Walken2.raw", "Z1.raw", "Z2.raw"
|
"Walken1.raw", "Walken2.raw", "Z1.raw", "Z2.raw"
|
||||||
];
|
];
|
||||||
|
|
||||||
var SOUND_BASE_URL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Cocktail+Party+Snippets/Raws/";
|
var SOUND_BASE_URL = HIFI_PUBLIC_BUCKET + "sounds/Cocktail+Party+Snippets/Raws/";
|
||||||
|
|
||||||
for (var i = 0; i < sound_filenames.length; i++) {
|
for (var i = 0; i < sound_filenames.length; i++) {
|
||||||
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
//For procedural walk animation
|
//For procedural walk animation
|
||||||
Script.include("http://s3-us-west-1.amazonaws.com/highfidelity-public/scripts/proceduralAnimationAPI.js");
|
Script.include("libraries/globals.js");
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/proceduralAnimationAPI.js");
|
||||||
|
|
||||||
var procAnimAPI = new ProcAnimAPI();
|
var procAnimAPI = new ProcAnimAPI();
|
||||||
|
|
||||||
|
@ -120,9 +121,9 @@ var newBodyFilePrefix = "bot" + botNumber;
|
||||||
|
|
||||||
// set the face model fst using the bot number
|
// set the face model fst using the bot number
|
||||||
// there is no need to change the body model - we're using the default
|
// there is no need to change the body model - we're using the default
|
||||||
Avatar.faceModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newFaceFilePrefix + ".fst";
|
Avatar.faceModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newFaceFilePrefix + ".fst";
|
||||||
Avatar.skeletonModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newBodyFilePrefix + "_a.fst";
|
Avatar.skeletonModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newBodyFilePrefix + "_a.fst";
|
||||||
Avatar.billboardURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/billboards/bot" + botNumber + ".png";
|
Avatar.billboardURL = HIFI_PUBLIC_BUCKET + "meshes/billboards/bot" + botNumber + ".png";
|
||||||
|
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
Agent.isListeningToAudioStream = true;
|
Agent.isListeningToAudioStream = true;
|
||||||
|
@ -145,9 +146,9 @@ function loadSounds() {
|
||||||
var footstep_filenames = ["FootstepW2Left-12db.wav", "FootstepW2Right-12db.wav", "FootstepW3Left-12db.wav", "FootstepW3Right-12db.wav",
|
var footstep_filenames = ["FootstepW2Left-12db.wav", "FootstepW2Right-12db.wav", "FootstepW3Left-12db.wav", "FootstepW3Right-12db.wav",
|
||||||
"FootstepW5Left-12db.wav", "FootstepW5Right-12db.wav"];
|
"FootstepW5Left-12db.wav", "FootstepW5Right-12db.wav"];
|
||||||
|
|
||||||
var SOUND_BASE_URL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Cocktail+Party+Snippets/Raws/";
|
var SOUND_BASE_URL = HIFI_PUBLIC_BUCKET + "sounds/Cocktail+Party+Snippets/Raws/";
|
||||||
|
|
||||||
var FOOTSTEP_BASE_URL = "http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Footsteps/";
|
var FOOTSTEP_BASE_URL = HIFI_PUBLIC_BUCKET + "sounds/Footsteps/";
|
||||||
|
|
||||||
for (var i = 0; i < sound_filenames.length; i++) {
|
for (var i = 0; i < sound_filenames.length; i++) {
|
||||||
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
//For procedural walk animation
|
//For procedural walk animation
|
||||||
Script.include("http://s3-us-west-1.amazonaws.com/highfidelity-public/scripts/proceduralAnimationAPI.js");
|
Script.include("libraries/globals.js");
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/proceduralAnimationAPI.js");
|
||||||
|
|
||||||
var procAnimAPI = new ProcAnimAPI();
|
var procAnimAPI = new ProcAnimAPI();
|
||||||
|
|
||||||
|
@ -82,9 +83,9 @@ var newBodyFilePrefix = "bot" + botNumber;
|
||||||
|
|
||||||
// set the face model fst using the bot number
|
// set the face model fst using the bot number
|
||||||
// there is no need to change the body model - we're using the default
|
// there is no need to change the body model - we're using the default
|
||||||
Avatar.faceModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newFaceFilePrefix + ".fst";
|
Avatar.faceModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newFaceFilePrefix + ".fst";
|
||||||
Avatar.skeletonModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newBodyFilePrefix + "_a.fst";
|
Avatar.skeletonModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newBodyFilePrefix + "_a.fst";
|
||||||
Avatar.billboardURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/billboards/bot" + botNumber + ".png";
|
Avatar.billboardURL = HIFI_PUBLIC_BUCKET + "meshes/billboards/bot" + botNumber + ".png";
|
||||||
|
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
Agent.isListeningToAudioStream = true;
|
Agent.isListeningToAudioStream = true;
|
||||||
|
@ -107,9 +108,9 @@ function loadSounds() {
|
||||||
var footstep_filenames = ["FootstepW2Left-12db.wav", "FootstepW2Right-12db.wav", "FootstepW3Left-12db.wav", "FootstepW3Right-12db.wav",
|
var footstep_filenames = ["FootstepW2Left-12db.wav", "FootstepW2Right-12db.wav", "FootstepW3Left-12db.wav", "FootstepW3Right-12db.wav",
|
||||||
"FootstepW5Left-12db.wav", "FootstepW5Right-12db.wav"];
|
"FootstepW5Left-12db.wav", "FootstepW5Right-12db.wav"];
|
||||||
|
|
||||||
var SOUND_BASE_URL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Cocktail+Party+Snippets/Raws/";
|
var SOUND_BASE_URL = HIFI_PUBLIC_BUCKET + "sounds/Cocktail+Party+Snippets/Raws/";
|
||||||
|
|
||||||
var FOOTSTEP_BASE_URL = "http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Footsteps/";
|
var FOOTSTEP_BASE_URL = HIFI_PUBLIC_BUCKET + "sounds/Footsteps/";
|
||||||
|
|
||||||
for (var i = 0; i < sound_filenames.length; i++) {
|
for (var i = 0; i < sound_filenames.length; i++) {
|
||||||
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
sounds.push(new Sound(SOUND_BASE_URL + sound_filenames[i]));
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function getRandomFloat(min, max) {
|
function getRandomFloat(min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +44,9 @@ newBodyFilePrefix = "bot" + botNumber;
|
||||||
|
|
||||||
// set the face model fst using the bot number
|
// set the face model fst using the bot number
|
||||||
// there is no need to change the body model - we're using the default
|
// there is no need to change the body model - we're using the default
|
||||||
Avatar.faceModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newFaceFilePrefix + ".fst";
|
Avatar.faceModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newFaceFilePrefix + ".fst";
|
||||||
Avatar.skeletonModelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/" + newBodyFilePrefix + ".fst";
|
Avatar.skeletonModelURL = HIFI_PUBLIC_BUCKET + "meshes/" + newBodyFilePrefix + ".fst";
|
||||||
Avatar.billboardURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/billboards/bot" + botNumber + ".png";
|
Avatar.billboardURL = HIFI_PUBLIC_BUCKET + "meshes/billboards/bot" + botNumber + ".png";
|
||||||
|
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
Agent.isListeningToAudioStream = true;
|
Agent.isListeningToAudioStream = true;
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var clapAnimation = "https://s3-us-west-1.amazonaws.com/highfidelity-public/animations/ClapAnimations/ClapHands_Standing.fbx";
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
|
var clapAnimation = HIFI_PUBLIC_BUCKET + "animations/ClapAnimations/ClapHands_Standing.fbx";
|
||||||
var ANIMATION_FRAMES_PER_CLAP = 10.0;
|
var ANIMATION_FRAMES_PER_CLAP = 10.0;
|
||||||
var startEndFrames = [];
|
var startEndFrames = [];
|
||||||
startEndFrames.push({ start: 0, end: 10});
|
startEndFrames.push({ start: 0, end: 10});
|
||||||
|
@ -26,16 +28,16 @@ var lastClapFrame = 0;
|
||||||
var lastAnimFrame = 0;
|
var lastAnimFrame = 0;
|
||||||
|
|
||||||
var claps = [];
|
var claps = [];
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap1Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap1Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap2Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap2Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap3Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap3Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap4Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap4Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap5Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap5Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap6Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap6Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap7Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap7Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap8Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap8Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap9Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap9Rvb.wav"));
|
||||||
claps.push(new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/claps/BClap10Rvb.wav"));
|
claps.push(new Sound(HIFI_PUBLIC_BUCKET + "sounds/claps/BClap10Rvb.wav"));
|
||||||
var numberOfSounds = claps.length;
|
var numberOfSounds = claps.length;
|
||||||
|
|
||||||
var clappingNow = false;
|
var clappingNow = false;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function length(v) {
|
function length(v) {
|
||||||
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
||||||
}
|
}
|
||||||
|
@ -26,8 +28,8 @@ function vMinus(a, b) {
|
||||||
|
|
||||||
// First, load two percussion sounds to be used on the sticks
|
// First, load two percussion sounds to be used on the sticks
|
||||||
|
|
||||||
var drum1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Drums/RackTomHi.raw");
|
var drum1 = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Drums/RackTomHi.raw");
|
||||||
var drum2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Drums/RackTomLo.raw");
|
var drum2 = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Drums/RackTomLo.raw");
|
||||||
|
|
||||||
// State Machine:
|
// State Machine:
|
||||||
// 0 = not triggered
|
// 0 = not triggered
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var moveUntil = 2000;
|
var moveUntil = 2000;
|
||||||
var stopAfter = moveUntil + 100;
|
var stopAfter = moveUntil + 100;
|
||||||
|
@ -31,12 +33,12 @@ var originalProperties = {
|
||||||
green: 255,
|
green: 255,
|
||||||
blue: 0 },
|
blue: 0 },
|
||||||
|
|
||||||
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/birarda/birarda_head.fbx",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/birarda/birarda_head.fbx",
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/pug.fbx",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/pug.fbx",
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/newInvader16x16-large-purple.svo",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/minotaur/mino_full.fbx",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/minotaur/mino_full.fbx",
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Combat_tank_V01.FBX",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/Combat_tank_V01.FBX",
|
||||||
|
|
||||||
rotation: rotation
|
rotation: rotation
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,9 +22,11 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
Script.include("libraries/toolBars.js");
|
Script.include("libraries/toolBars.js");
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var toolIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/";
|
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
var toolHeight = 50;
|
var toolHeight = 50;
|
||||||
var toolWidth = 50;
|
var toolWidth = 50;
|
||||||
|
|
||||||
|
@ -45,14 +47,14 @@ var SPAWN_DISTANCE = 1;
|
||||||
var DEFAULT_DIMENSION = 0.20;
|
var DEFAULT_DIMENSION = 0.20;
|
||||||
|
|
||||||
var modelURLs = [
|
var modelURLs = [
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/birarda/birarda_head.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/birarda/birarda_head.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/pug.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/pug.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/newInvader16x16-large-purple.svo",
|
HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/minotaur/mino_full.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/minotaur/mino_full.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Combat_tank_V01.FBX",
|
HIFI_PUBLIC_BUCKET + "meshes/Combat_tank_V01.FBX",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/orc.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/orc.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/slimer.fbx"
|
HIFI_PUBLIC_BUCKET + "meshes/slimer.fbx"
|
||||||
];
|
];
|
||||||
|
|
||||||
var jointList = MyAvatar.getJointNames();
|
var jointList = MyAvatar.getJointNames();
|
||||||
|
@ -1213,19 +1215,44 @@ var toolBar = (function () {
|
||||||
Overlays.editOverlay(loadFileMenuItem, { visible: active });
|
Overlays.editOverlay(loadFileMenuItem, { visible: active });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var RESIZE_INTERVAL = 50;
|
||||||
|
var RESIZE_TIMEOUT = 20000;
|
||||||
|
var RESIZE_MAX_CHECKS = RESIZE_TIMEOUT / RESIZE_INTERVAL;
|
||||||
function addModel(url) {
|
function addModel(url) {
|
||||||
var position;
|
var position;
|
||||||
|
|
||||||
position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
||||||
|
|
||||||
if (position.x > 0 && position.y > 0 && position.z > 0) {
|
if (position.x > 0 && position.y > 0 && position.z > 0) {
|
||||||
Entities.addEntity({
|
var entityId = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
position: position,
|
position: position,
|
||||||
dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION },
|
dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION },
|
||||||
modelURL: url
|
modelURL: url
|
||||||
});
|
});
|
||||||
print("Model added: " + url);
|
print("Model added: " + url);
|
||||||
|
|
||||||
|
var checkCount = 0;
|
||||||
|
function resize() {
|
||||||
|
var entityProperties = Entities.getEntityProperties(entityId);
|
||||||
|
var naturalDimensions = entityProperties.naturalDimensions;
|
||||||
|
|
||||||
|
checkCount++;
|
||||||
|
|
||||||
|
if (naturalDimensions.x == 0 && naturalDimensions.y == 0 && naturalDimensions.z == 0) {
|
||||||
|
if (checkCount < RESIZE_MAX_CHECKS) {
|
||||||
|
Script.setTimeout(resize, RESIZE_INTERVAL);
|
||||||
|
} else {
|
||||||
|
print("Resize failed: timed out waiting for model (" + url + ") to load");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
entityProperties.dimensions = naturalDimensions;
|
||||||
|
Entities.editEntity(entityId, entityProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.setTimeout(resize, RESIZE_INTERVAL);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print("Can't add model: Model would be out of bounds.");
|
print("Can't add model: Model would be out of bounds.");
|
||||||
}
|
}
|
||||||
|
@ -1766,7 +1793,7 @@ var modelImporter = new ModelImporter();
|
||||||
function isLocked(properties) {
|
function isLocked(properties) {
|
||||||
// special case to lock the ground plane model in hq.
|
// special case to lock the ground plane model in hq.
|
||||||
if (location.hostname == "hq.highfidelity.io" &&
|
if (location.hostname == "hq.highfidelity.io" &&
|
||||||
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
|
properties.modelURL == HIFI_PUBLIC_BUCKET + "ozan/Terrain_Reduce_forAlpha.fbx") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var editToolsOn = true; // starts out off
|
var editToolsOn = true; // starts out off
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
@ -94,61 +96,61 @@ function SoundArray() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var addVoxelSound = new SoundArray();
|
var addVoxelSound = new SoundArray();
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+1.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+1.raw");
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+2.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+2.raw");
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+3.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+3.raw");
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+4.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+4.raw");
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+5.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+5.raw");
|
||||||
addVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Add/VA+6.raw");
|
addVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Add/VA+6.raw");
|
||||||
|
|
||||||
var delVoxelSound = new SoundArray();
|
var delVoxelSound = new SoundArray();
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+A1.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+A1.raw");
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+A2.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+A2.raw");
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+A3.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+A3.raw");
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+B1.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+B1.raw");
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+B2.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+B2.raw");
|
||||||
delVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Del/VD+B3.raw");
|
delVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Del/VD+B3.raw");
|
||||||
|
|
||||||
var resizeVoxelSound = new SoundArray();
|
var resizeVoxelSound = new SoundArray();
|
||||||
resizeVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Size/V+Size+Minus.raw");
|
resizeVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Size/V+Size+Minus.raw");
|
||||||
resizeVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Voxel+Size/V+Size+Plus.raw");
|
resizeVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Voxel+Size/V+Size+Plus.raw");
|
||||||
var voxelSizeMinus = 0;
|
var voxelSizeMinus = 0;
|
||||||
var voxelSizePlus = 1;
|
var voxelSizePlus = 1;
|
||||||
|
|
||||||
var swatchesSound = new SoundArray();
|
var swatchesSound = new SoundArray();
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+1.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+1.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+2.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+2.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+3.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+3.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+4.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+4.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+5.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+5.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+6.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+6.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+7.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+7.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+8.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+8.raw");
|
||||||
swatchesSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Swatches/Swatch+9.raw");
|
swatchesSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Swatches/Swatch+9.raw");
|
||||||
|
|
||||||
var undoSound = new SoundArray();
|
var undoSound = new SoundArray();
|
||||||
undoSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Undo/Undo+1.raw");
|
undoSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Undo/Undo+1.raw");
|
||||||
undoSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Undo/Undo+2.raw");
|
undoSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Undo/Undo+2.raw");
|
||||||
undoSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Undo/Undo+3.raw");
|
undoSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Undo/Undo+3.raw");
|
||||||
|
|
||||||
var scriptInitSound = new SoundArray();
|
var scriptInitSound = new SoundArray();
|
||||||
scriptInitSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Script+Init/Script+Init+A.raw");
|
scriptInitSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Script+Init/Script+Init+A.raw");
|
||||||
scriptInitSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Script+Init/Script+Init+B.raw");
|
scriptInitSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Script+Init/Script+Init+B.raw");
|
||||||
scriptInitSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Script+Init/Script+Init+C.raw");
|
scriptInitSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Script+Init/Script+Init+C.raw");
|
||||||
scriptInitSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Script+Init/Script+Init+D.raw");
|
scriptInitSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Script+Init/Script+Init+D.raw");
|
||||||
|
|
||||||
var modeSwitchSound = new SoundArray();
|
var modeSwitchSound = new SoundArray();
|
||||||
modeSwitchSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Mode+Switch/Mode+1.raw");
|
modeSwitchSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Mode+Switch/Mode+1.raw");
|
||||||
modeSwitchSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Mode+Switch/Mode+2.raw");
|
modeSwitchSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Mode+Switch/Mode+2.raw");
|
||||||
modeSwitchSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Mode+Switch/Mode+3.raw");
|
modeSwitchSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Mode+Switch/Mode+3.raw");
|
||||||
|
|
||||||
var initialVoxelSound = new SoundArray();
|
var initialVoxelSound = new SoundArray();
|
||||||
initialVoxelSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Initial+Voxel/Initial+V.raw");
|
initialVoxelSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Initial+Voxel/Initial+V.raw");
|
||||||
|
|
||||||
var colorInheritSound = new SoundArray();
|
var colorInheritSound = new SoundArray();
|
||||||
colorInheritSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Color+Inherit/Inherit+A.raw");
|
colorInheritSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Color+Inherit/Inherit+A.raw");
|
||||||
colorInheritSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Color+Inherit/Inherit+B.raw");
|
colorInheritSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Color+Inherit/Inherit+B.raw");
|
||||||
colorInheritSound.addSound("https://highfidelity-public.s3.amazonaws.com/sounds/Voxel+Editing/Color+Inherit/Inherit+C.raw");
|
colorInheritSound.addSound(HIFI_PUBLIC_BUCKET + "sounds/Voxel+Editing/Color+Inherit/Inherit+C.raw");
|
||||||
|
|
||||||
// previewAsVoxel - by default, we will preview adds/deletes/recolors as just 4 lines on the intersecting face. But if you
|
// previewAsVoxel - by default, we will preview adds/deletes/recolors as just 4 lines on the intersecting face. But if you
|
||||||
// the preview to show a full voxel then set this to true and the voxel will be displayed for voxel editing
|
// the preview to show a full voxel then set this to true and the voxel will be displayed for voxel editing
|
||||||
|
@ -213,7 +215,7 @@ var swatchesWidth = swatchWidth * numColors + numColors + swatchExtraPadding * 2
|
||||||
var swatchesX = (windowDimensions.x - (swatchesWidth + scaleSelectorWidth)) / 2;
|
var swatchesX = (windowDimensions.x - (swatchesWidth + scaleSelectorWidth)) / 2;
|
||||||
var swatchesY = windowDimensions.y - swatchHeight + 1;
|
var swatchesY = windowDimensions.y - swatchHeight + 1;
|
||||||
|
|
||||||
var toolIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/";
|
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
|
||||||
// create the overlays, position them in a row, set their colors, and for the selected one, use a different source image
|
// create the overlays, position them in a row, set their colors, and for the selected one, use a different source image
|
||||||
// location so that it displays the "selected" marker
|
// location so that it displays the "selected" marker
|
||||||
|
|
|
@ -12,12 +12,14 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var zFightingSizeAdjust = 0.002; // used to adjust preview voxels to prevent z fighting
|
var zFightingSizeAdjust = 0.002; // used to adjust preview voxels to prevent z fighting
|
||||||
var previewLineWidth = 2.0;
|
var previewLineWidth = 2.0;
|
||||||
|
|
||||||
var voxelSize = 1;
|
var voxelSize = 1;
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var toolIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/";
|
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
|
||||||
var MAX_VOXEL_SCALE_POWER = 5;
|
var MAX_VOXEL_SCALE_POWER = 5;
|
||||||
var MIN_VOXEL_SCALE_POWER = -8;
|
var MIN_VOXEL_SCALE_POWER = -8;
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
Script.include("libraries/toolBars.js");
|
Script.include("libraries/toolBars.js");
|
||||||
|
|
||||||
const LEFT_PALM = 0;
|
const LEFT_PALM = 0;
|
||||||
|
@ -160,7 +162,7 @@ var currentMouseControl = false;
|
||||||
|
|
||||||
var newSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw");
|
var newSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw");
|
||||||
var catchSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw");
|
var catchSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw");
|
||||||
var throwSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Switches%20and%20sliders/slider%20-%20whoosh1.raw");
|
var throwSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Switches%20and%20sliders/slider%20-%20whoosh1.raw");
|
||||||
|
|
||||||
var simulatedFrisbees = [];
|
var simulatedFrisbees = [];
|
||||||
|
|
||||||
|
|
280
examples/gamepad.js
Normal file
|
@ -0,0 +1,280 @@
|
||||||
|
//
|
||||||
|
// controller.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Created by Ryan Huffman on 10/9/14.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
// TODO Update to work with any controller that is plugged in.
|
||||||
|
var CONTROLLER_NAMES = [
|
||||||
|
"Wireless 360 Controller",
|
||||||
|
"Controller (XBOX 360 For Windows)",
|
||||||
|
"Controller", // Wired 360 controller
|
||||||
|
]
|
||||||
|
|
||||||
|
for (var i = 0; i < CONTROLLER_NAMES.length; i++) {
|
||||||
|
gamepad = Joysticks.joystickWithName(CONTROLLER_NAMES[i]);
|
||||||
|
if (gamepad) {
|
||||||
|
print("Found controller: " + CONTROLLER_NAMES[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gamepad) {
|
||||||
|
print("No gamepad found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controller axis/button mappings
|
||||||
|
var GAMEPAD = {
|
||||||
|
AXES: {
|
||||||
|
LEFT_JOYSTICK_X: 0,
|
||||||
|
LEFT_JOYSTICK_Y: 1,
|
||||||
|
|
||||||
|
RIGHT_JOYSTICK_X: 2,
|
||||||
|
RIGHT_JOYSTICK_Y: 3,
|
||||||
|
|
||||||
|
LEFT_TRIGGER: 4,
|
||||||
|
RIGHT_TRIGGER: 5,
|
||||||
|
},
|
||||||
|
BUTTONS: {
|
||||||
|
DPAD_UP: 0,
|
||||||
|
DPAD_DOWN: 1,
|
||||||
|
DPAD_LEFT: 2,
|
||||||
|
DPAD_RIGHT: 3,
|
||||||
|
|
||||||
|
LEFT_JOYSTICK: 6,
|
||||||
|
RIGHT_JOYSTICK: 7,
|
||||||
|
|
||||||
|
LEFT_BUMPER: 8,
|
||||||
|
RIGHT_BUMPER: 9,
|
||||||
|
|
||||||
|
// Face buttons, ABXY on an XBOX controller
|
||||||
|
FACE_BOTTOM: 11,
|
||||||
|
FACE_RIGHT: 12,
|
||||||
|
FACE_LEFT: 13,
|
||||||
|
FACE_TOP: 14,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Button/axis mappings
|
||||||
|
var AXIS_STRAFE = GAMEPAD.AXES.LEFT_JOYSTICK_X;
|
||||||
|
var AXIS_FORWARD = GAMEPAD.AXES.LEFT_JOYSTICK_Y;
|
||||||
|
var AXIS_ROTATE = GAMEPAD.AXES.RIGHT_JOYSTICK_X;
|
||||||
|
|
||||||
|
var BUTTON_TURN_AROUND = GAMEPAD.BUTTONS.RIGHT_JOYSTICK;
|
||||||
|
|
||||||
|
var BUTTON_FLY_UP = GAMEPAD.BUTTONS.RIGHT_BUMPER;
|
||||||
|
var BUTTON_FLY_DOWN = GAMEPAD.BUTTONS.LEFT_BUMPER
|
||||||
|
var BUTTON_WARP = GAMEPAD.BUTTONS.FACE_BOTTOM;
|
||||||
|
|
||||||
|
var BUTTON_WARP_FORWARD = GAMEPAD.BUTTONS.DPAD_UP;
|
||||||
|
var BUTTON_WARP_BACKWARD = GAMEPAD.BUTTONS.DPAD_DOWN;
|
||||||
|
var BUTTON_WARP_LEFT = GAMEPAD.BUTTONS.DPAD_LEFT;
|
||||||
|
var BUTTON_WARP_RIGHT = GAMEPAD.BUTTONS.DPAD_RIGHT;
|
||||||
|
|
||||||
|
// Distance in meters to warp via BUTTON_WARP_*
|
||||||
|
var WARP_DISTANCE = 1;
|
||||||
|
|
||||||
|
// Walk speed in m/s
|
||||||
|
var MOVE_SPEED = 2;
|
||||||
|
|
||||||
|
// Amount to rotate in radians
|
||||||
|
var ROTATE_INCREMENT = Math.PI / 8;
|
||||||
|
|
||||||
|
// Pick from above where we want to warp
|
||||||
|
var WARP_PICK_OFFSET = { x: 0, y: 10, z: 0 };
|
||||||
|
|
||||||
|
// When warping, the warp position will snap to a target below the current warp position.
|
||||||
|
// This is the max distance it will snap to.
|
||||||
|
var WARP_PICK_MAX_DISTANCE = 100;
|
||||||
|
|
||||||
|
var flyDownButtonState = false;
|
||||||
|
var flyUpButtonState = false;
|
||||||
|
|
||||||
|
// Current move direction, axis aligned - that is, looking down and moving forward
|
||||||
|
// will not move you into the ground, but instead will keep you on the horizontal plane.
|
||||||
|
var moveDirection = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
|
var warpActive = false;
|
||||||
|
var warpPosition = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
|
var WARP_SPHERE_SIZE = 1;
|
||||||
|
var warpSphere = Overlays.addOverlay("sphere", {
|
||||||
|
position: { x: 0, y: 0, z: 0 },
|
||||||
|
size: WARP_SPHERE_SIZE,
|
||||||
|
color: { red: 0, green: 255, blue: 0 },
|
||||||
|
alpha: 1.0,
|
||||||
|
solid: true,
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
var WARP_LINE_HEIGHT = 10;
|
||||||
|
var warpLine = Overlays.addOverlay("line3d", {
|
||||||
|
position: { x: 0, y: 0, z:0 },
|
||||||
|
end: { x: 0, y: 0, z: 0 },
|
||||||
|
color: { red: 0, green: 255, blue: 255},
|
||||||
|
alpha: 1,
|
||||||
|
lineWidth: 5,
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
function copyVec3(vec) {
|
||||||
|
return { x: vec.x, y: vec.y, z: vec.z };
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateWarp() {
|
||||||
|
if (warpActive) return;
|
||||||
|
warpActive = true;
|
||||||
|
|
||||||
|
updateWarp();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateWarp() {
|
||||||
|
if (!warpActive) return;
|
||||||
|
|
||||||
|
var look = Quat.getFront(Camera.getOrientation());
|
||||||
|
var pitch = Math.asin(look.y);
|
||||||
|
|
||||||
|
// Get relative to looking straight down
|
||||||
|
pitch += Math.PI / 2;
|
||||||
|
|
||||||
|
// Scale up
|
||||||
|
pitch *= 2;
|
||||||
|
var distance = pitch * pitch * pitch;
|
||||||
|
|
||||||
|
var warpDirection = Vec3.normalize({ x: look.x, y: 0, z: look.z });
|
||||||
|
warpPosition = Vec3.multiply(warpDirection, distance);
|
||||||
|
warpPosition = Vec3.sum(MyAvatar.position, warpPosition);
|
||||||
|
|
||||||
|
var pickRay = {
|
||||||
|
origin: Vec3.sum(warpPosition, WARP_PICK_OFFSET),
|
||||||
|
direction: { x: 0, y: -1, z: 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
var intersection = Voxels.findRayIntersection(pickRay);
|
||||||
|
|
||||||
|
if (intersection.intersects && intersection.distance < WARP_PICK_MAX_DISTANCE) {
|
||||||
|
// Warp 1 meter above the object - this is an approximation
|
||||||
|
// TODO Get the actual offset to the Avatar's feet and plant them to
|
||||||
|
// the object.
|
||||||
|
warpPosition = Vec3.sum(intersection.intersection, { x: 0, y: 1, z:0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust overlays to match warp position
|
||||||
|
Overlays.editOverlay(warpSphere, {
|
||||||
|
position: warpPosition,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(warpLine, {
|
||||||
|
position: warpPosition,
|
||||||
|
end: Vec3.sum(warpPosition, { x: 0, y: WARP_LINE_HEIGHT, z: 0 }),
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishWarp() {
|
||||||
|
if (!warpActive) return;
|
||||||
|
warpActive = false;
|
||||||
|
Overlays.editOverlay(warpSphere, {
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(warpLine, {
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
MyAvatar.position = warpPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportAxisValue(axis, newValue, oldValue) {
|
||||||
|
if (Math.abs(oldValue) < 0.2) oldValue = 0;
|
||||||
|
if (Math.abs(newValue) < 0.2) newValue = 0;
|
||||||
|
|
||||||
|
if (axis == AXIS_FORWARD) {
|
||||||
|
moveDirection.z = newValue;
|
||||||
|
} else if (axis == AXIS_STRAFE) {
|
||||||
|
moveDirection.x = newValue;
|
||||||
|
} else if (axis == AXIS_ROTATE) {
|
||||||
|
if (oldValue == 0 && newValue != 0) {
|
||||||
|
var rotateRadians = newValue > 0 ? -ROTATE_INCREMENT : ROTATE_INCREMENT;
|
||||||
|
var orientation = MyAvatar.orientation;
|
||||||
|
orientation = Quat.multiply(Quat.fromPitchYawRollRadians(0, rotateRadians, 0), orientation) ;
|
||||||
|
MyAvatar.orientation = orientation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportButtonValue(button, newValue, oldValue) {
|
||||||
|
if (button == BUTTON_FLY_DOWN) {
|
||||||
|
flyDownButtonState = newValue;
|
||||||
|
} else if (button == BUTTON_FLY_UP) {
|
||||||
|
flyUpButtonState = newValue;
|
||||||
|
} else if (button == BUTTON_WARP) {
|
||||||
|
if (newValue) {
|
||||||
|
activateWarp();
|
||||||
|
} else {
|
||||||
|
finishWarp();
|
||||||
|
}
|
||||||
|
} else if (button == BUTTON_TURN_AROUND) {
|
||||||
|
if (newValue) {
|
||||||
|
MyAvatar.orientation = Quat.multiply(
|
||||||
|
Quat.fromPitchYawRollRadians(0, Math.PI, 0), MyAvatar.orientation);
|
||||||
|
}
|
||||||
|
} else if (newValue) {
|
||||||
|
var direction = null;
|
||||||
|
|
||||||
|
if (button == BUTTON_WARP_FORWARD) {
|
||||||
|
direction = Quat.getFront(Camera.getOrientation());
|
||||||
|
} else if (button == BUTTON_WARP_BACKWARD) {
|
||||||
|
direction = Quat.getFront(Camera.getOrientation());
|
||||||
|
direction = Vec3.multiply(-1, direction);
|
||||||
|
} else if (button == BUTTON_WARP_LEFT) {
|
||||||
|
direction = Quat.getRight(Camera.getOrientation());
|
||||||
|
direction = Vec3.multiply(-1, direction);
|
||||||
|
} else if (button == BUTTON_WARP_RIGHT) {
|
||||||
|
direction = Quat.getRight(Camera.getOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (direction) {
|
||||||
|
direction.y = 0;
|
||||||
|
direction = Vec3.multiply(Vec3.normalize(direction), WARP_DISTANCE);
|
||||||
|
MyAvatar.position = Vec3.sum(MyAvatar.position, direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flyUpButtonState && !flyDownButtonState) {
|
||||||
|
moveDirection.y = 1;
|
||||||
|
} else if (!flyUpButtonState && flyDownButtonState) {
|
||||||
|
moveDirection.y = -1;
|
||||||
|
} else {
|
||||||
|
moveDirection.y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(dt) {
|
||||||
|
var velocity = { x: 0, y: 0, z: 0 };
|
||||||
|
var move = copyVec3(moveDirection);
|
||||||
|
move.y = 0;
|
||||||
|
if (Vec3.length(move) > 0) {
|
||||||
|
velocity = Vec3.multiplyQbyV(Camera.getOrientation(), move);
|
||||||
|
velocity.y = 0;
|
||||||
|
velocity = Vec3.multiply(Vec3.normalize(velocity), MOVE_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moveDirection.y != 0) {
|
||||||
|
velocity.y = moveDirection.y * MOVE_SPEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyAvatar.setVelocity(velocity);
|
||||||
|
|
||||||
|
updateWarp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamepad) {
|
||||||
|
gamepad.axisValueChanged.connect(reportAxisValue);
|
||||||
|
gamepad.buttonStateChanged.connect(reportButtonValue);
|
||||||
|
|
||||||
|
Script.update.connect(update);
|
||||||
|
}
|
|
@ -14,6 +14,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function getRandomFloat(min, max) {
|
function getRandomFloat(min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +36,11 @@ var RELOAD_INTERVAL = 5;
|
||||||
var showScore = false;
|
var showScore = false;
|
||||||
|
|
||||||
// Load some sound to use for loading and firing
|
// Load some sound to use for loading and firing
|
||||||
var fireSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/GUN-SHOT2.raw");
|
var fireSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/GUN-SHOT2.raw");
|
||||||
var loadSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/Gun_Reload_Weapon22.raw");
|
var loadSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/Gun_Reload_Weapon22.raw");
|
||||||
var impactSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/BulletImpact2.raw");
|
var impactSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/BulletImpact2.raw");
|
||||||
var targetHitSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/hit.raw");
|
var targetHitSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/hit.raw");
|
||||||
var targetLaunchSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/shoot.raw");
|
var targetLaunchSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/shoot.raw");
|
||||||
|
|
||||||
var gunModel = "http://public.highfidelity.io/models/attachments/HaloGun.fst";
|
var gunModel = "http://public.highfidelity.io/models/attachments/HaloGun.fst";
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@ var reticle = Overlays.addOverlay("image", {
|
||||||
y: screenSize.y / 2 - 16,
|
y: screenSize.y / 2 - 16,
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/reticle.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/reticle.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var zFightingSizeAdjust = 0.002; // used to adjust preview voxels to prevent z fighting
|
var zFightingSizeAdjust = 0.002; // used to adjust preview voxels to prevent z fighting
|
||||||
var previewLineWidth = 2.0;
|
var previewLineWidth = 2.0;
|
||||||
|
|
||||||
var voxelSize = 1;
|
var voxelSize = 1;
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var toolIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/";
|
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
|
||||||
var MAX_VOXEL_SCALE_POWER = 5;
|
var MAX_VOXEL_SCALE_POWER = 5;
|
||||||
var MIN_VOXEL_SCALE_POWER = -8;
|
var MIN_VOXEL_SCALE_POWER = -8;
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
function getRandomFloat(min, max) {
|
function getRandomFloat(min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
@ -33,11 +35,11 @@ var RELOAD_INTERVAL = 5;
|
||||||
var showScore = false;
|
var showScore = false;
|
||||||
|
|
||||||
// Load some sound to use for loading and firing
|
// Load some sound to use for loading and firing
|
||||||
var fireSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/GUN-SHOT2.raw");
|
var fireSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/GUN-SHOT2.raw");
|
||||||
var loadSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/Gun_Reload_Weapon22.raw");
|
var loadSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/Gun_Reload_Weapon22.raw");
|
||||||
var impactSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/BulletImpact2.raw");
|
var impactSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guns/BulletImpact2.raw");
|
||||||
var targetHitSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/hit.raw");
|
var targetHitSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/hit.raw");
|
||||||
var targetLaunchSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/shoot.raw");
|
var targetLaunchSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/shoot.raw");
|
||||||
|
|
||||||
var gunModel = "http://public.highfidelity.io/models/attachments/HaloGun.fst";
|
var gunModel = "http://public.highfidelity.io/models/attachments/HaloGun.fst";
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ var reticle = Overlays.addOverlay("image", {
|
||||||
y: screenSize.y / 2 - 16,
|
y: screenSize.y / 2 - 16,
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/reticle.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/reticle.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/220Sine.wav");
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
|
var sound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/220Sine.wav");
|
||||||
|
|
||||||
var soundPlaying = false;
|
var soundPlaying = false;
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,13 @@ var leapHands = (function () {
|
||||||
fingers,
|
fingers,
|
||||||
NUM_FINGERS = 5, // 0 = thumb; ...; 4 = pinky
|
NUM_FINGERS = 5, // 0 = thumb; ...; 4 = pinky
|
||||||
THUMB = 0,
|
THUMB = 0,
|
||||||
NUM_FINGER_JOINTS = 3, // 0 = metacarpal(hand)-proximal(finger) joint; ...; 2 = intermediate-distal(tip) joint
|
NUM_FINGER_JOINTS = 3, // 0 = metacarpal(hand)-proximal(finger) joint; ...; 2 = intermediate-distal joint
|
||||||
MAX_HAND_INACTIVE_COUNT = 20,
|
MAX_HAND_INACTIVE_COUNT = 20,
|
||||||
calibrationStatus,
|
calibrationStatus,
|
||||||
UNCALIBRATED = 0,
|
UNCALIBRATED = 0,
|
||||||
CALIBRATING = 1,
|
CALIBRATING = 1,
|
||||||
CALIBRATED = 2,
|
CALIBRATED = 2,
|
||||||
CALIBRATION_TIME = 1000, // milliseconds
|
CALIBRATION_TIME = 1000, // milliseconds
|
||||||
PI = 3.141593,
|
|
||||||
isWindows,
|
|
||||||
avatarScale,
|
avatarScale,
|
||||||
avatarFaceModelURL,
|
avatarFaceModelURL,
|
||||||
avatarSkeletonModelURL,
|
avatarSkeletonModelURL,
|
||||||
|
@ -132,9 +130,6 @@ var leapHands = (function () {
|
||||||
|
|
||||||
if (hands[0].controller.isActive() && hands[1].controller.isActive()) {
|
if (hands[0].controller.isActive() && hands[1].controller.isActive()) {
|
||||||
leapHandHeight = (hands[0].controller.getAbsTranslation().y + hands[1].controller.getAbsTranslation().y) / 2.0;
|
leapHandHeight = (hands[0].controller.getAbsTranslation().y + hands[1].controller.getAbsTranslation().y) / 2.0;
|
||||||
|
|
||||||
// TODO: Temporary detection of Windows to work around Leap Controller problem.
|
|
||||||
isWindows = (hands[1].controller.getAbsRotation().z > (0.25 * PI));
|
|
||||||
} else {
|
} else {
|
||||||
calibrationStatus = UNCALIBRATED;
|
calibrationStatus = UNCALIBRATED;
|
||||||
return;
|
return;
|
||||||
|
@ -231,8 +226,6 @@ var leapHands = (function () {
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
|
||||||
// TODO: Leap Motion controller joint naming doesn't match up with skeleton joint naming; numbers are out by 1.
|
|
||||||
|
|
||||||
hands = [
|
hands = [
|
||||||
{
|
{
|
||||||
jointName: "LeftHand",
|
jointName: "LeftHand",
|
||||||
|
@ -251,6 +244,9 @@ var leapHands = (function () {
|
||||||
{ controller: Controller.createInputController("Spatial", "joint_R_wrist") }
|
{ controller: Controller.createInputController("Spatial", "joint_R_wrist") }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// The Leap controller's first joint is the hand-metacarpal joint but this joint's data is not used because it's too
|
||||||
|
// dependent on the model skeleton exactly matching the Leap skeleton; using just the second and subsequent joints
|
||||||
|
// seems to work better over all.
|
||||||
fingers = [{}, {}];
|
fingers = [{}, {}];
|
||||||
fingers[0] = [
|
fingers[0] = [
|
||||||
[
|
[
|
||||||
|
@ -318,11 +314,7 @@ var leapHands = (function () {
|
||||||
j,
|
j,
|
||||||
side,
|
side,
|
||||||
handOffset,
|
handOffset,
|
||||||
handRoll,
|
|
||||||
handPitch,
|
|
||||||
handYaw,
|
|
||||||
handRotation,
|
handRotation,
|
||||||
wristAbsRotation,
|
|
||||||
locRotation,
|
locRotation,
|
||||||
cameraOrientation,
|
cameraOrientation,
|
||||||
inverseAvatarOrientation;
|
inverseAvatarOrientation;
|
||||||
|
@ -361,20 +353,22 @@ var leapHands = (function () {
|
||||||
handOffset.x = -handOffset.x;
|
handOffset.x = -handOffset.x;
|
||||||
|
|
||||||
// Hand rotation in camera coordinates ...
|
// Hand rotation in camera coordinates ...
|
||||||
// TODO: 2.0* scale factors should not be necessary; Leap Motion controller code needs investigating.
|
handRotation = wrists[h].controller.getAbsRotation();
|
||||||
handRoll = 2.0 * -hands[h].controller.getAbsRotation().z;
|
handRotation = {
|
||||||
wristAbsRotation = wrists[h].controller.getAbsRotation();
|
x: handRotation.z,
|
||||||
handPitch = 2.0 * wristAbsRotation.x - PI / 2.0;
|
y: handRotation.y,
|
||||||
handYaw = 2.0 * -wristAbsRotation.y;
|
z: handRotation.x,
|
||||||
// TODO: Roll values only work if hand is upside down; Leap Motion controller code needs investigating.
|
w: handRotation.w
|
||||||
handRoll = PI + handRoll;
|
};
|
||||||
|
|
||||||
if (h === 0) {
|
if (h === 0) {
|
||||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 1, z: 0 }),
|
handRotation.x = -handRotation.x;
|
||||||
Quat.fromVec3Radians({ x: handRoll, y: handYaw, z: -handPitch }));
|
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 1, y: 0, z: 0 }), handRotation);
|
||||||
|
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 0, z: 1 }), handRotation);
|
||||||
} else {
|
} else {
|
||||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 1, z: 0 }),
|
handRotation.z = -handRotation.z;
|
||||||
Quat.fromVec3Radians({ x: -handRoll, y: handYaw, z: handPitch }));
|
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 1, y: 0, z: 0 }), handRotation);
|
||||||
|
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 0, z: 1 }), handRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hand rotation in avatar coordinates ...
|
// Hand rotation in avatar coordinates ...
|
||||||
|
@ -392,44 +386,48 @@ var leapHands = (function () {
|
||||||
z: hands[h].zeroPosition.z - handOffset.z
|
z: hands[h].zeroPosition.z - handOffset.z
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: 2.0* scale factors should not be necessary; Leap Motion controller code needs investigating.
|
handRotation = wrists[h].controller.getAbsRotation();
|
||||||
handRoll = 2.0 * -hands[h].controller.getAbsRotation().z;
|
handRotation = {
|
||||||
wristAbsRotation = wrists[h].controller.getAbsRotation();
|
x: handRotation.z,
|
||||||
handPitch = 2.0 * -wristAbsRotation.x;
|
y: handRotation.y,
|
||||||
handYaw = 2.0 * wristAbsRotation.y;
|
z: handRotation.x,
|
||||||
|
w: handRotation.w
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Leap Motion controller's right-hand roll calculation only works if physical hand is upside down.
|
|
||||||
// Approximate fix is to add a fudge factor.
|
|
||||||
if (h === 1 && isWindows) {
|
|
||||||
handRoll = handRoll + 0.6 * PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hand position and orientation ...
|
|
||||||
if (h === 0) {
|
if (h === 0) {
|
||||||
|
handRotation.x = -handRotation.x;
|
||||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 1, z: 0 }),
|
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 1, z: 0 }),
|
||||||
Quat.fromVec3Radians({ x: handRoll, y: handYaw, z: -handPitch }));
|
handRotation);
|
||||||
} else {
|
} else {
|
||||||
|
handRotation.z = -handRotation.z;
|
||||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 1, z: 0 }),
|
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 1, z: 0 }),
|
||||||
Quat.fromVec3Radians({ x: -handRoll, y: handYaw, z: handPitch }));
|
handRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyAvatar.setJointModelPositionAndOrientation(hands[h].jointName, handOffset, handRotation, true);
|
MyAvatar.setJointModelPositionAndOrientation(hands[h].jointName, handOffset, handRotation, true);
|
||||||
|
|
||||||
// Finger joints ...
|
// Finger joints ...
|
||||||
// TODO: 2.0 * scale factors should not be necessary; Leap Motion controller code needs investigating.
|
|
||||||
for (i = 0; i < NUM_FINGERS; i += 1) {
|
for (i = 0; i < NUM_FINGERS; i += 1) {
|
||||||
for (j = 0; j < NUM_FINGER_JOINTS; j += 1) {
|
for (j = 0; j < NUM_FINGER_JOINTS; j += 1) {
|
||||||
if (fingers[h][i][j].controller !== null) {
|
if (fingers[h][i][j].controller !== null) {
|
||||||
locRotation = fingers[h][i][j].controller.getLocRotation();
|
locRotation = fingers[h][i][j].controller.getLocRotation();
|
||||||
if (i === THUMB) {
|
if (i === THUMB) {
|
||||||
MyAvatar.setJointData(fingers[h][i][j].jointName,
|
locRotation = {
|
||||||
Quat.fromPitchYawRollRadians(2.0 * side * locRotation.y, 2.0 * -locRotation.z,
|
x: side * locRotation.y,
|
||||||
2.0 * side * -locRotation.x));
|
y: side * -locRotation.z,
|
||||||
|
z: side * -locRotation.x,
|
||||||
|
w: locRotation.w
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
MyAvatar.setJointData(fingers[h][i][j].jointName,
|
locRotation = {
|
||||||
Quat.fromPitchYawRollRadians(2.0 * -locRotation.x, 0.0, 2.0 * -locRotation.y));
|
x: -locRotation.x,
|
||||||
|
y: -locRotation.z,
|
||||||
|
z: -locRotation.y,
|
||||||
|
w: locRotation.w
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
MyAvatar.setJointData(fingers[h][i][j].jointName, locRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ EntityPropertyDialogBox = (function () {
|
||||||
properties.color.blue = array[index++].value;
|
properties.color.blue = array[index++].value;
|
||||||
}
|
}
|
||||||
Entities.editEntity(editModelID, properties);
|
Entities.editEntity(editModelID, properties);
|
||||||
selectionDisplay.highlightSelectable(editModelID, propeties);
|
selectionDisplay.select(editModelID, false);
|
||||||
}
|
}
|
||||||
modelSelected = false;
|
modelSelected = false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
SelectionDisplay = (function () {
|
SelectionDisplay = (function () {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
|
@ -29,10 +31,33 @@ SelectionDisplay = (function () {
|
||||||
var handleHoverColor = { red: 224, green: 67, blue: 36 };
|
var handleHoverColor = { red: 224, green: 67, blue: 36 };
|
||||||
var handleHoverAlpha = 1.0;
|
var handleHoverAlpha = 1.0;
|
||||||
|
|
||||||
|
var rotateOverlayTargetSize = 10000; // really big target
|
||||||
|
var innerSnapAngle = 22.5; // the angle which we snap to on the inner rotation tool
|
||||||
|
var innerRadius;
|
||||||
|
var outerRadius;
|
||||||
|
var yawHandleRotation;
|
||||||
|
var pitchHandleRotation;
|
||||||
|
var rollHandleRotation;
|
||||||
|
var yawCenter;
|
||||||
|
var pitchCenter;
|
||||||
|
var rollCenter;
|
||||||
|
var yawZero;
|
||||||
|
var pitchZero;
|
||||||
|
var rollZero;
|
||||||
|
var yawNormal;
|
||||||
|
var pitchNormal;
|
||||||
|
var rollNormal;
|
||||||
|
var rotationNormal;
|
||||||
|
|
||||||
|
var originalRotation;
|
||||||
|
var originalPitch;
|
||||||
|
var originalYaw;
|
||||||
|
var originalRoll;
|
||||||
|
|
||||||
|
|
||||||
var rotateHandleColor = { red: 0, green: 0, blue: 0 };
|
var rotateHandleColor = { red: 0, green: 0, blue: 0 };
|
||||||
var rotateHandleAlpha = 0.7;
|
var rotateHandleAlpha = 0.7;
|
||||||
|
|
||||||
|
|
||||||
var grabberSizeCorner = 0.025;
|
var grabberSizeCorner = 0.025;
|
||||||
var grabberSizeEdge = 0.015;
|
var grabberSizeEdge = 0.015;
|
||||||
var grabberSizeFace = 0.025;
|
var grabberSizeFace = 0.025;
|
||||||
|
@ -100,7 +125,7 @@ SelectionDisplay = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
var grabberMoveUp = Overlays.addOverlay("billboard", {
|
var grabberMoveUp = Overlays.addOverlay("billboard", {
|
||||||
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/up-arrow.png",
|
url: HIFI_PUBLIC_BUCKET + "images/up-arrow.png",
|
||||||
position: { x:0, y: 0, z: 0},
|
position: { x:0, y: 0, z: 0},
|
||||||
color: { red: 0, green: 0, blue: 0 },
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
alpha: 1.0,
|
alpha: 1.0,
|
||||||
|
@ -149,7 +174,8 @@ SelectionDisplay = (function () {
|
||||||
alpha: 0.5,
|
alpha: 0.5,
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
rotation: baseOverlayRotation
|
rotation: baseOverlayRotation,
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
});
|
});
|
||||||
|
|
||||||
var yawOverlayAngles = { x: 90, y: 0, z: 0 };
|
var yawOverlayAngles = { x: 90, y: 0, z: 0 };
|
||||||
|
@ -159,6 +185,34 @@ SelectionDisplay = (function () {
|
||||||
var rollOverlayAngles = { x: 0, y: 180, z: 0 };
|
var rollOverlayAngles = { x: 0, y: 180, z: 0 };
|
||||||
var rollOverlayRotation = Quat.fromVec3Degrees(rollOverlayAngles);
|
var rollOverlayRotation = Quat.fromVec3Degrees(rollOverlayAngles);
|
||||||
|
|
||||||
|
var rotateZeroOverlay = Overlays.addOverlay("line3d", {
|
||||||
|
visible: false,
|
||||||
|
lineWidth: 2.0,
|
||||||
|
start: { x: 0, y: 0, z: 0 },
|
||||||
|
end: { x: 0, y: 0, z: 0 },
|
||||||
|
color: { red: 255, green: 0, blue: 0 },
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
|
});
|
||||||
|
|
||||||
|
var rotateCurrentOverlay = Overlays.addOverlay("line3d", {
|
||||||
|
visible: false,
|
||||||
|
lineWidth: 2.0,
|
||||||
|
start: { x: 0, y: 0, z: 0 },
|
||||||
|
end: { x: 0, y: 0, z: 0 },
|
||||||
|
color: { red: 0, green: 0, blue: 255 },
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var rotateOverlayTarget = Overlays.addOverlay("circle3d", {
|
||||||
|
position: { x:0, y: 0, z: 0},
|
||||||
|
size: rotateOverlayTargetSize,
|
||||||
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
|
alpha: 0.0,
|
||||||
|
solid: true,
|
||||||
|
visible: false,
|
||||||
|
rotation: yawOverlayRotation,
|
||||||
|
});
|
||||||
|
|
||||||
var rotateOverlayInner = Overlays.addOverlay("circle3d", {
|
var rotateOverlayInner = Overlays.addOverlay("circle3d", {
|
||||||
position: { x:0, y: 0, z: 0},
|
position: { x:0, y: 0, z: 0},
|
||||||
|
@ -167,7 +221,15 @@ SelectionDisplay = (function () {
|
||||||
alpha: 0.2,
|
alpha: 0.2,
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
rotation: yawOverlayRotation
|
rotation: yawOverlayRotation,
|
||||||
|
hasTickMarks: true,
|
||||||
|
majorTickMarksAngle: innerSnapAngle,
|
||||||
|
minorTickMarksAngle: 0,
|
||||||
|
majorTickMarksLength: -0.25,
|
||||||
|
minorTickMarksLength: 0,
|
||||||
|
majorTickMarksColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
minorTickMarksColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
});
|
});
|
||||||
|
|
||||||
var rotateOverlayOuter = Overlays.addOverlay("circle3d", {
|
var rotateOverlayOuter = Overlays.addOverlay("circle3d", {
|
||||||
|
@ -177,7 +239,16 @@ SelectionDisplay = (function () {
|
||||||
alpha: 0.2,
|
alpha: 0.2,
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
rotation: yawOverlayRotation
|
rotation: yawOverlayRotation,
|
||||||
|
|
||||||
|
hasTickMarks: true,
|
||||||
|
majorTickMarksAngle: 45.0,
|
||||||
|
minorTickMarksAngle: 5,
|
||||||
|
majorTickMarksLength: 0.25,
|
||||||
|
minorTickMarksLength: 0.1,
|
||||||
|
majorTickMarksColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
minorTickMarksColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
});
|
});
|
||||||
|
|
||||||
var rotateOverlayCurrent = Overlays.addOverlay("circle3d", {
|
var rotateOverlayCurrent = Overlays.addOverlay("circle3d", {
|
||||||
|
@ -188,10 +259,11 @@ SelectionDisplay = (function () {
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
rotation: yawOverlayRotation,
|
rotation: yawOverlayRotation,
|
||||||
|
ignoreRayIntersection: true, // always ignore this
|
||||||
});
|
});
|
||||||
|
|
||||||
var yawHandle = Overlays.addOverlay("billboard", {
|
var yawHandle = Overlays.addOverlay("billboard", {
|
||||||
url: "https://s3.amazonaws.com/uploads.hipchat.com/33953/231323/HRRhkMk8ueLk8ku/rotate-arrow.png",
|
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png",
|
||||||
position: { x:0, y: 0, z: 0},
|
position: { x:0, y: 0, z: 0},
|
||||||
color: rotateHandleColor,
|
color: rotateHandleColor,
|
||||||
alpha: rotateHandleAlpha,
|
alpha: rotateHandleAlpha,
|
||||||
|
@ -203,7 +275,7 @@ SelectionDisplay = (function () {
|
||||||
|
|
||||||
|
|
||||||
var pitchHandle = Overlays.addOverlay("billboard", {
|
var pitchHandle = Overlays.addOverlay("billboard", {
|
||||||
url: "https://s3.amazonaws.com/uploads.hipchat.com/33953/231323/HRRhkMk8ueLk8ku/rotate-arrow.png",
|
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png",
|
||||||
position: { x:0, y: 0, z: 0},
|
position: { x:0, y: 0, z: 0},
|
||||||
color: rotateHandleColor,
|
color: rotateHandleColor,
|
||||||
alpha: rotateHandleAlpha,
|
alpha: rotateHandleAlpha,
|
||||||
|
@ -215,7 +287,7 @@ SelectionDisplay = (function () {
|
||||||
|
|
||||||
|
|
||||||
var rollHandle = Overlays.addOverlay("billboard", {
|
var rollHandle = Overlays.addOverlay("billboard", {
|
||||||
url: "https://s3.amazonaws.com/uploads.hipchat.com/33953/231323/HRRhkMk8ueLk8ku/rotate-arrow.png",
|
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png",
|
||||||
position: { x:0, y: 0, z: 0},
|
position: { x:0, y: 0, z: 0},
|
||||||
color: rotateHandleColor,
|
color: rotateHandleColor,
|
||||||
alpha: rotateHandleAlpha,
|
alpha: rotateHandleAlpha,
|
||||||
|
@ -262,11 +334,14 @@ SelectionDisplay = (function () {
|
||||||
overlayNames[pitchHandle] = "pitchHandle";
|
overlayNames[pitchHandle] = "pitchHandle";
|
||||||
overlayNames[rollHandle] = "rollHandle";
|
overlayNames[rollHandle] = "rollHandle";
|
||||||
|
|
||||||
|
overlayNames[rotateOverlayTarget] = "rotateOverlayTarget";
|
||||||
overlayNames[rotateOverlayInner] = "rotateOverlayInner";
|
overlayNames[rotateOverlayInner] = "rotateOverlayInner";
|
||||||
overlayNames[rotateOverlayOuter] = "rotateOverlayOuter";
|
overlayNames[rotateOverlayOuter] = "rotateOverlayOuter";
|
||||||
overlayNames[rotateOverlayCurrent] = "rotateOverlayCurrent";
|
overlayNames[rotateOverlayCurrent] = "rotateOverlayCurrent";
|
||||||
|
|
||||||
|
overlayNames[rotateZeroOverlay] = "rotateZeroOverlay";
|
||||||
|
overlayNames[rotateCurrentOverlay] = "rotateCurrentOverlay";
|
||||||
|
|
||||||
that.cleanup = function () {
|
that.cleanup = function () {
|
||||||
Overlays.deleteOverlay(highlightBox);
|
Overlays.deleteOverlay(highlightBox);
|
||||||
Overlays.deleteOverlay(selectionBox);
|
Overlays.deleteOverlay(selectionBox);
|
||||||
|
@ -305,10 +380,15 @@ SelectionDisplay = (function () {
|
||||||
Overlays.deleteOverlay(pitchHandle);
|
Overlays.deleteOverlay(pitchHandle);
|
||||||
Overlays.deleteOverlay(rollHandle);
|
Overlays.deleteOverlay(rollHandle);
|
||||||
|
|
||||||
|
Overlays.deleteOverlay(rotateOverlayTarget);
|
||||||
Overlays.deleteOverlay(rotateOverlayInner);
|
Overlays.deleteOverlay(rotateOverlayInner);
|
||||||
Overlays.deleteOverlay(rotateOverlayOuter);
|
Overlays.deleteOverlay(rotateOverlayOuter);
|
||||||
Overlays.deleteOverlay(rotateOverlayCurrent);
|
Overlays.deleteOverlay(rotateOverlayCurrent);
|
||||||
|
|
||||||
|
Overlays.deleteOverlay(rotateZeroOverlay);
|
||||||
|
Overlays.deleteOverlay(rotateCurrentOverlay);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
that.highlightSelectable = function(entityID) {
|
that.highlightSelectable = function(entityID) {
|
||||||
|
@ -360,8 +440,8 @@ SelectionDisplay = (function () {
|
||||||
|
|
||||||
var diagonal = (Vec3.length(properties.dimensions) / 2) * 1.1;
|
var diagonal = (Vec3.length(properties.dimensions) / 2) * 1.1;
|
||||||
var halfDimensions = Vec3.multiply(properties.dimensions, 0.5);
|
var halfDimensions = Vec3.multiply(properties.dimensions, 0.5);
|
||||||
var innerRadius = diagonal;
|
innerRadius = diagonal;
|
||||||
var outerRadius = diagonal * 1.15;
|
outerRadius = diagonal * 1.15;
|
||||||
var innerActive = false;
|
var innerActive = false;
|
||||||
var innerAlpha = 0.2;
|
var innerAlpha = 0.2;
|
||||||
var outerAlpha = 0.2;
|
var outerAlpha = 0.2;
|
||||||
|
@ -374,31 +454,33 @@ SelectionDisplay = (function () {
|
||||||
var rotateHandleOffset = 0.05;
|
var rotateHandleOffset = 0.05;
|
||||||
var grabberMoveUpOffset = 0.1;
|
var grabberMoveUpOffset = 0.1;
|
||||||
|
|
||||||
var left = properties.position.x - halfDimensions.x;
|
var top, far, left, bottom, near, right, boundsCenter, objectCenter, BLN, BRN, BLF, TLN, TRN, TLF, TRF;
|
||||||
var right = properties.position.x + halfDimensions.x;
|
|
||||||
var bottom = properties.position.y - halfDimensions.y;
|
|
||||||
var top = properties.position.y + halfDimensions.y;
|
|
||||||
var near = properties.position.z - halfDimensions.z;
|
|
||||||
var far = properties.position.z + halfDimensions.z;
|
|
||||||
var center = { x: properties.position.x, y: properties.position.y, z: properties.position.z };
|
|
||||||
|
|
||||||
var BLN = { x: left, y: bottom, z: near };
|
objectCenter = { x: properties.position.x, y: properties.position.y, z: properties.position.z };
|
||||||
var BRN = { x: right, y: bottom, z: near };
|
|
||||||
var BLF = { x: left, y: bottom, z: far };
|
top = properties.boundingBox.tfl.y;
|
||||||
var BRF = { x: right, y: bottom, z: far };
|
far = properties.boundingBox.tfl.z;
|
||||||
var TLN = { x: left, y: top, z: near };
|
left = properties.boundingBox.tfl.x;
|
||||||
var TRN = { x: right, y: top, z: near };
|
|
||||||
var TLF = { x: left, y: top, z: far };
|
bottom = properties.boundingBox.brn.y;
|
||||||
var TRF = { x: right, y: top, z: far };
|
right = properties.boundingBox.brn.x;
|
||||||
|
near = properties.boundingBox.brn.z;
|
||||||
|
|
||||||
|
boundsCenter = { x: properties.boundingBox.center.x, y: properties.boundingBox.center.y, z: properties.boundingBox.center.z };
|
||||||
|
|
||||||
|
BLN = { x: left, y: bottom, z: near };
|
||||||
|
BRN = { x: right, y: bottom, z: near };
|
||||||
|
BLF = { x: left, y: bottom, z: far };
|
||||||
|
BRF = { x: right, y: bottom, z: far };
|
||||||
|
TLN = { x: left, y: top, z: near };
|
||||||
|
TRN = { x: right, y: top, z: near };
|
||||||
|
TLF = { x: left, y: top, z: far };
|
||||||
|
TRF = { x: right, y: top, z: far };
|
||||||
|
|
||||||
var yawCorner;
|
var yawCorner;
|
||||||
var pitchCorner;
|
var pitchCorner;
|
||||||
var rollCorner;
|
var rollCorner;
|
||||||
|
|
||||||
var yawHandleRotation;
|
|
||||||
var pitchHandleRotation;
|
|
||||||
var rollHandleRotation;
|
|
||||||
|
|
||||||
// determine which bottom corner we are closest to
|
// determine which bottom corner we are closest to
|
||||||
/*------------------------------
|
/*------------------------------
|
||||||
example:
|
example:
|
||||||
|
@ -412,124 +494,189 @@ SelectionDisplay = (function () {
|
||||||
|
|
||||||
------------------------------*/
|
------------------------------*/
|
||||||
|
|
||||||
if (MyAvatar.position.x > center.x) {
|
if (MyAvatar.position.x > objectCenter.x) {
|
||||||
// must be BRF or BRN
|
// must be BRF or BRN
|
||||||
if (MyAvatar.position.z < center.z) {
|
if (MyAvatar.position.z < objectCenter.z) {
|
||||||
yawHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 0, z: 0 });
|
|
||||||
pitchHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 180, z: 180 });
|
|
||||||
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 90, z: 180 });
|
|
||||||
|
|
||||||
yawCorner = { x: right + rotateHandleOffset,
|
yawHandleRotation = Quat.fromVec3Degrees({ x: 270, y: 90, z: 0 });
|
||||||
|
pitchHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 90, z: 0 });
|
||||||
|
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 0 });
|
||||||
|
|
||||||
|
yawNormal = { x: 0, y: 1, z: 0 };
|
||||||
|
pitchNormal = { x: 1, y: 0, z: 0 };
|
||||||
|
rollNormal = { x: 0, y: 0, z: 1 };
|
||||||
|
|
||||||
|
yawCorner = { x: left + rotateHandleOffset,
|
||||||
y: bottom - rotateHandleOffset,
|
y: bottom - rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset };
|
z: near - rotateHandleOffset };
|
||||||
|
|
||||||
pitchCorner = { x: right + rotateHandleOffset,
|
pitchCorner = { x: right - rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
|
||||||
z: far + rotateHandleOffset };
|
|
||||||
|
|
||||||
rollCorner = { x: left - rotateHandleOffset,
|
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset};
|
z: near - rotateHandleOffset};
|
||||||
|
|
||||||
|
rollCorner = { x: left + rotateHandleOffset,
|
||||||
|
y: top + rotateHandleOffset,
|
||||||
|
z: far + rotateHandleOffset };
|
||||||
|
|
||||||
|
yawCenter = { x: boundsCenter.x, y: bottom, z: boundsCenter.z };
|
||||||
|
pitchCenter = { x: right, y: boundsCenter.y, z: boundsCenter.z};
|
||||||
|
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far };
|
||||||
|
|
||||||
|
|
||||||
|
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-south.png" });
|
||||||
|
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-south.png" });
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
yawHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 270, z: 0 });
|
|
||||||
|
yawHandleRotation = Quat.fromVec3Degrees({ x: 270, y: 0, z: 0 });
|
||||||
pitchHandleRotation = Quat.fromVec3Degrees({ x: 180, y: 270, z: 0 });
|
pitchHandleRotation = Quat.fromVec3Degrees({ x: 180, y: 270, z: 0 });
|
||||||
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 90 });
|
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 90 });
|
||||||
|
|
||||||
yawCorner = { x: right + rotateHandleOffset,
|
yawNormal = { x: 0, y: 1, z: 0 };
|
||||||
|
pitchNormal = { x: 1, y: 0, z: 0 };
|
||||||
|
rollNormal = { x: 0, y: 0, z: 1 };
|
||||||
|
|
||||||
|
|
||||||
|
yawCorner = { x: left + rotateHandleOffset,
|
||||||
y: bottom - rotateHandleOffset,
|
y: bottom - rotateHandleOffset,
|
||||||
z: far + rotateHandleOffset };
|
z: far + rotateHandleOffset };
|
||||||
|
|
||||||
pitchCorner = { x: left - rotateHandleOffset,
|
pitchCorner = { x: right - rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: far + rotateHandleOffset };
|
z: far + rotateHandleOffset };
|
||||||
|
|
||||||
rollCorner = { x: right + rotateHandleOffset,
|
rollCorner = { x: left + rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset};
|
z: near - rotateHandleOffset};
|
||||||
|
|
||||||
|
|
||||||
|
yawCenter = { x: boundsCenter.x, y: bottom, z: boundsCenter.z };
|
||||||
|
pitchCenter = { x: right, y: boundsCenter.y, z: boundsCenter.z };
|
||||||
|
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near};
|
||||||
|
|
||||||
|
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
|
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// must be BLF or BLN
|
// must be BLF or BLN
|
||||||
if (MyAvatar.position.z < center.z) {
|
if (MyAvatar.position.z < objectCenter.z) {
|
||||||
yawHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 90, z: 0 });
|
|
||||||
|
yawHandleRotation = Quat.fromVec3Degrees({ x: 270, y: 180, z: 0 });
|
||||||
pitchHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 0, z: 90 });
|
pitchHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 0, z: 90 });
|
||||||
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 180 });
|
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 180 });
|
||||||
|
|
||||||
yawCorner = { x: left - rotateHandleOffset,
|
yawNormal = { x: 0, y: 1, z: 0 };
|
||||||
|
pitchNormal = { x: 1, y: 0, z: 0 };
|
||||||
|
rollNormal = { x: 0, y: 0, z: 1 };
|
||||||
|
|
||||||
|
yawCorner = { x: right - rotateHandleOffset,
|
||||||
y: bottom - rotateHandleOffset,
|
y: bottom - rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset };
|
z: near - rotateHandleOffset };
|
||||||
|
|
||||||
pitchCorner = { x: right + rotateHandleOffset,
|
pitchCorner = { x: left + rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset };
|
z: near - rotateHandleOffset };
|
||||||
|
|
||||||
rollCorner = { x: left - rotateHandleOffset,
|
rollCorner = { x: right - rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: far + rotateHandleOffset};
|
z: far + rotateHandleOffset};
|
||||||
|
|
||||||
|
yawCenter = { x: boundsCenter.x, y: bottom, z: boundsCenter.z };
|
||||||
} else {
|
pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z };
|
||||||
yawHandleRotation = Quat.fromVec3Degrees({ x: 90, y: 180, z: 0 });
|
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far};
|
||||||
pitchHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 180 });
|
|
||||||
rollHandleRotation = Quat.fromVec3Degrees({ x: 180, y: 270, z: 0 });
|
|
||||||
|
|
||||||
yawCorner = { x: left - rotateHandleOffset,
|
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
|
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
yawHandleRotation = Quat.fromVec3Degrees({ x: 270, y: 270, z: 0 });
|
||||||
|
rollHandleRotation = Quat.fromVec3Degrees({ x: 0, y: 0, z: 180 });
|
||||||
|
pitchHandleRotation = Quat.fromVec3Degrees({ x: 180, y: 270, z: 0 });
|
||||||
|
|
||||||
|
yawNormal = { x: 0, y: 1, z: 0 };
|
||||||
|
rollNormal = { x: 0, y: 0, z: 1 };
|
||||||
|
pitchNormal = { x: 1, y: 0, z: 0 };
|
||||||
|
|
||||||
|
yawCorner = { x: right - rotateHandleOffset,
|
||||||
y: bottom - rotateHandleOffset,
|
y: bottom - rotateHandleOffset,
|
||||||
z: far + rotateHandleOffset };
|
z: far + rotateHandleOffset };
|
||||||
|
|
||||||
pitchCorner = { x: left - rotateHandleOffset,
|
rollCorner = { x: right - rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: near - rotateHandleOffset };
|
z: near - rotateHandleOffset };
|
||||||
|
|
||||||
rollCorner = { x: right + rotateHandleOffset,
|
pitchCorner = { x: left + rotateHandleOffset,
|
||||||
y: top + rotateHandleOffset,
|
y: top + rotateHandleOffset,
|
||||||
z: far + rotateHandleOffset};
|
z: far + rotateHandleOffset};
|
||||||
|
|
||||||
|
yawCenter = { x: boundsCenter.x, y: bottom, z: boundsCenter.z };
|
||||||
|
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near };
|
||||||
|
pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z};
|
||||||
|
|
||||||
|
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
|
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rotateHandlesVisible = true;
|
||||||
|
var translateHandlesVisible = true;
|
||||||
|
var stretchHandlesVisible = true;
|
||||||
|
var selectionBoxVisible = true;
|
||||||
|
if (mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL" || mode == "TRANSLATE_XZ") {
|
||||||
|
rotateHandlesVisible = false;
|
||||||
|
translateHandlesVisible = false;
|
||||||
|
stretchHandlesVisible = false;
|
||||||
|
selectionBoxVisible = false;
|
||||||
|
} else if (mode == "TRANSLATE_UP_DOWN") {
|
||||||
|
rotateHandlesVisible = false;
|
||||||
|
stretchHandlesVisible = false;
|
||||||
|
} else if (mode != "UNKNOWN") {
|
||||||
|
// every other mode is a stretch mode...
|
||||||
|
rotateHandlesVisible = false;
|
||||||
|
translateHandlesVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
Overlays.editOverlay(highlightBox, { visible: false });
|
Overlays.editOverlay(highlightBox, { visible: false });
|
||||||
|
|
||||||
Overlays.editOverlay(selectionBox,
|
Overlays.editOverlay(selectionBox, { visible: selectionBoxVisible, position: objectCenter, dimensions: properties.dimensions,
|
||||||
{
|
rotation: properties.rotation,});
|
||||||
visible: true,
|
|
||||||
position: center,
|
|
||||||
dimensions: properties.dimensions,
|
|
||||||
rotation: properties.rotation,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Overlays.editOverlay(grabberMoveUp, { visible: true, position: { x: center.x, y: top + grabberMoveUpOffset, z: center.z } });
|
Overlays.editOverlay(grabberMoveUp, { visible: translateHandlesVisible, position: { x: boundsCenter.x, y: top + grabberMoveUpOffset, z: boundsCenter.z } });
|
||||||
|
|
||||||
Overlays.editOverlay(grabberLBN, { visible: true, position: { x: left, y: bottom, z: near } });
|
Overlays.editOverlay(grabberLBN, { visible: stretchHandlesVisible, position: { x: left, y: bottom, z: near } });
|
||||||
Overlays.editOverlay(grabberRBN, { visible: true, position: { x: right, y: bottom, z: near } });
|
Overlays.editOverlay(grabberRBN, { visible: stretchHandlesVisible, position: { x: right, y: bottom, z: near } });
|
||||||
Overlays.editOverlay(grabberLBF, { visible: true, position: { x: left, y: bottom, z: far } });
|
Overlays.editOverlay(grabberLBF, { visible: stretchHandlesVisible, position: { x: left, y: bottom, z: far } });
|
||||||
Overlays.editOverlay(grabberRBF, { visible: true, position: { x: right, y: bottom, z: far } });
|
Overlays.editOverlay(grabberRBF, { visible: stretchHandlesVisible, position: { x: right, y: bottom, z: far } });
|
||||||
Overlays.editOverlay(grabberLTN, { visible: true, position: { x: left, y: top, z: near } });
|
Overlays.editOverlay(grabberLTN, { visible: stretchHandlesVisible, position: { x: left, y: top, z: near } });
|
||||||
Overlays.editOverlay(grabberRTN, { visible: true, position: { x: right, y: top, z: near } });
|
Overlays.editOverlay(grabberRTN, { visible: stretchHandlesVisible, position: { x: right, y: top, z: near } });
|
||||||
Overlays.editOverlay(grabberLTF, { visible: true, position: { x: left, y: top, z: far } });
|
Overlays.editOverlay(grabberLTF, { visible: stretchHandlesVisible, position: { x: left, y: top, z: far } });
|
||||||
Overlays.editOverlay(grabberRTF, { visible: true, position: { x: right, y: top, z: far } });
|
Overlays.editOverlay(grabberRTF, { visible: stretchHandlesVisible, position: { x: right, y: top, z: far } });
|
||||||
|
|
||||||
|
|
||||||
Overlays.editOverlay(grabberTOP, { visible: true, position: { x: center.x, y: top, z: center.z } });
|
Overlays.editOverlay(grabberTOP, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: top, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberBOTTOM, { visible: true, position: { x: center.x, y: bottom, z: center.z } });
|
Overlays.editOverlay(grabberBOTTOM, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: bottom, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberLEFT, { visible: true, position: { x: left, y: center.y, z: center.z } });
|
Overlays.editOverlay(grabberLEFT, { visible: stretchHandlesVisible, position: { x: left, y: boundsCenter.y, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberRIGHT, { visible: true, position: { x: right, y: center.y, z: center.z } });
|
Overlays.editOverlay(grabberRIGHT, { visible: stretchHandlesVisible, position: { x: right, y: boundsCenter.y, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberNEAR, { visible: true, position: { x: center.x, y: center.y, z: near } });
|
Overlays.editOverlay(grabberNEAR, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: boundsCenter.y, z: near } });
|
||||||
Overlays.editOverlay(grabberFAR, { visible: true, position: { x: center.x, y: center.y, z: far } });
|
Overlays.editOverlay(grabberFAR, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: boundsCenter.y, z: far } });
|
||||||
|
|
||||||
Overlays.editOverlay(grabberEdgeTR, { visible: true, position: { x: right, y: top, z: center.z } });
|
Overlays.editOverlay(grabberEdgeTR, { visible: stretchHandlesVisible, position: { x: right, y: top, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberEdgeTL, { visible: true, position: { x: left, y: top, z: center.z } });
|
Overlays.editOverlay(grabberEdgeTL, { visible: stretchHandlesVisible, position: { x: left, y: top, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberEdgeTF, { visible: true, position: { x: center.x, y: top, z: far } });
|
Overlays.editOverlay(grabberEdgeTF, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: top, z: far } });
|
||||||
Overlays.editOverlay(grabberEdgeTN, { visible: true, position: { x: center.x, y: top, z: near } });
|
Overlays.editOverlay(grabberEdgeTN, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: top, z: near } });
|
||||||
Overlays.editOverlay(grabberEdgeBR, { visible: true, position: { x: right, y: bottom, z: center.z } });
|
Overlays.editOverlay(grabberEdgeBR, { visible: stretchHandlesVisible, position: { x: right, y: bottom, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberEdgeBL, { visible: true, position: { x: left, y: bottom, z: center.z } });
|
Overlays.editOverlay(grabberEdgeBL, { visible: stretchHandlesVisible, position: { x: left, y: bottom, z: boundsCenter.z } });
|
||||||
Overlays.editOverlay(grabberEdgeBF, { visible: true, position: { x: center.x, y: bottom, z: far } });
|
Overlays.editOverlay(grabberEdgeBF, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: bottom, z: far } });
|
||||||
Overlays.editOverlay(grabberEdgeBN, { visible: true, position: { x: center.x, y: bottom, z: near } });
|
Overlays.editOverlay(grabberEdgeBN, { visible: stretchHandlesVisible, position: { x: boundsCenter.x, y: bottom, z: near } });
|
||||||
Overlays.editOverlay(grabberEdgeNR, { visible: true, position: { x: right, y: center.y, z: near } });
|
Overlays.editOverlay(grabberEdgeNR, { visible: stretchHandlesVisible, position: { x: right, y: boundsCenter.y, z: near } });
|
||||||
Overlays.editOverlay(grabberEdgeNL, { visible: true, position: { x: left, y: center.y, z: near } });
|
Overlays.editOverlay(grabberEdgeNL, { visible: stretchHandlesVisible, position: { x: left, y: boundsCenter.y, z: near } });
|
||||||
Overlays.editOverlay(grabberEdgeFR, { visible: true, position: { x: right, y: center.y, z: far } });
|
Overlays.editOverlay(grabberEdgeFR, { visible: stretchHandlesVisible, position: { x: right, y: boundsCenter.y, z: far } });
|
||||||
Overlays.editOverlay(grabberEdgeFL, { visible: true, position: { x: left, y: center.y, z: far } });
|
Overlays.editOverlay(grabberEdgeFL, { visible: stretchHandlesVisible, position: { x: left, y: boundsCenter.y, z: far } });
|
||||||
|
|
||||||
|
|
||||||
Overlays.editOverlay(baseOfEntityProjectionOverlay,
|
Overlays.editOverlay(baseOfEntityProjectionOverlay,
|
||||||
|
@ -545,14 +692,12 @@ SelectionDisplay = (function () {
|
||||||
rotation: properties.rotation,
|
rotation: properties.rotation,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { visible: false });
|
||||||
|
|
||||||
Overlays.editOverlay(rotateOverlayInner,
|
Overlays.editOverlay(rotateOverlayInner,
|
||||||
{
|
{
|
||||||
visible: false,
|
visible: false,
|
||||||
position: { x: properties.position.x,
|
|
||||||
y: properties.position.y - (properties.dimensions.y / 2),
|
|
||||||
z: properties.position.z},
|
|
||||||
|
|
||||||
size: innerRadius,
|
size: innerRadius,
|
||||||
innerRadius: 0.9,
|
innerRadius: 0.9,
|
||||||
alpha: innerAlpha
|
alpha: innerAlpha
|
||||||
|
@ -561,34 +706,29 @@ SelectionDisplay = (function () {
|
||||||
Overlays.editOverlay(rotateOverlayOuter,
|
Overlays.editOverlay(rotateOverlayOuter,
|
||||||
{
|
{
|
||||||
visible: false,
|
visible: false,
|
||||||
position: { x: properties.position.x,
|
|
||||||
y: properties.position.y - (properties.dimensions.y / 2),
|
|
||||||
z: properties.position.z},
|
|
||||||
|
|
||||||
size: outerRadius,
|
size: outerRadius,
|
||||||
innerRadius: 0.9,
|
innerRadius: 0.9,
|
||||||
startAt: 0,
|
startAt: 0,
|
||||||
endAt: 360,
|
endAt: 360,
|
||||||
alpha: outerAlpha
|
alpha: outerAlpha,
|
||||||
});
|
});
|
||||||
|
|
||||||
Overlays.editOverlay(rotateOverlayCurrent,
|
Overlays.editOverlay(rotateOverlayCurrent,
|
||||||
{
|
{
|
||||||
visible: false,
|
visible: false,
|
||||||
position: { x: properties.position.x,
|
|
||||||
y: properties.position.y - (properties.dimensions.y / 2),
|
|
||||||
z: properties.position.z},
|
|
||||||
|
|
||||||
size: outerRadius,
|
size: outerRadius,
|
||||||
startAt: 0,
|
startAt: 0,
|
||||||
endAt: 0,
|
endAt: 0,
|
||||||
innerRadius: 0.9
|
innerRadius: 0.9,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Overlays.editOverlay(rotateZeroOverlay, { visible: false });
|
||||||
|
Overlays.editOverlay(rotateCurrentOverlay, { visible: false });
|
||||||
|
|
||||||
// TODO: we have not implemented the rotating handle/controls yet... so for now, these handles are hidden
|
// TODO: we have not implemented the rotating handle/controls yet... so for now, these handles are hidden
|
||||||
Overlays.editOverlay(yawHandle, { visible: false, position: yawCorner, rotation: yawHandleRotation});
|
Overlays.editOverlay(yawHandle, { visible: rotateHandlesVisible, position: yawCorner, rotation: yawHandleRotation});
|
||||||
Overlays.editOverlay(pitchHandle, { visible: false, position: pitchCorner, rotation: pitchHandleRotation});
|
Overlays.editOverlay(pitchHandle, { visible: rotateHandlesVisible, position: pitchCorner, rotation: pitchHandleRotation});
|
||||||
Overlays.editOverlay(rollHandle, { visible: false, position: rollCorner, rotation: rollHandleRotation});
|
Overlays.editOverlay(rollHandle, { visible: rotateHandlesVisible, position: rollCorner, rotation: rollHandleRotation});
|
||||||
|
|
||||||
Entities.editEntity(entityID, { localRenderAlpha: 0.1 });
|
Entities.editEntity(entityID, { localRenderAlpha: 0.1 });
|
||||||
};
|
};
|
||||||
|
@ -638,10 +778,14 @@ SelectionDisplay = (function () {
|
||||||
Overlays.editOverlay(pitchHandle, { visible: false });
|
Overlays.editOverlay(pitchHandle, { visible: false });
|
||||||
Overlays.editOverlay(rollHandle, { visible: false });
|
Overlays.editOverlay(rollHandle, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { visible: false });
|
||||||
Overlays.editOverlay(rotateOverlayInner, { visible: false });
|
Overlays.editOverlay(rotateOverlayInner, { visible: false });
|
||||||
Overlays.editOverlay(rotateOverlayOuter, { visible: false });
|
Overlays.editOverlay(rotateOverlayOuter, { visible: false });
|
||||||
Overlays.editOverlay(rotateOverlayCurrent, { visible: false });
|
Overlays.editOverlay(rotateOverlayCurrent, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(rotateZeroOverlay, { visible: false });
|
||||||
|
Overlays.editOverlay(rotateCurrentOverlay, { visible: false });
|
||||||
|
|
||||||
Entities.editEntity(entityID, { localRenderAlpha: 1.0 });
|
Entities.editEntity(entityID, { localRenderAlpha: 1.0 });
|
||||||
|
|
||||||
currentSelection = { id: -1, isKnownID: false };
|
currentSelection = { id: -1, isKnownID: false };
|
||||||
|
@ -1423,7 +1567,185 @@ SelectionDisplay = (function () {
|
||||||
Entities.editEntity(currentSelection, selectedEntityProperties);
|
Entities.editEntity(currentSelection, selectedEntityProperties);
|
||||||
tooltip.updateText(selectedEntityProperties);
|
tooltip.updateText(selectedEntityProperties);
|
||||||
that.select(currentSelection, false); // TODO: this should be more than highlighted
|
that.select(currentSelection, false); // TODO: this should be more than highlighted
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.rotateYaw = function(event) {
|
||||||
|
if (!entitySelected || mode !== "ROTATE_YAW") {
|
||||||
|
return; // not allowed
|
||||||
|
}
|
||||||
|
|
||||||
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false});
|
||||||
|
Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { ignoreRayIntersection: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { ignoreRayIntersection: true });
|
||||||
|
|
||||||
|
var result = Overlays.findRayIntersection(pickRay);
|
||||||
|
if (result.intersects) {
|
||||||
|
var properties = Entities.getEntityProperties(currentSelection);
|
||||||
|
var center = yawCenter;
|
||||||
|
var zero = yawZero;
|
||||||
|
var centerToZero = Vec3.subtract(center, zero);
|
||||||
|
var centerToIntersect = Vec3.subtract(center, result.intersection);
|
||||||
|
var angleFromZero = Vec3.orientedAngle(centerToZero, centerToIntersect, rotationNormal);
|
||||||
|
|
||||||
|
var distanceFromCenter = Vec3.distance(center, result.intersection);
|
||||||
|
var snapToInner = false;
|
||||||
|
if (distanceFromCenter < innerRadius) {
|
||||||
|
angleFromZero = Math.floor(angleFromZero/innerSnapAngle) * innerSnapAngle;
|
||||||
|
snapToInner = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for debugging
|
||||||
|
//Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection });
|
||||||
|
|
||||||
|
var yawChange = Quat.fromVec3Degrees({ x: 0, y: angleFromZero, z: 0 });
|
||||||
|
var newRotation = Quat.multiply(yawChange, originalRotation);
|
||||||
|
|
||||||
|
Entities.editEntity(currentSelection, { rotation: newRotation });
|
||||||
|
|
||||||
|
// update the rotation display accordingly...
|
||||||
|
var startAtCurrent = 0;
|
||||||
|
var endAtCurrent = angleFromZero;
|
||||||
|
var startAtRemainder = angleFromZero;
|
||||||
|
var endAtRemainder = 360;
|
||||||
|
if (angleFromZero < 0) {
|
||||||
|
startAtCurrent = 360 + angleFromZero;
|
||||||
|
endAtCurrent = 360;
|
||||||
|
startAtRemainder = 0;
|
||||||
|
endAtRemainder = startAtCurrent;
|
||||||
|
}
|
||||||
|
if (snapToInner) {
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: innerRadius });
|
||||||
|
} else {
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: outerRadius });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.rotatePitch = function(event) {
|
||||||
|
if (!entitySelected || mode !== "ROTATE_PITCH") {
|
||||||
|
return; // not allowed
|
||||||
|
}
|
||||||
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false});
|
||||||
|
Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { ignoreRayIntersection: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { ignoreRayIntersection: true });
|
||||||
|
var result = Overlays.findRayIntersection(pickRay);
|
||||||
|
|
||||||
|
if (result.intersects) {
|
||||||
|
var properties = Entities.getEntityProperties(currentSelection);
|
||||||
|
var center = pitchCenter;
|
||||||
|
var zero = pitchZero;
|
||||||
|
var centerToZero = Vec3.subtract(center, zero);
|
||||||
|
var centerToIntersect = Vec3.subtract(center, result.intersection);
|
||||||
|
var angleFromZero = Vec3.orientedAngle(centerToZero, centerToIntersect, rotationNormal);
|
||||||
|
|
||||||
|
var distanceFromCenter = Vec3.distance(center, result.intersection);
|
||||||
|
var snapToInner = false;
|
||||||
|
if (distanceFromCenter < innerRadius) {
|
||||||
|
angleFromZero = Math.floor(angleFromZero/innerSnapAngle) * innerSnapAngle;
|
||||||
|
snapToInner = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for debugging
|
||||||
|
//Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection });
|
||||||
|
|
||||||
|
var pitchChange = Quat.fromVec3Degrees({ x: angleFromZero, y: 0, z: 0 });
|
||||||
|
var newRotation = Quat.multiply(pitchChange, originalRotation);
|
||||||
|
|
||||||
|
Entities.editEntity(currentSelection, { rotation: newRotation });
|
||||||
|
|
||||||
|
// update the rotation display accordingly...
|
||||||
|
var startAtCurrent = 0;
|
||||||
|
var endAtCurrent = angleFromZero;
|
||||||
|
var startAtRemainder = angleFromZero;
|
||||||
|
var endAtRemainder = 360;
|
||||||
|
if (angleFromZero < 0) {
|
||||||
|
startAtCurrent = 360 + angleFromZero;
|
||||||
|
endAtCurrent = 360;
|
||||||
|
startAtRemainder = 0;
|
||||||
|
endAtRemainder = startAtCurrent;
|
||||||
|
}
|
||||||
|
if (snapToInner) {
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: innerRadius });
|
||||||
|
} else {
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: outerRadius });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.rotateRoll = function(event) {
|
||||||
|
if (!entitySelected || mode !== "ROTATE_ROLL") {
|
||||||
|
return; // not allowed
|
||||||
|
}
|
||||||
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false});
|
||||||
|
Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { ignoreRayIntersection: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { ignoreRayIntersection: true });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { ignoreRayIntersection: true });
|
||||||
|
var result = Overlays.findRayIntersection(pickRay);
|
||||||
|
if (result.intersects) {
|
||||||
|
var properties = Entities.getEntityProperties(currentSelection);
|
||||||
|
var center = rollCenter;
|
||||||
|
var zero = rollZero;
|
||||||
|
var centerToZero = Vec3.subtract(center, zero);
|
||||||
|
var centerToIntersect = Vec3.subtract(center, result.intersection);
|
||||||
|
var angleFromZero = Vec3.orientedAngle(centerToZero, centerToIntersect, rotationNormal);
|
||||||
|
|
||||||
|
var distanceFromCenter = Vec3.distance(center, result.intersection);
|
||||||
|
var snapToInner = false;
|
||||||
|
if (distanceFromCenter < innerRadius) {
|
||||||
|
angleFromZero = Math.floor(angleFromZero/innerSnapAngle) * innerSnapAngle;
|
||||||
|
snapToInner = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for debugging
|
||||||
|
//Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection });
|
||||||
|
|
||||||
|
var rollChange = Quat.fromVec3Degrees({ x: 0, y: 0, z: angleFromZero });
|
||||||
|
var newRotation = Quat.multiply(rollChange, originalRotation);
|
||||||
|
|
||||||
|
Entities.editEntity(currentSelection, { rotation: newRotation });
|
||||||
|
|
||||||
|
// update the rotation display accordingly...
|
||||||
|
var startAtCurrent = 0;
|
||||||
|
var endAtCurrent = angleFromZero;
|
||||||
|
var startAtRemainder = angleFromZero;
|
||||||
|
var endAtRemainder = 360;
|
||||||
|
if (angleFromZero < 0) {
|
||||||
|
startAtCurrent = 360 + angleFromZero;
|
||||||
|
endAtCurrent = 360;
|
||||||
|
startAtRemainder = 0;
|
||||||
|
endAtRemainder = startAtCurrent;
|
||||||
|
}
|
||||||
|
if (snapToInner) {
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: innerRadius });
|
||||||
|
} else {
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { startAt: startAtRemainder, endAt: endAtRemainder });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { startAt: startAtCurrent, endAt: endAtCurrent, size: outerRadius });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
that.checkMove = function() {
|
that.checkMove = function() {
|
||||||
if (currentSelection.isKnownID &&
|
if (currentSelection.isKnownID &&
|
||||||
|
@ -1460,6 +1782,36 @@ SelectionDisplay = (function () {
|
||||||
case grabberMoveUp:
|
case grabberMoveUp:
|
||||||
mode = "TRANSLATE_UP_DOWN";
|
mode = "TRANSLATE_UP_DOWN";
|
||||||
somethingClicked = true;
|
somethingClicked = true;
|
||||||
|
|
||||||
|
// in translate mode, we hide our stretch handles...
|
||||||
|
Overlays.editOverlay(grabberLBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLTF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRTF, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(grabberTOP, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberBOTTOM, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLEFT, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRIGHT, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberNEAR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberFAR, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(grabberEdgeTR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeNR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeNL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeFR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeFL, { visible: false });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case grabberRBN:
|
case grabberRBN:
|
||||||
|
@ -1542,20 +1894,131 @@ SelectionDisplay = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if one of the items above was clicked, then we know we are in translate or stretch mode, and we
|
||||||
|
// should hide our rotate handles...
|
||||||
|
if (somethingClicked) {
|
||||||
|
Overlays.editOverlay(yawHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(pitchHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(rollHandle, { visible: false });
|
||||||
|
|
||||||
|
if (mode != "TRANSLATE_UP_DOWN") {
|
||||||
|
Overlays.editOverlay(grabberMoveUp, { visible: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!somethingClicked) {
|
if (!somethingClicked) {
|
||||||
|
|
||||||
|
print("rotate handle case...");
|
||||||
|
|
||||||
// After testing our stretch handles, then check out rotate handles
|
// After testing our stretch handles, then check out rotate handles
|
||||||
Overlays.editOverlay(yawHandle, { ignoreRayIntersection: false });
|
Overlays.editOverlay(yawHandle, { ignoreRayIntersection: false });
|
||||||
Overlays.editOverlay(pitchHandle, { ignoreRayIntersection: false });
|
Overlays.editOverlay(pitchHandle, { ignoreRayIntersection: false });
|
||||||
Overlays.editOverlay(rollHandle, { ignoreRayIntersection: false });
|
Overlays.editOverlay(rollHandle, { ignoreRayIntersection: false });
|
||||||
var result = Overlays.findRayIntersection(pickRay);
|
var result = Overlays.findRayIntersection(pickRay);
|
||||||
|
|
||||||
|
var overlayOrientation;
|
||||||
|
var overlayCenter;
|
||||||
|
|
||||||
|
var properties = Entities.getEntityProperties(currentSelection);
|
||||||
|
var angles = Quat.safeEulerAngles(properties.rotation);
|
||||||
|
var pitch = angles.x;
|
||||||
|
var yaw = angles.y;
|
||||||
|
var roll = angles.z;
|
||||||
|
|
||||||
|
originalRotation = properties.rotation;
|
||||||
|
originalPitch = pitch;
|
||||||
|
originalYaw = yaw;
|
||||||
|
originalRoll = roll;
|
||||||
|
|
||||||
if (result.intersects) {
|
if (result.intersects) {
|
||||||
switch(result.overlayID) {
|
switch(result.overlayID) {
|
||||||
|
case yawHandle:
|
||||||
|
mode = "ROTATE_YAW";
|
||||||
|
somethingClicked = true;
|
||||||
|
overlayOrientation = yawHandleRotation;
|
||||||
|
overlayCenter = yawCenter;
|
||||||
|
yawZero = result.intersection;
|
||||||
|
rotationNormal = yawNormal;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case pitchHandle:
|
||||||
|
mode = "ROTATE_PITCH";
|
||||||
|
somethingClicked = true;
|
||||||
|
overlayOrientation = pitchHandleRotation;
|
||||||
|
overlayCenter = pitchCenter;
|
||||||
|
pitchZero = result.intersection;
|
||||||
|
rotationNormal = pitchNormal;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case rollHandle:
|
||||||
|
mode = "ROTATE_ROLL";
|
||||||
|
somethingClicked = true;
|
||||||
|
overlayOrientation = rollHandleRotation;
|
||||||
|
overlayCenter = rollCenter;
|
||||||
|
rollZero = result.intersection;
|
||||||
|
rotationNormal = rollNormal;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
|
print("mousePressEvent()...... " + overlayNames[result.overlayID]);
|
||||||
mode = "UNKNOWN";
|
mode = "UNKNOWN";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(" somethingClicked:" + somethingClicked);
|
||||||
|
print(" mode:" + mode);
|
||||||
|
|
||||||
|
|
||||||
|
if (somethingClicked) {
|
||||||
|
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { visible: true, rotation: overlayOrientation, position: overlayCenter });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { visible: true, rotation: overlayOrientation, position: overlayCenter });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { visible: true, rotation: overlayOrientation, position: overlayCenter, startAt: 0, endAt: 360 });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { visible: true, rotation: overlayOrientation, position: overlayCenter, startAt: 0, endAt: 0 });
|
||||||
|
|
||||||
|
// for debugging
|
||||||
|
//Overlays.editOverlay(rotateZeroOverlay, { visible: true, start: overlayCenter, end: result.intersection });
|
||||||
|
//Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: overlayCenter, end: result.intersection });
|
||||||
|
|
||||||
|
Overlays.editOverlay(yawHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(pitchHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(rollHandle, { visible: false });
|
||||||
|
|
||||||
|
|
||||||
|
Overlays.editOverlay(yawHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(pitchHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(rollHandle, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberMoveUp, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLTF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRTF, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(grabberTOP, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberBOTTOM, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberLEFT, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberRIGHT, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberNEAR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberFAR, { visible: false });
|
||||||
|
|
||||||
|
Overlays.editOverlay(grabberEdgeTR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeTN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBF, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeBN, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeNR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeNL, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeFR, { visible: false });
|
||||||
|
Overlays.editOverlay(grabberEdgeFL, { visible: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!somethingClicked) {
|
if (!somethingClicked) {
|
||||||
|
@ -1597,6 +2060,15 @@ SelectionDisplay = (function () {
|
||||||
that.mouseMoveEvent = function(event) {
|
that.mouseMoveEvent = function(event) {
|
||||||
//print("mouseMoveEvent()... mode:" + mode);
|
//print("mouseMoveEvent()... mode:" + mode);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
case "ROTATE_YAW":
|
||||||
|
that.rotateYaw(event);
|
||||||
|
break;
|
||||||
|
case "ROTATE_PITCH":
|
||||||
|
that.rotatePitch(event);
|
||||||
|
break;
|
||||||
|
case "ROTATE_ROLL":
|
||||||
|
that.rotateRoll(event);
|
||||||
|
break;
|
||||||
case "TRANSLATE_UP_DOWN":
|
case "TRANSLATE_UP_DOWN":
|
||||||
that.translateUpDown(event);
|
that.translateUpDown(event);
|
||||||
break;
|
break;
|
||||||
|
@ -1654,14 +2126,34 @@ SelectionDisplay = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.mouseReleaseEvent = function(event) {
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
var showHandles = false;
|
||||||
|
// hide our rotation overlays..., and show our handles
|
||||||
|
if (mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL") {
|
||||||
|
Overlays.editOverlay(rotateOverlayTarget, { visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayInner, { visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayOuter, { visible: false });
|
||||||
|
Overlays.editOverlay(rotateOverlayCurrent, { visible: false });
|
||||||
|
showHandles = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode != "UNKNOWN") {
|
||||||
|
showHandles = true;
|
||||||
|
}
|
||||||
|
|
||||||
mode = "UNKNOWN";
|
mode = "UNKNOWN";
|
||||||
|
|
||||||
// if something is selected, then reset the "original" properties for any potential next click+move operation
|
// if something is selected, then reset the "original" properties for any potential next click+move operation
|
||||||
if (entitySelected) {
|
if (entitySelected) {
|
||||||
|
|
||||||
|
if (showHandles) {
|
||||||
|
that.select(currentSelection, event);
|
||||||
|
}
|
||||||
|
|
||||||
selectedEntityProperties = Entities.getEntityProperties(currentSelection);
|
selectedEntityProperties = Entities.getEntityProperties(currentSelection);
|
||||||
selectedEntityPropertiesOriginalPosition = properties.position;
|
selectedEntityPropertiesOriginalPosition = properties.position;
|
||||||
selectedEntityPropertiesOriginalDimensions = properties.dimensions;
|
selectedEntityPropertiesOriginalDimensions = properties.dimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(that.mousePressEvent);
|
Controller.mousePressEvent.connect(that.mousePressEvent);
|
||||||
|
|
11
examples/libraries/globals.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//
|
||||||
|
// globals.js
|
||||||
|
// examples/libraries
|
||||||
|
//
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
HIFI_PUBLIC_BUCKET = "https://s3.amazonaws.com/hifi-public/";
|
|
@ -9,6 +9,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var scriptUrl = "https://script.google.com/macros/s/AKfycbwIo4lmF-qUwX1Z-9eA_P-g2gse9oFhNcjVyyksGukyDDEFXgU/exec?action=listOwners&domain=alpha.highfidelity.io";
|
var scriptUrl = "https://script.google.com/macros/s/AKfycbwIo4lmF-qUwX1Z-9eA_P-g2gse9oFhNcjVyyksGukyDDEFXgU/exec?action=listOwners&domain=alpha.highfidelity.io";
|
||||||
|
|
||||||
var LocationMenu = function(opts) {
|
var LocationMenu = function(opts) {
|
||||||
|
@ -24,7 +26,7 @@ var LocationMenu = function(opts) {
|
||||||
var disabledColor = { red: 64, green: 64, blue: 64};
|
var disabledColor = { red: 64, green: 64, blue: 64};
|
||||||
var position = { x: 0, y: 0 };
|
var position = { x: 0, y: 0 };
|
||||||
|
|
||||||
var locationIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/location.svg";
|
var locationIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/location.svg";
|
||||||
var toolHeight = 50;
|
var toolHeight = 50;
|
||||||
var toolWidth = 50;
|
var toolWidth = 50;
|
||||||
var visible = false;
|
var visible = false;
|
||||||
|
|
0
examples/move.js
Executable file → Normal file
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var Controller = Controller || {};
|
var Controller = Controller || {};
|
||||||
var Overlays = Overlays || {};
|
var Overlays = Overlays || {};
|
||||||
var Script = Script || {};
|
var Script = Script || {};
|
||||||
|
@ -18,7 +20,7 @@ var Account = Account || {};
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
var iconUrl = 'http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/',
|
var iconUrl = HIFI_PUBLIC_BUCKET + 'images/tools/',
|
||||||
overlayWidth = 150,
|
overlayWidth = 150,
|
||||||
overlayHeight = 50,
|
overlayHeight = 50,
|
||||||
overlayTopOffset = 15,
|
overlayTopOffset = 15,
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
Script.include("libraries/stringHelpers.js");
|
Script.include("libraries/stringHelpers.js");
|
||||||
Script.include("libraries/dataviewHelpers.js");
|
Script.include("libraries/dataviewHelpers.js");
|
||||||
Script.include("libraries/httpMultiPart.js");
|
Script.include("libraries/httpMultiPart.js");
|
||||||
|
@ -31,7 +32,7 @@ Script.include("libraries/entityPropertyDialogBox.js");
|
||||||
var entityPropertyDialogBox = EntityPropertyDialogBox;
|
var entityPropertyDialogBox = EntityPropertyDialogBox;
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var toolIconUrl = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/tools/";
|
var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
var toolHeight = 50;
|
var toolHeight = 50;
|
||||||
var toolWidth = 50;
|
var toolWidth = 50;
|
||||||
|
|
||||||
|
@ -45,14 +46,14 @@ var SPAWN_DISTANCE = 1;
|
||||||
var DEFAULT_DIMENSION = 0.20;
|
var DEFAULT_DIMENSION = 0.20;
|
||||||
|
|
||||||
var modelURLs = [
|
var modelURLs = [
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/birarda/birarda_head.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/birarda/birarda_head.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/pug.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/pug.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/newInvader16x16-large-purple.svo",
|
HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/minotaur/mino_full.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/minotaur/mino_full.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Combat_tank_V01.FBX",
|
HIFI_PUBLIC_BUCKET + "meshes/Combat_tank_V01.FBX",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/orc.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/orc.fbx",
|
||||||
"http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/slimer.fbx"
|
HIFI_PUBLIC_BUCKET + "meshes/slimer.fbx"
|
||||||
];
|
];
|
||||||
|
|
||||||
var mode = 0;
|
var mode = 0;
|
||||||
|
@ -310,7 +311,7 @@ var exportMenu = null;
|
||||||
function isLocked(properties) {
|
function isLocked(properties) {
|
||||||
// special case to lock the ground plane model in hq.
|
// special case to lock the ground plane model in hq.
|
||||||
if (location.hostname == "hq.highfidelity.io" &&
|
if (location.hostname == "hq.highfidelity.io" &&
|
||||||
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
|
properties.modelURL == HIFI_PUBLIC_BUCKET + "ozan/Terrain_Reduce_forAlpha.fbx") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -569,6 +570,19 @@ function handeMenuEvent(menuItem) {
|
||||||
}
|
}
|
||||||
} else if (menuItem == "Edit Properties...") {
|
} else if (menuItem == "Edit Properties...") {
|
||||||
// good place to put the properties dialog
|
// good place to put the properties dialog
|
||||||
|
|
||||||
|
editModelID = -1;
|
||||||
|
if (entitySelected) {
|
||||||
|
print(" Edit Properties.... selectedEntityID="+ selectedEntityID);
|
||||||
|
editModelID = selectedEntityID;
|
||||||
|
} else {
|
||||||
|
print(" Edit Properties.... not holding...");
|
||||||
|
}
|
||||||
|
if (editModelID != -1) {
|
||||||
|
print(" Edit Properties.... about to edit properties...");
|
||||||
|
entityPropertyDialogBox.openDialog(editModelID);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (menuItem == "Paste Models") {
|
} else if (menuItem == "Paste Models") {
|
||||||
modelImporter.paste();
|
modelImporter.paste();
|
||||||
} else if (menuItem == "Export Models") {
|
} else if (menuItem == "Export Models") {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// The "Swatches" example of this script will create 9 different image overlays, that use the color feature to
|
// The "Swatches" example of this script will create 9 different image overlays, that use the color feature to
|
||||||
// display different colors as color swatches. The overlays can be clicked on, to change the "selectedSwatch" variable
|
// display different colors as color swatches. The overlays can be clicked on, to change the "selectedSwatch" variable
|
||||||
|
@ -51,7 +52,7 @@ for (s = 0; s < numberOfSwatches; s++) {
|
||||||
width: 31,
|
width: 31,
|
||||||
height: 54,
|
height: 54,
|
||||||
subImage: { x: imageFromX, y: imageFromY, width: 30, height: 54 },
|
subImage: { x: imageFromX, y: imageFromY, width: 30, height: 54 },
|
||||||
imageURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/testing-swatches.svg",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/testing-swatches.svg",
|
||||||
color: swatchColors[s],
|
color: swatchColors[s],
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -63,8 +64,8 @@ var text = Overlays.addOverlay("text", {
|
||||||
y: 100,
|
y: 100,
|
||||||
width: 150,
|
width: 150,
|
||||||
height: 50,
|
height: 50,
|
||||||
color: { red: 0, green: 0, blue: 0},
|
backgroundColor: { red: 255, green: 255, blue: 255},
|
||||||
textColor: { red: 255, green: 0, blue: 0},
|
color: { red: 255, green: 0, blue: 0},
|
||||||
topMargin: 4,
|
topMargin: 4,
|
||||||
leftMargin: 4,
|
leftMargin: 4,
|
||||||
text: "Here is some text.\nAnd a second line."
|
text: "Here is some text.\nAnd a second line."
|
||||||
|
@ -77,7 +78,7 @@ var toolA = Overlays.addOverlay("image", {
|
||||||
width: 62,
|
width: 62,
|
||||||
height: 40,
|
height: 40,
|
||||||
subImage: { x: 0, y: 0, width: 62, height: 40 },
|
subImage: { x: 0, y: 0, width: 62, height: 40 },
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/hifi-interface-tools.svg",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/hifi-interface-tools.svg",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
|
@ -87,7 +88,7 @@ var toolA = Overlays.addOverlay("image", {
|
||||||
var slider = Overlays.addOverlay("image", {
|
var slider = Overlays.addOverlay("image", {
|
||||||
// alternate form of expressing bounds
|
// alternate form of expressing bounds
|
||||||
bounds: { x: 100, y: 300, width: 158, height: 35},
|
bounds: { x: 100, y: 300, width: 158, height: 35},
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/slider.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
@ -101,7 +102,7 @@ var thumb = Overlays.addOverlay("image", {
|
||||||
y: 309,
|
y: 309,
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 17,
|
height: 17,
|
||||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png",
|
imageURL: HIFI_PUBLIC_BUCKET + "images/thumb.png",
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
alpha: 1
|
alpha: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// Multiply vector by scalar
|
// Multiply vector by scalar
|
||||||
function vScalarMult(v, s) {
|
function vScalarMult(v, s) {
|
||||||
var rval = { x: v.x * s, y: v.y * s, z: v.z * s };
|
var rval = { x: v.x * s, y: v.y * s, z: v.z * s };
|
||||||
|
@ -68,23 +70,23 @@ function addBird()
|
||||||
var size;
|
var size;
|
||||||
var which = Math.random();
|
var which = Math.random();
|
||||||
if (which < 0.2) {
|
if (which < 0.2) {
|
||||||
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
|
tweet = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/bushtit_1.raw");
|
||||||
color = { red: 100, green: 50, blue: 120 };
|
color = { red: 100, green: 50, blue: 120 };
|
||||||
size = 0.08;
|
size = 0.08;
|
||||||
} else if (which < 0.4) {
|
} else if (which < 0.4) {
|
||||||
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/rosyfacedlovebird.raw");
|
tweet = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/rosyfacedlovebird.raw");
|
||||||
color = { red: 100, green: 150, blue: 75 };
|
color = { red: 100, green: 150, blue: 75 };
|
||||||
size = 0.09;
|
size = 0.09;
|
||||||
} else if (which < 0.6) {
|
} else if (which < 0.6) {
|
||||||
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/saysphoebe.raw");
|
tweet = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/saysphoebe.raw");
|
||||||
color = { red: 84, green: 121, blue: 36 };
|
color = { red: 84, green: 121, blue: 36 };
|
||||||
size = 0.05;
|
size = 0.05;
|
||||||
} else if (which < 0.8) {
|
} else if (which < 0.8) {
|
||||||
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
tweet = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
color = { red: 23, green: 197, blue: 230 };
|
color = { red: 23, green: 197, blue: 230 };
|
||||||
size = 0.12;
|
size = 0.12;
|
||||||
} else {
|
} else {
|
||||||
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/westernscreechowl.raw");
|
tweet = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/westernscreechowl.raw");
|
||||||
color = { red: 50, green: 67, blue: 144 };
|
color = { red: 50, green: 67, blue: 144 };
|
||||||
size = 0.15;
|
size = 0.15;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var stopAfter = 100;
|
var stopAfter = 100;
|
||||||
|
|
||||||
|
@ -20,7 +22,7 @@ var modelPropertiesA = {
|
||||||
gravity: { x: 0, y: 0, z: 0 },
|
gravity: { x: 0, y: 0, z: 0 },
|
||||||
damping: 0,
|
damping: 0,
|
||||||
radius : 0.25,
|
radius : 0.25,
|
||||||
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
modelURL: HIFI_PUBLICK_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
lifetime: 20
|
lifetime: 20
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +32,7 @@ var modelPropertiesB = {
|
||||||
gravity: { x: 0, y: 0, z: 0 },
|
gravity: { x: 0, y: 0, z: 0 },
|
||||||
damping: 0,
|
damping: 0,
|
||||||
radius : 0.25,
|
radius : 0.25,
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
lifetime: 20
|
lifetime: 20
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// First, load a sample sound from a URL
|
// First, load a sample sound from a URL
|
||||||
var bird = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
|
var bird = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Animals/bushtit_1.raw");
|
||||||
|
|
||||||
function maybePlaySound(deltaTime) {
|
function maybePlaySound(deltaTime) {
|
||||||
if (Math.random() < 0.01) {
|
if (Math.random() < 0.01) {
|
||||||
|
|
|
@ -11,12 +11,13 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// A few sample files you may want to try:
|
// A few sample files you may want to try:
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
|
var sound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+A.raw");
|
||||||
//var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/220Sine.wav");
|
//var sound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/220Sine.wav");
|
||||||
//var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Cocktail+Party+Snippets/Bandcamp.wav");
|
//var sound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Cocktail+Party+Snippets/Bandcamp.wav");
|
||||||
|
|
||||||
var soundPlaying = false;
|
var soundPlaying = false;
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var soundClip = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Voxels/voxel create 3.raw");
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
|
var soundClip = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Voxels/voxel create 3.raw");
|
||||||
|
|
||||||
var currentTime = 1.570079; // pi/2
|
var currentTime = 1.570079; // pi/2
|
||||||
var deltaTime = 0.05;
|
var deltaTime = 0.05;
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var soundClip = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Cocktail%20Party%20Snippets/Walken1.wav");
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
|
var soundClip = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Cocktail%20Party%20Snippets/Walken1.wav");
|
||||||
|
|
||||||
function playSound() {
|
function playSound() {
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var modelURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/models/entities/radio/Speakers.fbx";
|
var modelURL = HIFI_PUBLIC_BUCKET + "models/entities/radio/Speakers.fbx";
|
||||||
var soundURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/FamilyStereo.raw";
|
var soundURL = HIFI_PUBLIC_BUCKET + "sounds/FamilyStereo.raw";
|
||||||
|
|
||||||
var AudioRotationOffset = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
var AudioRotationOffset = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||||
var audioOptions = new AudioInjectionOptions();
|
var audioOptions = new AudioInjectionOptions();
|
||||||
|
|
|
@ -41,6 +41,9 @@ if (typeof String.prototype.trimEndsWith != 'function') {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const INPUT_DEVICE_SETTING = "audio_input_device";
|
||||||
|
const OUTPUT_DEVICE_SETTING = "audio_output_device";
|
||||||
|
|
||||||
var selectedInputMenu = "";
|
var selectedInputMenu = "";
|
||||||
var selectedOutputMenu = "";
|
var selectedOutputMenu = "";
|
||||||
|
|
||||||
|
@ -48,9 +51,14 @@ function setupAudioMenus() {
|
||||||
Menu.addMenu("Tools > Audio");
|
Menu.addMenu("Tools > Audio");
|
||||||
Menu.addSeparator("Tools > Audio","Output Audio Device");
|
Menu.addSeparator("Tools > Audio","Output Audio Device");
|
||||||
|
|
||||||
|
var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING);
|
||||||
var outputDevices = AudioDevice.getOutputDevices();
|
var outputDevices = AudioDevice.getOutputDevices();
|
||||||
var selectedOutputDevice = AudioDevice.getOutputDevice();
|
var selectedOutputDevice = AudioDevice.getOutputDevice();
|
||||||
|
if (outputDevices.indexOf(outputDeviceSetting) != -1 && selectedOutputDevice != outputDeviceSetting) {
|
||||||
|
if (AudioDevice.setOutputDevice(outputDeviceSetting)) {
|
||||||
|
selectedOutputDevice = outputDeviceSetting;
|
||||||
|
}
|
||||||
|
}
|
||||||
for(var i = 0; i < outputDevices.length; i++) {
|
for(var i = 0; i < outputDevices.length; i++) {
|
||||||
var thisDeviceSelected = (outputDevices[i] == selectedOutputDevice);
|
var thisDeviceSelected = (outputDevices[i] == selectedOutputDevice);
|
||||||
var menuItem = "Use " + outputDevices[i] + " for Output";
|
var menuItem = "Use " + outputDevices[i] + " for Output";
|
||||||
|
@ -67,9 +75,14 @@ function setupAudioMenus() {
|
||||||
|
|
||||||
Menu.addSeparator("Tools > Audio","Input Audio Device");
|
Menu.addSeparator("Tools > Audio","Input Audio Device");
|
||||||
|
|
||||||
|
var inputDeviceSetting = Settings.getValue(INPUT_DEVICE_SETTING);
|
||||||
var inputDevices = AudioDevice.getInputDevices();
|
var inputDevices = AudioDevice.getInputDevices();
|
||||||
var selectedInputDevice = AudioDevice.getInputDevice();
|
var selectedInputDevice = AudioDevice.getInputDevice();
|
||||||
|
if (inputDevices.indexOf(inputDeviceSetting) != -1 && selectedInputDevice != inputDeviceSetting) {
|
||||||
|
if (AudioDevice.setInputDevice(inputDeviceSetting)) {
|
||||||
|
selectedInputDevice = inputDeviceSetting;
|
||||||
|
}
|
||||||
|
}
|
||||||
for(var i = 0; i < inputDevices.length; i++) {
|
for(var i = 0; i < inputDevices.length; i++) {
|
||||||
var thisDeviceSelected = (inputDevices[i] == selectedInputDevice);
|
var thisDeviceSelected = (inputDevices[i] == selectedInputDevice);
|
||||||
var menuItem = "Use " + inputDevices[i] + " for Input";
|
var menuItem = "Use " + inputDevices[i] + " for Input";
|
||||||
|
@ -85,7 +98,8 @@ function setupAudioMenus() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAudioMenus();
|
// Have a small delay before the menu's get setup and the audio devices can switch to the last selected ones
|
||||||
|
Script.setTimeout(function() { setupAudioMenus(); }, 5000);
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
Menu.removeMenu("Tools > Audio");
|
Menu.removeMenu("Tools > Audio");
|
||||||
|
@ -101,15 +115,18 @@ function menuItemEvent(menuItem) {
|
||||||
Menu.setIsOptionChecked(selectedOutputMenu, false);
|
Menu.setIsOptionChecked(selectedOutputMenu, false);
|
||||||
selectedOutputMenu = menuItem;
|
selectedOutputMenu = menuItem;
|
||||||
Menu.setIsOptionChecked(selectedOutputMenu, true);
|
Menu.setIsOptionChecked(selectedOutputMenu, true);
|
||||||
AudioDevice.setOutputDevice(selectedDevice);
|
if (AudioDevice.setOutputDevice(selectedDevice)) {
|
||||||
|
Settings.setValue(OUTPUT_DEVICE_SETTING, selectedDevice);
|
||||||
|
}
|
||||||
} else if (menuItem.endsWith(" for Input")) {
|
} else if (menuItem.endsWith(" for Input")) {
|
||||||
var selectedDevice = menuItem.trimStartsWith("Use ").trimEndsWith(" for Input");
|
var selectedDevice = menuItem.trimStartsWith("Use ").trimEndsWith(" for Input");
|
||||||
print("input audio selection..." + selectedDevice);
|
print("input audio selection..." + selectedDevice);
|
||||||
Menu.setIsOptionChecked(selectedInputMenu, false);
|
Menu.setIsOptionChecked(selectedInputMenu, false);
|
||||||
selectedInputMenu = menuItem;
|
selectedInputMenu = menuItem;
|
||||||
Menu.setIsOptionChecked(selectedInputMenu, true);
|
Menu.setIsOptionChecked(selectedInputMenu, true);
|
||||||
AudioDevice.setInputDevice(selectedDevice);
|
if (AudioDevice.setInputDevice(selectedDevice)) {
|
||||||
|
Settings.setValue(INPUT_DEVICE_SETTING, selectedDevice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
var iteration = 0;
|
var iteration = 0;
|
||||||
|
|
||||||
var gameOver = false;
|
var gameOver = false;
|
||||||
|
@ -82,13 +84,13 @@ var missileFired = false;
|
||||||
var myMissile;
|
var myMissile;
|
||||||
|
|
||||||
// sounds
|
// sounds
|
||||||
var hitSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/hit.raw");
|
var hitSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/hit.raw");
|
||||||
var shootSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/shoot.raw");
|
var shootSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/shoot.raw");
|
||||||
var moveSounds = new Array();
|
var moveSounds = new Array();
|
||||||
moveSounds[0] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/Lo1.raw");
|
moveSounds[0] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/Lo1.raw");
|
||||||
moveSounds[1] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/Lo2.raw");
|
moveSounds[1] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/Lo2.raw");
|
||||||
moveSounds[2] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/Lo3.raw");
|
moveSounds[2] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/Lo3.raw");
|
||||||
moveSounds[3] = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/Lo4.raw");
|
moveSounds[3] = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Space%20Invaders/Lo4.raw");
|
||||||
var currentMoveSound = 0;
|
var currentMoveSound = 0;
|
||||||
var numberOfSounds = 4;
|
var numberOfSounds = 4;
|
||||||
var stepsPerSound = invaderStepsPerCycle / numberOfSounds;
|
var stepsPerSound = invaderStepsPerCycle / numberOfSounds;
|
||||||
|
@ -99,36 +101,36 @@ var soundInMyHead = true;
|
||||||
// models...
|
// models...
|
||||||
var invaderModels = new Array();
|
var invaderModels = new Array();
|
||||||
invaderModels[0] = {
|
invaderModels[0] = {
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-large-purple.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
};
|
};
|
||||||
invaderModels[1] = {
|
invaderModels[1] = {
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-large-cyan.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-cyan.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
};
|
};
|
||||||
invaderModels[2] = {
|
invaderModels[2] = {
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-medium-cyan.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-medium-cyan.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
};
|
};
|
||||||
invaderModels[3] = {
|
invaderModels[3] = {
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-medium-green.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-medium-green.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
};
|
};
|
||||||
invaderModels[4] = {
|
invaderModels[4] = {
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/newInvader16x16-small-green.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-small-green.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
//modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/invader.svo",
|
//modelURL: HIFI_PUBLIC_BUCKET + "meshes/invader.svo",
|
||||||
// "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/spaceInvader3.fbx"
|
// HIFI_PUBLIC_BUCKET + "meshes/spaceInvader3.fbx"
|
||||||
|
|
||||||
function initializeMyShip() {
|
function initializeMyShip() {
|
||||||
myShipProperties = {
|
myShipProperties = {
|
||||||
|
@ -138,7 +140,7 @@ function initializeMyShip() {
|
||||||
damping: 0,
|
damping: 0,
|
||||||
radius: shipSize,
|
radius: shipSize,
|
||||||
color: { red: 0, green: 255, blue: 0 },
|
color: { red: 0, green: 255, blue: 0 },
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/meshes/myCannon16x16.svo",
|
modelURL: HIFI_PUBLIC_BUCKET + "meshes/myCannon16x16.svo",
|
||||||
modelScale: 450,
|
modelScale: 450,
|
||||||
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
modelTranslation: { x: -1.3, y: -1.3, z: -1.3 },
|
||||||
lifetime: itemLifetimes
|
lifetime: itemLifetimes
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var rightHandAnimation = "https://s3-us-west-1.amazonaws.com/highfidelity-public/animations/RightHandAnimPhilip.fbx";
|
Script.include("libraries/globals.js");
|
||||||
var leftHandAnimation = "https://s3-us-west-1.amazonaws.com/highfidelity-public/animations/LeftHandAnimPhilip.fbx";
|
|
||||||
|
var rightHandAnimation = HIFI_PUBLIC_BUCKET + "animations/RightHandAnimPhilip.fbx";
|
||||||
|
var leftHandAnimation = HIFI_PUBLIC_BUCKET + "animations/LeftHandAnimPhilip.fbx";
|
||||||
|
|
||||||
var LEFT = 0;
|
var LEFT = 0;
|
||||||
var RIGHT = 1;
|
var RIGHT = 1;
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Script.include("libraries/globals.js");
|
||||||
|
|
||||||
// maybe we should make these constants...
|
// maybe we should make these constants...
|
||||||
var LEFT_PALM = 0;
|
var LEFT_PALM = 0;
|
||||||
var LEFT_TIP = 1;
|
var LEFT_TIP = 1;
|
||||||
|
@ -39,7 +41,7 @@ var rightHandParticle;
|
||||||
|
|
||||||
var newSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw");
|
var newSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw");
|
||||||
var catchSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw");
|
var catchSound = new Sound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw");
|
||||||
var throwSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Switches%20and%20sliders/slider%20-%20whoosh1.raw");
|
var throwSound = new Sound(HIFI_PUBLIC_BUCKET + "sounds/Switches%20and%20sliders/slider%20-%20whoosh1.raw");
|
||||||
var targetRadius = 1.0;
|
var targetRadius = 1.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
3851
examples/walk.js
Normal file
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// xbox.js
|
|
||||||
// examples
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on September 23, 2014
|
|
||||||
//
|
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
gamepad = Joysticks.joystickWithName("Wireless 360 Controller");
|
|
||||||
|
|
||||||
function reportAxisValue(axis, newValue, oldValue) {
|
|
||||||
print("The value for axis " + axis + " has changed to " + newValue + ". It was " + oldValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
gamepad.axisValueChanged.connect(reportAxisValue);
|
|
|
@ -102,7 +102,7 @@ void IceServer::processDatagrams() {
|
||||||
if (requestingConnections.size() > 0) {
|
if (requestingConnections.size() > 0) {
|
||||||
// send a heartbeart response based on the set of connections
|
// send a heartbeart response based on the set of connections
|
||||||
qDebug() << "Sending a heartbeat response to" << senderUUID << "who has" << requestingConnections.size()
|
qDebug() << "Sending a heartbeat response to" << senderUUID << "who has" << requestingConnections.size()
|
||||||
<< "potential connections";
|
<< "potential connections";
|
||||||
sendHeartbeatResponse(sendingSockAddr, requestingConnections);
|
sendHeartbeatResponse(sendingSockAddr, requestingConnections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,7 @@ void IceServer::sendHeartbeatResponse(const HifiSockAddr& destinationSockAddr, Q
|
||||||
|
|
||||||
QByteArray outgoingPacket(MAX_PACKET_SIZE, 0);
|
QByteArray outgoingPacket(MAX_PACKET_SIZE, 0);
|
||||||
int currentPacketSize = populatePacketHeader(outgoingPacket, PacketTypeIceServerHeartbeatResponse, _id);
|
int currentPacketSize = populatePacketHeader(outgoingPacket, PacketTypeIceServerHeartbeatResponse, _id);
|
||||||
|
int numHeaderBytes = currentPacketSize;
|
||||||
|
|
||||||
// go through the connections, sending packets containing connection information for those nodes
|
// go through the connections, sending packets containing connection information for those nodes
|
||||||
while (peerID != connections.end()) {
|
while (peerID != connections.end()) {
|
||||||
|
@ -142,9 +143,11 @@ void IceServer::sendHeartbeatResponse(const HifiSockAddr& destinationSockAddr, Q
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the last packet
|
if (currentPacketSize > numHeaderBytes) {
|
||||||
_serverSocket.writeDatagram(outgoingPacket.data(), currentPacketSize,
|
// write the last packet, if there is data in it
|
||||||
destinationSockAddr.getAddress(), destinationSockAddr.getPort());
|
_serverSocket.writeDatagram(outgoingPacket.data(), currentPacketSize,
|
||||||
|
destinationSockAddr.getAddress(), destinationSockAddr.getPort());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IceServer::clearInactivePeers() {
|
void IceServer::clearInactivePeers() {
|
||||||
|
|
BIN
images/bg_hr.png
Before Width: | Height: | Size: 943 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 33 KiB |
BIN
images/hr.png
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
52
index.html
|
@ -1,52 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
|
||||||
<title>Hifi by highfidelity</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="stylesheets/styles.css">
|
|
||||||
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="wrapper">
|
|
||||||
<header>
|
|
||||||
<h1>Hifi</h1>
|
|
||||||
<p>Open, decentralized virtual worlds using sensors to control avatars and dynamically assigned devices as servers. San Francisco based startup, we are hiring: http://highfidelity.io/jobs You can also contribute by doing jobs listed at http://worklist.net -</p>
|
|
||||||
|
|
||||||
<p class="view"><a href="https://github.com/highfidelity/hifi">View the Project on GitHub <small>highfidelity/hifi</small></a></p>
|
|
||||||
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/zipball/master">Download <strong>ZIP File</strong></a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/tarball/master">Download <strong>TAR Ball</strong></a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi">View On <strong>GitHub</strong></a></li>
|
|
||||||
</ul>
|
|
||||||
</header>
|
|
||||||
<section>
|
|
||||||
<h3>
|
|
||||||
<a name="avatar-documentation" class="anchor" href="#avatar-documentation"><span class="octicon octicon-link"></span></a>Avatar Documentation</h3>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/Exporting-Your-Rigged-Avatar-From-Faceshift">Exporting your Rigged Avatar from Faceshift</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/Creating-Blendshapes-for-your-Avatar">Creating Blendshapes for your Avatar</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/How-to-Rig-a-Character-for-Faceshift">How to Rig a Character for Faceshift</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/Naming-Your-Skeletal-Joints">Naming your Skeletal Joints</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/The-FST-file">The FST File</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/Training-in-Faceshift">Training in Faceshift</a></li>
|
|
||||||
<li><a href="https://github.com/highfidelity/hifi/wiki/Uploading-Your-Models">Uploading your Models</a></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<footer>
|
|
||||||
<p>This project is maintained by <a href="https://github.com/highfidelity">highfidelity</a></p>
|
|
||||||
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
<script src="javascripts/scale.fix.js"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -41,7 +41,7 @@ configure_file(InterfaceVersion.h.in "${PROJECT_BINARY_DIR}/includes/InterfaceVe
|
||||||
|
|
||||||
# grab the implementation and header files from src dirs
|
# grab the implementation and header files from src dirs
|
||||||
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
|
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
|
||||||
foreach(SUBDIR avatar devices renderer ui starfield location scripting voxels particles entities)
|
foreach(SUBDIR avatar devices renderer ui starfield location scripting voxels particles entities gpu)
|
||||||
file(GLOB_RECURSE SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h)
|
file(GLOB_RECURSE SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h)
|
||||||
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${SUBDIR_SRCS}")
|
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${SUBDIR_SRCS}")
|
||||||
endforeach(SUBDIR)
|
endforeach(SUBDIR)
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
uniform vec3 v3CameraPos; // The camera's current position
|
uniform vec3 v3CameraPos; // The camera's current position
|
||||||
uniform vec3 v3LightPos; // The direction vector to the light source
|
uniform vec3 v3LightPos; // The direction vector to the light source
|
||||||
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels
|
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels
|
||||||
|
uniform float fOuterRadius; // The outer (atmosphere) radius
|
||||||
uniform float fInnerRadius; // The inner (planetary) radius
|
uniform float fInnerRadius; // The inner (planetary) radius
|
||||||
uniform float fKrESun; // Kr * ESun
|
uniform float fKrESun; // Kr * ESun
|
||||||
uniform float fKmESun; // Km * ESun
|
uniform float fKmESun; // Km * ESun
|
||||||
|
@ -44,6 +45,7 @@ uniform float fScale; // 1 / (fOuterRadius - fInnerRadius)
|
||||||
uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found)
|
uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found)
|
||||||
uniform float fScaleOverScaleDepth; // fScale / fScaleDepth
|
uniform float fScaleOverScaleDepth; // fScale / fScaleDepth
|
||||||
|
|
||||||
|
|
||||||
const int nSamples = 2;
|
const int nSamples = 2;
|
||||||
const float fSamples = 2.0;
|
const float fSamples = 2.0;
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ float scale(float fCos)
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
// Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere)
|
// Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere)
|
||||||
position = gl_Vertex.xyz;
|
position = gl_Vertex.xyz * fOuterRadius;
|
||||||
|
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
// Copyright (c) 2004 Sean O'Neil
|
// Copyright (c) 2004 Sean O'Neil
|
||||||
//
|
//
|
||||||
|
|
||||||
|
uniform float fOuterRadius; // The outer (atmosphere) radius
|
||||||
|
|
||||||
varying vec3 position;
|
varying vec3 position;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
position = gl_Vertex.xyz;
|
position = gl_Vertex.xyz * fOuterRadius;
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,16 +13,19 @@
|
||||||
|
|
||||||
uniform float pointScale;
|
uniform float pointScale;
|
||||||
|
|
||||||
void main(void) {
|
// the interpolated normal
|
||||||
|
varying vec4 normal;
|
||||||
|
|
||||||
// standard diffuse lighting
|
void main(void) {
|
||||||
gl_FrontColor = vec4(gl_Color.rgb * (gl_LightModel.ambient.rgb + gl_LightSource[0].ambient.rgb +
|
// transform and store the normal for interpolation
|
||||||
gl_LightSource[0].diffuse.rgb * max(0.0, dot(gl_NormalMatrix * gl_Normal, gl_LightSource[0].position.xyz))),
|
normal = vec4(normalize(gl_NormalMatrix * gl_Normal), 0.0);
|
||||||
0.0);
|
|
||||||
|
|
||||||
// extract the first three components of the vertex for position
|
// extract the first three components of the vertex for position
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
|
||||||
|
|
||||||
// the final component is the size in world space
|
// the final component is the size in world space
|
||||||
gl_PointSize = pointScale * gl_Vertex.w / gl_Position.w;
|
gl_PointSize = pointScale * gl_Vertex.w / gl_Position.w;
|
||||||
|
|
||||||
|
// copy the color for interpolation
|
||||||
|
gl_FrontColor = vec4(gl_Color.rgb, 0.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,20 @@ varying vec4 alphaValues;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// determine the cube face to use for texture coordinate generation
|
// determine the cube face to use for texture coordinate generation
|
||||||
vec3 absNormal = abs(normal);
|
vec3 absNormal = abs(normal);
|
||||||
vec3 steps = step(absNormal.zzy, absNormal.xyx);
|
vec3 steps = smoothstep(absNormal.zzy - vec3(0.05, 0.05, 0.05), absNormal.zzy + vec3(0.05, 0.05, 0.05), absNormal.xyx);
|
||||||
vec2 parameters = mix(vec2(0.0, steps.y), vec2(steps.x, steps.x), steps.z);
|
|
||||||
|
|
||||||
// blend the splat textures
|
// blend the splat textures
|
||||||
gl_FragColor = (texture2D(diffuseMaps[0], mix(gl_TexCoord[0].xy, gl_TexCoord[0].zw, parameters)) * alphaValues.x +
|
vec4 base0 = texture2D(diffuseMaps[0], gl_TexCoord[0].xy);
|
||||||
texture2D(diffuseMaps[1], mix(gl_TexCoord[1].xy, gl_TexCoord[1].zw, parameters)) * alphaValues.y +
|
vec4 base1 = texture2D(diffuseMaps[1], gl_TexCoord[1].xy);
|
||||||
texture2D(diffuseMaps[2], mix(gl_TexCoord[2].xy, gl_TexCoord[2].zw, parameters)) * alphaValues.z +
|
vec4 base2 = texture2D(diffuseMaps[2], gl_TexCoord[2].xy);
|
||||||
texture2D(diffuseMaps[3], mix(gl_TexCoord[3].xy, gl_TexCoord[3].zw, parameters)) * alphaValues.w);
|
vec4 base3 = texture2D(diffuseMaps[3], gl_TexCoord[3].xy);
|
||||||
|
gl_FragColor =
|
||||||
|
mix(mix(base0, texture2D(diffuseMaps[0], gl_TexCoord[0].xw), steps.y),
|
||||||
|
mix(base0, texture2D(diffuseMaps[0], gl_TexCoord[0].zw), steps.x), steps.z) * alphaValues.x +
|
||||||
|
mix(mix(base1, texture2D(diffuseMaps[1], gl_TexCoord[1].xw), steps.y),
|
||||||
|
mix(base1, texture2D(diffuseMaps[1], gl_TexCoord[1].zw), steps.x), steps.z) * alphaValues.y +
|
||||||
|
mix(mix(base2, texture2D(diffuseMaps[2], gl_TexCoord[2].xw), steps.y),
|
||||||
|
mix(base2, texture2D(diffuseMaps[2], gl_TexCoord[2].zw), steps.x), steps.z) * alphaValues.z +
|
||||||
|
mix(mix(base3, texture2D(diffuseMaps[3], gl_TexCoord[3].xw), steps.y),
|
||||||
|
mix(base3, texture2D(diffuseMaps[3], gl_TexCoord[3].zw), steps.x), steps.z) * alphaValues.w;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_lastQueriedViewFrustum(),
|
_lastQueriedViewFrustum(),
|
||||||
_lastQueriedTime(usecTimestampNow()),
|
_lastQueriedTime(usecTimestampNow()),
|
||||||
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
|
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
|
||||||
_cameraPushback(0.0f),
|
|
||||||
_scaleMirror(1.0f),
|
_scaleMirror(1.0f),
|
||||||
_rotateMirror(0.0f),
|
_rotateMirror(0.0f),
|
||||||
_raiseMirror(0.0f),
|
_raiseMirror(0.0f),
|
||||||
|
@ -350,7 +349,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
QString cachePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
QString cachePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||||
|
|
||||||
NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkDiskCache* cache = new QNetworkDiskCache();
|
QNetworkDiskCache* cache = new QNetworkDiskCache();
|
||||||
cache->setCacheDirectory(!cachePath.isEmpty() ? cachePath : "interfaceCache");
|
cache->setCacheDirectory(!cachePath.isEmpty() ? cachePath : "interfaceCache");
|
||||||
networkAccessManager.setCache(cache);
|
networkAccessManager.setCache(cache);
|
||||||
|
@ -605,37 +604,40 @@ void Application::paintGL() {
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
||||||
_myCamera.setTightness(0.0f); // In first person, camera follows (untweaked) head exactly without delay
|
|
||||||
if (!OculusManager::isConnected()) {
|
if (!OculusManager::isConnected()) {
|
||||||
_myCamera.setTargetPosition(_myAvatar->getHead()->getEyePosition());
|
// If there isn't an HMD, match exactly to avatar's head
|
||||||
_myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
|
_myCamera.setPosition(_myAvatar->getHead()->getEyePosition());
|
||||||
|
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
|
||||||
|
} else {
|
||||||
|
// For an HMD, set the base position and orientation to that of the avatar body
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
|
||||||
|
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
|
||||||
}
|
}
|
||||||
// OculusManager::display() updates camera position and rotation a bit further on.
|
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
//Note, the camera distance is set in Camera::setMode() so we dont have to do it here.
|
static const float THIRD_PERSON_CAMERA_DISTANCE = 1.5f;
|
||||||
_myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
|
_myCamera.setPosition(_myAvatar->getUprightHeadPosition() +
|
||||||
_myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());
|
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * THIRD_PERSON_CAMERA_DISTANCE * _myAvatar->getScale());
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation());
|
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
|
||||||
} else {
|
} else {
|
||||||
_myCamera.setTargetRotation(_myAvatar->getHead()->getOrientation());
|
_myCamera.setRotation(_myAvatar->getHead()->getOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
_myCamera.setTightness(0.0f);
|
|
||||||
//Only behave like a true mirror when in the OR
|
//Only behave like a true mirror when in the OR
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
_myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
||||||
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
_myCamera.setPosition(_myAvatar->getHead()->getEyePosition() +
|
||||||
_myCamera.setTargetPosition(_myAvatar->getHead()->getEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0));
|
glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0) +
|
||||||
|
(_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||||
|
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
||||||
} else {
|
} else {
|
||||||
_myCamera.setTightness(0.0f);
|
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
||||||
glm::vec3 eyePosition = _myAvatar->getHead()->getEyePosition();
|
_myCamera.setPosition(_myAvatar->getHead()->getEyePosition() +
|
||||||
float headHeight = eyePosition.y - _myAvatar->getPosition().y;
|
glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0) +
|
||||||
_myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
(_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||||
_myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
|
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
||||||
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,12 +661,13 @@ void Application::paintGL() {
|
||||||
ViewFrustumOffset viewFrustumOffset = Menu::getInstance()->getViewFrustumOffset();
|
ViewFrustumOffset viewFrustumOffset = Menu::getInstance()->getViewFrustumOffset();
|
||||||
|
|
||||||
// set the camera to third-person view but offset so we can see the frustum
|
// set the camera to third-person view but offset so we can see the frustum
|
||||||
_viewFrustumOffsetCamera.setTargetPosition(_myCamera.getTargetPosition());
|
glm::quat frustumRotation = glm::quat(glm::radians(glm::vec3(viewFrustumOffset.pitch, viewFrustumOffset.yaw, viewFrustumOffset.roll)));
|
||||||
_viewFrustumOffsetCamera.setTargetRotation(_myCamera.getTargetRotation() * glm::quat(glm::radians(glm::vec3(
|
|
||||||
viewFrustumOffset.pitch, viewFrustumOffset.yaw, viewFrustumOffset.roll))));
|
_viewFrustumOffsetCamera.setPosition(_myCamera.getPosition() +
|
||||||
_viewFrustumOffsetCamera.setUpShift(viewFrustumOffset.up);
|
frustumRotation * glm::vec3(0.0f, viewFrustumOffset.up, -viewFrustumOffset.distance));
|
||||||
_viewFrustumOffsetCamera.setDistance(viewFrustumOffset.distance);
|
|
||||||
_viewFrustumOffsetCamera.initialize(); // force immediate snap to ideal position and orientation
|
_viewFrustumOffsetCamera.setRotation(_myCamera.getRotation() * frustumRotation);
|
||||||
|
|
||||||
_viewFrustumOffsetCamera.update(1.f/_fps);
|
_viewFrustumOffsetCamera.update(1.f/_fps);
|
||||||
whichCamera = &_viewFrustumOffsetCamera;
|
whichCamera = &_viewFrustumOffsetCamera;
|
||||||
}
|
}
|
||||||
|
@ -883,7 +886,11 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_W:
|
case Qt::Key_W:
|
||||||
_myAvatar->setDriveKeys(FWD, 1.f);
|
if (isOption && !isShifted && !isMeta) {
|
||||||
|
Menu::getInstance()->triggerOption(MenuOption::Wireframe);
|
||||||
|
} else {
|
||||||
|
_myAvatar->setDriveKeys(FWD, 1.f);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_S:
|
case Qt::Key_S:
|
||||||
|
@ -1781,10 +1788,8 @@ void Application::init() {
|
||||||
// TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
|
// TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
|
||||||
_avatarManager.init();
|
_avatarManager.init();
|
||||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||||
_myCamera.setModeShiftPeriod(1.0f);
|
|
||||||
|
|
||||||
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
|
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
|
||||||
_mirrorCamera.setModeShiftPeriod(0.0f);
|
|
||||||
|
|
||||||
OculusManager::connect();
|
OculusManager::connect();
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
|
@ -2124,17 +2129,14 @@ void Application::cameraMenuChanged() {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
|
||||||
if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
|
if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
|
||||||
_myCamera.setMode(CAMERA_MODE_MIRROR);
|
_myCamera.setMode(CAMERA_MODE_MIRROR);
|
||||||
_myCamera.setModeShiftPeriod(0.0f);
|
|
||||||
}
|
}
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
|
} else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
|
||||||
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
|
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
|
||||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||||
_myCamera.setModeShiftPeriod(modeShiftPeriod);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) {
|
if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) {
|
||||||
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
|
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
|
||||||
_myCamera.setModeShiftPeriod(modeShiftPeriod);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2908,10 +2910,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
// draw a red sphere
|
// draw a red sphere
|
||||||
float originSphereRadius = 0.05f;
|
float originSphereRadius = 0.05f;
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glPushMatrix();
|
_geometryCache.renderSphere(originSphereRadius, 15, 15);
|
||||||
glutSolidSphere(originSphereRadius, 15, 15);
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
// draw the audio reflector overlay
|
// draw the audio reflector overlay
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("audio");
|
PerformanceTimer perfTimer("audio");
|
||||||
|
@ -2966,7 +2966,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR);
|
bool mirrorMode = (whichCamera.getMode() == CAMERA_MODE_MIRROR);
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("avatars");
|
PerformanceTimer perfTimer("avatars");
|
||||||
_avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE,
|
_avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE,
|
||||||
|
@ -3105,30 +3105,30 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) {
|
||||||
bool eyeRelativeCamera = false;
|
bool eyeRelativeCamera = false;
|
||||||
if (billboard) {
|
if (billboard) {
|
||||||
_mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
|
_mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
|
||||||
_mirrorCamera.setDistance(BILLBOARD_DISTANCE * _myAvatar->getScale());
|
_mirrorCamera.setPosition(_myAvatar->getPosition() +
|
||||||
_mirrorCamera.setTargetPosition(_myAvatar->getPosition());
|
_myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
|
||||||
|
|
||||||
} else if (_rearMirrorTools->getZoomLevel() == BODY) {
|
} else if (_rearMirrorTools->getZoomLevel() == BODY) {
|
||||||
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
||||||
_mirrorCamera.setDistance(MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
|
_mirrorCamera.setPosition(_myAvatar->getChestPosition() +
|
||||||
_mirrorCamera.setTargetPosition(_myAvatar->getChestPosition());
|
_myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
|
||||||
|
|
||||||
} else { // HEAD zoom level
|
} else { // HEAD zoom level
|
||||||
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
||||||
_mirrorCamera.setDistance(MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
|
|
||||||
if (_myAvatar->getSkeletonModel().isActive() && _myAvatar->getHead()->getFaceModel().isActive()) {
|
if (_myAvatar->getSkeletonModel().isActive() && _myAvatar->getHead()->getFaceModel().isActive()) {
|
||||||
// as a hack until we have a better way of dealing with coordinate precision issues, reposition the
|
// as a hack until we have a better way of dealing with coordinate precision issues, reposition the
|
||||||
// face/body so that the average eye position lies at the origin
|
// face/body so that the average eye position lies at the origin
|
||||||
eyeRelativeCamera = true;
|
eyeRelativeCamera = true;
|
||||||
_mirrorCamera.setTargetPosition(glm::vec3());
|
_mirrorCamera.setPosition(_myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_mirrorCamera.setTargetPosition(_myAvatar->getHead()->getEyePosition());
|
_mirrorCamera.setPosition(_myAvatar->getHead()->getEyePosition() +
|
||||||
|
_myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_mirrorCamera.setAspectRatio((float)region.width() / region.height());
|
_mirrorCamera.setAspectRatio((float)region.width() / region.height());
|
||||||
|
|
||||||
_mirrorCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
_mirrorCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
||||||
_mirrorCamera.update(1.0f/_fps);
|
_mirrorCamera.update(1.0f/_fps);
|
||||||
|
|
||||||
// set the bounds of rear mirror view
|
// set the bounds of rear mirror view
|
||||||
|
@ -3468,9 +3468,9 @@ void Application::updateWindowTitle(){
|
||||||
void Application::updateLocationInServer() {
|
void Application::updateLocationInServer() {
|
||||||
|
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
const QUuid& domainUUID = NodeList::getInstance()->getDomainHandler().getUUID();
|
DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler();
|
||||||
|
|
||||||
if (accountManager.isLoggedIn() && !domainUUID.isNull()) {
|
if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) {
|
||||||
|
|
||||||
// construct a QJsonObject given the user's current address information
|
// construct a QJsonObject given the user's current address information
|
||||||
QJsonObject rootObject;
|
QJsonObject rootObject;
|
||||||
|
@ -3484,7 +3484,7 @@ void Application::updateLocationInServer() {
|
||||||
const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id";
|
const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id";
|
||||||
|
|
||||||
locationObject.insert(PATH_KEY_IN_LOCATION, pathString);
|
locationObject.insert(PATH_KEY_IN_LOCATION, pathString);
|
||||||
locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainUUID.toString());
|
locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString());
|
||||||
|
|
||||||
rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
|
rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
|
||||||
|
|
||||||
|
|
|
@ -520,7 +520,6 @@ private:
|
||||||
QRect _mirrorViewRect;
|
QRect _mirrorViewRect;
|
||||||
RearMirrorTools* _rearMirrorTools;
|
RearMirrorTools* _rearMirrorTools;
|
||||||
|
|
||||||
float _cameraPushback;
|
|
||||||
glm::mat4 _untranslatedViewMatrix;
|
glm::mat4 _untranslatedViewMatrix;
|
||||||
glm::vec3 _viewMatrixTranslation;
|
glm::vec3 _viewMatrixTranslation;
|
||||||
glm::mat4 _projectionMatrix;
|
glm::mat4 _projectionMatrix;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "BuckyBalls.h"
|
#include "BuckyBalls.h"
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "devices/SixenseManager.h"
|
#include "devices/SixenseManager.h"
|
||||||
|
@ -171,7 +172,7 @@ void BuckyBalls::render() {
|
||||||
}
|
}
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(_bballPosition[i].x, _bballPosition[i].y, _bballPosition[i].z);
|
glTranslatef(_bballPosition[i].x, _bballPosition[i].y, _bballPosition[i].z);
|
||||||
glutSolidSphere(_bballRadius[i], 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(_bballRadius[i], 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,102 +20,24 @@
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
|
|
||||||
const float CAMERA_FIRST_PERSON_MODE_UP_SHIFT = 0.0f;
|
|
||||||
const float CAMERA_FIRST_PERSON_MODE_DISTANCE = 0.0f;
|
|
||||||
const float CAMERA_FIRST_PERSON_MODE_TIGHTNESS = 100.0f;
|
|
||||||
|
|
||||||
const float CAMERA_INDEPENDENT_MODE_UP_SHIFT = 0.0f;
|
|
||||||
const float CAMERA_INDEPENDENT_MODE_DISTANCE = 0.0f;
|
|
||||||
const float CAMERA_INDEPENDENT_MODE_TIGHTNESS = 100.0f;
|
|
||||||
|
|
||||||
const float CAMERA_THIRD_PERSON_MODE_UP_SHIFT = -0.2f;
|
|
||||||
const float CAMERA_THIRD_PERSON_MODE_DISTANCE = 1.5f;
|
|
||||||
const float CAMERA_THIRD_PERSON_MODE_TIGHTNESS = 8.0f;
|
|
||||||
|
|
||||||
const float CAMERA_MIRROR_MODE_UP_SHIFT = 0.0f;
|
|
||||||
const float CAMERA_MIRROR_MODE_DISTANCE = 0.17f;
|
|
||||||
const float CAMERA_MIRROR_MODE_TIGHTNESS = 100.0f;
|
|
||||||
|
|
||||||
|
|
||||||
Camera::Camera() :
|
Camera::Camera() :
|
||||||
_needsToInitialize(true),
|
|
||||||
_mode(CAMERA_MODE_THIRD_PERSON),
|
_mode(CAMERA_MODE_THIRD_PERSON),
|
||||||
_prevMode(CAMERA_MODE_THIRD_PERSON),
|
|
||||||
_frustumNeedsReshape(true),
|
|
||||||
_position(0.0f, 0.0f, 0.0f),
|
_position(0.0f, 0.0f, 0.0f),
|
||||||
_idealPosition(0.0f, 0.0f, 0.0f),
|
|
||||||
_targetPosition(0.0f, 0.0f, 0.0f),
|
|
||||||
_fieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES),
|
_fieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES),
|
||||||
_aspectRatio(16.0f/9.0f),
|
_aspectRatio(16.0f/9.0f),
|
||||||
_nearClip(DEFAULT_NEAR_CLIP), // default
|
_nearClip(DEFAULT_NEAR_CLIP), // default
|
||||||
_farClip(DEFAULT_FAR_CLIP), // default
|
_farClip(DEFAULT_FAR_CLIP), // default
|
||||||
_upShift(0.0f),
|
_hmdPosition(),
|
||||||
_distance(0.0f),
|
_hmdRotation(),
|
||||||
_tightness(10.0f), // default
|
_targetPosition(),
|
||||||
_previousUpShift(0.0f),
|
_targetRotation(),
|
||||||
_previousDistance(0.0f),
|
_scale(1.0f)
|
||||||
_previousTightness(0.0f),
|
|
||||||
_newUpShift(0.0f),
|
|
||||||
_newDistance(0.0f),
|
|
||||||
_newTightness(0.0f),
|
|
||||||
_modeShift(1.0f),
|
|
||||||
_linearModeShift(0.0f),
|
|
||||||
_modeShiftPeriod(1.0f),
|
|
||||||
_scale(1.0f),
|
|
||||||
_lookingAt(0.0f, 0.0f, 0.0f),
|
|
||||||
_isKeepLookingAt(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::update(float deltaTime) {
|
void Camera::update(float deltaTime) {
|
||||||
|
return;
|
||||||
if (_mode != CAMERA_MODE_NULL) {
|
|
||||||
// use iterative forces to push the camera towards the target position and angle
|
|
||||||
updateFollowMode(deltaTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// use iterative forces to keep the camera at the desired position and angle
|
|
||||||
void Camera::updateFollowMode(float deltaTime) {
|
|
||||||
if (_linearModeShift < 1.0f) {
|
|
||||||
_linearModeShift += deltaTime / _modeShiftPeriod;
|
|
||||||
if (_needsToInitialize || _linearModeShift > 1.0f) {
|
|
||||||
_linearModeShift = 1.0f;
|
|
||||||
_modeShift = 1.0f;
|
|
||||||
_upShift = _newUpShift;
|
|
||||||
_distance = _newDistance;
|
|
||||||
_tightness = _newTightness;
|
|
||||||
} else {
|
|
||||||
_modeShift = ONE_HALF - ONE_HALF * cosf(_linearModeShift * PI );
|
|
||||||
_upShift = _previousUpShift * (1.0f - _modeShift) + _newUpShift * _modeShift;
|
|
||||||
_distance = _previousDistance * (1.0f - _modeShift) + _newDistance * _modeShift;
|
|
||||||
_tightness = _previousTightness * (1.0f - _modeShift) + _newTightness * _modeShift;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// derive t from tightness
|
|
||||||
float t = _tightness * _modeShift * deltaTime;
|
|
||||||
if (t > 1.0f) {
|
|
||||||
t = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle keepLookingAt
|
|
||||||
if (_isKeepLookingAt) {
|
|
||||||
lookAt(_lookingAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update position and rotation, setting directly if tightness is 0.0
|
|
||||||
if (_needsToInitialize || (_tightness == 0.0f)) {
|
|
||||||
_rotation = _targetRotation;
|
|
||||||
_idealPosition = _targetPosition + _scale * (_rotation * glm::vec3(0.0f, _upShift, _distance));
|
|
||||||
_position = _idealPosition;
|
|
||||||
_needsToInitialize = false;
|
|
||||||
} else {
|
|
||||||
// pull rotation towards ideal
|
|
||||||
_rotation = safeMix(_rotation, _targetRotation, t);
|
|
||||||
_idealPosition = _targetPosition + _scale * (_rotation * glm::vec3(0.0f, _upShift, _distance));
|
|
||||||
_position += (_idealPosition - _position) * t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Camera::getFarClip() const {
|
float Camera::getFarClip() const {
|
||||||
|
@ -124,136 +46,25 @@ float Camera::getFarClip() const {
|
||||||
: std::numeric_limits<int16_t>::max() - 1;
|
: std::numeric_limits<int16_t>::max() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setModeShiftPeriod (float period) {
|
void Camera::setMode(CameraMode m) {
|
||||||
const float MIN_PERIOD = 0.001f;
|
|
||||||
const float MAX_PERIOD = 3.0f;
|
|
||||||
_modeShiftPeriod = glm::clamp(period, MIN_PERIOD, MAX_PERIOD);
|
|
||||||
|
|
||||||
// if a zero period was requested, we clearly want to snap immediately to the target
|
|
||||||
if (period == 0.0f) {
|
|
||||||
update(MAX_PERIOD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setMode(CameraMode m) {
|
|
||||||
|
|
||||||
_prevMode = _mode;
|
|
||||||
_mode = m;
|
_mode = m;
|
||||||
_modeShift = 0.0;
|
|
||||||
_linearModeShift = 0.0;
|
|
||||||
|
|
||||||
_previousUpShift = _upShift;
|
|
||||||
_previousDistance = _distance;
|
|
||||||
_previousTightness = _tightness;
|
|
||||||
|
|
||||||
if (_mode == CAMERA_MODE_THIRD_PERSON) {
|
|
||||||
_newUpShift = CAMERA_THIRD_PERSON_MODE_UP_SHIFT;
|
|
||||||
_newDistance = CAMERA_THIRD_PERSON_MODE_DISTANCE;
|
|
||||||
_newTightness = CAMERA_THIRD_PERSON_MODE_TIGHTNESS;
|
|
||||||
} else if (_mode == CAMERA_MODE_FIRST_PERSON) {
|
|
||||||
_newUpShift = CAMERA_FIRST_PERSON_MODE_UP_SHIFT;
|
|
||||||
_newDistance = CAMERA_FIRST_PERSON_MODE_DISTANCE;
|
|
||||||
_newTightness = CAMERA_FIRST_PERSON_MODE_TIGHTNESS;
|
|
||||||
} else if (_mode == CAMERA_MODE_MIRROR) {
|
|
||||||
_newUpShift = CAMERA_MIRROR_MODE_UP_SHIFT;
|
|
||||||
_newDistance = CAMERA_MIRROR_MODE_DISTANCE;
|
|
||||||
_newTightness = CAMERA_MIRROR_MODE_TIGHTNESS;
|
|
||||||
} else if (_mode == CAMERA_MODE_INDEPENDENT) {
|
|
||||||
_newUpShift = CAMERA_INDEPENDENT_MODE_UP_SHIFT;
|
|
||||||
_newDistance = CAMERA_INDEPENDENT_MODE_DISTANCE;
|
|
||||||
_newTightness = CAMERA_INDEPENDENT_MODE_TIGHTNESS;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setTargetPosition(const glm::vec3& t) {
|
|
||||||
_targetPosition = t;
|
|
||||||
|
|
||||||
// handle keepLookingAt
|
|
||||||
if (_isKeepLookingAt) {
|
|
||||||
lookAt(_lookingAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setTargetRotation( const glm::quat& targetRotation ) {
|
|
||||||
_targetRotation = targetRotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setFieldOfView(float f) {
|
void Camera::setFieldOfView(float f) {
|
||||||
_fieldOfView = f;
|
_fieldOfView = f;
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setAspectRatio(float a) {
|
void Camera::setAspectRatio(float a) {
|
||||||
_aspectRatio = a;
|
_aspectRatio = a;
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setNearClip(float n) {
|
void Camera::setNearClip(float n) {
|
||||||
_nearClip = n;
|
_nearClip = n;
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setFarClip(float f) {
|
void Camera::setFarClip(float f) {
|
||||||
_farClip = f;
|
_farClip = f;
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setEyeOffsetPosition(const glm::vec3& p) {
|
|
||||||
_eyeOffsetPosition = p;
|
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setEyeOffsetOrientation(const glm::quat& o) {
|
|
||||||
_eyeOffsetOrientation = o;
|
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::setScale(float s) {
|
|
||||||
_scale = s;
|
|
||||||
_needsToInitialize = true;
|
|
||||||
_frustumNeedsReshape = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::initialize() {
|
|
||||||
_needsToInitialize = true;
|
|
||||||
_modeShift = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// call to find out if the view frustum needs to be reshaped
|
|
||||||
bool Camera::getFrustumNeedsReshape() const {
|
|
||||||
return _frustumNeedsReshape;
|
|
||||||
}
|
|
||||||
|
|
||||||
// call this when deciding whether to render the head or not
|
|
||||||
CameraMode Camera::getInterpolatedMode() const {
|
|
||||||
const float SHIFT_THRESHOLD_INTO_FIRST_PERSON = 0.7f;
|
|
||||||
const float SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON = 0.6f;
|
|
||||||
if ((_mode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_INTO_FIRST_PERSON) ||
|
|
||||||
(_prevMode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON)) {
|
|
||||||
return _prevMode;
|
|
||||||
}
|
|
||||||
return _mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// call this after reshaping the view frustum
|
|
||||||
void Camera::setFrustumWasReshaped() {
|
|
||||||
_frustumNeedsReshape = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::lookAt(const glm::vec3& lookAt) {
|
|
||||||
glm::vec3 up = IDENTITY_UP;
|
|
||||||
glm::mat4 lookAtMatrix = glm::lookAt(_targetPosition, lookAt, up);
|
|
||||||
glm::quat rotation = glm::quat_cast(lookAtMatrix);
|
|
||||||
rotation.w = -rotation.w; // Rosedale approved
|
|
||||||
setTargetRotation(rotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::keepLookingAt(const glm::vec3& point) {
|
|
||||||
lookAt(point);
|
|
||||||
_isKeepLookingAt = true;
|
|
||||||
_lookingAt = point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraScriptableObject::CameraScriptableObject(Camera* camera, ViewFrustum* viewFrustum) :
|
CameraScriptableObject::CameraScriptableObject(Camera* camera, ViewFrustum* viewFrustum) :
|
||||||
|
|
|
@ -35,30 +35,27 @@ public:
|
||||||
void initialize(); // instantly put the camera at the ideal position and rotation.
|
void initialize(); // instantly put the camera at the ideal position and rotation.
|
||||||
|
|
||||||
void update( float deltaTime );
|
void update( float deltaTime );
|
||||||
|
|
||||||
void setUpShift(float u) { _upShift = u; }
|
|
||||||
void setDistance(float d) { _distance = d; }
|
|
||||||
void setPosition(const glm::vec3& p) { _position = p; }
|
void setPosition(const glm::vec3& p) { _position = p; }
|
||||||
void setTargetPosition(const glm::vec3& t);
|
void setRotation(const glm::quat& rotation) { _rotation = rotation; };
|
||||||
void setTightness(float t) { _tightness = t; }
|
void setHmdPosition(const glm::vec3& hmdPosition) { _hmdPosition = hmdPosition; }
|
||||||
void setTargetRotation(const glm::quat& rotation);
|
void setHmdRotation(const glm::quat& hmdRotation) { _hmdRotation = hmdRotation; };
|
||||||
void setModeShiftPeriod(float r);
|
|
||||||
void setMode(CameraMode m);
|
void setMode(CameraMode m);
|
||||||
void setFieldOfView(float f);
|
void setFieldOfView(float f);
|
||||||
void setAspectRatio(float a);
|
void setAspectRatio(float a);
|
||||||
void setNearClip(float n);
|
void setNearClip(float n);
|
||||||
void setFarClip(float f);
|
void setFarClip(float f);
|
||||||
void setEyeOffsetPosition(const glm::vec3& p);
|
void setEyeOffsetPosition(const glm::vec3& p) { _eyeOffsetPosition = p; }
|
||||||
void setEyeOffsetOrientation(const glm::quat& o);
|
void setEyeOffsetOrientation(const glm::quat& o) { _eyeOffsetOrientation = o; }
|
||||||
void setScale(const float s);
|
void setScale(const float s) { _scale = s; }
|
||||||
|
|
||||||
|
glm::vec3 getPosition() const { return _position + _hmdPosition; }
|
||||||
|
glm::quat getRotation() const { return _rotation * _hmdRotation; }
|
||||||
|
const glm::vec3& getHmdPosition() const { return _hmdPosition; }
|
||||||
|
const glm::quat& getHmdRotation() const { return _hmdRotation; }
|
||||||
|
|
||||||
const glm::vec3& getPosition() const { return _position; }
|
|
||||||
const glm::quat& getRotation() const { return _rotation; }
|
|
||||||
CameraMode getMode() const { return _mode; }
|
CameraMode getMode() const { return _mode; }
|
||||||
float getModeShiftPeriod() const { return _modeShiftPeriod; }
|
|
||||||
float getDistance() const { return _distance; }
|
|
||||||
const glm::vec3& getTargetPosition() const { return _targetPosition; }
|
|
||||||
const glm::quat& getTargetRotation() const { return _targetRotation; }
|
|
||||||
float getFieldOfView() const { return _fieldOfView; }
|
float getFieldOfView() const { return _fieldOfView; }
|
||||||
float getAspectRatio() const { return _aspectRatio; }
|
float getAspectRatio() const { return _aspectRatio; }
|
||||||
float getNearClip() const { return _scale * _nearClip; }
|
float getNearClip() const { return _scale * _nearClip; }
|
||||||
|
@ -67,31 +64,10 @@ public:
|
||||||
const glm::quat& getEyeOffsetOrientation() const { return _eyeOffsetOrientation; }
|
const glm::quat& getEyeOffsetOrientation() const { return _eyeOffsetOrientation; }
|
||||||
float getScale() const { return _scale; }
|
float getScale() const { return _scale; }
|
||||||
|
|
||||||
CameraMode getInterpolatedMode() const;
|
|
||||||
|
|
||||||
bool getFrustumNeedsReshape() const; // call to find out if the view frustum needs to be reshaped
|
|
||||||
void setFrustumWasReshaped(); // call this after reshaping the view frustum.
|
|
||||||
|
|
||||||
// These only work on independent cameras
|
|
||||||
/// one time change to what the camera is looking at
|
|
||||||
void lookAt(const glm::vec3& value);
|
|
||||||
|
|
||||||
/// fix what the camera is looking at, and keep the camera looking at this even if position changes
|
|
||||||
void keepLookingAt(const glm::vec3& value);
|
|
||||||
|
|
||||||
/// stops the keep looking at feature, doesn't change what's being looked at, but will stop camera from
|
|
||||||
/// continuing to update it's orientation to keep looking at the item
|
|
||||||
void stopLooking() { _isKeepLookingAt = false; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool _needsToInitialize;
|
|
||||||
CameraMode _mode;
|
CameraMode _mode;
|
||||||
CameraMode _prevMode;
|
|
||||||
bool _frustumNeedsReshape;
|
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::vec3 _idealPosition;
|
|
||||||
glm::vec3 _targetPosition;
|
|
||||||
float _fieldOfView; // degrees
|
float _fieldOfView; // degrees
|
||||||
float _aspectRatio;
|
float _aspectRatio;
|
||||||
float _nearClip;
|
float _nearClip;
|
||||||
|
@ -99,25 +75,11 @@ private:
|
||||||
glm::vec3 _eyeOffsetPosition;
|
glm::vec3 _eyeOffsetPosition;
|
||||||
glm::quat _eyeOffsetOrientation;
|
glm::quat _eyeOffsetOrientation;
|
||||||
glm::quat _rotation;
|
glm::quat _rotation;
|
||||||
|
glm::vec3 _hmdPosition;
|
||||||
|
glm::quat _hmdRotation;
|
||||||
|
glm::vec3 _targetPosition;
|
||||||
glm::quat _targetRotation;
|
glm::quat _targetRotation;
|
||||||
float _upShift;
|
|
||||||
float _distance;
|
|
||||||
float _tightness;
|
|
||||||
float _previousUpShift;
|
|
||||||
float _previousDistance;
|
|
||||||
float _previousTightness;
|
|
||||||
float _newUpShift;
|
|
||||||
float _newDistance;
|
|
||||||
float _newTightness;
|
|
||||||
float _modeShift;
|
|
||||||
float _linearModeShift;
|
|
||||||
float _modeShiftPeriod;
|
|
||||||
float _scale;
|
float _scale;
|
||||||
|
|
||||||
glm::vec3 _lookingAt;
|
|
||||||
bool _isKeepLookingAt;
|
|
||||||
|
|
||||||
void updateFollowMode(float deltaTime);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,25 +91,13 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
QString getMode() const;
|
QString getMode() const;
|
||||||
void setMode(const QString& mode);
|
void setMode(const QString& mode);
|
||||||
void setModeShiftPeriod(float r) {_camera->setModeShiftPeriod(r); }
|
void setPosition(const glm::vec3& value) { _camera->setPosition(value);}
|
||||||
void setPosition(const glm::vec3& value) { _camera->setTargetPosition(value);}
|
|
||||||
|
|
||||||
glm::vec3 getPosition() const { return _camera->getPosition(); }
|
glm::vec3 getPosition() const { return _camera->getPosition(); }
|
||||||
|
|
||||||
void setOrientation(const glm::quat& value) { _camera->setTargetRotation(value); }
|
void setOrientation(const glm::quat& value) { _camera->setRotation(value); }
|
||||||
glm::quat getOrientation() const { return _camera->getRotation(); }
|
glm::quat getOrientation() const { return _camera->getRotation(); }
|
||||||
|
|
||||||
// These only work on independent cameras
|
|
||||||
/// one time change to what the camera is looking at
|
|
||||||
void lookAt(const glm::vec3& value) { _camera->lookAt(value);}
|
|
||||||
|
|
||||||
/// fix what the camera is looking at, and keep the camera looking at this even if position changes
|
|
||||||
void keepLookingAt(const glm::vec3& value) { _camera->keepLookingAt(value);}
|
|
||||||
|
|
||||||
/// stops the keep looking at feature, doesn't change what's being looked at, but will stop camera from
|
|
||||||
/// continuing to update it's orientation to keep looking at the item
|
|
||||||
void stopLooking() { _camera->stopLooking();}
|
|
||||||
|
|
||||||
PickRay computePickRay(float x, float y);
|
PickRay computePickRay(float x, float y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -261,10 +261,10 @@ void Environment::renderAtmosphere(Camera& camera, const EnvironmentData& data)
|
||||||
|
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glutSolidSphere(data.getAtmosphereOuterRadius(), 100, 50);
|
Application::getInstance()->getGeometryCache()->renderSphere(1.f, 100, 50); //Draw a unit sphere
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
program->release();
|
program->release();
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ FileLogger::FileLogger(QObject* parent) :
|
||||||
setExtraDebugging(false);
|
setExtraDebugging(false);
|
||||||
|
|
||||||
_fileName = FileUtils::standardPath(LOGS_DIRECTORY);
|
_fileName = FileUtils::standardPath(LOGS_DIRECTORY);
|
||||||
QHostAddress clientAddress = QHostAddress(getHostOrderLocalAddress());
|
QHostAddress clientAddress = getLocalAddress();
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
_fileName.append(QString(FILENAME_FORMAT).arg(clientAddress.toString(), now.toString(DATETIME_FORMAT)));
|
_fileName.append(QString(FILENAME_FORMAT).arg(clientAddress.toString(), now.toString(DATETIME_FORMAT)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,7 @@ Menu::Menu() :
|
||||||
0,
|
0,
|
||||||
appInstance->getGlowEffect(),
|
appInstance->getGlowEffect(),
|
||||||
SLOT(cycleRenderMode()));
|
SLOT(cycleRenderMode()));
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, 0, false);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
||||||
|
|
||||||
QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar");
|
QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar");
|
||||||
|
@ -423,6 +423,10 @@ Menu::Menu() :
|
||||||
addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DontFadeOnVoxelServerChanges);
|
addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DontFadeOnVoxelServerChanges);
|
||||||
addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DisableAutoAdjustLOD);
|
addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DisableAutoAdjustLOD);
|
||||||
|
|
||||||
|
QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels");
|
||||||
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false,
|
||||||
|
Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData()));
|
||||||
|
|
||||||
QMenu* handOptionsMenu = developerMenu->addMenu("Hands");
|
QMenu* handOptionsMenu = developerMenu->addMenu("Hands");
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlternateIK, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlternateIK, 0, false);
|
||||||
|
@ -1234,7 +1238,7 @@ void Menu::toggleLocationList() {
|
||||||
if (!_userLocationsDialog) {
|
if (!_userLocationsDialog) {
|
||||||
JavascriptObjectMap locationObjectMap;
|
JavascriptObjectMap locationObjectMap;
|
||||||
locationObjectMap.insert("InterfaceLocation", LocationScriptingInterface::getInstance());
|
locationObjectMap.insert("InterfaceLocation", LocationScriptingInterface::getInstance());
|
||||||
_userLocationsDialog = DataWebDialog::dialogForPath("/locations", locationObjectMap);
|
_userLocationsDialog = DataWebDialog::dialogForPath("/user/locations", locationObjectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_userLocationsDialog->isVisible()) {
|
if (!_userLocationsDialog->isVisible()) {
|
||||||
|
@ -1278,7 +1282,7 @@ void Menu::nameLocation() {
|
||||||
if (!_newLocationDialog) {
|
if (!_newLocationDialog) {
|
||||||
JavascriptObjectMap locationObjectMap;
|
JavascriptObjectMap locationObjectMap;
|
||||||
locationObjectMap.insert("InterfaceLocation", LocationScriptingInterface::getInstance());
|
locationObjectMap.insert("InterfaceLocation", LocationScriptingInterface::getInstance());
|
||||||
_newLocationDialog = DataWebDialog::dialogForPath("/locations/new", locationObjectMap);
|
_newLocationDialog = DataWebDialog::dialogForPath("/user/locations/new", locationObjectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_newLocationDialog->isVisible()) {
|
if (!_newLocationDialog->isVisible()) {
|
||||||
|
|
|
@ -374,6 +374,7 @@ namespace MenuOption {
|
||||||
const QString DisplayFrustum = "Display Frustum";
|
const QString DisplayFrustum = "Display Frustum";
|
||||||
const QString DisplayHands = "Show Hand Info";
|
const QString DisplayHands = "Show Hand Info";
|
||||||
const QString DisplayHandTargets = "Show Hand Targets";
|
const QString DisplayHandTargets = "Show Hand Targets";
|
||||||
|
const QString DisplayHermiteData = "Display Hermite Data";
|
||||||
const QString DisplayModelBounds = "Display Model Bounds";
|
const QString DisplayModelBounds = "Display Model Bounds";
|
||||||
const QString DisplayModelElementChildProxies = "Display Model Element Children";
|
const QString DisplayModelElementChildProxies = "Display Model Element Children";
|
||||||
const QString DisplayModelElementProxy = "Display Model Element Bounds";
|
const QString DisplayModelElementProxy = "Display Model Element Bounds";
|
||||||
|
|
|
@ -137,6 +137,18 @@ void MetavoxelSystem::render() {
|
||||||
emit rendering();
|
emit rendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetavoxelSystem::refreshVoxelData() {
|
||||||
|
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||||
|
if (node->getType() == NodeType::MetavoxelServer) {
|
||||||
|
QMutexLocker locker(&node->getMutex());
|
||||||
|
MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData());
|
||||||
|
if (client) {
|
||||||
|
QMetaObject::invokeMethod(client, "refreshVoxelData");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class RayHeightfieldIntersectionVisitor : public RayIntersectionVisitor {
|
class RayHeightfieldIntersectionVisitor : public RayIntersectionVisitor {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -577,6 +589,14 @@ void Augmenter::run() {
|
||||||
QMetaObject::invokeMethod(node->getLinkedData(), "setAugmentedData", Q_ARG(const MetavoxelData&, _data));
|
QMetaObject::invokeMethod(node->getLinkedData(), "setAugmentedData", Q_ARG(const MetavoxelData&, _data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetavoxelSystemClient::refreshVoxelData() {
|
||||||
|
// make it look as if all the colors have changed
|
||||||
|
MetavoxelData oldData = getAugmentedData();
|
||||||
|
oldData.touch(AttributeRegistry::getInstance()->getVoxelColorAttribute());
|
||||||
|
|
||||||
|
QThreadPool::globalInstance()->start(new Augmenter(_node, _data, oldData, _remoteDataLOD));
|
||||||
|
}
|
||||||
|
|
||||||
void MetavoxelSystemClient::dataChanged(const MetavoxelData& oldData) {
|
void MetavoxelSystemClient::dataChanged(const MetavoxelData& oldData) {
|
||||||
MetavoxelClient::dataChanged(oldData);
|
MetavoxelClient::dataChanged(oldData);
|
||||||
QThreadPool::globalInstance()->start(new Augmenter(_node, _data, getAugmentedData(), _remoteDataLOD));
|
QThreadPool::globalInstance()->start(new Augmenter(_node, _data, getAugmentedData(), _remoteDataLOD));
|
||||||
|
@ -970,12 +990,14 @@ void VoxelPoint::setNormal(const glm::vec3& normal) {
|
||||||
this->normal[2] = (char)(normal.z * 127.0f);
|
this->normal[2] = (char)(normal.z * 127.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelBuffer::VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices,
|
VoxelBuffer::VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices, const QVector<glm::vec3>& hermite,
|
||||||
const QVector<SharedObjectPointer>& materials) :
|
const QVector<SharedObjectPointer>& materials) :
|
||||||
_vertices(vertices),
|
_vertices(vertices),
|
||||||
_indices(indices),
|
_indices(indices),
|
||||||
|
_hermite(hermite),
|
||||||
_vertexCount(vertices.size()),
|
_vertexCount(vertices.size()),
|
||||||
_indexCount(indices.size()),
|
_indexCount(indices.size()),
|
||||||
|
_hermiteCount(hermite.size()),
|
||||||
_indexBuffer(QOpenGLBuffer::IndexBuffer),
|
_indexBuffer(QOpenGLBuffer::IndexBuffer),
|
||||||
_materials(materials) {
|
_materials(materials) {
|
||||||
}
|
}
|
||||||
|
@ -1095,6 +1117,39 @@ void VoxelBuffer::render(bool cursor) {
|
||||||
|
|
||||||
_vertexBuffer.release();
|
_vertexBuffer.release();
|
||||||
_indexBuffer.release();
|
_indexBuffer.release();
|
||||||
|
|
||||||
|
if (_hermiteCount > 0 && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
||||||
|
if (!_hermiteBuffer.isCreated()) {
|
||||||
|
_hermiteBuffer.create();
|
||||||
|
_hermiteBuffer.bind();
|
||||||
|
_hermiteBuffer.allocate(_hermite.constData(), _hermite.size() * sizeof(glm::vec3));
|
||||||
|
_hermite.clear();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_hermiteBuffer.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, 0);
|
||||||
|
|
||||||
|
Application::getInstance()->getDeferredLightingEffect()->getSimpleProgram().bind();
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
|
||||||
|
glDrawArrays(GL_LINES, 0, _hermiteCount);
|
||||||
|
|
||||||
|
DefaultMetavoxelRendererImplementation::getBaseVoxelProgram().bind();
|
||||||
|
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
_hermiteBuffer.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferDataAttribute::BufferDataAttribute(const QString& name) :
|
BufferDataAttribute::BufferDataAttribute(const QString& name) :
|
||||||
|
@ -1117,7 +1172,10 @@ AttributeValue BufferDataAttribute::inherit(const AttributeValue& parentValue) c
|
||||||
|
|
||||||
void DefaultMetavoxelRendererImplementation::init() {
|
void DefaultMetavoxelRendererImplementation::init() {
|
||||||
if (!_pointProgram.isLinked()) {
|
if (!_pointProgram.isLinked()) {
|
||||||
_pointProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert");
|
_pointProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||||
|
"shaders/metavoxel_point.vert");
|
||||||
|
_pointProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||||
|
"shaders/metavoxel_voxel_base.frag");
|
||||||
_pointProgram.link();
|
_pointProgram.link();
|
||||||
|
|
||||||
_pointProgram.bind();
|
_pointProgram.bind();
|
||||||
|
@ -1551,22 +1609,28 @@ public:
|
||||||
AxisIndex(int x = -1, int y = -1, int z = -1) : x(x), y(y), z(z) { }
|
AxisIndex(int x = -1, int y = -1, int z = -1) : x(x), y(y), z(z) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static glm::vec3 safeNormalize(const glm::vec3& vector) {
|
||||||
|
float length = glm::length(vector);
|
||||||
|
return (length > 0.0f) ? (vector / length) : vector;
|
||||||
|
}
|
||||||
|
|
||||||
int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
if (!info.isLeaf) {
|
if (!info.isLeaf) {
|
||||||
return DEFAULT_ORDER;
|
return DEFAULT_ORDER;
|
||||||
}
|
}
|
||||||
VoxelBuffer* buffer = NULL;
|
BufferData* buffer = NULL;
|
||||||
VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>();
|
VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>();
|
||||||
VoxelMaterialDataPointer material = info.inputValues.at(1).getInlineValue<VoxelMaterialDataPointer>();
|
VoxelMaterialDataPointer material = info.inputValues.at(1).getInlineValue<VoxelMaterialDataPointer>();
|
||||||
VoxelHermiteDataPointer hermite = info.inputValues.at(2).getInlineValue<VoxelHermiteDataPointer>();
|
VoxelHermiteDataPointer hermite = info.inputValues.at(2).getInlineValue<VoxelHermiteDataPointer>();
|
||||||
if (color && material && hermite) {
|
|
||||||
|
if (color && hermite) {
|
||||||
QVector<VoxelPoint> vertices;
|
QVector<VoxelPoint> vertices;
|
||||||
QVector<int> indices;
|
QVector<int> indices;
|
||||||
|
QVector<glm::vec3> hermiteSegments;
|
||||||
|
|
||||||
// see http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf for a description of the
|
// see http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf for a description of the
|
||||||
// dual contour algorithm for generating meshes from voxel data using Hermite-tagged edges
|
// dual contour algorithm for generating meshes from voxel data using Hermite-tagged edges
|
||||||
const QVector<QRgb>& colorContents = color->getContents();
|
const QVector<QRgb>& colorContents = color->getContents();
|
||||||
const QByteArray& materialContents = material->getContents();
|
|
||||||
const QVector<QRgb>& hermiteContents = hermite->getContents();
|
const QVector<QRgb>& hermiteContents = hermite->getContents();
|
||||||
int size = color->getSize();
|
int size = color->getSize();
|
||||||
int area = size * size;
|
int area = size * size;
|
||||||
|
@ -1584,7 +1648,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
int hermiteStride = hermite->getSize() * VoxelHermiteData::EDGE_COUNT;
|
int hermiteStride = hermite->getSize() * VoxelHermiteData::EDGE_COUNT;
|
||||||
int hermiteArea = hermiteStride * hermite->getSize();
|
int hermiteArea = hermiteStride * hermite->getSize();
|
||||||
|
|
||||||
const char* materialData = materialContents.constData();
|
const char* materialData = material ? material->getContents().constData() : NULL;
|
||||||
|
|
||||||
// as we scan down the cube generating vertices between grid points, we remember the indices of the last
|
// as we scan down the cube generating vertices between grid points, we remember the indices of the last
|
||||||
// (element, line, section--x, y, z) so that we can connect generated vertices as quads
|
// (element, line, section--x, y, z) so that we can connect generated vertices as quads
|
||||||
|
@ -1600,6 +1664,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
float highest = size - 1.0f;
|
float highest = size - 1.0f;
|
||||||
float scale = info.size / highest;
|
float scale = info.size / highest;
|
||||||
const int ALPHA_OFFSET = 24;
|
const int ALPHA_OFFSET = 24;
|
||||||
|
bool displayHermite = Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData);
|
||||||
for (int z = 0; z < expanded; z++) {
|
for (int z = 0; z < expanded; z++) {
|
||||||
const QRgb* colorY = colorZ;
|
const QRgb* colorY = colorZ;
|
||||||
for (int y = 0; y < expanded; y++) {
|
for (int y = 0; y < expanded; y++) {
|
||||||
|
@ -1662,7 +1727,8 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
int clampedX = qMax(x - 1, 0), clampedY = qMax(y - 1, 0), clampedZ = qMax(z - 1, 0);
|
int clampedX = qMax(x - 1, 0), clampedY = qMax(y - 1, 0), clampedZ = qMax(z - 1, 0);
|
||||||
const QRgb* hermiteBase = hermiteData + clampedZ * hermiteArea + clampedY * hermiteStride +
|
const QRgb* hermiteBase = hermiteData + clampedZ * hermiteArea + clampedY * hermiteStride +
|
||||||
clampedX * VoxelHermiteData::EDGE_COUNT;
|
clampedX * VoxelHermiteData::EDGE_COUNT;
|
||||||
const char* materialBase = materialData + clampedZ * area + clampedY * size + clampedX;
|
const char* materialBase = materialData ?
|
||||||
|
(materialData + clampedZ * area + clampedY * size + clampedX) : NULL;
|
||||||
int crossingCount = 0;
|
int crossingCount = 0;
|
||||||
if (middleX) {
|
if (middleX) {
|
||||||
if (alpha0 != alpha1) {
|
if (alpha0 != alpha1) {
|
||||||
|
@ -1671,10 +1737,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha0 == 0) {
|
if (alpha0 == 0) {
|
||||||
crossing.color = colorX[1];
|
crossing.color = colorX[1];
|
||||||
crossing.material = materialBase[1];
|
crossing.material = materialBase ? materialBase[1] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[0];
|
crossing.color = colorX[0];
|
||||||
crossing.material = materialBase[0];
|
crossing.material = materialBase ? materialBase[0] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 0.0f);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 0.0f);
|
||||||
crossing.axis = 0;
|
crossing.axis = 0;
|
||||||
|
@ -1686,10 +1752,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha1 == 0) {
|
if (alpha1 == 0) {
|
||||||
crossing.color = colorX[offset3];
|
crossing.color = colorX[offset3];
|
||||||
crossing.material = materialBase[offset3];
|
crossing.material = materialBase ? materialBase[offset3] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[1];
|
crossing.color = colorX[1];
|
||||||
crossing.material = materialBase[1];
|
crossing.material = materialBase ? materialBase[1] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
||||||
crossing.axis = 1;
|
crossing.axis = 1;
|
||||||
|
@ -1700,10 +1766,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha2 == 0) {
|
if (alpha2 == 0) {
|
||||||
crossing.color = colorX[offset3];
|
crossing.color = colorX[offset3];
|
||||||
crossing.material = materialBase[offset3];
|
crossing.material = materialBase ? materialBase[offset3] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[size];
|
crossing.color = colorX[size];
|
||||||
crossing.material = materialBase[size];
|
crossing.material = materialBase ? materialBase[size] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 0.0f);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 0.0f);
|
||||||
crossing.axis = 0;
|
crossing.axis = 0;
|
||||||
|
@ -1715,10 +1781,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha3 == 0) {
|
if (alpha3 == 0) {
|
||||||
crossing.color = colorX[offset7];
|
crossing.color = colorX[offset7];
|
||||||
crossing.material = materialBase[offset7];
|
crossing.material = materialBase ? materialBase[offset7] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[offset3];
|
crossing.color = colorX[offset3];
|
||||||
crossing.material = materialBase[offset3];
|
crossing.material = materialBase ? materialBase[offset3] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(1.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
crossing.point = glm::vec3(1.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossing.axis = 2;
|
crossing.axis = 2;
|
||||||
|
@ -1729,10 +1795,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha5 == 0) {
|
if (alpha5 == 0) {
|
||||||
crossing.color = colorX[offset7];
|
crossing.color = colorX[offset7];
|
||||||
crossing.material = materialBase[offset7];
|
crossing.material = materialBase ? materialBase[offset7] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[offset5];
|
crossing.color = colorX[offset5];
|
||||||
crossing.material = materialBase[offset5];
|
crossing.material = materialBase ? materialBase[offset5] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
||||||
crossing.axis = 1;
|
crossing.axis = 1;
|
||||||
|
@ -1743,10 +1809,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha6 == 0) {
|
if (alpha6 == 0) {
|
||||||
crossing.color = colorX[offset7];
|
crossing.color = colorX[offset7];
|
||||||
crossing.material = materialBase[offset7];
|
crossing.material = materialBase ? materialBase[offset7] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[offset6];
|
crossing.color = colorX[offset6];
|
||||||
crossing.material = materialBase[offset6];
|
crossing.material = materialBase ? materialBase[offset6] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 1.0f);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 1.0f);
|
||||||
crossing.axis = 0;
|
crossing.axis = 0;
|
||||||
|
@ -1760,10 +1826,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha1 == 0) {
|
if (alpha1 == 0) {
|
||||||
crossing.color = colorX[offset5];
|
crossing.color = colorX[offset5];
|
||||||
crossing.material = materialBase[offset5];
|
crossing.material = materialBase ? materialBase[offset5] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[1];
|
crossing.color = colorX[1];
|
||||||
crossing.material = materialBase[1];
|
crossing.material = materialBase ? materialBase[1] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(1.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
crossing.point = glm::vec3(1.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossing.axis = 2;
|
crossing.axis = 2;
|
||||||
|
@ -1774,10 +1840,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha4 == 0) {
|
if (alpha4 == 0) {
|
||||||
crossing.color = colorX[offset5];
|
crossing.color = colorX[offset5];
|
||||||
crossing.material = materialBase[offset5];
|
crossing.material = materialBase ? materialBase[offset5] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[area];
|
crossing.color = colorX[area];
|
||||||
crossing.material = materialBase[area];
|
crossing.material = materialBase ? materialBase[area] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 1.0f);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 1.0f);
|
||||||
crossing.axis = 0;
|
crossing.axis = 0;
|
||||||
|
@ -1791,10 +1857,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha0 == 0) {
|
if (alpha0 == 0) {
|
||||||
crossing.color = colorX[size];
|
crossing.color = colorX[size];
|
||||||
crossing.material = materialBase[size];
|
crossing.material = materialBase ? materialBase[size] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[0];
|
crossing.color = colorX[0];
|
||||||
crossing.material = materialBase[0];
|
crossing.material = materialBase ? materialBase[0] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
||||||
crossing.axis = 1;
|
crossing.axis = 1;
|
||||||
|
@ -1806,10 +1872,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha2 == 0) {
|
if (alpha2 == 0) {
|
||||||
crossing.color = colorX[offset6];
|
crossing.color = colorX[offset6];
|
||||||
crossing.material = materialBase[offset6];
|
crossing.material = materialBase ? materialBase[offset6] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[size];
|
crossing.color = colorX[size];
|
||||||
crossing.material = materialBase[size];
|
crossing.material = materialBase ? materialBase[size] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(0.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
crossing.point = glm::vec3(0.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossing.axis = 2;
|
crossing.axis = 2;
|
||||||
|
@ -1820,10 +1886,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha4 == 0) {
|
if (alpha4 == 0) {
|
||||||
crossing.color = colorX[offset6];
|
crossing.color = colorX[offset6];
|
||||||
crossing.material = materialBase[offset6];
|
crossing.material = materialBase ? materialBase[offset6] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[area];
|
crossing.color = colorX[area];
|
||||||
crossing.material = materialBase[area];
|
crossing.material = materialBase ? materialBase[area] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
||||||
crossing.axis = 1;
|
crossing.axis = 1;
|
||||||
|
@ -1836,10 +1902,10 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
crossing.normal = unpackNormal(hermite);
|
crossing.normal = unpackNormal(hermite);
|
||||||
if (alpha0 == 0) {
|
if (alpha0 == 0) {
|
||||||
crossing.color = colorX[area];
|
crossing.color = colorX[area];
|
||||||
crossing.material = materialBase[area];
|
crossing.material = materialBase ? materialBase[area] : 0;
|
||||||
} else {
|
} else {
|
||||||
crossing.color = colorX[0];
|
crossing.color = colorX[0];
|
||||||
crossing.material = materialBase[0];
|
crossing.material = materialBase ? materialBase[0] : 0;
|
||||||
}
|
}
|
||||||
crossing.point = glm::vec3(0.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
crossing.point = glm::vec3(0.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossing.axis = 2;
|
crossing.axis = 2;
|
||||||
|
@ -1861,6 +1927,13 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
green += qGreen(crossing.color);
|
green += qGreen(crossing.color);
|
||||||
blue += qBlue(crossing.color);
|
blue += qBlue(crossing.color);
|
||||||
|
|
||||||
|
if (displayHermite) {
|
||||||
|
glm::vec3 start = info.minimum + (glm::vec3(clampedX, clampedY, clampedZ) +
|
||||||
|
crossing.point) * scale;
|
||||||
|
hermiteSegments.append(start);
|
||||||
|
hermiteSegments.append(start + crossing.normal * scale);
|
||||||
|
}
|
||||||
|
|
||||||
// when assigning a material, search for its presence and, if not found,
|
// when assigning a material, search for its presence and, if not found,
|
||||||
// place it in the first empty slot
|
// place it in the first empty slot
|
||||||
if (crossing.material != 0) {
|
if (crossing.material != 0) {
|
||||||
|
@ -1879,7 +1952,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glm::vec3 normal = glm::normalize(axisNormals[0] + axisNormals[1] + axisNormals[2]);
|
glm::vec3 normal = safeNormalize(axisNormals[0] + axisNormals[1] + axisNormals[2]);
|
||||||
center /= crossingCount;
|
center /= crossingCount;
|
||||||
|
|
||||||
// use a sequence of Givens rotations to perform a QR decomposition
|
// use a sequence of Givens rotations to perform a QR decomposition
|
||||||
|
@ -1967,12 +2040,12 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
vertices.append(point);
|
vertices.append(point);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
axisNormals[0] = glm::normalize(axisNormals[0]);
|
axisNormals[0] = safeNormalize(axisNormals[0]);
|
||||||
axisNormals[1] = glm::normalize(axisNormals[1]);
|
axisNormals[1] = safeNormalize(axisNormals[1]);
|
||||||
axisNormals[2] = glm::normalize(axisNormals[2]);
|
axisNormals[2] = safeNormalize(axisNormals[2]);
|
||||||
glm::vec3 normalXY(glm::normalize(axisNormals[0] + axisNormals[1]));
|
glm::vec3 normalXY(safeNormalize(axisNormals[0] + axisNormals[1]));
|
||||||
glm::vec3 normalXZ(glm::normalize(axisNormals[0] + axisNormals[2]));
|
glm::vec3 normalXZ(safeNormalize(axisNormals[0] + axisNormals[2]));
|
||||||
glm::vec3 normalYZ(glm::normalize(axisNormals[1] + axisNormals[2]));
|
glm::vec3 normalYZ(safeNormalize(axisNormals[1] + axisNormals[2]));
|
||||||
if (glm::dot(axisNormals[0], normalXY) > CREASE_COS_NORMAL &&
|
if (glm::dot(axisNormals[0], normalXY) > CREASE_COS_NORMAL &&
|
||||||
glm::dot(axisNormals[1], normalXY) > CREASE_COS_NORMAL) {
|
glm::dot(axisNormals[1], normalXY) > CREASE_COS_NORMAL) {
|
||||||
point.setNormal(normalXY);
|
point.setNormal(normalXY);
|
||||||
|
@ -2085,8 +2158,8 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
colorZ += area;
|
colorZ += area;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buffer = new VoxelBuffer(vertices, indices, hermiteSegments,
|
||||||
buffer = new VoxelBuffer(vertices, indices, material->getMaterials());
|
material ? material->getMaterials() : QVector<SharedObjectPointer>());
|
||||||
}
|
}
|
||||||
BufferDataPointer pointer(buffer);
|
BufferDataPointer pointer(buffer);
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
|
@ -2418,7 +2491,7 @@ void SphereRenderer::renderUnclipped(const glm::vec4& color, Mode mode) {
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
glm::vec3 axis = glm::axis(rotation);
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
|
|
||||||
glutSolidSphere(sphere->getScale(), 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(sphere->getScale(), 10, 10);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ signals:
|
||||||
|
|
||||||
void rendering();
|
void rendering();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void refreshVoxelData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual MetavoxelClient* createClient(const SharedNodePointer& node);
|
virtual MetavoxelClient* createClient(const SharedNodePointer& node);
|
||||||
|
@ -99,9 +103,11 @@ public:
|
||||||
MetavoxelData getAugmentedData();
|
MetavoxelData getAugmentedData();
|
||||||
|
|
||||||
void setRenderedAugmentedData(const MetavoxelData& data) { _renderedAugmentedData = data; }
|
void setRenderedAugmentedData(const MetavoxelData& data) { _renderedAugmentedData = data; }
|
||||||
|
|
||||||
virtual int parseData(const QByteArray& packet);
|
virtual int parseData(const QByteArray& packet);
|
||||||
|
|
||||||
|
Q_INVOKABLE void refreshVoxelData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void dataChanged(const MetavoxelData& oldData);
|
virtual void dataChanged(const MetavoxelData& oldData);
|
||||||
|
@ -234,7 +240,7 @@ public:
|
||||||
class VoxelBuffer : public BufferData {
|
class VoxelBuffer : public BufferData {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices,
|
VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices, const QVector<glm::vec3>& hermite,
|
||||||
const QVector<SharedObjectPointer>& materials = QVector<SharedObjectPointer>());
|
const QVector<SharedObjectPointer>& materials = QVector<SharedObjectPointer>());
|
||||||
|
|
||||||
virtual void render(bool cursor = false);
|
virtual void render(bool cursor = false);
|
||||||
|
@ -243,10 +249,13 @@ private:
|
||||||
|
|
||||||
QVector<VoxelPoint> _vertices;
|
QVector<VoxelPoint> _vertices;
|
||||||
QVector<int> _indices;
|
QVector<int> _indices;
|
||||||
|
QVector<glm::vec3> _hermite;
|
||||||
int _vertexCount;
|
int _vertexCount;
|
||||||
int _indexCount;
|
int _indexCount;
|
||||||
|
int _hermiteCount;
|
||||||
QOpenGLBuffer _vertexBuffer;
|
QOpenGLBuffer _vertexBuffer;
|
||||||
QOpenGLBuffer _indexBuffer;
|
QOpenGLBuffer _indexBuffer;
|
||||||
|
QOpenGLBuffer _hermiteBuffer;
|
||||||
QVector<SharedObjectPointer> _materials;
|
QVector<SharedObjectPointer> _materials;
|
||||||
QVector<NetworkTexturePointer> _networkTextures;
|
QVector<NetworkTexturePointer> _networkTextures;
|
||||||
};
|
};
|
||||||
|
@ -272,6 +281,9 @@ public:
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
|
|
||||||
|
static ProgramObject& getPointProgram() { return _pointProgram; }
|
||||||
|
static int getPointScaleLocation() { return _pointScaleLocation; }
|
||||||
|
|
||||||
static ProgramObject& getBaseHeightfieldProgram() { return _baseHeightfieldProgram; }
|
static ProgramObject& getBaseHeightfieldProgram() { return _baseHeightfieldProgram; }
|
||||||
static int getBaseHeightScaleLocation() { return _baseHeightScaleLocation; }
|
static int getBaseHeightScaleLocation() { return _baseHeightScaleLocation; }
|
||||||
static int getBaseColorScaleLocation() { return _baseColorScaleLocation; }
|
static int getBaseColorScaleLocation() { return _baseColorScaleLocation; }
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "ScriptsModel.h"
|
#include "ScriptsModel.h"
|
||||||
|
|
||||||
static const QString S3_URL = "http://highfidelity-public.s3-us-west-1.amazonaws.com";
|
static const QString S3_URL = "https://s3.amazonaws.com/hifi-public";
|
||||||
static const QString PUBLIC_URL = "http://public.highfidelity.io";
|
static const QString PUBLIC_URL = "http://public.highfidelity.io";
|
||||||
static const QString MODELS_LOCATION = "scripts/";
|
static const QString MODELS_LOCATION = "scripts/";
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void ScriptsModel::requestRemoteFiles(QString marker) {
|
||||||
}
|
}
|
||||||
url.setQuery(query);
|
url.setQuery(query);
|
||||||
|
|
||||||
NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
QNetworkReply* reply = networkAccessManager.get(request);
|
QNetworkReply* reply = networkAccessManager.get(request);
|
||||||
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||||
|
|
0
interface/src/Stars.cpp
Executable file → Normal file
0
interface/src/Stars.h
Executable file → Normal file
|
@ -27,6 +27,7 @@
|
||||||
#include "ui/TextRenderer.h"
|
#include "ui/TextRenderer.h"
|
||||||
#include "VoxelConstants.h"
|
#include "VoxelConstants.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
@ -112,13 +113,13 @@ void drawVector(glm::vec3 * vector) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glTranslatef(vector->x, 0, 0);
|
glTranslatef(vector->x, 0, 0);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glColor3f(0,1,0);
|
glColor3f(0,1,0);
|
||||||
glTranslatef(-vector->x, vector->y, 0);
|
glTranslatef(-vector->x, vector->y, 0);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glColor3f(0,0,1);
|
glColor3f(0,0,1);
|
||||||
glTranslatef(0, -vector->y, vector->z);
|
glTranslatef(0, -vector->y, vector->z);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -155,22 +156,22 @@ void renderWorldBox() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(MARKER_DISTANCE, 0, 0);
|
glTranslatef(MARKER_DISTANCE, 0, 0);
|
||||||
glColor3fv(red);
|
glColor3fv(red);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, MARKER_DISTANCE, 0);
|
glTranslatef(0, MARKER_DISTANCE, 0);
|
||||||
glColor3fv(green);
|
glColor3fv(green);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, 0, MARKER_DISTANCE);
|
glTranslatef(0, 0, MARKER_DISTANCE);
|
||||||
glColor3fv(blue);
|
glColor3fv(blue);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3fv(gray);
|
glColor3fv(gray);
|
||||||
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
|
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
} else {
|
} else {
|
||||||
glTranslatef(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z);
|
glTranslatef(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z);
|
||||||
}
|
}
|
||||||
glutSolidSphere(LOOK_AT_INDICATOR_RADIUS, 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(LOOK_AT_INDICATOR_RADIUS, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,8 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(_position.x, _position.y, _position.z);
|
glTranslatef(_position.x, _position.y, _position.z);
|
||||||
glScalef(height, height, height);
|
glScalef(height, height, height);
|
||||||
glutSolidSphere(sphereRadius, 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(sphereRadius, 15, 15);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|