Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -13,49 +13,46 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "../CommonInterfaces/CommonExampleInterface.h"
|
||||
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
||||
#include "../Utils/b3Clock.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#include "../OpenGLWindow/SimpleOpenGL3App.h"
|
||||
#include <stdio.h>
|
||||
#include "../ExampleBrowser/OpenGLGuiHelper.h"
|
||||
|
||||
CommonExampleInterface* example;
|
||||
int gSharedMemoryKey=-1;
|
||||
CommonExampleInterface* example;
|
||||
int gSharedMemoryKey = -1;
|
||||
|
||||
b3MouseMoveCallback prevMouseMoveCallback = 0;
|
||||
static void OnMouseMove( float x, float y)
|
||||
static void OnMouseMove(float x, float y)
|
||||
{
|
||||
bool handled = false;
|
||||
handled = example->mouseMoveCallback(x,y);
|
||||
bool handled = false;
|
||||
handled = example->mouseMoveCallback(x, y);
|
||||
if (!handled)
|
||||
{
|
||||
if (prevMouseMoveCallback)
|
||||
prevMouseMoveCallback (x,y);
|
||||
prevMouseMoveCallback(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
b3MouseButtonCallback prevMouseButtonCallback = 0;
|
||||
static void OnMouseDown(int button, int state, float x, float y) {
|
||||
b3MouseButtonCallback prevMouseButtonCallback = 0;
|
||||
static void OnMouseDown(int button, int state, float x, float y)
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
handled = example->mouseButtonCallback(button, state, x,y);
|
||||
handled = example->mouseButtonCallback(button, state, x, y);
|
||||
if (!handled)
|
||||
{
|
||||
if (prevMouseButtonCallback )
|
||||
prevMouseButtonCallback (button,state,x,y);
|
||||
if (prevMouseButtonCallback)
|
||||
prevMouseButtonCallback(button, state, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
class LessDummyGuiHelper : public DummyGUIHelper
|
||||
{
|
||||
CommonGraphicsApp* m_app;
|
||||
|
||||
public:
|
||||
virtual CommonGraphicsApp* getAppInterface()
|
||||
{
|
||||
@@ -63,54 +60,52 @@ public:
|
||||
}
|
||||
|
||||
LessDummyGuiHelper(CommonGraphicsApp* app)
|
||||
:m_app(app)
|
||||
: m_app(app)
|
||||
{
|
||||
}
|
||||
};
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
SimpleOpenGL3App* app = new SimpleOpenGL3App("Bullet Standalone Example",1024,768,true);
|
||||
|
||||
SimpleOpenGL3App* app = new SimpleOpenGL3App("Bullet Standalone Example", 1024, 768, true);
|
||||
|
||||
prevMouseButtonCallback = app->m_window->getMouseButtonCallback();
|
||||
prevMouseMoveCallback = app->m_window->getMouseMoveCallback();
|
||||
|
||||
app->m_window->setMouseButtonCallback((b3MouseButtonCallback)OnMouseDown);
|
||||
app->m_window->setMouseMoveCallback((b3MouseMoveCallback)OnMouseMove);
|
||||
|
||||
OpenGLGuiHelper gui(app,false);
|
||||
|
||||
OpenGLGuiHelper gui(app, false);
|
||||
//LessDummyGuiHelper gui(app);
|
||||
//DummyGUIHelper gui;
|
||||
|
||||
CommonExampleOptions options(&gui);
|
||||
|
||||
|
||||
example = StandaloneExampleCreateFunc(options);
|
||||
example->processCommandLineArgs(argc, argv);
|
||||
|
||||
example->initPhysics();
|
||||
example->resetCamera();
|
||||
|
||||
|
||||
b3Clock clock;
|
||||
|
||||
do
|
||||
{
|
||||
app->m_instancingRenderer->init();
|
||||
app->m_instancingRenderer->updateCamera(app->getUpAxis());
|
||||
app->m_instancingRenderer->updateCamera(app->getUpAxis());
|
||||
|
||||
btScalar dtSec = btScalar(clock.getTimeInSeconds());
|
||||
if (dtSec<0.1)
|
||||
if (dtSec < 0.1)
|
||||
dtSec = 0.1;
|
||||
|
||||
|
||||
example->stepSimulation(dtSec);
|
||||
clock.reset();
|
||||
clock.reset();
|
||||
|
||||
example->renderScene();
|
||||
|
||||
|
||||
DrawGridData dg;
|
||||
dg.upAxis = app->getUpAxis();
|
||||
dg.upAxis = app->getUpAxis();
|
||||
app->drawGrid(dg);
|
||||
|
||||
|
||||
app->swapBuffer();
|
||||
} while (!app->m_window->requestedExit());
|
||||
|
||||
@@ -119,4 +114,3 @@ int main(int argc, char* argv[])
|
||||
delete app;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user