Merge pull request #2953 from erwincoumans/master

improve premake4 build in case X11 headers are missing
This commit is contained in:
erwincoumans 2020-07-24 18:11:10 -07:00 committed by GitHub
commit 579115cf9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 3 deletions

View File

@ -43,6 +43,21 @@
configuration{}
end
function initX11()
if os.is("Linux") then
if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
links{"X11","pthread"}
else
print("No X11/X.h found, using dynamic loading of X11")
includedirs {
projectRootDir .. "examples/ThirdPartyLibs/optionalX11"
}
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
links {"dl","pthread"}
end
end
end
function initX11()
if os.is("Linux") then
@ -79,7 +94,7 @@
if os.is("Linux") then
configuration{"Linux"}
initX11()
initX11()
if _OPTIONS["enable_system_glx"] then --# and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/glx.h")) then
links{"pthread"}
print("Using system GL/glx.h")
@ -103,3 +118,4 @@
configuration{}
end

View File

@ -2309,6 +2309,29 @@ int b3RobotSimulatorClientAPI_NoDirect::createCollisionShape(int shapeType, stru
scalarToDouble3(args.m_meshScale, meshScale);
shapeIndex = b3CreateCollisionShapeAddMesh(command, args.m_fileName, meshScale);
}
if (shapeType == GEOM_HEIGHTFIELD)
{
double meshScale[3];
scalarToDouble3(args.m_meshScale, meshScale);
if (args.m_fileName)
{
shapeIndex = b3CreateCollisionShapeAddHeightfield(command, args.m_fileName, meshScale, args.m_heightfieldTextureScaling);
}
else
{
if (args.m_heightfieldData.size() && args.m_numHeightfieldRows>0 && args.m_numHeightfieldColumns>0)
{
shapeIndex = b3CreateCollisionShapeAddHeightfield2(sm, command, meshScale, args.m_heightfieldTextureScaling,
&args.m_heightfieldData[0],
args.m_numHeightfieldRows,
args.m_numHeightfieldColumns,
args.m_replaceHeightfieldIndex);
}
}
}
if (shapeType == GEOM_PLANE)
{
double planeConstant = 0;

View File

@ -471,12 +471,23 @@ struct b3RobotSimulatorCreateCollisionShapeArgs
btVector3 m_meshScale;
btVector3 m_planeNormal;
int m_flags;
double m_heightfieldTextureScaling;
btAlignedObjectArray<float> m_heightfieldData;
int m_numHeightfieldRows;
int m_numHeightfieldColumns;
int m_replaceHeightfieldIndex;
b3RobotSimulatorCreateCollisionShapeArgs()
: m_shapeType(-1),
m_radius(0.5),
m_height(1),
m_fileName(NULL),
m_flags(0)
m_flags(0),
m_heightfieldTextureScaling(1),
m_numHeightfieldRows(0),
m_numHeightfieldColumns(0),
m_replaceHeightfieldIndex(-1)
{
m_halfExtents.m_floats[0] = 1;
m_halfExtents.m_floats[1] = 1;

View File

@ -2,10 +2,15 @@ import pybullet as p
import time
import pybullet_data
#Once the video is recorded, you can extract all individual frames using ffmpeg
#mkdir frames
#ffmpeg -i test.mp4 "frames/out-%03d.png"
#by default, PyBullet runs at 240Hz
p.connect(p.GUI, options="--mp4=\"test.mp4\" --mp4fps=240")
p.connect(p.GUI, options="--width=1920 --height=1080 --mp4=\"test.mp4\" --mp4fps=240")
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.configureDebugVisualizer(p.COV_ENABLE_GUI,0)
p.configureDebugVisualizer(p.COV_ENABLE_SINGLE_STEP_RENDERING,1)
p.loadURDF("plane.urdf")