Showing the changes to interface/src/Application.cpp (1 of 18 files). Show all
Unified · Split
| @@ -2301,21 +2301,6 @@ void Application::updateAvatar(float deltaTime) { · 2300 unmodified lines | ||
| 2301 | 2301 | _myAvatar.getHead().setAudioLoudness(_audio.getLastInputLoudness()); |
| 2302 | 2302 | #endif |
| 2303 | 2303 | |
| 2304 | − // Update Avatar with latest camera and view frustum data... | |
| 2305 | − // NOTE: we get this from the view frustum, to make it simpler, since the | |
| 2306 | − // loadViewFrumstum() method will get the correct details from the camera | |
| 2307 | − // We could optimize this to not actually load the viewFrustum, since we don't | |
| 2308 | − // actually need to calculate the view frustum planes to send these details | |
| 2309 | − // to the server. | |
| 2310 | − loadViewFrustum(_myCamera, _viewFrustum); | |
| 2311 | − _myAvatar.setCameraPosition(_viewFrustum.getPosition()); | |
| 2312 | − _myAvatar.setCameraOrientation(_viewFrustum.getOrientation()); | |
| 2313 | − _myAvatar.setCameraFov(_viewFrustum.getFieldOfView()); | |
| 2314 | − _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio()); | |
| 2315 | − _myAvatar.setCameraNearClip(_viewFrustum.getNearClip()); | |
| 2316 | − _myAvatar.setCameraFarClip(_viewFrustum.getFarClip()); | |
| 2317 | − _myAvatar.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition()); | |
| 2318 | − | |
| 2319 | 2304 | NodeList* nodeList = NodeList::getInstance(); |
| 2320 | 2305 | |
| 2321 | 2306 | // send head/hand data to the avatar mixer and voxel server |
| @@ -2330,7 +2315,7 @@ void Application::updateAvatar(float deltaTime) { · 8 unmodified lines | ||
| 2330 | 2315 | |
| 2331 | 2316 | endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite); |
| 2332 | 2317 | |
| 2333 | − const char nodeTypesOfInterest[] = { NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AVATAR_MIXER }; | |
| 2318 | + const char nodeTypesOfInterest[] = { NODE_TYPE_AVATAR_MIXER }; | |
| 2334 | 2319 | controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString, |
| 2335 | 2320 | nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); |
| 2336 | 2321 | |
| @@ -2339,6 +2324,48 @@ void Application::updateAvatar(float deltaTime) { · 2 unmodified lines | ||
| 2339 | 2324 | if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) { |
| 2340 | 2325 | Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL()); |
| 2341 | 2326 | } |
| 2327 | + | |
| 2328 | + // Update _viewFrustum with latest camera and view frustum data... | |
| 2329 | + // NOTE: we get this from the view frustum, to make it simpler, since the | |
| 2330 | + // loadViewFrumstum() method will get the correct details from the camera | |
| 2331 | + // We could optimize this to not actually load the viewFrustum, since we don't | |
| 2332 | + // actually need to calculate the view frustum planes to send these details | |
| 2333 | + // to the server. | |
| 2334 | + loadViewFrustum(_myCamera, _viewFrustum); | |
| 2335 | + | |
| 2336 | + // Update my voxel servers with my current voxel query... | |
| 2337 | + queryVoxels(); | |
| 2338 | +} | |
| 2339 | + | |
| 2340 | +void Application::queryVoxels() { | |
| 2341 | + // Need to update this to support multiple different servers... | |
| 2342 | + | |
| 2343 | + _voxelQuery.setCameraPosition(_viewFrustum.getPosition()); | |
| 2344 | + _voxelQuery.setCameraOrientation(_viewFrustum.getOrientation()); | |
| 2345 | + _voxelQuery.setCameraFov(_viewFrustum.getFieldOfView()); | |
| 2346 | + _voxelQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio()); | |
| 2347 | + _voxelQuery.setCameraNearClip(_viewFrustum.getNearClip()); | |
| 2348 | + _voxelQuery.setCameraFarClip(_viewFrustum.getFarClip()); | |
| 2349 | + _voxelQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition()); | |
| 2350 | + | |
| 2351 | + NodeList* nodeList = NodeList::getInstance(); | |
| 2352 | + | |
| 2353 | + // send head/hand data to the avatar mixer and voxel server | |
| 2354 | + unsigned char voxelQueryPacket[MAX_PACKET_SIZE]; | |
| 2355 | + unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; | |
| 2356 | + | |
| 2357 | + endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, PACKET_TYPE_VOXEL_QUERY); | |
| 2358 | + | |
| 2359 | + QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); | |
| 2360 | + memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); | |
| 2361 | + endOfVoxelQueryPacket += ownerUUID.size(); | |
| 2362 | + | |
| 2363 | + endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); | |
| 2364 | + | |
| 2365 | + const char nodeTypesOfInterest[] = { NODE_TYPE_VOXEL_SERVER }; | |
| 2366 | + controlledBroadcastToNodes(voxelQueryPacket, endOfVoxelQueryPacket - voxelQueryPacket, | |
| 2367 | + nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); | |
| 2368 | + | |
| 2342 | 2369 | } |
| 2343 | 2370 | |
| 2344 | 2371 | ///////////////////////////////////////////////////////////////////////////////////// |