Merge pull request #369 from erwincoumans/master

use wall-time delta time for examples, fix btDbvt (disable memmove)
This commit is contained in:
erwincoumans
2015-05-04 17:22:46 -07:00
5 changed files with 23 additions and 21 deletions

View File

@@ -364,10 +364,10 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
m_data->m_explorerTreeCtrl = ctrl;
ctrl->SetKeyboardInputEnabled(true);
ctrl->Focus();
ctrl->SetBounds(2, 10, 236, 400);
ctrl->SetBounds(2, 10, 236, 300);
m_data->m_exampleInfoGroupBox = new Gwen::Controls::Label( m_data->m_explorerPage->GetPage() );
m_data->m_exampleInfoGroupBox->SetPos(2, 414);
m_data->m_exampleInfoGroupBox->SetPos(2, 314);
m_data->m_exampleInfoGroupBox->SetHeight( 15 );
m_data->m_exampleInfoGroupBox->SetWidth(234);
m_data->m_exampleInfoGroupBox->SetText("Example Description");
@@ -376,7 +376,7 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
//m_data->m_exampleInfoTextOutput->Dock( Gwen::Pos::Bottom );
m_data->m_exampleInfoTextOutput->SetPos(2, 432);
m_data->m_exampleInfoTextOutput->SetPos(2, 332);
m_data->m_exampleInfoTextOutput->SetHeight( 150 );
m_data->m_exampleInfoTextOutput->SetWidth(233);

View File

@@ -12,22 +12,25 @@
#include "../Utils/b3Clock.h"
#include "ExampleEntries.h"
#include "Bullet3Common/b3Logging.h"
int main(int argc, char* argv[])
{
b3CommandLineArgs args(argc,argv);
b3Clock clock;
ExampleEntries examples;
examples.initExampleEntries();
ExampleBrowserInterface* exampleBrowser = new DefaultBrowser(&examples);
bool init = exampleBrowser->init(argc,argv);
clock.reset();
if (init)
{
do
{
float deltaTimeInSeconds = 1./120.f;
float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
clock.reset();
exampleBrowser->update(deltaTimeInSeconds);
} while (!exampleBrowser->requestedExit());

View File

@@ -291,4 +291,4 @@ class CommonExampleInterface* ImportURDFCreateFunc(struct CommonExampleOption
{
return new ImportUrdfSetup(options.m_guiHelper, options.m_option,options.m_fileName);
}
}

View File

@@ -66,7 +66,7 @@ struct MyURDFInternalData
my_shared_ptr<ModelInterface> m_robot;
std::vector<my_shared_ptr<Link> > m_links;
struct GUIHelperInterface* m_guiHelper;
const char* m_pathPrefix;
char m_pathPrefix[1024];
};
@@ -89,7 +89,7 @@ MyURDFImporter::MyURDFImporter(struct GUIHelperInterface* helper)
m_data = new MyURDFInternalData;
m_data->m_robot = 0;
m_data->m_guiHelper = helper;
m_data->m_pathPrefix=0;
m_data->m_pathPrefix[0]=0;
@@ -107,9 +107,8 @@ bool MyURDFImporter::loadURDF(const char* fileName)
bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
std::string xml_string;
char pathPrefix[1024];
pathPrefix[0] = 0;
m_data->m_pathPrefix[0] = 0;
if (!fileFound){
std::cerr << "URDF file not found" << std::endl;
return false;
@@ -117,7 +116,7 @@ bool MyURDFImporter::loadURDF(const char* fileName)
{
int maxPathLen = 1024;
fu.extractPath(relativeFileName,pathPrefix,maxPathLen);
fu.extractPath(relativeFileName,m_data->m_pathPrefix,maxPathLen);
std::fstream xml_file(relativeFileName, std::fstream::in);

View File

@@ -1196,23 +1196,23 @@ inline void btDbvt::collideOCL( const btDbvtNode* root,
//void * memmove ( void * destination, const void * source, size_t num );
#if DBVT_USE_MEMMOVE
memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
#else
//#if DBVT_USE_MEMMOVE
// memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
//#else
for(int k=stack.size()-1;k>j;--k)
{
stack[k]=stack[k-1];
}
#endif
//#endif
stack[j]=allocate(ifree,stock,nes[q]);
/* Insert 1 */
j=nearest(&stack[0],&stock[0],nes[1-q].value,j,stack.size());
stack.push_back(0);
#if DBVT_USE_MEMMOVE
memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
#else
//#if DBVT_USE_MEMMOVE
// memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
//#else
for(int k=stack.size()-1;k>j;--k) stack[k]=stack[k-1];
#endif
//#endif
stack[j]=allocate(ifree,stock,nes[1-q]);
}
else