add Obj and STL import demo, work on URDF import

This commit is contained in:
Erwin Coumans
2014-08-03 13:45:05 -07:00
parent 35fa146f13
commit ae98ffe218
18 changed files with 1196 additions and 71 deletions

View File

@@ -379,7 +379,8 @@ GLInstancingRenderer::GLInstancingRenderer(int maxNumObjectCapacity, int maxShap
m_textureenabled(true),
m_textureinitialized(false),
m_screenWidth(0),
m_screenHeight(0)
m_screenHeight(0),
m_upAxis(1)
{
m_data = new InternalDataRenderer;
@@ -1068,6 +1069,7 @@ void GLInstancingRenderer::updateCamera(int upAxis)
b3Assert(glGetError() ==GL_NO_ERROR);
m_upAxis = upAxis;
int m_forwardAxis(-1);
switch (upAxis)
{

View File

@@ -52,6 +52,8 @@ class GLInstancingRenderer
int m_screenWidth;
int m_screenHeight;
int m_upAxis;
void renderSceneInternal(int renderMode=B3_DEFAULT_RENDERMODE);

View File

@@ -42,6 +42,7 @@ struct SimpleInternalData
FILE* m_ffmpegFile;
GLRenderToTexture* m_renderTexture;
void* m_userPointer;
int m_upAxis;//y=1 or z=2 is supported
};
@@ -85,6 +86,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
m_data->m_renderTexture = 0;
m_data->m_ffmpegFile = 0;
m_data->m_userPointer = 0;
m_data->m_upAxis = 1;
m_window = new b3gDefaultOpenGLWindow();
b3gWindowConstructionInfo ci;
@@ -123,7 +125,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
b3Assert(glGetError() ==GL_NO_ERROR);
m_instancingRenderer = new GLInstancingRenderer(128*1024,4*1024*1024);
m_instancingRenderer = new GLInstancingRenderer(128*1024,32*1024*1024);
m_instancingRenderer->init();
m_instancingRenderer->resize(width,height);
@@ -562,3 +564,15 @@ void SimpleOpenGL3App::dumpNextFrameToPng(const char* filename)
bool result = m_data->m_renderTexture->enable();
*/
}
void SimpleOpenGL3App::setUpAxis(int axis)
{
b3Assert((axis == 1)||(axis==2));//only Y or Z is supported at the moment
m_data->m_upAxis = axis;
}
int SimpleOpenGL3App::getUpAxis() const
{
return m_data->m_upAxis;
}

View File

@@ -43,6 +43,9 @@ struct SimpleOpenGL3App
void dumpFramesToVideo(const char* mp4Filename);
void drawGrid(DrawGridData data=DrawGridData());
void setUpAxis(int axis);
int getUpAxis() const;
void swapBuffer();
void drawText( const char* txt, int posX, int posY);
struct sth_stash* getFontStash();