add texture support in SDF, URDF for both OpenGL and software renderer (TinyRenderer)
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
#include "b3ImportMeshUtility.h"
|
||||
|
||||
#include <vector>
|
||||
#include "../../OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include"Wavefront/tiny_obj_loader.h"
|
||||
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "../../OpenGLWindow/SimpleOpenGL3App.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "../ImportObjDemo/Wavefront2GLInstanceGraphicsShape.h"
|
||||
#include "../../Utils/b3ResourcePath.h"
|
||||
#include "Bullet3Common/b3FileUtils.h"
|
||||
@@ -88,28 +85,4 @@ bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string&
|
||||
return false;
|
||||
}
|
||||
|
||||
int b3ImportMeshUtility::loadAndRegisterMeshFromFile(const std::string& fileName, CommonRenderInterface* renderer)
|
||||
{
|
||||
int shapeId = -1;
|
||||
|
||||
b3ImportMeshData meshData;
|
||||
if (b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(fileName, meshData))
|
||||
{
|
||||
int textureIndex = -1;
|
||||
|
||||
if (meshData.m_textureImage)
|
||||
{
|
||||
textureIndex = renderer->registerTexture(meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight);
|
||||
}
|
||||
|
||||
shapeId = renderer->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0],
|
||||
meshData.m_gfxShape->m_numvertices,
|
||||
&meshData.m_gfxShape->m_indices->at(0),
|
||||
meshData.m_gfxShape->m_numIndices,
|
||||
B3_GL_TRIANGLES,
|
||||
textureIndex);
|
||||
delete meshData.m_gfxShape;
|
||||
delete meshData.m_textureImage;
|
||||
}
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user