Merge pull request #1874 from erwincoumans/master

more egl plugin fixes, create stb_image_write.cpp (instead of magic defines in various source files)
This commit is contained in:
erwincoumans
2018-09-11 14:14:40 -07:00
committed by GitHub
23 changed files with 374 additions and 228 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

@@ -6,6 +6,9 @@ del pybullet.grpc.pb.h
..\..\..\ThirdPartyLibs\grpc\lib\win32\protoc --proto_path=. --cpp_out=. pybullet.proto
..\..\..\ThirdPartyLibs\grpc\lib\win32\protoc.exe --plugin=protoc-gen-grpc="..\..\..\ThirdPartyLibs\grpc\lib\win32\grpc_cpp_plugin.exe" --grpc_out=. pybullet.proto
rename pybullet.grpc.pb.cc pybullet.grpc.pb.cpp
rename pybullet.pb.cc pybullet.pb.cpp
del pybullet_pb2.py
del pybullet_pb2_grpc.py

View File

@@ -1,19 +1,15 @@
rm ../pybullet.pb.cpp
rm ../pybullet.pb.h
rm ../pybullet.grpc.pb.cpp
rm ../pybullet.grpc.pb.h
rm pybullet.pb.cpp
rm pybullet.pb.h
rm pybullet.grpc.pb.cpp
rm pybullet.grpc.pb.h
protoc --proto_path=. --cpp_out=. pybullet.proto
protoc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --grpc_out=. pybullet.proto
mv pybullet.grpc.pb.cc ../pybullet.grpc.pb.cpp
mv pybullet.grpc.pb.h ../pybullet.grpc.pb.h
mv pybullet.pb.cc ../pybullet.pb.cpp
mv pybullet.pb.h ../pybullet.pb.h
mv pybullet.grpc.pb.cc pybullet.grpc.pb.cpp
mv pybullet.pb.cc pybullet.pb.cpp
rm ../pybullet_pb2.py
rm ../pybullet_pb2_grpc.py
rm pybullet_pb2.py
rm pybullet_pb2_grpc.py
protoc --proto_path=. --python_out=. pybullet.proto
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. pybullet.proto
mv pybullet_pb2.py ../pybullet_pb2.py
mv pybullet_pb2_grpc.py ../pybullet_pb2_grpc.py

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,17 @@ 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
{
#if PY_MAJOR_VERSION >= 3
return 0;
#endif
}
#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",
}