move stb_image/stb_image_write.cpp into a cpp file instead of random files with the magic 'STB_IMAGE_WRITE_IMPLEMENTATION' define

move setup.py back to eglRenderer extension, use pkgutil.get_loader('eglRenderer').get_filename()
disable dlmopen by default, unless B3_USE_DLMOPEN is defined.
This commit is contained in:
erwincoumans
2018-09-10 23:18:34 -07:00
parent f26d4fdc4c
commit 684a9f6a99
19 changed files with 210 additions and 44 deletions

View File

@@ -18,13 +18,13 @@
#define B3_DYNLIB_IMPORT GetProcAddress
#else
#include <dlfcn.h>
typedef void* B3_DYNLIB_HANDLE;
#ifdef __APPLE__
#define B3_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
#else
#ifdef B3_USE_DLMOPEN
#define B3_DYNLIB_OPEN(path) dlmopen(LM_ID_NEWLM, path, RTLD_LAZY)
#else
#define B3_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
#endif
#define B3_DYNLIB_CLOSE dlclose
#define B3_DYNLIB_IMPORT dlsym
@@ -40,16 +40,16 @@ struct b3Plugin
PFN_INIT m_initFunc;
PFN_EXIT m_exitFunc;
PFN_EXECUTE m_executeCommandFunc;
PFN_TICK m_preTickFunc;
PFN_TICK m_postTickFunc;
PFN_TICK m_processNotificationsFunc;
PFN_TICK m_processClientCommandsFunc;
PFN_GET_RENDER_INTERFACE m_getRendererFunc;
void* m_userPointer;
b3Plugin()
:m_pluginHandle(0),
m_ownsPluginHandle(false),
@@ -332,7 +332,7 @@ void b3PluginManager::tickPlugins(double timeStep, b3PluginManagerTickMode tickM
{
continue;
}
PFN_TICK tick = 0;
switch (tickMode)
{
@@ -355,7 +355,7 @@ void b3PluginManager::tickPlugins(double timeStep, b3PluginManagerTickMode tickM
{
}
}
if (tick)
{
b3PluginContext context = { 0 };
@@ -437,7 +437,7 @@ int b3PluginManager::registerStaticLinkedPlugin(const char* pluginPath, PFN_INIT
{
b3Plugin orgPlugin;
int pluginUniqueId = m_data->m_plugins.allocHandle();
b3PluginHandle* pluginHandle = m_data->m_plugins.getHandle(pluginUniqueId);
pluginHandle->m_pluginHandle = 0;
@@ -453,7 +453,7 @@ int b3PluginManager::registerStaticLinkedPlugin(const char* pluginPath, PFN_INIT
pluginHandle->m_pluginHandle = 0;
pluginHandle->m_pluginPath = pluginPath;
pluginHandle->m_userPointer = 0;
if (pluginHandle->m_processNotificationsFunc)
{

View File

@@ -1,4 +1,12 @@
#ifdef EGL_ADD_PYTHON_INIT
#if defined(__APPLE__) && (!defined(B3_NO_PYTHON_FRAMEWORK))
#include <Python/Python.h>
#else
#include <Python.h>
#endif
#endif //EGL_ADD_PYTHON_INIT
//eglRenderer plugin
//see Bullet/examples/pybullet/examples/eglRendererTest.py
@@ -52,3 +60,15 @@ B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_eglRendererPlugi
return &obj->m_renderer;
}
#ifdef EGL_ADD_PYTHON_INIT
PyMODINIT_FUNC
#if PY_MAJOR_VERSION >= 3
PyInit_eglRenderer(void)
#else
initeglRenderer(void)
#endif
{
return 0;
}
#endif //EGL_ADD_PYTHON_INIT

View File

@@ -795,7 +795,7 @@ void EGLRendererVisualShapeConverter::convertVisualShapes(
// register mesh to m_instancingRenderer too.
int shapeIndex = m_data->m_instancingRenderer->registerShape(&vertices[0].xyzw[0], vertices.size(), &indices[0], indices.size(),B3_GL_TRIANGLES, textureIndex);
btVector3 scaling(1,1,1);
double scaling[3]={1,1,1};
visuals->m_graphicsInstanceId = m_data->m_instancingRenderer->registerGraphicsInstance(shapeIndex, &visualShape.m_localVisualFrame[0], &visualShape.m_localVisualFrame[3], &visualShape.m_rgbaColor[0],scaling);
m_data->m_instancingRenderer->writeTransforms();

View File

@@ -6,7 +6,7 @@ project ("pybullet_eglRendererPlugin")
initEGL()
includedirs {".","../../../../src", "../../../../examples",
"../../../ThirdPartyLibs", "../../examples/ThirdPartyLibs/glad"}
"../../../ThirdPartyLibs", "../../../ThirdPartyLibs/glad"}
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER", "STB_AGAIN"}
hasCL = findOpenCL("clew")
@@ -25,7 +25,8 @@ project ("pybullet_eglRendererPlugin")
end
if os.is("Linux") then
files {"../../../ThirdPartyLibs/glad/glx.c",}
files {"../../../OpenGLWindow/EGLOpenGLWindow.cpp"}
end
files {

View File

@@ -98,7 +98,8 @@ myfiles =
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
"../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
"../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
"../ThirdPartyLibs/stb_image/stb_image.cpp",
"../ThirdPartyLibs/stb_image/stb_image.cpp",
"../ThirdPartyLibs/stb_image/stb_image_write.cpp",
}