History

resolve conflicts on merge, add cstring inc

Stephen Birarda committed 11 years ago

Commit dfb02ae2 parents ba09bba 315b932188 files · +5596 −1978Browse files

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

Unified · Split

interface/src/Application.cpp+41−15
@@ -71,6 +71,7 @@ · 70 unmodified lines
7171 #include <PacketHeaders.h>
7272 #include <PathUtils.h>
7373 #include <PerfStat.h>
74+#include <PhysicsEngine.h>
7475 #include <ProgramObject.h>
7576 #include <ResourceCache.h>
7677 #include <SoundCache.h>
@@ -157,6 +158,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 80 unmodified lines
157158 _voxelImporter(),
158159 _importSucceded(false),
159160 _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard),
161+#ifdef USE_BULLET_PHYSICS
162+ _physicsEngine(glm::vec3(0.0f)),
163+#endif // USE_BULLET_PHYSICS
160164 _entities(true, this, this),
161165 _entityCollisionSystem(),
162166 _entityClipboardRenderer(false, this, this),
@@ -2028,6 +2032,12 @@ void Application::init() { · 1865 unmodified lines
20282032 // save settings when avatar changes
20292033 connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
20302034
2035+#ifdef USE_BULLET_PHYSICS
2036+ EntityTree* tree = _entities.getTree();
2037+ _physicsEngine.setEntityTree(tree);
2038+ tree->setSimulation(&_physicsEngine);
2039+ _physicsEngine.init(&_entityEditSender);
2040+#endif // USE_BULLET_PHYSICS
20312041 // make sure our texture cache knows about window size changes
20322042 DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
20332043
@@ -2337,6 +2347,13 @@ void Application::update(float deltaTime) { · 303 unmodified lines
23372347 updateDialogs(deltaTime); // update various stats dialogs if present
23382348 updateCursor(deltaTime); // Handle cursor updates
23392349
2350+#ifdef USE_BULLET_PHYSICS
2351+ {
2352+ PerformanceTimer perfTimer("physics");
2353+ _physicsEngine.stepSimulation();
2354+ }
2355+#endif // USE_BULLET_PHYSICS
2356+
23402357 if (!_aboutToQuit) {
23412358 PerformanceTimer perfTimer("entities");
23422359 // NOTE: the _entities.update() call below will wait for lock
@@ -2880,18 +2897,18 @@ void Application::updateShadowMap() { · 537 unmodified lines
28802897
28812898 {
28822899 PerformanceTimer perfTimer("entities");
2883− _entities.render(RenderArgs::SHADOW_RENDER_MODE);
2900+ // _entities.render(RenderArgs::SHADOW_RENDER_MODE);
28842901 }
28852902
28862903 // render JS/scriptable overlays
28872904 {
28882905 PerformanceTimer perfTimer("3dOverlays");
2889− _overlays.render3D(false, RenderArgs::SHADOW_RENDER_MODE);
2906+ _overlays.renderWorld(false, RenderArgs::SHADOW_RENDER_MODE);
28902907 }
28912908
28922909 {
28932910 PerformanceTimer perfTimer("3dOverlaysFront");
2894− _overlays.render3D(true, RenderArgs::SHADOW_RENDER_MODE);
2911+ _overlays.renderWorld(true, RenderArgs::SHADOW_RENDER_MODE);
28952912 }
28962913
28972914 glDisable(GL_POLYGON_OFFSET_FILL);
@@ -3119,7 +3136,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 221 unmodified lines
31193136 // render JS/scriptable overlays
31203137 {
31213138 PerformanceTimer perfTimer("3dOverlays");
3122− _overlays.render3D(false);
3139+ _overlays.renderWorld(false);
31233140 }
31243141
31253142 // render the ambient occlusion effect if enabled
@@ -3208,7 +3225,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 82 unmodified lines
32083225 {
32093226 PerformanceTimer perfTimer("3dOverlaysFront");
32103227 glClear(GL_DEPTH_BUFFER_BIT);
3211− _overlays.render3D(true);
3228+ _overlays.renderWorld(true);
32123229 }
32133230 }
32143231
@@ -3626,16 +3643,6 @@ void Application::updateWindowTitle(){ · 411 unmodified lines
36263643 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
36273644 + DependencyManager::get<AddressManager>()->getCurrentDomain() + connectionStatus + buildVersion;
36283645
3629− AccountManager& accountManager = AccountManager::getInstance();
3630− if (accountManager.getAccountInfo().hasBalance()) {
3631− float creditBalance = accountManager.getAccountInfo().getBalance() / SATOSHIS_PER_CREDIT;
3632−
3633− QString creditBalanceString;
3634− creditBalanceString.sprintf("%.8f", creditBalance);
3635−
3636− title += " - ₵" + creditBalanceString;
3637− }
3638−
36393646 #ifndef WIN32
36403647 // crashes with vs2013/win32
36413648 qDebug("Application title set to: %s", title.toStdString().c_str());
@@ -4197,6 +4204,25 @@ void Application::openUrl(const QUrl& url) { · 555 unmodified lines
41974204 }
41984205 }
41994206
4207+void Application::updateMyAvatarTransform() {
4208+ bumpSettings();
4209+#ifdef USE_BULLET_PHYSICS
4210+ const float SIMULATION_OFFSET_QUANTIZATION = 16.0f; // meters
4211+ glm::vec3 avatarPosition = _myAvatar->getPosition();
4212+ glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset();
4213+ if (glm::distance(avatarPosition, physicsWorldOffset) > SIMULATION_OFFSET_QUANTIZATION) {
4214+ glm::vec3 newOriginOffset = avatarPosition;
4215+ int halfExtent = (int)HALF_SIMULATION_EXTENT;
4216+ for (int i = 0; i < 3; ++i) {
4217+ newOriginOffset[i] = (float)(glm::max(halfExtent,
4218+ ((int)(avatarPosition[i] / SIMULATION_OFFSET_QUANTIZATION)) * (int)SIMULATION_OFFSET_QUANTIZATION));
4219+ }
4220+ // TODO: Andrew to replace this with method that actually moves existing object positions in PhysicsEngine
4221+ _physicsEngine.setOriginOffset(newOriginOffset);
4222+ }
4223+#endif // USE_BULLET_PHYSICS
4224+}
4225+
42004226 void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {
42014227
42024228 // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed

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