History

first cut at splitting out PACKET_TYPE_VOXEL_QUERY from PACKET_TYPE_HEAD_DATA

ZappoMan committed 13 years ago

Commit 015adee1 parent ba5db3218 files · +509 −313Browse files

Showing the changes to interface/src/Application.cpp (1 of 18 files). Show all

Unified · Split

interface/src/Application.cpp+43−16
@@ -2301,21 +2301,6 @@ void Application::updateAvatar(float deltaTime) { · 2300 unmodified lines
23012301 _myAvatar.getHead().setAudioLoudness(_audio.getLastInputLoudness());
23022302 #endif
23032303
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−
23192304 NodeList* nodeList = NodeList::getInstance();
23202305
23212306 // send head/hand data to the avatar mixer and voxel server
@@ -2330,7 +2315,7 @@ void Application::updateAvatar(float deltaTime) { · 8 unmodified lines
23302315
23312316 endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
23322317
2333− const char nodeTypesOfInterest[] = { NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AVATAR_MIXER };
2318+ const char nodeTypesOfInterest[] = { NODE_TYPE_AVATAR_MIXER };
23342319 controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
23352320 nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
23362321
@@ -2339,6 +2324,48 @@ void Application::updateAvatar(float deltaTime) { · 2 unmodified lines
23392324 if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) {
23402325 Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL());
23412326 }
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+
23422369 }
23432370
23442371 /////////////////////////////////////////////////////////////////////////////////////

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t