History

merge

atlante45 committed 13 years ago

Commit b8c18be2 parents 5da525f f0bb42a14 files · +192 −151Browse files

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

Unified · Split

interface/src/Application.cpp+37−34
@@ -82,7 +82,6 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2; · 81 unmodified lines
82 // Startup optimistically with small jitter buffer that 82 // Startup optimistically with small jitter buffer that
83 // will start playback on the second received audio packet.83 // will start playback on the second received audio packet.
84 84
85static const float CLIPBOARD_TREE_SCALE = 1.0f;
86 85
87void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {86void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
88 fprintf(stdout, "%s", message.toLocal8Bit().constData());87 fprintf(stdout, "%s", message.toLocal8Bit().constData());
@@ -97,7 +96,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 8 unmodified lines
97 _frameCount(0),96 _frameCount(0),
98 _fps(120.0f),97 _fps(120.0f),
99 _justStarted(true),98 _justStarted(true),
100 _clipboard(CLIPBOARD_TREE_SCALE),
101 _voxelImporter(_window),99 _voxelImporter(_window),
102 _wantToKillLocalVoxels(false),100 _wantToKillLocalVoxels(false),
103 _audioScope(256, 200, true),101 _audioScope(256, 200, true),
@@ -238,6 +236,8 @@ Application::~Application() { · 134 unmodified lines
238 NodeList::getInstance()->removeHook(&_voxels);236 NodeList::getInstance()->removeHook(&_voxels);
239 NodeList::getInstance()->removeHook(this);237 NodeList::getInstance()->removeHook(this);
240 238
239 _sharedVoxelSystem.changeTree(new VoxelTree);
240
241 delete Menu::getInstance();241 delete Menu::getInstance();
242 242
243 delete _oculusProgram;243 delete _oculusProgram;
@@ -1215,15 +1215,6 @@ void Application::exportVoxels() { · 971 unmodified lines
1215void Application::importVoxels() {1215void Application::importVoxels() {
1216 if (_voxelImporter.exec()) {1216 if (_voxelImporter.exec()) {
1217 qDebug("[DEBUG] Import succedded.\n");1217 qDebug("[DEBUG] Import succedded.\n");
1218
1219 if (_voxelImporter.getImportIntoClipboard()) {
1220 _clipboard.killLocalVoxels();
1221 _voxelImporter.getVoxelSystem()->copySubTreeIntoNewTree(
1222 _voxelImporter.getVoxelSystem()->getVoxelAt(0, 0, 0, 1),
1223 &_clipboard,
1224 true);
1225 _voxelImporter.reset();
1226 }
1227 } else {1218 } else {
1228 qDebug("[DEBUG] Import failed.\n");1219 qDebug("[DEBUG] Import failed.\n");
1229 }1220 }
@@ -1238,13 +1229,17 @@ void Application::cutVoxels() { · 8 unmodified lines
1238}1229}
1239 1230
1240void Application::copyVoxels() {1231void Application::copyVoxels() {
1232 // switch to and clear the clipboard first...
1233 _sharedVoxelSystem.killLocalVoxels();
1234 if (_sharedVoxelSystem.getTree() != &_clipboard) {
1235 _clipboard.eraseAllVoxels();
1236 _sharedVoxelSystem.changeTree(&_clipboard);
1237 }
1238
1239 // then copy onto it if there is something to copy
1241 VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);1240 VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
1242 if (selectedNode) {1241 if (selectedNode) {
1243 // clear the clipboard first...1242 _voxels.copySubTreeIntoNewTree(selectedNode, &_sharedVoxelSystem, true);
1244 _clipboard.killLocalVoxels();
1245
1246 // then copy onto it
1247 _voxels.copySubTreeIntoNewTree(selectedNode, &_clipboard, true);
1248 }1243 }
1249}1244}
1250 1245
@@ -1265,12 +1260,13 @@ void Application::pasteVoxels() { · 14 unmodified lines
1265 args.newBaseOctCode = calculatedOctCode = pointToVoxel(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);1260 args.newBaseOctCode = calculatedOctCode = pointToVoxel(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
1266 }1261 }
1267 1262
1268 if (_voxelImporter.getImportWaiting()) {1263 _sharedVoxelSystem.getTree()->recurseTreeWithOperation(sendVoxelsOperation, &args);
1269 _voxelImporter.getVoxelSystem()->recurseTreeWithOperation(sendVoxelsOperation, &args);1264
1270 _voxelImporter.reset();1265 if (_sharedVoxelSystem.getTree() != &_clipboard) {
1271 } else {1266 _sharedVoxelSystem.killLocalVoxels();
1272 _clipboard.recurseTreeWithOperation(sendVoxelsOperation, &args);1267 _sharedVoxelSystem.changeTree(&_clipboard);
1273 }1268 }
1269
1274 _voxelEditSender.flushQueue();1270 _voxelEditSender.flushQueue();
1275 1271
1276 if (calculatedOctCode) {1272 if (calculatedOctCode) {
@@ -1312,10 +1308,21 @@ void Application::initDisplay() { · 35 unmodified lines
1312 1308
1313void Application::init() {1309void Application::init() {
1314 _voxels.init();1310 _voxels.init();
1315 _clipboard.init();1311 _sharedVoxelSystemViewFrustum.setPosition(glm::vec3(TREE_SCALE / 2.0f,
1316 _clipboardViewFrustum.setKeyholeRadius(1000.0f);1312 TREE_SCALE / 2.0f,
1317 _clipboardViewFrustum.calculate();1313 3.0f * TREE_SCALE / 2.0f));
1318 _clipboard.setViewFrustum(&_clipboardViewFrustum);1314 _sharedVoxelSystemViewFrustum.setNearClip(TREE_SCALE / 2.0f);
1315 _sharedVoxelSystemViewFrustum.setFarClip(3.0f * TREE_SCALE / 2.0f);
1316 _sharedVoxelSystemViewFrustum.setFieldOfView(90);
1317 _sharedVoxelSystemViewFrustum.setOrientation(glm::quat());
1318 _sharedVoxelSystemViewFrustum.calculate();
1319 _sharedVoxelSystem.setViewFrustum(&_sharedVoxelSystemViewFrustum);
1320 _sharedVoxelSystem.init();
1321 VoxelTree* tmpTree = _sharedVoxelSystem.getTree();
1322 _sharedVoxelSystem.changeTree(&_clipboard);
1323 delete tmpTree;
1324
1325 _voxelImporter.init();
1319 1326
1320 _environment.init();1327 _environment.init();
1321 1328
@@ -1326,6 +1333,7 @@ void Application::init() { · 4 unmodified lines
1326 1333
1327 _headMouseX = _mouseX = _glWidget->width() / 2;1334 _headMouseX = _mouseX = _glWidget->width() / 2;
1328 _headMouseY = _mouseY = _glWidget->height() / 2;1335 _headMouseY = _mouseY = _glWidget->height() / 2;
1336 QCursor::setPos(_headMouseX, _headMouseY);
1329 1337
1330 _myAvatar.init();1338 _myAvatar.init();
1331 _myAvatar.setPosition(START_LOCATION);1339 _myAvatar.setPosition(START_LOCATION);
@@ -1333,7 +1341,6 @@ void Application::init() { · 1 unmodified line
1333 _myCamera.setModeShiftRate(1.0f);1341 _myCamera.setModeShiftRate(1.0f);
1334 _myAvatar.setDisplayingLookatVectors(false); 1342 _myAvatar.setDisplayingLookatVectors(false);
1335 1343
1336 QCursor::setPos(_headMouseX, _headMouseY);
1337 1344
1338 OculusManager::connect();1345 OculusManager::connect();
1339 if (OculusManager::isConnected()) {1346 if (OculusManager::isConnected()) {
@@ -2233,15 +2240,11 @@ void Application::displaySide(Camera& whichCamera) { · 893 unmodified lines
2233 glTranslatef(_mouseVoxel.x * TREE_SCALE,2240 glTranslatef(_mouseVoxel.x * TREE_SCALE,
2234 _mouseVoxel.y * TREE_SCALE,2241 _mouseVoxel.y * TREE_SCALE,
2235 _mouseVoxel.z * TREE_SCALE);2242 _mouseVoxel.z * TREE_SCALE);
2236 glScalef(_mouseVoxel.s * TREE_SCALE,2243 glScalef(_mouseVoxel.s,
2237 _mouseVoxel.s * TREE_SCALE,2244 _mouseVoxel.s,
2238 _mouseVoxel.s * TREE_SCALE);2245 _mouseVoxel.s);
2239 2246
2240 if (_voxelImporter.getImportWaiting()) {2247 _sharedVoxelSystem.render(true);
2241 _voxelImporter.getVoxelSystem()->render(true);
2242 } else {
2243 _clipboard.render(true);
2244 }
2245 glPopMatrix();2248 glPopMatrix();
2246 }2249 }
2247 2250

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