Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 2.4.3)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
cmake_policy(SET CMP0017 NEW)
|
||||
#this line has to appear before 'PROJECT' in order to be able to disable incremental linking
|
||||
SET(MSVC_INCREMENTAL_DEFAULT ON)
|
||||
|
||||
@@ -27,7 +27,7 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF)
|
||||
OPTION(USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON)
|
||||
OPTION(BUILD_SHARED_LIBS "Use shared libraries" OFF)
|
||||
OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF)
|
||||
OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF)
|
||||
OPTION(BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations" OFF)
|
||||
|
||||
OPTION(USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" OFF)
|
||||
@@ -123,22 +123,22 @@ IF(MSVC)
|
||||
|
||||
OPTION(USE_MSVC_EXEPTIONS "Use MSVC C++ exceptions option" OFF)
|
||||
|
||||
|
||||
|
||||
|
||||
OPTION(USE_MSVC_COMDAT_FOLDING "Use MSVC /OPT:ICF COMDAT folding option" ON)
|
||||
|
||||
|
||||
IF(USE_MSVC_COMDAT_FOLDING)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF")
|
||||
ENDIF()
|
||||
|
||||
|
||||
OPTION(USE_MSVC_DISABLE_RTTI "Use MSVC /GR- disabled RTTI flags option" ON)
|
||||
IF(USE_MSVC_DISABLE_RTTI)
|
||||
STRING(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
|
||||
SET(CMAKE_C_FLAGS "/GR- ${CMAKE_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "/GR- ${CMAKE_CXX_FLAGS}")
|
||||
ENDIF(USE_MSVC_DISABLE_RTTI)
|
||||
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267")
|
||||
ENDIF(MSVC)
|
||||
|
||||
@@ -254,24 +254,39 @@ ENDIF()
|
||||
|
||||
OPTION(BUILD_BULLET3 "Set when you want to build Bullet 3" ON)
|
||||
|
||||
OPTION(BUILD_PYBULLET "Set when you want to build pybullet (Python bindings for Bullet)" OFF)
|
||||
|
||||
# Optional Python configuration
|
||||
# builds pybullet automatically if all the requirements are met
|
||||
SET(PYTHON_VERSION_PYBULLET "2.7" CACHE STRING "Python version pybullet will use.")
|
||||
SET(Python_ADDITIONAL_VERSIONS 2.7 2.7.3 3 3.0 3.1 3.2 3.3 3.4 3.5 3.6)
|
||||
SET_PROPERTY(CACHE PYTHON_VERSION_PYBULLET PROPERTY STRINGS ${Python_ADDITIONAL_VERSIONS})
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build3/cmake ${CMAKE_MODULE_PATH})
|
||||
OPTION(EXACT_PYTHON_VERSION "Require Python and match PYTHON_VERSION_PYBULLET exactly, e.g. 2.7.3" OFF)
|
||||
IF(EXACT_PYTHON_VERSION)
|
||||
set(EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED)
|
||||
ENDIF(EXACT_PYTHON_VERSION)
|
||||
# first find the python interpreter
|
||||
FIND_PACKAGE(PythonInterp ${PYTHON_VERSION_PYBULLET} ${EXACT_PYTHON_VERSION_FLAG})
|
||||
# python library should exactly match that of the interpreter
|
||||
FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
|
||||
SET(DEFAULT_BUILD_PYBULLET OFF)
|
||||
IF(PYTHONLIBS_FOUND)
|
||||
SET(DEFAULT_BUILD_PYBULLET ON)
|
||||
ENDIF(PYTHONLIBS_FOUND)
|
||||
OPTION(BUILD_PYBULLET "Set when you want to build pybullet (Python bindings for Bullet)" ${DEFAULT_BUILD_PYBULLET})
|
||||
|
||||
OPTION(BUILD_ENET "Set when you want to build apps with enet UDP networking support" ON)
|
||||
OPTION(BUILD_CLSOCKET "Set when you want to build apps with enet TCP networking support" ON)
|
||||
|
||||
|
||||
|
||||
IF(BUILD_PYBULLET)
|
||||
|
||||
FIND_PACKAGE(PythonLibs)
|
||||
|
||||
OPTION(BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" OFF)
|
||||
OPTION(BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" ON)
|
||||
OPTION(BUILD_PYBULLET_ENET "Set when you want to build pybullet with enet UDP networking support" ON)
|
||||
OPTION(BUILD_PYBULLET_CLSOCKET "Set when you want to build pybullet with enet TCP networking support" ON)
|
||||
|
||||
OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" ON)
|
||||
OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" OFF)
|
||||
|
||||
IF(BUILD_PYBULLET_NUMPY)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/build3/cmake)
|
||||
IF(BUILD_PYBULLET_NUMPY)
|
||||
#include(FindNumPy)
|
||||
FIND_PACKAGE(NumPy)
|
||||
if (PYTHON_NUMPY_FOUND)
|
||||
@@ -281,7 +296,6 @@ IF(BUILD_PYBULLET)
|
||||
message("NumPy not found")
|
||||
endif()
|
||||
ENDIF()
|
||||
OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF)
|
||||
|
||||
IF(WIN32)
|
||||
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Shared Libs" FORCE)
|
||||
|
||||
25
build3/cmake/FindLibPython.py
Normal file
25
build3/cmake/FindLibPython.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Note by Nikolaus Demmel 28.03.2014: My contributions are licensend under the
|
||||
# same as CMake (BSD). My adaptations are in part based
|
||||
# https://github.com/qgis/QGIS/tree/master/cmake which has the following
|
||||
# copyright note:
|
||||
|
||||
# FindLibPython.py
|
||||
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
import sys
|
||||
import distutils.sysconfig
|
||||
|
||||
print("exec_prefix:%s" % sys.exec_prefix)
|
||||
print("major_version:%s" % str(sys.version_info[0]))
|
||||
print("minor_version:%s" % str(sys.version_info[1]))
|
||||
print("patch_version:%s" % str(sys.version_info[2]))
|
||||
print("short_version:%s" % '.'.join(map(lambda x:str(x), sys.version_info[0:2])))
|
||||
print("long_version:%s" % '.'.join(map(lambda x:str(x), sys.version_info[0:3])))
|
||||
print("py_inc_dir:%s" % distutils.sysconfig.get_python_inc())
|
||||
print("site_packages_dir:%s" % distutils.sysconfig.get_python_lib(plat_specific=1))
|
||||
for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
|
||||
if e != None:
|
||||
print("py_lib_dir:%s" % e)
|
||||
break
|
||||
@@ -1,41 +1,59 @@
|
||||
# Find the Python NumPy package
|
||||
# PYTHON_NUMPY_INCLUDE_DIR
|
||||
# PYTHON_NUMPY_FOUND
|
||||
# will be set by this script
|
||||
# - Find the NumPy libraries
|
||||
# This module finds if NumPy is installed, and sets the following variables
|
||||
# indicating where it is.
|
||||
#
|
||||
# TODO: Update to provide the libraries and paths for linking npymath lib.
|
||||
#
|
||||
# PYTHON_NUMPY_FOUND - was NumPy found
|
||||
# PYTHON_NUMPY_VERSION - the version of NumPy found as a string
|
||||
# PYTHON_NUMPY_VERSION_MAJOR - the major version number of NumPy
|
||||
# PYTHON_NUMPY_VERSION_MINOR - the minor version number of NumPy
|
||||
# PYTHON_NUMPY_VERSION_PATCH - the patch version number of NumPy
|
||||
# PYTHON_NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
|
||||
# PYTHON_NUMPY_INCLUDE_DIR - path to the NumPy include files
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
unset(PYTHON_NUMPY_VERSION)
|
||||
unset(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
|
||||
if(NOT PYTHON_EXECUTABLE)
|
||||
if(NumPy_FIND_QUIETLY)
|
||||
find_package(PythonInterp QUIET)
|
||||
else()
|
||||
find_package(PythonInterp)
|
||||
set(__numpy_out 1)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
||||
"import numpy as n; print(n.__version__); print(n.get_include());"
|
||||
RESULT_VARIABLE __result
|
||||
OUTPUT_VARIABLE __output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(__result MATCHES 0)
|
||||
string(REGEX REPLACE ";" "\\\\;" __values ${__output})
|
||||
string(REGEX REPLACE "\r?\n" ";" __values ${__values})
|
||||
list(GET __values 0 PYTHON_NUMPY_VERSION)
|
||||
list(GET __values 1 PYTHON_NUMPY_INCLUDE_DIR)
|
||||
|
||||
string(REGEX MATCH "^([0-9])+\\.([0-9])+\\.([0-9])+" __ver_check "${PYTHON_NUMPY_VERSION}")
|
||||
if(NOT "${__ver_check}" STREQUAL "")
|
||||
set(PYTHON_NUMPY_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(PYTHON_NUMPY_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(PYTHON_NUMPY_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
math(EXPR PYTHON_NUMPY_VERSION_DECIMAL
|
||||
"(${PYTHON_NUMPY_VERSION_MAJOR} * 10000) + (${PYTHON_NUMPY_VERSION_MINOR} * 100) + ${PYTHON_NUMPY_VERSION_PATCH}")
|
||||
string(REGEX REPLACE "\\\\" "/" PYTHON_NUMPY_INCLUDE_DIR ${PYTHON_NUMPY_INCLUDE_DIR})
|
||||
else()
|
||||
unset(PYTHON_NUMPY_VERSION)
|
||||
unset(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
message(STATUS "Requested NumPy version and include path, but got instead:\n${__output}\n")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "To find NumPy Python interpretor is required to be found.")
|
||||
endif()
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
# Find out the include path
|
||||
execute_process(
|
||||
COMMAND "${PYTHON_EXECUTABLE}" -c
|
||||
"from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
|
||||
OUTPUT_VARIABLE __numpy_path)
|
||||
# And the version
|
||||
execute_process(
|
||||
COMMAND "${PYTHON_EXECUTABLE}" -c
|
||||
"from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
|
||||
OUTPUT_VARIABLE __numpy_version)
|
||||
elseif(__numpy_out)
|
||||
message(STATUS "Python executable not found.")
|
||||
endif(PYTHON_EXECUTABLE)
|
||||
|
||||
find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
|
||||
HINTS "${__numpy_path}" "${PYTHON_INCLUDE_PATH}" NO_DEFAULT_PATH)
|
||||
|
||||
if(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found")
|
||||
endif(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(NumPy REQUIRED_VARS PYTHON_NUMPY_INCLUDE_DIR
|
||||
VERSION_VAR __numpy_version)
|
||||
find_package_handle_standard_args(NumPy REQUIRED_VARS PYTHON_NUMPY_INCLUDE_DIR PYTHON_NUMPY_VERSION
|
||||
VERSION_VAR PYTHON_NUMPY_VERSION)
|
||||
|
||||
if(NUMPY_FOUND)
|
||||
set(PYTHON_NUMPY_FOUND TRUE)
|
||||
message(STATUS "NumPy ver. ${PYTHON_NUMPY_VERSION} found (include: ${PYTHON_NUMPY_INCLUDE_DIR})")
|
||||
endif()
|
||||
|
||||
# caffe_clear_vars(__result __output __error_value __values __ver_check __error_value)
|
||||
|
||||
|
||||
353
build3/cmake/FindPythonLibs.cmake
Normal file
353
build3/cmake/FindPythonLibs.cmake
Normal file
@@ -0,0 +1,353 @@
|
||||
# - Find python libraries
|
||||
# This module finds if Python is installed and determines where the
|
||||
# include files and libraries are. It also determines what the name of
|
||||
# the library is. This code sets the following variables:
|
||||
#
|
||||
# PYTHONLIBS_FOUND - have the Python libs been found
|
||||
# PYTHON_LIBRARIES - path to the python library
|
||||
# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
|
||||
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
|
||||
# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
|
||||
# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
|
||||
#
|
||||
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
|
||||
# version numbers that should be taken into account when searching for Python.
|
||||
# You need to set this variable before calling find_package(PythonLibs).
|
||||
#
|
||||
# If you'd like to specify the installation of Python to use, you should modify
|
||||
# the following cache variables:
|
||||
# PYTHON_LIBRARY - path to the python library
|
||||
# PYTHON_INCLUDE_DIR - path to where Python.h is found
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Note by Nikolaus Demmel 28.03.2014: My contributions are licensend under the
|
||||
# same as CMake (BSD). My adaptations are in part based
|
||||
# https://github.com/qgis/QGIS/tree/master/cmake which has the following
|
||||
# copyright note:
|
||||
|
||||
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
if(NOT DEFINED PYTHON_INCLUDE_DIR)
|
||||
if(DEFINED PYTHON_INCLUDE_PATH)
|
||||
# For backward compatibility, repect PYTHON_INCLUDE_PATH.
|
||||
set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
|
||||
"Path to where Python.h is found" FORCE)
|
||||
else()
|
||||
set(PYTHON_INCLUDE_DIR "" CACHE PATH
|
||||
"Path to where Python.h is found" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS "${PYTHON_INCLUDE_DIR}" AND EXISTS "${PYTHON_LIBRARY}")
|
||||
if(EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
|
||||
file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" _PYTHON_VERSION_STR
|
||||
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
|
||||
string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
|
||||
PYTHONLIBS_VERSION_STRING "${_PYTHON_VERSION_STR}")
|
||||
unset(_PYTHON_VERSION_STR)
|
||||
endif()
|
||||
else()
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
|
||||
set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}")
|
||||
if(NOT PythonLibs_FIND_VERSION_EXACT)
|
||||
foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
|
||||
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||
if(NOT _PYTHON_V STREQUAL PythonLibs_FIND_VERSION)
|
||||
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_PYTHON_FIND_MAJ_MIN)
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
|
||||
endif()
|
||||
else()
|
||||
# add an empty version to check the `python` executable first in case no version is requested
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||
endif()
|
||||
|
||||
unset(_PYTHON1_VERSIONS)
|
||||
unset(_PYTHON2_VERSIONS)
|
||||
unset(_PYTHON3_VERSIONS)
|
||||
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
# If FindPythonInterp has already found the major and minor version,
|
||||
# insert that version between the user supplied versions and the stock
|
||||
# version list.
|
||||
# If no specific version is requested or suggested by PythonInterp, always look
|
||||
# for "python" executable first
|
||||
set(_PYTHON_VERSIONS ${PythonLibs_FIND_VERSION} ${PythonLibs_ADDITIONAL_VERSIONS} )
|
||||
if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
|
||||
list(APPEND _PYTHON_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
||||
endif()
|
||||
if (NOT _PYTHON_VERSIONS)
|
||||
set(_PYTHON_VERSIONS ";") # empty entry at the front makeing sure we search for "python" first
|
||||
endif()
|
||||
list(APPEND _PYTHON_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
|
||||
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
|
||||
message(STATUS "Looking for versions: ${_PYTHON_VERSIONS}")
|
||||
|
||||
FIND_FILE(_FIND_LIB_PYTHON_PY FindLibPython.py PATHS ${CMAKE_MODULE_PATH} ${CMAKE_ROOT}/Modules)
|
||||
|
||||
if(NOT _FIND_LIB_PYTHON_PY)
|
||||
message(FATAL_ERROR "Could not find required file 'FindLibPython.py'")
|
||||
endif()
|
||||
|
||||
unset(PYTHONLIBS_VERSION_STRING)
|
||||
foreach(_CURRENT_VERSION IN LISTS _PYTHON_VERSIONS)
|
||||
|
||||
STRING(REGEX REPLACE "^([0-9]+).*$" "\\1" _VERSION_MAJOR "${_CURRENT_VERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$" "\\1" _VERSION_MINOR "${_CURRENT_VERSION}")
|
||||
|
||||
set(_PYTHON_NAMES python)
|
||||
|
||||
if (_CURRENT_VERSION MATCHES "^[0-9]+.*$")
|
||||
list(APPEND _PYTHON_NAMES "python${_VERSION_MAJOR}")
|
||||
if (_CURRENT_VERSION MATCHES "^[0-9]+\\.[0-9].*$")
|
||||
list(APPEND _PYTHON_NAMES "python${_VERSION_MAJOR}.${_VERSION_MINOR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Looking for python version '${_CURRENT_VERSION}' by checking executables: ${_PYTHON_NAMES}.")
|
||||
|
||||
foreach(_CURRENT_PYTHON_NAME IN LISTS _PYTHON_NAMES)
|
||||
|
||||
unset(_PYTHON_EXECUTABLE CACHE)
|
||||
find_program(_PYTHON_EXECUTABLE ${_CURRENT_PYTHON_NAME}
|
||||
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath])
|
||||
|
||||
if(_PYTHON_EXECUTABLE)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${_PYTHON_EXECUTABLE} "${_FIND_LIB_PYTHON_PY}"
|
||||
OUTPUT_VARIABLE _PYTHON_CONFIG
|
||||
RESULT_VARIABLE _PYTHON_CONFIG_RESULT
|
||||
ERROR_QUIET)
|
||||
|
||||
if(NOT ${_PYTHON_CONFIG_RESULT} AND (NOT ${_PYTHON_CONFIG} STREQUAL ""))
|
||||
STRING(REGEX REPLACE ".*\nmajor_version:([0-9]+).*$" "\\1" _PYTHON_MAJOR_VERSION ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\nminor_version:([0-9]+).*$" "\\1" _PYTHON_MINOR_VERSION ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\npatch_version:([0-9]+).*$" "\\1" _PYTHON_PATCH_VERSION ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" _PYTHON_SHORT_VERSION ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" _PYTHON_LONG_VERSION ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" _PYTHON_INCLUDE_DIR ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\npy_lib_dir:([^\n]+).*$" "\\1" _PYTHON_LIBRARY_DIR ${_PYTHON_CONFIG})
|
||||
STRING(REGEX REPLACE ".*\nexec_prefix:(^\n+).*$" "\\1" _PYTHON_PREFIX ${_PYTHON_CONFIG})
|
||||
|
||||
if ("${_CURRENT_VERSION}" STREQUAL "" OR
|
||||
"${_CURRENT_VERSION}" STREQUAL "${_PYTHON_MAJOR_VERSION}" OR
|
||||
"${_CURRENT_VERSION}" STREQUAL "${_PYTHON_SHORT_VERSION}" OR
|
||||
"${_CURRENT_VERSION}" STREQUAL "${_PYTHON_LONG_VERSION}")
|
||||
|
||||
message(STATUS "Found executable ${_PYTHON_EXECUTABLE} with suitable version ${_PYTHON_LONG_VERSION}")
|
||||
|
||||
if(NOT EXISTS "${PYTHON_INCLUDE_DIR}")
|
||||
set(PYTHON_INCLUDE_DIR "${_PYTHON_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${PYTHON_LIBRARY}")
|
||||
set(_PYTHON_SHORT_VERSION_NO_DOT "${_PYTHON_MAJOR_VERSION}${_PYTHON_MINOR_VERSION}")
|
||||
set(_PYTHON_LIBRARY_NAMES python${_PYTHON_SHORT_VERSION} python${_PYTHON_SHORT_VERSION_NO_DOT})
|
||||
FIND_LIBRARY(PYTHON_LIBRARY
|
||||
NAMES ${_PYTHON_LIBRARY_NAMES}
|
||||
PATH_SUFFIXES
|
||||
python${_PYTHON_SHORT_VERSION}/config
|
||||
python${_PYTHON_SHORT_VERSION_NO_DOT}/config
|
||||
PATHS
|
||||
${_PYTHON_LIBRARY_DIR}
|
||||
${_PYTHON_PREFIX}/lib $
|
||||
{_PYTHON_PREFIX}/libs
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if(WIN32)
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python${_PYTHON_SHORT_VERSION_NO_DOT}_d python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(PYTHONLIBS_VERSION_STRING ${_PYTHON_LONG_VERSION})
|
||||
if(_PYTHON_PATCH_VERSION STREQUAL "0")
|
||||
# it's called "Python 2.7", not "2.7.0"
|
||||
string(REGEX REPLACE "\\.0$" "" PYTHONLIBS_VERSION_STRING "${PYTHONLIBS_VERSION_STRING}")
|
||||
endif()
|
||||
|
||||
break()
|
||||
else()
|
||||
message(STATUS "Found executable ${_PYTHON_EXECUTABLE} with UNsuitable version ${_PYTHON_LONG_VERSION}")
|
||||
endif() # version ok
|
||||
else()
|
||||
message(WARNING "Found executable ${_PYTHON_EXECUTABLE}, but could not extract version info.")
|
||||
endif() # could extract config
|
||||
endif() # found executable
|
||||
endforeach() # python names
|
||||
if (PYTHONLIBS_VERSION_STRING)
|
||||
break()
|
||||
endif()
|
||||
endforeach() # python versions
|
||||
endif()
|
||||
|
||||
unset(_PYTHON_NAMES)
|
||||
unset(_PYTHON_VERSIONS)
|
||||
unset(_PYTHON_EXECUTABLE CACHE)
|
||||
unset(_PYTHON_MAJOR_VERSION)
|
||||
unset(_PYTHON_MINOR_VERSION)
|
||||
unset(_PYTHON_PATCH_VERSION)
|
||||
unset(_PYTHON_SHORT_VERSION)
|
||||
unset(_PYTHON_LONG_VERSION)
|
||||
unset(_PYTHON_LIBRARY_DIR)
|
||||
unset(_PYTHON_INCLUDE_DIR)
|
||||
unset(_PYTHON_PREFIX)
|
||||
unset(_PYTHON_SHORT_VERSION_NO_DOT)
|
||||
unset(_PYTHON_LIBRARY_NAMES)
|
||||
|
||||
|
||||
# For backward compatibility, set PYTHON_INCLUDE_PATH.
|
||||
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
|
||||
|
||||
mark_as_advanced(
|
||||
PYTHON_DEBUG_LIBRARY
|
||||
PYTHON_LIBRARY
|
||||
PYTHON_INCLUDE_DIR
|
||||
)
|
||||
|
||||
# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
|
||||
# cache entries because they are meant to specify the location of a single
|
||||
# library. We now set the variables listed by the documentation for this
|
||||
# module.
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
|
||||
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|
||||
|
||||
# These variables have been historically named in this module different from
|
||||
# what SELECT_LIBRARY_CONFIGURATIONS() expects.
|
||||
set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
|
||||
set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||
SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
|
||||
# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
|
||||
# Unset this, this prefix doesn't match the module prefix, they are different
|
||||
# for historical reasons.
|
||||
unset(PYTHON_FOUND)
|
||||
|
||||
# include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
|
||||
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
|
||||
VERSION_VAR PYTHONLIBS_VERSION_STRING)
|
||||
|
||||
# PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python.
|
||||
# PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include
|
||||
# in your sources to initialize the static python modules
|
||||
function(PYTHON_ADD_MODULE _NAME )
|
||||
get_property(_TARGET_SUPPORTS_SHARED_LIBS
|
||||
GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||
option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
|
||||
option(PYTHON_MODULE_${_NAME}_BUILD_SHARED
|
||||
"Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
|
||||
|
||||
# Mark these options as advanced
|
||||
mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME}
|
||||
PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
|
||||
if(PYTHON_ENABLE_MODULE_${_NAME})
|
||||
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
set(PY_MODULE_TYPE MODULE)
|
||||
else()
|
||||
set(PY_MODULE_TYPE STATIC)
|
||||
set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
|
||||
add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
|
||||
# target_link_libraries(${_NAME} ${PYTHON_LIBRARIES})
|
||||
|
||||
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||
set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(PYTHON_WRITE_MODULES_HEADER _filename)
|
||||
|
||||
get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
|
||||
|
||||
get_filename_component(_name "${_filename}" NAME)
|
||||
string(REPLACE "." "_" _name "${_name}")
|
||||
string(TOUPPER ${_name} _nameUpper)
|
||||
set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename})
|
||||
|
||||
set(_filenameTmp "${_filename}.in")
|
||||
file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
|
||||
file(APPEND ${_filenameTmp}
|
||||
"#ifndef ${_nameUpper}
|
||||
#define ${_nameUpper}
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern \"C\" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
")
|
||||
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${_filenameTmp}
|
||||
"#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
")
|
||||
|
||||
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
|
||||
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||
file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
|
||||
endforeach()
|
||||
file(APPEND ${_filenameTmp} "}\n\n")
|
||||
file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
|
||||
|
||||
# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
endfunction()
|
||||
70
build3/cmake/SelectLibraryConfigurations.cmake
Normal file
70
build3/cmake/SelectLibraryConfigurations.cmake
Normal file
@@ -0,0 +1,70 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# SelectLibraryConfigurations
|
||||
# ---------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# select_library_configurations( basename )
|
||||
#
|
||||
# This macro takes a library base name as an argument, and will choose
|
||||
# good values for basename_LIBRARY, basename_LIBRARIES,
|
||||
# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
|
||||
# has been found and set. If only basename_LIBRARY_RELEASE is defined,
|
||||
# basename_LIBRARY will be set to the release value, and
|
||||
# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
|
||||
# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
|
||||
# take the debug value, and basename_LIBRARY_RELEASE will be set to
|
||||
# basename_LIBRARY_RELEASE-NOTFOUND.
|
||||
#
|
||||
# If the generator supports configuration types, then basename_LIBRARY
|
||||
# and basename_LIBRARIES will be set with debug and optimized flags
|
||||
# specifying the library to be used for the given configuration. If no
|
||||
# build type has been set or the generator in use does not support
|
||||
# configuration types, then basename_LIBRARY and basename_LIBRARIES will
|
||||
# take only the release value, or the debug value if the release one is
|
||||
# not set.
|
||||
|
||||
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
|
||||
# Dicharry <wdicharry@stellarscience.com>.
|
||||
|
||||
macro( select_library_configurations basename )
|
||||
if(NOT ${basename}_LIBRARY_RELEASE)
|
||||
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||
endif()
|
||||
if(NOT ${basename}_LIBRARY_DEBUG)
|
||||
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||
endif()
|
||||
|
||||
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
|
||||
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
|
||||
( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) )
|
||||
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
||||
# is set, then set optimized and debug options.
|
||||
set( ${basename}_LIBRARY "" )
|
||||
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
|
||||
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
|
||||
endforeach()
|
||||
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
|
||||
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
|
||||
endforeach()
|
||||
elseif( ${basename}_LIBRARY_RELEASE )
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
|
||||
elseif( ${basename}_LIBRARY_DEBUG )
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
|
||||
else()
|
||||
set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
|
||||
|
||||
if( ${basename}_LIBRARY )
|
||||
set( ${basename}_FOUND TRUE )
|
||||
endif()
|
||||
|
||||
mark_as_advanced( ${basename}_LIBRARY_RELEASE
|
||||
${basename}_LIBRARY_DEBUG
|
||||
)
|
||||
endmacro()
|
||||
115
data/mjcf/humanoid_fixed.xml
Normal file
115
data/mjcf/humanoid_fixed.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<mujoco model="humanoid">
|
||||
<compiler angle="degree" inertiafromgeom="true"/>
|
||||
<default>
|
||||
<joint armature="1" damping="1" limited="true"/>
|
||||
<geom conaffinity="1" condim="1" contype="1" margin="0.001" material="geom" rgba="0.8 0.6 .4 1"/>
|
||||
<motor ctrllimited="true" ctrlrange="-.4 .4"/>
|
||||
</default>
|
||||
<option integrator="RK4" iterations="50" solver="PGS" timestep="0.003">
|
||||
<!-- <flags solverstat="enable" energy="enable"/>-->
|
||||
</option>
|
||||
<size nkey="5" nuser_geom="1"/>
|
||||
<visual>
|
||||
<map fogend="5" fogstart="3"/>
|
||||
</visual>
|
||||
<asset>
|
||||
<texture builtin="gradient" height="100" rgb1=".4 .5 .6" rgb2="0 0 0" type="skybox" width="100"/>
|
||||
<!-- <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>-->
|
||||
<texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
|
||||
<texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
|
||||
<material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
|
||||
<material name="geom" texture="texgeom" texuniform="true"/>
|
||||
</asset>
|
||||
<worldbody>
|
||||
<body name="torso" pos="0 0 1.4">
|
||||
<joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="fixed"/>
|
||||
<geom fromto="0 -.07 0 0 .07 0" name="torso1" size="0.07" type="capsule"/>
|
||||
<geom name="head" pos="0 0 .19" size=".09" type="sphere" user="258"/>
|
||||
<geom fromto="-.01 -.06 -.12 -.01 .06 -.12" name="uwaist" size="0.06" type="capsule"/>
|
||||
<body name="lwaist" pos="-.01 0 -0.260" quat="1.000 0 -0.002 0">
|
||||
<geom fromto="0 -.06 0 0 .06 0" name="lwaist" size="0.06" type="capsule"/>
|
||||
<joint armature="0.02" axis="0 0 1" damping="5" name="abdomen_z" pos="0 0 0.065" range="-45 45" stiffness="20" type="hinge"/>
|
||||
<joint armature="0.02" axis="0 1 0" damping="5" name="abdomen_y" pos="0 0 0.065" range="-75 30" stiffness="10" type="hinge"/>
|
||||
<body name="pelvis" pos="0 0 -0.165" quat="1.000 0 -0.002 0">
|
||||
<joint armature="0.02" axis="1 0 0" damping="5" name="abdomen_x" pos="0 0 0.1" range="-35 35" stiffness="10" type="hinge"/>
|
||||
<geom fromto="-.02 -.07 0 -.02 .07 0" name="butt" size="0.09" type="capsule"/>
|
||||
<body name="right_thigh" pos="0 -0.1 -0.04">
|
||||
<joint armature="0.01" axis="1 0 0" damping="5" name="right_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||
<joint armature="0.01" axis="0 0 1" damping="5" name="right_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||
<joint armature="0.01" axis="0 1 0" damping="5" name="right_hip_y" pos="0 0 0" range="-120 20" stiffness="20" type="hinge"/>
|
||||
<geom fromto="0 0 0 0 0.01 -.34" name="right_thigh1" size="0.06" type="capsule"/>
|
||||
<body name="right_shin" pos="0 0.01 -0.403">
|
||||
<joint armature="0.0060" axis="0 -1 0" name="right_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
||||
<geom fromto="0 0 0 0 0 -.3" name="right_shin1" size="0.049" type="capsule"/>
|
||||
<body name="right_foot" pos="0 0 -0.45">
|
||||
<geom name="right_foot" pos="0 0 0.1" size="0.075" type="sphere" user="0"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="left_thigh" pos="0 0.1 -0.04">
|
||||
<joint armature="0.01" axis="-1 0 0" damping="5" name="left_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||
<joint armature="0.01" axis="0 0 -1" damping="5" name="left_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||
<joint armature="0.01" axis="0 1 0" damping="5" name="left_hip_y" pos="0 0 0" range="-120 20" stiffness="20" type="hinge"/>
|
||||
<geom fromto="0 0 0 0 -0.01 -.34" name="left_thigh1" size="0.06" type="capsule"/>
|
||||
<body name="left_shin" pos="0 -0.01 -0.403">
|
||||
<joint armature="0.0060" axis="0 -1 0" name="left_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
||||
<geom fromto="0 0 0 0 0 -.3" name="left_shin1" size="0.049" type="capsule"/>
|
||||
<body name="left_foot" pos="0 0 -0.45">
|
||||
<geom name="left_foot" type="sphere" size="0.075" pos="0 0 0.1" user="0" />
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="right_upper_arm" pos="0 -0.17 0.06">
|
||||
<joint armature="0.0068" axis="2 1 1" name="right_shoulder1" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||
<joint armature="0.0051" axis="0 -1 1" name="right_shoulder2" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||
<geom fromto="0 0 0 .16 -.16 -.16" name="right_uarm1" size="0.04 0.16" type="capsule"/>
|
||||
<body name="right_lower_arm" pos=".18 -.18 -.18">
|
||||
<joint armature="0.0028" axis="0 -1 1" name="right_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||
<geom fromto="0.01 0.01 0.01 .17 .17 .17" name="right_larm" size="0.031" type="capsule"/>
|
||||
<geom name="right_hand" pos=".18 .18 .18" size="0.04" type="sphere"/>
|
||||
</body>
|
||||
</body>
|
||||
<body name="left_upper_arm" pos="0 0.17 0.06">
|
||||
<joint armature="0.0068" axis="2 -1 1" name="left_shoulder1" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||
<joint armature="0.0051" axis="0 1 1" name="left_shoulder2" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||
<geom fromto="0 0 0 .16 .16 -.16" name="left_uarm1" size="0.04 0.16" type="capsule"/>
|
||||
<body name="left_lower_arm" pos=".18 .18 -.18">
|
||||
<joint armature="0.0028" axis="0 -1 -1" name="left_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||
<geom fromto="0.01 -0.01 0.01 .17 -.17 .17" name="left_larm" size="0.031" type="capsule"/>
|
||||
<geom name="left_hand" pos=".18 -.18 .18" size="0.04" type="sphere"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
<tendon>
|
||||
<fixed name="left_hipknee">
|
||||
<joint coef="-1" joint="left_hip_y"/>
|
||||
<joint coef="1" joint="left_knee"/>
|
||||
</fixed>
|
||||
<fixed name="right_hipknee">
|
||||
<joint coef="-1" joint="right_hip_y"/>
|
||||
<joint coef="1" joint="right_knee"/>
|
||||
</fixed>
|
||||
</tendon>
|
||||
<actuator><!-- this section is not supported, same constants in code -->
|
||||
<motor gear="100" joint="abdomen_y" name="abdomen_y"/>
|
||||
<motor gear="100" joint="abdomen_z" name="abdomen_z"/>
|
||||
<motor gear="100" joint="abdomen_x" name="abdomen_x"/>
|
||||
<motor gear="100" joint="right_hip_x" name="right_hip_x"/>
|
||||
<motor gear="100" joint="right_hip_z" name="right_hip_z"/>
|
||||
<motor gear="300" joint="right_hip_y" name="right_hip_y"/>
|
||||
<motor gear="200" joint="right_knee" name="right_knee"/>
|
||||
<motor gear="100" joint="left_hip_x" name="left_hip_x"/>
|
||||
<motor gear="100" joint="left_hip_z" name="left_hip_z"/>
|
||||
<motor gear="300" joint="left_hip_y" name="left_hip_y"/>
|
||||
<motor gear="200" joint="left_knee" name="left_knee"/>
|
||||
<motor gear="25" joint="right_shoulder1" name="right_shoulder1"/>
|
||||
<motor gear="25" joint="right_shoulder2" name="right_shoulder2"/>
|
||||
<motor gear="25" joint="right_elbow" name="right_elbow"/>
|
||||
<motor gear="25" joint="left_shoulder1" name="left_shoulder1"/>
|
||||
<motor gear="25" joint="left_shoulder2" name="left_shoulder2"/>
|
||||
<motor gear="25" joint="left_elbow" name="left_elbow"/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
Binary file not shown.
@@ -277,9 +277,10 @@ static ExampleEntry gDefaultExamples[]=
|
||||
ExampleEntry(1,"Gripper Grasp","Grasp experiment with a gripper to improve contact model", GripperGraspExampleCreateFunc,eGRIPPER_GRASP),
|
||||
ExampleEntry(1,"Two Point Grasp","Grasp experiment with two point contact to test rolling friction", GripperGraspExampleCreateFunc, eTWO_POINT_GRASP),
|
||||
ExampleEntry(1,"One Motor Gripper Grasp","Grasp experiment with a gripper with one motor to test slider constraint for closed loop structure", GripperGraspExampleCreateFunc, eONE_MOTOR_GRASP),
|
||||
ExampleEntry(1,"Grasp Soft Body","Grasp soft body experiment", GripperGraspExampleCreateFunc, eGRASP_SOFT_BODY),
|
||||
ExampleEntry(1,"Softbody Multibody Coupling","Two way coupling between soft body and multibody experiment", GripperGraspExampleCreateFunc, eSOFTBODY_MULTIBODY_COUPLING),
|
||||
|
||||
#ifdef USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||
ExampleEntry(1,"Grasp Soft Body","Grasp soft body experiment", GripperGraspExampleCreateFunc, eGRASP_SOFT_BODY),
|
||||
ExampleEntry(1,"Softbody Multibody Coupling","Two way coupling between soft body and multibody experiment", GripperGraspExampleCreateFunc, eSOFTBODY_MULTIBODY_COUPLING),
|
||||
#endif //USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||
|
||||
#ifdef ENABLE_LUA
|
||||
ExampleEntry(1,"Lua Script", "Create the dynamics world, collision shapes and rigid bodies using Lua scripting",
|
||||
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual ~MyDebugDrawer()
|
||||
{
|
||||
}
|
||||
virtual DefaultColors getDefaultColors() const
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../../Utils/b3ResourcePath.h"
|
||||
#include "Bullet3Common/b3FileUtils.h"
|
||||
#include "../../ThirdPartyLibs/stb_image/stb_image.h"
|
||||
|
||||
#include "../ImportObjDemo/LoadMeshFromObj.h"
|
||||
bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string& fileName, b3ImportMeshData& meshData)
|
||||
{
|
||||
B3_PROFILE("loadAndRegisterMeshFromFileInternal");
|
||||
@@ -28,7 +28,8 @@ bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string&
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
{
|
||||
B3_PROFILE("tinyobj::LoadObj");
|
||||
std::string err = tinyobj::LoadObj(shapes, relativeFileName, pathPrefix);
|
||||
std::string err = LoadFromCachedOrFromObj(shapes, relativeFileName, pathPrefix);
|
||||
//std::string err = tinyobj::LoadObj(shapes, relativeFileName, pathPrefix);
|
||||
}
|
||||
|
||||
GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes);
|
||||
|
||||
@@ -1,11 +1,56 @@
|
||||
#include "LoadMeshFromObj.h"
|
||||
#include"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h"
|
||||
|
||||
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||
#include <stdio.h> //fopen
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Wavefront2GLInstanceGraphicsShape.h"
|
||||
#include "Bullet3Common/b3HashMap.h"
|
||||
|
||||
struct CachedObjResult
|
||||
{
|
||||
std::string m_msg;
|
||||
std::vector<tinyobj::shape_t> m_shapes;
|
||||
};
|
||||
|
||||
static b3HashMap<b3HashString, CachedObjResult> gCachedObjResults;
|
||||
static int gEnableFileCaching = 1;
|
||||
|
||||
void b3EnableFileCaching(int enable)
|
||||
{
|
||||
gEnableFileCaching = enable;
|
||||
if (enable==0)
|
||||
{
|
||||
gCachedObjResults.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string LoadFromCachedOrFromObj(
|
||||
std::vector<tinyobj::shape_t>& shapes, // [output]
|
||||
const char* filename,
|
||||
const char* mtl_basepath)
|
||||
{
|
||||
CachedObjResult* resultPtr = gCachedObjResults[filename];
|
||||
if (resultPtr)
|
||||
{
|
||||
const CachedObjResult& result = *resultPtr;
|
||||
shapes = result.m_shapes;
|
||||
return result.m_msg;
|
||||
}
|
||||
|
||||
std::string err = tinyobj::LoadObj(shapes, filename, mtl_basepath);
|
||||
CachedObjResult result;
|
||||
result.m_msg = err;
|
||||
result.m_shapes = shapes;
|
||||
if (gEnableFileCaching)
|
||||
{
|
||||
gCachedObjResults.insert(filename,result);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
GLInstanceGraphicsShape* LoadMeshFromObj(const char* relativeFileName, const char* materialPrefixPath)
|
||||
{
|
||||
@@ -13,7 +58,7 @@ GLInstanceGraphicsShape* LoadMeshFromObj(const char* relativeFileName, const cha
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
{
|
||||
B3_PROFILE("tinyobj::LoadObj2");
|
||||
std::string err = tinyobj::LoadObj(shapes, relativeFileName, materialPrefixPath);
|
||||
std::string err = LoadFromCachedOrFromObj(shapes, relativeFileName, materialPrefixPath);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
|
||||
struct GLInstanceGraphicsShape;
|
||||
|
||||
#include"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h"
|
||||
|
||||
void b3EnableFileCaching(int enable);
|
||||
|
||||
std::string LoadFromCachedOrFromObj(
|
||||
std::vector<tinyobj::shape_t>& shapes, // [output]
|
||||
const char* filename,
|
||||
const char* mtl_basepath);
|
||||
|
||||
GLInstanceGraphicsShape* LoadMeshFromObj(const char* relativeFileName, const char* materialPrefixPath);
|
||||
|
||||
|
||||
@@ -634,8 +634,15 @@ btCollisionShape* convertURDFToCollisionShape(const UrdfCollision* collision, co
|
||||
case UrdfGeometry::FILE_OBJ:
|
||||
if (collision->m_flags & URDF_FORCE_CONCAVE_TRIMESH)
|
||||
{
|
||||
|
||||
glmesh = LoadMeshFromObj(collision->m_geometry.m_meshFileName.c_str(), 0);
|
||||
char relativeFileName[1024];
|
||||
char pathPrefix[1024];
|
||||
pathPrefix[0] = 0;
|
||||
if (b3ResourcePath::findResourcePath(collision->m_geometry.m_meshFileName.c_str(), relativeFileName, 1024))
|
||||
{
|
||||
|
||||
b3FileUtils::extractPath(relativeFileName, pathPrefix, 1024);
|
||||
}
|
||||
glmesh = LoadMeshFromObj(collision->m_geometry.m_meshFileName.c_str(), pathPrefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -588,6 +588,10 @@ public:
|
||||
) :
|
||||
btDiscreteDynamicsWorldMt( dispatcher, pairCache, constraintSolver, collisionConfiguration )
|
||||
{
|
||||
#if USE_PARALLEL_ISLAND_SOLVER
|
||||
btSimulationIslandManagerMt* islandMgr = static_cast<btSimulationIslandManagerMt*>( m_islandManager );
|
||||
islandMgr->setIslandDispatchFunction( parallelIslandDispatch );
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
}
|
||||
|
||||
};
|
||||
@@ -762,14 +766,7 @@ void CommonRigidBodyMTBase::createEmptyDynamicsWorld()
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
btDiscreteDynamicsWorld* world = new MyDiscreteDynamicsWorld( m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration );
|
||||
m_dynamicsWorld = world;
|
||||
|
||||
#if USE_PARALLEL_ISLAND_SOLVER
|
||||
if ( btSimulationIslandManagerMt* islandMgr = dynamic_cast<btSimulationIslandManagerMt*>( world->getSimulationIslandManager() ) )
|
||||
{
|
||||
islandMgr->setIslandDispatchFunction( parallelIslandDispatch );
|
||||
m_multithreadedWorld = true;
|
||||
}
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
m_multithreadedWorld = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1621,6 +1621,11 @@ static void b3CreateLookAt(const b3Vector3& eye, const b3Vector3& center,cons
|
||||
void GLInstancingRenderer::renderSceneInternal(int renderMode)
|
||||
{
|
||||
|
||||
if (!useShadowMap)
|
||||
{
|
||||
renderMode = B3_DEFAULT_RENDERMODE;
|
||||
}
|
||||
|
||||
// glEnable(GL_DEPTH_TEST);
|
||||
|
||||
GLint dims[4];
|
||||
|
||||
@@ -290,6 +290,7 @@ void b3RobotSimulatorClientAPI::setGravity(const b3Vector3& gravityAcceleration)
|
||||
b3Warning("Not connected");
|
||||
return;
|
||||
}
|
||||
b3Assert(b3CanSubmitCommand(m_data->m_physicsClientHandle));
|
||||
|
||||
b3SharedMemoryCommandHandle command = b3InitPhysicsParamCommand(m_data->m_physicsClientHandle);
|
||||
b3SharedMemoryStatusHandle statusHandle;
|
||||
@@ -1142,5 +1143,5 @@ void b3RobotSimulatorClientAPI::loadBunny(double scale, double mass, double coll
|
||||
b3LoadBunnySetScale(command, scale);
|
||||
b3LoadBunnySetMass(command, mass);
|
||||
b3LoadBunnySetCollisionMargin(command, collisionMargin);
|
||||
b3SubmitClientCommand(m_data->m_physicsClientHandle, command);
|
||||
b3SubmitClientCommandAndWaitStatus(m_data->m_physicsClientHandle, command);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
m_robotSim.loadSDF("kiva_shelf/model.sdf",results);
|
||||
}
|
||||
{
|
||||
m_robotSim.loadURDF("results");
|
||||
m_robotSim.loadURDF("plane.urdf");
|
||||
}
|
||||
|
||||
m_robotSim.setGravity(b3MakeVector3(0,0,-10));
|
||||
|
||||
@@ -62,7 +62,7 @@ SET(SharedMemory_SRCS
|
||||
../Importers/ImportMJCFDemo/BulletMJCFImporter.cpp
|
||||
../Importers/ImportMJCFDemo/BulletMJCFImporter.h
|
||||
../Utils/b3ResourcePath.cpp
|
||||
../Utils/b3Clock.cpp
|
||||
../Utils/b3Clock.cpp
|
||||
../Utils/RobotLoggingUtil.cpp
|
||||
../Utils/RobotLoggingUtil.h
|
||||
../Utils/ChromeTraceUtil.cpp
|
||||
@@ -75,13 +75,13 @@ SET(SharedMemory_SRCS
|
||||
../Importers/ImportSTLDemo/LoadMeshFromSTL.h
|
||||
../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||
../Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
||||
../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../MultiThreading/b3ThreadSupportInterface.cpp
|
||||
../MultiThreading/b3ThreadSupportInterface.h
|
||||
)
|
||||
@@ -95,6 +95,10 @@ LINK_LIBRARIES(
|
||||
Bullet3Common BulletWorldImporter BulletFileLoader BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK
|
||||
)
|
||||
|
||||
IF (USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD)
|
||||
LINK_LIBRARIES(BulletSoftBody)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory
|
||||
${SharedMemory_SRCS}
|
||||
@@ -112,7 +116,7 @@ ELSE(WIN32)
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
main.cpp
|
||||
)
|
||||
|
||||
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( pthread ${DL} )
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory
|
||||
@@ -152,7 +156,7 @@ LINK_LIBRARIES(
|
||||
IF (WIN32)
|
||||
ADD_DEFINITIONS(-DGLEW_STATIC)
|
||||
LINK_LIBRARIES( ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
@@ -169,23 +173,23 @@ ELSE(WIN32)
|
||||
FIND_LIBRARY(COCOA NAMES Cocoa)
|
||||
MESSAGE(${COCOA})
|
||||
LINK_LIBRARIES(${COCOA} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
)
|
||||
|
||||
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( pthread ${DL} )
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
@@ -215,7 +219,7 @@ INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/headers
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
)
|
||||
|
||||
|
||||
@@ -233,7 +237,7 @@ LINK_LIBRARIES(
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win64)
|
||||
ELSE(CMAKE_CL_64)
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win32)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_VR
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/hellovr_opengl_main.cpp
|
||||
@@ -250,12 +254,12 @@ LINK_LIBRARIES(
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/Vectors.h
|
||||
../MultiThreading/b3Win32ThreadSupport.cpp
|
||||
../MultiThreading/b3Win32ThreadSupport.h
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
@@ -272,7 +276,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.dll
|
||||
)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET App_PhysicsServer_SharedMemory_VR
|
||||
POST_BUILD
|
||||
|
||||
@@ -381,6 +381,17 @@ int b3PhysicsParamSetMaxNumCommandsPer1ms(b3SharedMemoryCommandHandle commandHan
|
||||
|
||||
}
|
||||
|
||||
int b3PhysicsParamSetEnableFileCaching(b3SharedMemoryCommandHandle commandHandle, int enableFileCaching)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command->m_type == CMD_SEND_PHYSICS_SIMULATION_PARAMETERS);
|
||||
|
||||
command->m_physSimParamArgs.m_enableFileCaching= enableFileCaching;
|
||||
command->m_updateFlags |= SIM_PARAM_ENABLE_FILE_CACHING ;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int b3PhysicsParamSetNumSolverIterations(b3SharedMemoryCommandHandle commandHandle, int numSolverIterations)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
@@ -1785,7 +1796,10 @@ void b3RequestCameraImageSelectRenderer(b3SharedMemoryCommandHandle commandHandl
|
||||
b3Assert(command);
|
||||
b3Assert(command->m_type == CMD_REQUEST_CAMERA_IMAGE_DATA);
|
||||
b3Assert(renderer>(1<<15));
|
||||
command->m_updateFlags |= renderer;
|
||||
if (renderer>(1<<15))
|
||||
{
|
||||
command->m_updateFlags |= renderer;
|
||||
}
|
||||
}
|
||||
|
||||
void b3RequestCameraImageSetCameraMatrices(b3SharedMemoryCommandHandle commandHandle, float viewMatrix[16], float projectionMatrix[16])
|
||||
@@ -2712,6 +2726,8 @@ int b3SetVRCameraRootOrientation(b3SharedMemoryCommandHandle commandHandle, doub
|
||||
command->m_vrCameraStateArguments.m_rootOrientation[0] = rootOrn[0];
|
||||
command->m_vrCameraStateArguments.m_rootOrientation[1] = rootOrn[1];
|
||||
command->m_vrCameraStateArguments.m_rootOrientation[2] = rootOrn[2];
|
||||
command->m_vrCameraStateArguments.m_rootOrientation[3] = rootOrn[3];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2725,6 +2741,15 @@ int b3SetVRCameraTrackingObject(b3SharedMemoryCommandHandle commandHandle, int o
|
||||
return 0;
|
||||
}
|
||||
|
||||
int b3SetVRCameraTrackingObjectFlag(b3SharedMemoryCommandHandle commandHandle, int flag)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command);
|
||||
b3Assert(command->m_type == CMD_SET_VR_CAMERA_STATE);
|
||||
command->m_updateFlags |= VR_CAMERA_FLAG;
|
||||
command->m_vrCameraStateArguments.m_trackingObjectFlag = flag;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
b3SharedMemoryCommandHandle b3RequestKeyboardEventsCommandInit(b3PhysicsClientHandle physClient)
|
||||
|
||||
@@ -215,6 +215,7 @@ int b3PhysicsParamSetUseSplitImpulse(b3SharedMemoryCommandHandle commandHandle,
|
||||
int b3PhysicsParamSetSplitImpulsePenetrationThreshold(b3SharedMemoryCommandHandle commandHandle, double splitImpulsePenetrationThreshold);
|
||||
int b3PhysicsParamSetContactBreakingThreshold(b3SharedMemoryCommandHandle commandHandle, double contactBreakingThreshold);
|
||||
int b3PhysicsParamSetMaxNumCommandsPer1ms(b3SharedMemoryCommandHandle commandHandle, int maxNumCmdPer1ms);
|
||||
int b3PhysicsParamSetEnableFileCaching(b3SharedMemoryCommandHandle commandHandle, int enableFileCaching);
|
||||
|
||||
//b3PhysicsParamSetInternalSimFlags is for internal/temporary/easter-egg/experimental demo purposes
|
||||
//Use at own risk: magic things may or my not happen when calling this API
|
||||
@@ -376,6 +377,7 @@ b3SharedMemoryCommandHandle b3SetVRCameraStateCommandInit(b3PhysicsClientHandle
|
||||
int b3SetVRCameraRootPosition(b3SharedMemoryCommandHandle commandHandle, double rootPos[3]);
|
||||
int b3SetVRCameraRootOrientation(b3SharedMemoryCommandHandle commandHandle, double rootOrn[4]);
|
||||
int b3SetVRCameraTrackingObject(b3SharedMemoryCommandHandle commandHandle, int objectUniqueId);
|
||||
int b3SetVRCameraTrackingObjectFlag(b3SharedMemoryCommandHandle commandHandle, int flag);
|
||||
|
||||
b3SharedMemoryCommandHandle b3RequestKeyboardEventsCommandInit(b3PhysicsClientHandle physClient);
|
||||
void b3GetKeyboardEventsData(b3PhysicsClientHandle physClient, struct b3KeyboardEventsData* keyboardEventsData);
|
||||
|
||||
@@ -122,7 +122,8 @@ protected:
|
||||
{
|
||||
if (m_options == eCLIENTEXAMPLE_SERVER)
|
||||
{
|
||||
m_physicsServer.renderScene();
|
||||
int renderFlags = 0;
|
||||
m_physicsServer.renderScene(renderFlags);
|
||||
}
|
||||
|
||||
b3DebugLines debugLines;
|
||||
|
||||
@@ -226,7 +226,7 @@ bool TcpNetworkedPhysicsProcessor::receiveStatus(struct SharedMemoryStatus& serv
|
||||
}
|
||||
|
||||
|
||||
void TcpNetworkedPhysicsProcessor::renderScene()
|
||||
void TcpNetworkedPhysicsProcessor::renderScene(int renderFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual bool receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
virtual void renderScene();
|
||||
virtual void renderScene(int renderFlags);
|
||||
|
||||
virtual void physicsDebugDraw(int debugDrawFlags);
|
||||
|
||||
|
||||
@@ -540,7 +540,7 @@ bool UdpNetworkedPhysicsProcessor::receiveStatus(struct SharedMemoryStatus& serv
|
||||
}
|
||||
|
||||
|
||||
void UdpNetworkedPhysicsProcessor::renderScene()
|
||||
void UdpNetworkedPhysicsProcessor::renderScene(int renderFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual bool receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
virtual void renderScene();
|
||||
virtual void renderScene(int renderFlags);
|
||||
|
||||
virtual void physicsDebugDraw(int debugDrawFlags);
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#ifndef PHYSICS_COMMAND_PROCESSOR_INTERFACE_H
|
||||
#define PHYSICS_COMMAND_PROCESSOR_INTERFACE_H
|
||||
|
||||
enum PhysicsCOmmandRenderFlags
|
||||
{
|
||||
COV_DISABLE_SYNC_RENDERING=1
|
||||
};
|
||||
|
||||
class PhysicsCommandProcessorInterface
|
||||
{
|
||||
|
||||
@@ -17,7 +22,7 @@ public:
|
||||
|
||||
virtual bool receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes) = 0;
|
||||
|
||||
virtual void renderScene() = 0;
|
||||
virtual void renderScene(int renderFlags) = 0;
|
||||
virtual void physicsDebugDraw(int debugDrawFlags) = 0;
|
||||
virtual void setGuiHelper(struct GUIHelperInterface* guiHelper) = 0;
|
||||
virtual void setTimeOut(double timeOutInSeconds) = 0;
|
||||
|
||||
@@ -171,7 +171,8 @@ bool PhysicsDirect::connect(struct GUIHelperInterface* guiHelper)
|
||||
|
||||
void PhysicsDirect::renderScene()
|
||||
{
|
||||
m_data->m_commandProcessor->renderScene();
|
||||
int renderFlags = 0;
|
||||
m_data->m_commandProcessor->renderScene(renderFlags);
|
||||
}
|
||||
|
||||
void PhysicsDirect::debugDraw(int debugDrawMode)
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
//and for physics visualization. The idea is that physicsDebugDraw can also send wireframe
|
||||
//to a physics client, over shared memory
|
||||
virtual void physicsDebugDraw(int debugDrawFlags)=0;
|
||||
virtual void renderScene()=0;
|
||||
virtual void renderScene(int renderFlags)=0;
|
||||
|
||||
virtual void enableCommandLogging(bool enable, const char* fileName)=0;
|
||||
virtual void replayFromLogFile(const char* fileName)=0;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../Utils/RobotLoggingUtil.h"
|
||||
#include "LinearMath/btTransform.h"
|
||||
#include "../Importers/ImportMJCFDemo/BulletMJCFImporter.h"
|
||||
#include "../Importers/ImportObjDemo/LoadMeshFromObj.h"
|
||||
#include "../Extras/Serialize/BulletWorldImporter/btBulletWorldImporter.h"
|
||||
#include "BulletDynamics/Featherstone/btMultiBodyJointMotor.h"
|
||||
#include "LinearMath/btSerializer.h"
|
||||
@@ -54,6 +55,8 @@ bool gCreateDefaultRobotAssets = false;
|
||||
int gInternalSimFlags = 0;
|
||||
bool gResetSimulation = 0;
|
||||
int gVRTrackingObjectUniqueId = -1;
|
||||
int gVRTrackingObjectFlag = VR_CAMERA_TRACK_OBJECT_ORIENTATION;
|
||||
|
||||
btTransform gVRTrackingObjectTr = btTransform::getIdentity();
|
||||
|
||||
int gMaxNumCmdPer1ms = -1;//experiment: add some delay to avoid threads starving other threads
|
||||
@@ -2181,7 +2184,7 @@ int PhysicsServerCommandProcessor::createBodyInfoStream(int bodyUniqueId, char*
|
||||
//serialize the btMultiBody and send the data to the client. This is one way to get the link/joint names across the (shared memory) wire
|
||||
|
||||
InternalBodyHandle* bodyHandle = m_data->m_bodyHandles.getHandle(bodyUniqueId);
|
||||
btMultiBody* mb = bodyHandle->m_multiBody;
|
||||
btMultiBody* mb = bodyHandle? bodyHandle->m_multiBody:0;
|
||||
if (mb)
|
||||
{
|
||||
UrdfLinkNameMapUtil* util = new UrdfLinkNameMapUtil;
|
||||
@@ -2440,6 +2443,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
{
|
||||
if (clientCmd.m_stateLoggingArguments.m_loggingUniqueId == m_data->m_profileTimingLoggingUid)
|
||||
{
|
||||
serverStatusOut.m_type = CMD_STATE_LOGGING_COMPLETED;
|
||||
b3ChromeUtilsStopTimingsAndWriteJsonFile(m_data->m_profileTimingFileName.c_str());
|
||||
m_data->m_profileTimingLoggingUid = -1;
|
||||
}
|
||||
@@ -2482,6 +2486,11 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
gVRTrackingObjectUniqueId = clientCmd.m_vrCameraStateArguments.m_trackingObjectUniqueId;
|
||||
}
|
||||
|
||||
if (clientCmd.m_updateFlags & VR_CAMERA_FLAG)
|
||||
{
|
||||
gVRTrackingObjectFlag = clientCmd.m_vrCameraStateArguments.m_trackingObjectFlag;
|
||||
}
|
||||
|
||||
serverStatusOut.m_type = CMD_CLIENT_COMMAND_COMPLETED;
|
||||
hasStatus = true;
|
||||
break;
|
||||
@@ -2837,10 +2846,11 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
int actualNumBodies = 0;
|
||||
for (int i=0;i<usedHandles.size();i++)
|
||||
{
|
||||
InteralBodyData* body = m_data->m_bodyHandles.getHandle(usedHandles[i]);
|
||||
int usedHandle = usedHandles[i];
|
||||
InteralBodyData* body = m_data->m_bodyHandles.getHandle(usedHandle);
|
||||
if (body && (body->m_multiBody || body->m_rigidBody))
|
||||
{
|
||||
serverStatusOut.m_sdfLoadedArgs.m_bodyUniqueIds[actualNumBodies++] = i;
|
||||
serverStatusOut.m_sdfLoadedArgs.m_bodyUniqueIds[actualNumBodies++] = usedHandle;
|
||||
}
|
||||
}
|
||||
serverStatusOut.m_sdfLoadedArgs.m_numBodies = actualNumBodies;
|
||||
@@ -3237,6 +3247,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
}
|
||||
case CMD_LOAD_BUNNY:
|
||||
{
|
||||
serverStatusOut.m_type = CMD_UNKNOWN_COMMAND_FLUSHED;
|
||||
hasStatus = true;
|
||||
#ifdef USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||
double scale = 0.1;
|
||||
double mass = 0.1;
|
||||
@@ -3277,6 +3289,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
psb->getCollisionShape()->setMargin(collisionMargin);
|
||||
|
||||
m_data->m_dynamicsWorld->addSoftBody(psb);
|
||||
serverStatusOut.m_type = CMD_CLIENT_COMMAND_COMPLETED;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -4058,6 +4071,12 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
m_data->m_dynamicsWorld->getSolverInfo().m_erp2 = clientCmd.m_physSimParamArgs.m_defaultContactERP;
|
||||
}
|
||||
|
||||
if (clientCmd.m_updateFlags&SIM_PARAM_ENABLE_FILE_CACHING)
|
||||
{
|
||||
b3EnableFileCaching(clientCmd.m_physSimParamArgs.m_enableFileCaching);
|
||||
}
|
||||
|
||||
|
||||
SharedMemoryStatus& serverCmd =serverStatusOut;
|
||||
serverCmd.m_type = CMD_CLIENT_COMMAND_COMPLETED;
|
||||
hasStatus = true;
|
||||
@@ -4216,10 +4235,12 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
|
||||
case CMD_RESET_SIMULATION:
|
||||
{
|
||||
|
||||
BT_PROFILE("CMD_RESET_SIMULATION");
|
||||
|
||||
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,0);
|
||||
resetSimulation();
|
||||
|
||||
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,1);
|
||||
|
||||
SharedMemoryStatus& serverCmd =serverStatusOut;
|
||||
serverCmd.m_type = CMD_RESET_SIMULATION_COMPLETED;
|
||||
hasStatus = true;
|
||||
@@ -5062,6 +5083,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
serverCmd.m_removeObjectArgs.m_numBodies = 0;
|
||||
serverCmd.m_removeObjectArgs.m_numUserConstraints = 0;
|
||||
|
||||
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,0);
|
||||
|
||||
for (int i=0;i<clientCmd.m_removeObjectArgs.m_numBodies;i++)
|
||||
{
|
||||
int bodyUniqueId = clientCmd.m_removeObjectArgs.m_bodyUniqueIds[i];
|
||||
@@ -5142,7 +5165,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
|
||||
m_data->m_bodyHandles.freeHandle(bodyUniqueId);
|
||||
}
|
||||
|
||||
m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,1);
|
||||
|
||||
|
||||
hasStatus = true;
|
||||
break;
|
||||
@@ -5929,11 +5953,14 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
|
||||
//static int skip=1;
|
||||
|
||||
void PhysicsServerCommandProcessor::renderScene()
|
||||
void PhysicsServerCommandProcessor::renderScene(int renderFlags)
|
||||
{
|
||||
if (m_data->m_guiHelper)
|
||||
{
|
||||
m_data->m_guiHelper->syncPhysicsToGraphics(m_data->m_dynamicsWorld);
|
||||
if (0==(renderFlags&COV_DISABLE_SYNC_RENDERING))
|
||||
{
|
||||
m_data->m_guiHelper->syncPhysicsToGraphics(m_data->m_dynamicsWorld);
|
||||
}
|
||||
m_data->m_guiHelper->render(m_data->m_dynamicsWorld);
|
||||
}
|
||||
#ifdef USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||
@@ -6180,6 +6207,24 @@ void PhysicsServerCommandProcessor::stepSimulationRealTime(double dtInSec, const
|
||||
gResetSimulation = false;
|
||||
}
|
||||
|
||||
if (gVRTrackingObjectUniqueId >= 0)
|
||||
{
|
||||
InternalBodyHandle* bodyHandle = m_data->m_bodyHandles.getHandle(gVRTrackingObjectUniqueId);
|
||||
if (bodyHandle && bodyHandle->m_multiBody)
|
||||
{
|
||||
// gVRTrackingObjectTr = bodyHandle->m_multiBody->getBaseWorldTransform();
|
||||
|
||||
if (gVRTrackingObjectUniqueId>=0)
|
||||
{
|
||||
gVRTrackingObjectTr.setOrigin(bodyHandle->m_multiBody->getBaseWorldTransform().getOrigin());
|
||||
}
|
||||
if (gVRTrackingObjectFlag&VR_CAMERA_TRACK_OBJECT_ORIENTATION)
|
||||
{
|
||||
gVRTrackingObjectTr.setBasis(bodyHandle->m_multiBody->getBaseWorldTransform().getBasis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_data->m_allowRealTimeSimulation) && m_data->m_guiHelper)
|
||||
{
|
||||
|
||||
@@ -6199,14 +6244,7 @@ void PhysicsServerCommandProcessor::stepSimulationRealTime(double dtInSec, const
|
||||
gSubStep = m_data->m_physicsDeltaTime;
|
||||
}
|
||||
|
||||
if (gVRTrackingObjectUniqueId >= 0)
|
||||
{
|
||||
InternalBodyHandle* bodyHandle = m_data->m_bodyHandles.getHandle(gVRTrackingObjectUniqueId);
|
||||
if (bodyHandle && bodyHandle->m_multiBody)
|
||||
{
|
||||
gVRTrackingObjectTr = bodyHandle->m_multiBody->getBaseWorldTransform();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int numSteps = m_data->m_dynamicsWorld->stepSimulation(dtInSec*simTimeScalingFactor,maxSteps, gSubStep);
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
return false;
|
||||
};
|
||||
|
||||
virtual void renderScene();
|
||||
virtual void renderScene(int renderFlags);
|
||||
virtual void physicsDebugDraw(int debugDrawFlags);
|
||||
virtual void setGuiHelper(struct GUIHelperInterface* guiHelper);
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
//@todo(erwincoumans) those globals are hacks for a VR demo, move this to Python/pybullet!
|
||||
extern btVector3 gLastPickPos;
|
||||
bool gEnablePicking=true;
|
||||
bool gEnableTeleporting=true;
|
||||
bool gEnableRendering= true;
|
||||
bool gEnableSyncPhysicsRendering= true;
|
||||
bool gEnableUpdateDebugDrawLines = true;
|
||||
|
||||
btVector3 gVRTeleportPosLocal(0,0,0);
|
||||
btQuaternion gVRTeleportOrnLocal(0,0,0,1);
|
||||
@@ -181,6 +186,7 @@ enum MultiThreadedGUIHelperCommunicationEnums
|
||||
eGUIDumpFramesToVideo,
|
||||
eGUIHelperRemoveGraphicsInstance,
|
||||
eGUIHelperChangeGraphicsInstanceRGBAColor,
|
||||
eGUIHelperSetVisualizerFlag,
|
||||
};
|
||||
|
||||
|
||||
@@ -232,7 +238,9 @@ struct MyMouseCommand
|
||||
struct MotionArgs
|
||||
{
|
||||
MotionArgs()
|
||||
:m_physicsServerPtr(0)
|
||||
:
|
||||
m_debugDrawFlags(0),
|
||||
m_physicsServerPtr(0)
|
||||
{
|
||||
for (int i=0;i<MAX_VR_CONTROLLERS;i++)
|
||||
{
|
||||
@@ -254,6 +262,7 @@ struct MotionArgs
|
||||
b3CriticalSection* m_cs3;
|
||||
b3CriticalSection* m_csGUI;
|
||||
|
||||
int m_debugDrawFlags;
|
||||
|
||||
btAlignedObjectArray<MyMouseCommand> m_mouseCommands;
|
||||
|
||||
@@ -452,6 +461,15 @@ void MotionThreadFunc(void* userPtr,void* lsMemory)
|
||||
{
|
||||
args->m_physicsServerPtr->stepSimulationRealTime(deltaTimeInSeconds, args->m_sendVrControllerEvents,numSendVrControllers, keyEvents, args->m_sendKeyEvents.size());
|
||||
}
|
||||
{
|
||||
if (gEnableUpdateDebugDrawLines)
|
||||
{
|
||||
args->m_csGUI->lock();
|
||||
args->m_physicsServerPtr->physicsDebugDraw(args->m_debugDrawFlags);
|
||||
gEnableUpdateDebugDrawLines=false;
|
||||
args->m_csGUI->unlock();
|
||||
}
|
||||
}
|
||||
deltaTimeInSeconds = 0;
|
||||
|
||||
}
|
||||
@@ -546,6 +564,138 @@ struct UserDebugText
|
||||
};
|
||||
|
||||
|
||||
struct LineSegment
|
||||
{
|
||||
btVector3 m_from;
|
||||
btVector3 m_to;
|
||||
};
|
||||
|
||||
struct ColorWidth
|
||||
{
|
||||
btVector3FloatData m_color;
|
||||
int width;
|
||||
int getHash() const
|
||||
{
|
||||
unsigned char r = (unsigned char) m_color.m_floats[0]*255;
|
||||
unsigned char g = (unsigned char) m_color.m_floats[1]*255;
|
||||
unsigned char b = (unsigned char) m_color.m_floats[2]*255;
|
||||
unsigned char w = width;
|
||||
return r+(256*g)+(256*256*b)+(256*256*256*w);
|
||||
}
|
||||
bool equals(const ColorWidth& other) const
|
||||
{
|
||||
bool same = ((width == other.width) && (m_color.m_floats[0] == other.m_color.m_floats[0]) &&
|
||||
(m_color.m_floats[1] == other.m_color.m_floats[1]) &&
|
||||
(m_color.m_floats[2] == other.m_color.m_floats[2]));
|
||||
return same;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
ATTRIBUTE_ALIGNED16( class )MultithreadedDebugDrawer : public btIDebugDraw
|
||||
{
|
||||
class GUIHelperInterface* m_guiHelper;
|
||||
int m_debugMode;
|
||||
|
||||
btAlignedObjectArray< btAlignedObjectArray<unsigned int> > m_sortedIndices;
|
||||
btAlignedObjectArray< btAlignedObjectArray<btVector3FloatData> > m_sortedLines;
|
||||
btHashMap<ColorWidth,int> m_hashedLines;
|
||||
|
||||
|
||||
public:
|
||||
void drawDebugDrawerLines()
|
||||
{
|
||||
if (m_hashedLines.size())
|
||||
{
|
||||
for (int i=0;i<m_hashedLines.size();i++)
|
||||
{
|
||||
ColorWidth cw = m_hashedLines.getKeyAtIndex(i);
|
||||
int index = *m_hashedLines.getAtIndex(i);
|
||||
int stride = sizeof(btVector3FloatData);
|
||||
const float* positions = &m_sortedLines[index][0].m_floats[0];
|
||||
int numPoints = m_sortedLines[index].size();
|
||||
const unsigned int* indices = &m_sortedIndices[index][0];
|
||||
int numIndices = m_sortedIndices[index].size();
|
||||
m_guiHelper->getRenderInterface()->drawLines(positions,cw.m_color.m_floats,numPoints, stride, indices,numIndices,cw.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
MultithreadedDebugDrawer(GUIHelperInterface* guiHelper)
|
||||
:m_guiHelper(guiHelper),
|
||||
m_debugMode(0)
|
||||
{
|
||||
}
|
||||
virtual ~MultithreadedDebugDrawer()
|
||||
{
|
||||
}
|
||||
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||
{
|
||||
{
|
||||
ColorWidth cw;
|
||||
color.serializeFloat(cw.m_color);
|
||||
cw.width = 1;
|
||||
int index = -1;
|
||||
|
||||
int* indexPtr = m_hashedLines.find(cw);
|
||||
if (indexPtr)
|
||||
{
|
||||
index = *indexPtr;
|
||||
} else
|
||||
{
|
||||
index = m_sortedLines.size();
|
||||
m_sortedLines.expand();
|
||||
m_sortedIndices.expand();
|
||||
m_hashedLines.insert(cw,index);
|
||||
}
|
||||
btAssert(index>=0);
|
||||
if (index>=0)
|
||||
{
|
||||
btVector3FloatData from1,toX1;
|
||||
m_sortedIndices[index].push_back(m_sortedLines[index].size());
|
||||
from.serializeFloat(from1);
|
||||
m_sortedLines[index].push_back(from1);
|
||||
m_sortedIndices[index].push_back(m_sortedLines[index].size());
|
||||
to.serializeFloat(toX1);
|
||||
m_sortedLines[index].push_back(toX1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
|
||||
{
|
||||
drawLine(PointOnB,PointOnB+normalOnB*distance,color);
|
||||
btVector3 ncolor(0, 0, 0);
|
||||
drawLine(PointOnB, PointOnB + normalOnB*0.01, ncolor);
|
||||
}
|
||||
|
||||
virtual void reportErrorWarning(const char* warningString)
|
||||
{
|
||||
}
|
||||
virtual void draw3dText(const btVector3& location,const char* textString)
|
||||
{
|
||||
}
|
||||
virtual void setDebugMode(int debugMode)
|
||||
{
|
||||
m_debugMode = debugMode;
|
||||
}
|
||||
|
||||
virtual int getDebugMode() const
|
||||
{
|
||||
return m_debugMode;
|
||||
}
|
||||
|
||||
virtual void clearLines()
|
||||
{
|
||||
m_hashedLines.clear();
|
||||
m_sortedIndices.clear();
|
||||
m_sortedLines.clear();
|
||||
}
|
||||
virtual void flushLines()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class MultiThreadedOpenGLGuiHelper : public GUIHelperInterface
|
||||
{
|
||||
@@ -555,17 +705,19 @@ class MultiThreadedOpenGLGuiHelper : public GUIHelperInterface
|
||||
b3CriticalSection* m_cs2;
|
||||
b3CriticalSection* m_cs3;
|
||||
b3CriticalSection* m_csGUI;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void setVisualizerFlag(int flag, int enable)
|
||||
{
|
||||
m_childGuiHelper->setVisualizerFlag(flag,enable);
|
||||
}
|
||||
|
||||
|
||||
MultithreadedDebugDrawer* m_debugDraw;
|
||||
void drawDebugDrawerLines()
|
||||
{
|
||||
if (m_debugDraw)
|
||||
{
|
||||
m_debugDraw->drawDebugDrawerLines();
|
||||
}
|
||||
}
|
||||
GUIHelperInterface* m_childGuiHelper;
|
||||
|
||||
int m_uidGenerator;
|
||||
@@ -626,6 +778,7 @@ public:
|
||||
m_cs2(0),
|
||||
m_cs3(0),
|
||||
m_csGUI(0),
|
||||
m_debugDraw(0),
|
||||
m_uidGenerator(0),
|
||||
m_texels(0),
|
||||
m_textureId(-1)
|
||||
@@ -727,7 +880,18 @@ public:
|
||||
|
||||
virtual void createPhysicsDebugDrawer( btDiscreteDynamicsWorld* rbWorld)
|
||||
{
|
||||
m_childGuiHelper->createPhysicsDebugDrawer(rbWorld);
|
||||
btAssert(rbWorld);
|
||||
if (m_debugDraw)
|
||||
{
|
||||
delete m_debugDraw;
|
||||
m_debugDraw = 0;
|
||||
}
|
||||
|
||||
m_debugDraw = new MultithreadedDebugDrawer(this);
|
||||
|
||||
rbWorld->setDebugDrawer(m_debugDraw );
|
||||
|
||||
//m_childGuiHelper->createPhysicsDebugDrawer(rbWorld);
|
||||
}
|
||||
|
||||
virtual int registerTexture(const unsigned char* texels, int width, int height)
|
||||
@@ -759,6 +923,25 @@ public:
|
||||
|
||||
return m_shapeIndex;
|
||||
}
|
||||
|
||||
int m_visualizerFlag;
|
||||
int m_visualizerEnable;
|
||||
void setVisualizerFlag(int flag, int enable)
|
||||
{
|
||||
m_visualizerFlag = flag;
|
||||
m_visualizerEnable = enable;
|
||||
|
||||
m_cs->lock();
|
||||
m_cs->setSharedParam(1,eGUIHelperSetVisualizerFlag);
|
||||
workerThreadWait();
|
||||
}
|
||||
|
||||
void setVisualizerFlagCallback(VisualizerFlagCallback callback)
|
||||
{
|
||||
m_childGuiHelper->setVisualizerFlagCallback(callback);
|
||||
}
|
||||
|
||||
|
||||
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling)
|
||||
{
|
||||
m_shapeIndex = shapeIndex;
|
||||
@@ -998,6 +1181,10 @@ public:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char* m_mp4FileName;
|
||||
virtual void dumpFramesToVideo(const char* mp4FileName)
|
||||
{
|
||||
@@ -1558,6 +1745,38 @@ void PhysicsServerExample::updateGraphics()
|
||||
m_multiThreadedHelper->mainThreadRelease();
|
||||
break;
|
||||
}
|
||||
|
||||
case eGUIHelperSetVisualizerFlag:
|
||||
{
|
||||
int flag = m_multiThreadedHelper->m_visualizerFlag;
|
||||
int enable = m_multiThreadedHelper->m_visualizerEnable;
|
||||
|
||||
if (flag==COV_ENABLE_VR_TELEPORTING)
|
||||
{
|
||||
gEnableTeleporting = enable;
|
||||
}
|
||||
|
||||
if (flag == COV_ENABLE_VR_PICKING)
|
||||
{
|
||||
gEnablePicking = enable;
|
||||
}
|
||||
|
||||
if (flag ==COV_ENABLE_SYNC_RENDERING_INTERNAL)
|
||||
{
|
||||
gEnableSyncPhysicsRendering = enable;
|
||||
}
|
||||
|
||||
if (flag == COV_ENABLE_RENDERING)
|
||||
{
|
||||
gEnableRendering = enable;
|
||||
}
|
||||
|
||||
m_multiThreadedHelper->m_childGuiHelper->setVisualizerFlag(m_multiThreadedHelper->m_visualizerFlag,m_multiThreadedHelper->m_visualizerEnable);
|
||||
m_multiThreadedHelper->mainThreadRelease();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case eGUIHelperRegisterGraphicsInstance:
|
||||
{
|
||||
m_multiThreadedHelper->m_instanceId = m_multiThreadedHelper->m_childGuiHelper->registerGraphicsInstance(
|
||||
@@ -1761,32 +1980,6 @@ extern double gSubStep;
|
||||
extern int gVRTrackingObjectUniqueId;
|
||||
extern btTransform gVRTrackingObjectTr;
|
||||
|
||||
struct LineSegment
|
||||
{
|
||||
btVector3 m_from;
|
||||
btVector3 m_to;
|
||||
};
|
||||
|
||||
struct ColorWidth
|
||||
{
|
||||
btVector3FloatData m_color;
|
||||
int width;
|
||||
int getHash() const
|
||||
{
|
||||
unsigned char r = (unsigned char) m_color.m_floats[0]*255;
|
||||
unsigned char g = (unsigned char) m_color.m_floats[1]*255;
|
||||
unsigned char b = (unsigned char) m_color.m_floats[2]*255;
|
||||
unsigned char w = width;
|
||||
return r+(256*g)+(256*256*b)+(256*256*256*w);
|
||||
}
|
||||
bool equals(const ColorWidth& other) const
|
||||
{
|
||||
bool same = ((width == other.width) && (m_color.m_floats[0] == other.m_color.m_floats[0]) &&
|
||||
(m_color.m_floats[1] == other.m_color.m_floats[1]) &&
|
||||
(m_color.m_floats[2] == other.m_color.m_floats[2]));
|
||||
return same;
|
||||
}
|
||||
};
|
||||
|
||||
void PhysicsServerExample::drawUserDebugLines()
|
||||
{
|
||||
@@ -2013,30 +2206,41 @@ void PhysicsServerExample::renderScene()
|
||||
m_multiThreadedHelper->m_childGuiHelper->getRenderInterface()->
|
||||
getActiveCamera()->setVRCameraOffsetTransform(vrOffset);
|
||||
}
|
||||
m_physicsServer.renderScene();
|
||||
|
||||
for (int i=0;i<MAX_VR_CONTROLLERS;i++)
|
||||
if (gEnableRendering)
|
||||
{
|
||||
if (m_args[0].m_isVrControllerPicking[i] || m_args[0].m_isVrControllerDragging[i])
|
||||
int renderFlags = 0;
|
||||
if (!gEnableSyncPhysicsRendering)
|
||||
{
|
||||
btVector3 from = m_args[0].m_vrControllerPos[i];
|
||||
btMatrix3x3 mat(m_args[0].m_vrControllerOrn[i]);
|
||||
renderFlags|=1;//COV_DISABLE_SYNC_RENDERING;
|
||||
}
|
||||
m_physicsServer.renderScene(renderFlags);
|
||||
}
|
||||
|
||||
btVector3 toX = from+mat.getColumn(0);
|
||||
btVector3 toY = from+mat.getColumn(1);
|
||||
btVector3 toZ = from+mat.getColumn(2);
|
||||
if (gEnablePicking)
|
||||
{
|
||||
for (int i=0;i<MAX_VR_CONTROLLERS;i++)
|
||||
{
|
||||
if (m_args[0].m_isVrControllerPicking[i] || m_args[0].m_isVrControllerDragging[i])
|
||||
{
|
||||
btVector3 from = m_args[0].m_vrControllerPos[i];
|
||||
btMatrix3x3 mat(m_args[0].m_vrControllerOrn[i]);
|
||||
|
||||
int width = 2;
|
||||
btVector3 toX = from+mat.getColumn(0);
|
||||
btVector3 toY = from+mat.getColumn(1);
|
||||
btVector3 toZ = from+mat.getColumn(2);
|
||||
|
||||
int width = 2;
|
||||
|
||||
|
||||
btVector4 color;
|
||||
color=btVector4(1,0,0,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toX,color,width);
|
||||
color=btVector4(0,1,0,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toY,color,width);
|
||||
color=btVector4(0,0,1,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toZ,color,width);
|
||||
btVector4 color;
|
||||
color=btVector4(1,0,0,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toX,color,width);
|
||||
color=btVector4(0,1,0,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toY,color,width);
|
||||
color=btVector4(0,0,1,1);
|
||||
m_guiHelper->getAppInterface()->m_renderer->drawLine(from,toZ,color,width);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2058,9 +2262,18 @@ void PhysicsServerExample::physicsDebugDraw(int debugDrawFlags)
|
||||
{
|
||||
drawUserDebugLines();
|
||||
|
||||
///debug rendering
|
||||
m_physicsServer.physicsDebugDraw(debugDrawFlags);
|
||||
if (gEnableRendering)
|
||||
{
|
||||
///debug rendering
|
||||
//m_physicsServer.physicsDebugDraw(debugDrawFlags);
|
||||
m_args[0].m_csGUI->lock();
|
||||
//draw stuff and flush?
|
||||
this->m_multiThreadedHelper->m_debugDraw->drawDebugDrawerLines();
|
||||
m_args[0].m_debugDrawFlags = debugDrawFlags;
|
||||
gEnableUpdateDebugDrawLines = true;
|
||||
m_args[0].m_csGUI->unlock();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2132,10 +2345,12 @@ btVector3 PhysicsServerExample::getRayTo(int x,int y)
|
||||
|
||||
extern int gSharedMemoryKey;
|
||||
|
||||
|
||||
class CommonExampleInterface* PhysicsServerCreateFunc(struct CommonExampleOptions& options)
|
||||
{
|
||||
|
||||
MultiThreadedOpenGLGuiHelper* guiHelperWrapper = new MultiThreadedOpenGLGuiHelper(options.m_guiHelper->getAppInterface(),options.m_guiHelper);
|
||||
|
||||
|
||||
PhysicsServerExample* example = new PhysicsServerExample(guiHelperWrapper,
|
||||
options.m_sharedMem,
|
||||
@@ -2250,7 +2465,7 @@ void PhysicsServerExample::vrControllerButtonCallback(int controllerId, int butt
|
||||
}
|
||||
|
||||
|
||||
if (button==1)
|
||||
if (button==1 && gEnableTeleporting)
|
||||
{
|
||||
m_args[0].m_isVrControllerTeleporting[controllerId] = true;
|
||||
}
|
||||
@@ -2262,7 +2477,7 @@ void PhysicsServerExample::vrControllerButtonCallback(int controllerId, int butt
|
||||
else
|
||||
{
|
||||
|
||||
if (button == 33)
|
||||
if (button == 33 && gEnablePicking)
|
||||
{
|
||||
m_args[0].m_isVrControllerPicking[controllerId] = (state != 0);
|
||||
m_args[0].m_isVrControllerReleasing[controllerId] = (state == 0);
|
||||
|
||||
@@ -274,9 +274,9 @@ void PhysicsServerSharedMemory::processClientCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServerSharedMemory::renderScene()
|
||||
void PhysicsServerSharedMemory::renderScene(int renderFlags)
|
||||
{
|
||||
m_data->m_commandProcessor->renderScene();
|
||||
m_data->m_commandProcessor->renderScene(renderFlags);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
//and for physics visualization. The idea is that physicsDebugDraw can also send wireframe
|
||||
//to a physics client, over shared memory
|
||||
void physicsDebugDraw(int debugDrawFlags);
|
||||
void renderScene();
|
||||
void renderScene(int renderFlags);
|
||||
|
||||
void enableCommandLogging(bool enable, const char* fileName);
|
||||
void replayFromLogFile(const char* fileName);
|
||||
|
||||
@@ -183,7 +183,7 @@ bool SharedMemoryCommandProcessor::receiveStatus(struct SharedMemoryStatus& serv
|
||||
return false;
|
||||
}
|
||||
|
||||
void SharedMemoryCommandProcessor::renderScene()
|
||||
void SharedMemoryCommandProcessor::renderScene(int renderFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
virtual bool receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
virtual void renderScene();
|
||||
virtual void renderScene(int renderFlags);
|
||||
virtual void physicsDebugDraw(int debugDrawFlags);
|
||||
virtual void setGuiHelper(struct GUIHelperInterface* guiHelper);
|
||||
|
||||
|
||||
@@ -353,6 +353,8 @@ enum EnumSimParamUpdateFlags
|
||||
SIM_PARAM_UPDATE_COLLISION_FILTER_MODE=512,
|
||||
SIM_PARAM_UPDATE_CONTACT_BREAKING_THRESHOLD = 1024,
|
||||
SIM_PARAM_MAX_CMD_PER_1MS = 2048,
|
||||
SIM_PARAM_ENABLE_FILE_CACHING = 4096,
|
||||
|
||||
};
|
||||
|
||||
enum EnumLoadBunnyUpdateFlags
|
||||
@@ -384,6 +386,7 @@ struct SendPhysicsSimulationParameters
|
||||
int m_internalSimFlags;
|
||||
double m_defaultContactERP;
|
||||
int m_collisionFilterMode;
|
||||
int m_enableFileCaching;
|
||||
};
|
||||
|
||||
struct LoadBunnyArgs
|
||||
@@ -675,7 +678,8 @@ enum eVRCameraEnums
|
||||
{
|
||||
VR_CAMERA_ROOT_POSITION=1,
|
||||
VR_CAMERA_ROOT_ORIENTATION=2,
|
||||
VR_CAMERA_ROOT_TRACKING_OBJECT=4
|
||||
VR_CAMERA_ROOT_TRACKING_OBJECT=4,
|
||||
VR_CAMERA_FLAG = 8,
|
||||
};
|
||||
|
||||
enum eStateLoggingEnums
|
||||
@@ -696,6 +700,7 @@ struct VRCameraState
|
||||
double m_rootPosition[3];
|
||||
double m_rootOrientation[4];
|
||||
int m_trackingObjectUniqueId;
|
||||
int m_trackingObjectFlag;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -320,6 +320,11 @@ enum eVRDeviceTypeEnums
|
||||
VR_DEVICE_GENERIC_TRACKER=4,
|
||||
};
|
||||
|
||||
enum EVRCameraFlags
|
||||
{
|
||||
VR_CAMERA_TRACK_OBJECT_ORIENTATION=1,
|
||||
};
|
||||
|
||||
struct b3VRControllerEvent
|
||||
{
|
||||
int m_controllerId;//valid for VR_CONTROLLER_MOVE_EVENT and VR_CONTROLLER_BUTTON_EVENT
|
||||
@@ -495,6 +500,11 @@ enum b3ConfigureDebugVisualizerEnum
|
||||
COV_ENABLE_GUI=1,
|
||||
COV_ENABLE_SHADOWS,
|
||||
COV_ENABLE_WIREFRAME,
|
||||
COV_ENABLE_VR_TELEPORTING,
|
||||
COV_ENABLE_VR_PICKING,
|
||||
COV_ENABLE_VR_RENDER_CONTROLLERS,
|
||||
COV_ENABLE_RENDERING,
|
||||
COV_ENABLE_SYNC_RENDERING_INTERNAL,
|
||||
};
|
||||
|
||||
enum eCONNECT_METHOD {
|
||||
|
||||
@@ -516,7 +516,6 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(
|
||||
btAssert(linkPtr); // TODO: remove if (not doing it now, because diff will be 50+ lines)
|
||||
if (linkPtr)
|
||||
{
|
||||
const btArray<UrdfVisual>* shapeArray;
|
||||
bool useVisual;
|
||||
int cnt = 0;
|
||||
if (linkPtr->m_visualArray.size() > 0)
|
||||
|
||||
@@ -367,6 +367,49 @@ void MyKeyboardCallback(int key, int state)
|
||||
prevKeyboardCallback(key,state);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "../SharedMemory/SharedMemoryPublic.h"
|
||||
extern bool useShadowMap;
|
||||
bool gEnableVRRenderControllers=true;
|
||||
|
||||
|
||||
|
||||
void VRPhysicsServerVisualizerFlagCallback(int flag, bool enable)
|
||||
{
|
||||
if (flag == COV_ENABLE_SHADOWS)
|
||||
{
|
||||
useShadowMap = enable;
|
||||
}
|
||||
if (flag == COV_ENABLE_GUI)
|
||||
{
|
||||
//there is no regular GUI here, but disable the
|
||||
}
|
||||
if (flag == COV_ENABLE_VR_RENDER_CONTROLLERS)
|
||||
{
|
||||
gEnableVRRenderControllers = enable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (flag == COV_ENABLE_WIREFRAME)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
//gDebugDrawFlags |= btIDebugDraw::DBG_DrawWireframe;
|
||||
} else
|
||||
{
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
|
||||
//gDebugDrawFlags &= ~btIDebugDraw::DBG_DrawWireframe;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -418,6 +461,7 @@ bool CMainApplication::BInit()
|
||||
|
||||
|
||||
sGuiPtr = new OpenGLGuiHelper(m_app,false);
|
||||
sGuiPtr->setVisualizerFlagCallback(VRPhysicsServerVisualizerFlagCallback);
|
||||
sGuiPtr->setVRMode(true);
|
||||
|
||||
//sGuiPtr = new DummyGUIHelper;
|
||||
@@ -773,6 +817,7 @@ bool CMainApplication::HandleInput()
|
||||
if (button==2)
|
||||
{
|
||||
//glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
|
||||
///todo(erwincoumans) can't use reguar debug drawer, because physics/graphics are not in sync
|
||||
///so it can (and likely will) cause crashes
|
||||
///add a special debug drawer that deals with this
|
||||
@@ -810,7 +855,6 @@ bool CMainApplication::HandleInput()
|
||||
if (button==2)
|
||||
{
|
||||
gDebugDrawFlags = 0;
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
sExample->vrControllerButtonCallback(unDevice, button, 0, pos, orn);
|
||||
@@ -1379,6 +1423,8 @@ extern int gGraspingController;
|
||||
|
||||
void CMainApplication::DrawControllers()
|
||||
{
|
||||
|
||||
|
||||
// don't draw controllers if somebody else has input focus
|
||||
if( m_pHMD->IsInputFocusCapturedByAnotherProcess() )
|
||||
return;
|
||||
@@ -1866,39 +1912,42 @@ void CMainApplication::RenderScene( vr::Hmd_Eye nEye )
|
||||
|
||||
bool bIsInputCapturedByAnotherProcess = m_pHMD->IsInputFocusCapturedByAnotherProcess();
|
||||
|
||||
if( !bIsInputCapturedByAnotherProcess )
|
||||
if (gEnableVRRenderControllers)
|
||||
{
|
||||
// draw the controller axis lines
|
||||
glUseProgram( m_unControllerTransformProgramID );
|
||||
glUniformMatrix4fv( m_nControllerMatrixLocation, 1, GL_FALSE, GetCurrentViewProjectionMatrix( nEye ).get() );
|
||||
glBindVertexArray( m_unControllerVAO );
|
||||
glDrawArrays( GL_LINES, 0, m_uiControllerVertcount );
|
||||
glBindVertexArray( 0 );
|
||||
if( !bIsInputCapturedByAnotherProcess )
|
||||
{
|
||||
// draw the controller axis lines
|
||||
glUseProgram( m_unControllerTransformProgramID );
|
||||
glUniformMatrix4fv( m_nControllerMatrixLocation, 1, GL_FALSE, GetCurrentViewProjectionMatrix( nEye ).get() );
|
||||
glBindVertexArray( m_unControllerVAO );
|
||||
glDrawArrays( GL_LINES, 0, m_uiControllerVertcount );
|
||||
glBindVertexArray( 0 );
|
||||
}
|
||||
|
||||
// ----- Render Model rendering -----
|
||||
glUseProgram( m_unRenderModelProgramID );
|
||||
|
||||
for( uint32_t unTrackedDevice = 0; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; unTrackedDevice++ )
|
||||
{
|
||||
if( !m_rTrackedDeviceToRenderModel[ unTrackedDevice ] || !m_rbShowTrackedDevice[ unTrackedDevice ] )
|
||||
continue;
|
||||
|
||||
const vr::TrackedDevicePose_t & pose = m_rTrackedDevicePose[ unTrackedDevice ];
|
||||
if( !pose.bPoseIsValid )
|
||||
continue;
|
||||
|
||||
if( bIsInputCapturedByAnotherProcess && m_pHMD->GetTrackedDeviceClass( unTrackedDevice ) == vr::TrackedDeviceClass_Controller )
|
||||
continue;
|
||||
|
||||
const Matrix4 & matDeviceToTracking = m_rmat4DevicePose[ unTrackedDevice ];
|
||||
Matrix4 matMVP = GetCurrentViewProjectionMatrix( nEye ) * matDeviceToTracking;
|
||||
glUniformMatrix4fv( m_nRenderModelMatrixLocation, 1, GL_FALSE, matMVP.get() );
|
||||
|
||||
m_rTrackedDeviceToRenderModel[ unTrackedDevice ]->Draw();
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Render Model rendering -----
|
||||
glUseProgram( m_unRenderModelProgramID );
|
||||
|
||||
for( uint32_t unTrackedDevice = 0; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; unTrackedDevice++ )
|
||||
{
|
||||
if( !m_rTrackedDeviceToRenderModel[ unTrackedDevice ] || !m_rbShowTrackedDevice[ unTrackedDevice ] )
|
||||
continue;
|
||||
|
||||
const vr::TrackedDevicePose_t & pose = m_rTrackedDevicePose[ unTrackedDevice ];
|
||||
if( !pose.bPoseIsValid )
|
||||
continue;
|
||||
|
||||
if( bIsInputCapturedByAnotherProcess && m_pHMD->GetTrackedDeviceClass( unTrackedDevice ) == vr::TrackedDeviceClass_Controller )
|
||||
continue;
|
||||
|
||||
const Matrix4 & matDeviceToTracking = m_rmat4DevicePose[ unTrackedDevice ];
|
||||
Matrix4 matMVP = GetCurrentViewProjectionMatrix( nEye ) * matDeviceToTracking;
|
||||
glUniformMatrix4fv( m_nRenderModelMatrixLocation, 1, GL_FALSE, matMVP.get() );
|
||||
|
||||
m_rTrackedDeviceToRenderModel[ unTrackedDevice ]->Draw();
|
||||
}
|
||||
|
||||
glUseProgram( 0 );
|
||||
glUseProgram( 0 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -560,9 +560,12 @@ LoadObj(
|
||||
|
||||
int maxchars = 8192; // Alloc enough size.
|
||||
std::vector<char> buf(maxchars); // Alloc enough size.
|
||||
std::string linebuf;
|
||||
linebuf.reserve(maxchars);
|
||||
|
||||
while (ifs.peek() != -1) {
|
||||
|
||||
std::string linebuf;
|
||||
linebuf.resize(0);
|
||||
safeGetline(ifs,linebuf);
|
||||
|
||||
// Trim newline '\r\n' or '\r'
|
||||
|
||||
37
examples/pybullet/examples/humanoid_knee_position_control.py
Normal file
37
examples/pybullet/examples/humanoid_knee_position_control.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import pybullet as p
|
||||
import time
|
||||
|
||||
cid = p.connect(p.SHARED_MEMORY)
|
||||
if (cid<0):
|
||||
cid = p.connect(p.GUI)
|
||||
|
||||
p.resetSimulation()
|
||||
|
||||
useRealTime = 0
|
||||
|
||||
p.setRealTimeSimulation(useRealTime)
|
||||
|
||||
p.setGravity(0,0,0)
|
||||
|
||||
p.loadURDF("plane.urdf")
|
||||
|
||||
obUids = p.loadMJCF("mjcf/humanoid_fixed.xml")
|
||||
human = obUids[0]
|
||||
|
||||
|
||||
|
||||
for i in range (p.getNumJoints(human)):
|
||||
p.setJointMotorControl2(human,i,p.POSITION_CONTROL,targetPosition=0,force=50)
|
||||
|
||||
kneeAngleTargetId = p.addUserDebugParameter("kneeAngle",-4,4,-1)
|
||||
maxForceId = p.addUserDebugParameter("maxForce",0,100,10)
|
||||
|
||||
kneeJointIndex=11
|
||||
|
||||
while (1):
|
||||
time.sleep(0.01)
|
||||
kneeAngleTarget = p.readUserDebugParameter(kneeAngleTargetId)
|
||||
maxForce = p.readUserDebugParameter(maxForceId)
|
||||
p.setJointMotorControl2(human,kneeJointIndex,p.POSITION_CONTROL,targetPosition=kneeAngleTarget,force=maxForce)
|
||||
if (useRealTime==0):
|
||||
p.stepSimulation()
|
||||
@@ -1,21 +0,0 @@
|
||||
"""An actor network."""
|
||||
import tensorflow as tf
|
||||
import sonnet as snt
|
||||
|
||||
class ActorNetwork(snt.AbstractModule):
|
||||
"""An actor network as a sonnet Module."""
|
||||
|
||||
def __init__(self, layer_sizes, action_size, name='target_actor'):
|
||||
super(ActorNetwork, self).__init__(name=name)
|
||||
self._layer_sizes = layer_sizes
|
||||
self._action_size = action_size
|
||||
|
||||
def _build(self, inputs):
|
||||
state = inputs
|
||||
for output_size in self._layer_sizes:
|
||||
state = snt.Linear(output_size)(state)
|
||||
state = tf.nn.relu(state)
|
||||
|
||||
action = tf.tanh(
|
||||
snt.Linear(self._action_size, name='action')(state))
|
||||
return action
|
||||
@@ -1,46 +0,0 @@
|
||||
"""Loads a DDPG agent without too much external dependencies
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import collections
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
import sonnet as snt
|
||||
from agents import actor_net
|
||||
|
||||
class SimpleAgent():
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
ckpt_path,
|
||||
actor_layer_size,
|
||||
observation_size=(31,),
|
||||
action_size=8,
|
||||
):
|
||||
self._ckpt_path = ckpt_path
|
||||
self._actor_layer_size = actor_layer_size
|
||||
self._observation_size = observation_size
|
||||
self._action_size = action_size
|
||||
self._session = session
|
||||
self._build()
|
||||
|
||||
def _build(self):
|
||||
self._agent_net = actor_net.ActorNetwork(self._actor_layer_size, self._action_size)
|
||||
self._obs = tf.placeholder(tf.float32, (31,))
|
||||
with tf.name_scope('Act'):
|
||||
batch_obs = snt.nest.pack_iterable_as(self._obs,
|
||||
snt.nest.map(lambda x: tf.expand_dims(x, 0),
|
||||
snt.nest.flatten_iterable(self._obs)))
|
||||
self._action = self._agent_net(batch_obs)
|
||||
saver = tf.train.Saver()
|
||||
saver.restore(
|
||||
sess=self._session,
|
||||
save_path=self._ckpt_path)
|
||||
|
||||
def __call__(self, observation):
|
||||
out_action = self._session.run(self._action, feed_dict={self._obs: observation})
|
||||
return out_action[0]
|
||||
36
examples/pybullet/gym/agents/simplerAgent.py
Normal file
36
examples/pybullet/gym/agents/simplerAgent.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Loads a DDPG agent without too much external dependencies
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import collections
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import pdb
|
||||
|
||||
class SimplerAgent():
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
ckpt_path,
|
||||
observation_dim=31
|
||||
):
|
||||
self._ckpt_path = ckpt_path
|
||||
self._session = session
|
||||
self._observation_dim = observation_dim
|
||||
self._build()
|
||||
|
||||
def _build(self):
|
||||
saver = tf.train.import_meta_graph(self._ckpt_path + '.meta')
|
||||
saver.restore(
|
||||
sess=self._session,
|
||||
save_path=self._ckpt_path)
|
||||
self._action = tf.get_collection('action_op')[0]
|
||||
self._obs = tf.get_collection('observation_placeholder')[0]
|
||||
|
||||
def __call__(self, observation):
|
||||
feed_dict={self._obs: observation}
|
||||
out_action = self._session.run(self._action, feed_dict=feed_dict)
|
||||
return out_action[0]
|
||||
@@ -1,2 +1,2 @@
|
||||
model_checkpoint_path: "/cns/ij-d/home/jietan/persistent/minitaur/minitaur_vizier_3_153645653/Bullet/MinitaurSimEnv/28158/0003600000/agent/tf_graph_data/tf_graph_data.ckpt"
|
||||
all_model_checkpoint_paths: "/cns/ij-d/home/jietan/persistent/minitaur/minitaur_vizier_3_153645653/Bullet/MinitaurSimEnv/28158/0003600000/agent/tf_graph_data/tf_graph_data.ckpt"
|
||||
model_checkpoint_path: "tf_graph_data_converted.ckpt-0"
|
||||
all_model_checkpoint_paths: "tf_graph_data_converted.ckpt-0"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
from envs.bullet.minitaurGymEnv import MinitaurGymEnv
|
||||
from agents import simpleAgent
|
||||
from agents import simplerAgent
|
||||
|
||||
def testSinePolicy():
|
||||
"""Tests sine policy
|
||||
@@ -53,17 +53,14 @@ def testDDPGPolicy():
|
||||
environment = MinitaurGymEnv(render=True)
|
||||
sum_reward = 0
|
||||
steps = 1000
|
||||
ckpt_path = 'data/agent/tf_graph_data/tf_graph_data.ckpt'
|
||||
ckpt_path = 'data/agent/tf_graph_data/tf_graph_data_converted.ckpt-0'
|
||||
observation_shape = (31,)
|
||||
action_size = 8
|
||||
actor_layer_sizes = (100, 181)
|
||||
n_steps = 0
|
||||
tf.reset_default_graph()
|
||||
with tf.Session() as session:
|
||||
agent = simpleAgent.SimpleAgent(session, ckpt_path,
|
||||
actor_layer_sizes,
|
||||
observation_size=observation_shape,
|
||||
action_size=action_size)
|
||||
agent = simplerAgent.SimplerAgent(session, ckpt_path)
|
||||
state = environment.reset()
|
||||
action = agent(state)
|
||||
for _ in range(steps):
|
||||
|
||||
@@ -95,6 +95,9 @@ static int pybullet_internalSetMatrix(PyObject* objMat, float matrix[16])
|
||||
int i, len;
|
||||
PyObject* seq;
|
||||
|
||||
if (objMat==NULL)
|
||||
return 0;
|
||||
|
||||
seq = PySequence_Fast(objMat, "expected a sequence");
|
||||
if (seq)
|
||||
{
|
||||
@@ -123,6 +126,7 @@ static int pybullet_internalSetVector(PyObject* objVec, float vector[3])
|
||||
{
|
||||
int i, len;
|
||||
PyObject* seq = 0;
|
||||
|
||||
if (objVec == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -720,13 +724,15 @@ static PyObject* pybullet_setPhysicsEngineParameter(PyObject* self, PyObject* ar
|
||||
int collisionFilterMode = -1;
|
||||
double contactBreakingThreshold = -1;
|
||||
int maxNumCmdPer1ms = -2;
|
||||
int enableFileCaching = -1;
|
||||
|
||||
b3PhysicsClientHandle sm = 0;
|
||||
|
||||
int physicsClientId = 0;
|
||||
static char* kwlist[] = {"fixedTimeStep", "numSolverIterations", "useSplitImpulse", "splitImpulsePenetrationThreshold", "numSubSteps", "collisionFilterMode", "contactBreakingThreshold", "maxNumCmdPer1ms", "physicsClientId", NULL};
|
||||
static char* kwlist[] = {"fixedTimeStep", "numSolverIterations", "useSplitImpulse", "splitImpulsePenetrationThreshold", "numSubSteps", "collisionFilterMode", "contactBreakingThreshold", "maxNumCmdPer1ms", "enableFileCaching","physicsClientId", NULL};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|diidiidii", kwlist, &fixedTimeStep, &numSolverIterations, &useSplitImpulse, &splitImpulsePenetrationThreshold, &numSubSteps,
|
||||
&collisionFilterMode, &contactBreakingThreshold, &maxNumCmdPer1ms, &physicsClientId))
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|diidiidiii", kwlist, &fixedTimeStep, &numSolverIterations, &useSplitImpulse, &splitImpulsePenetrationThreshold, &numSubSteps,
|
||||
&collisionFilterMode, &contactBreakingThreshold, &maxNumCmdPer1ms, &enableFileCaching, &physicsClientId))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -777,6 +783,11 @@ static PyObject* pybullet_setPhysicsEngineParameter(PyObject* self, PyObject* ar
|
||||
b3PhysicsParamSetMaxNumCommandsPer1ms(command, maxNumCmdPer1ms);
|
||||
}
|
||||
|
||||
if (enableFileCaching>=0)
|
||||
{
|
||||
b3PhysicsParamSetEnableFileCaching(command, enableFileCaching);
|
||||
}
|
||||
|
||||
//ret = b3PhysicsParamSetRealTimeSimulation(command, enableRealTimeSimulation);
|
||||
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command);
|
||||
@@ -3699,11 +3710,12 @@ static PyObject* pybullet_setVRCameraState(PyObject* self, PyObject* args, PyObj
|
||||
PyObject* rootPosObj = 0;
|
||||
PyObject* rootOrnObj = 0;
|
||||
int trackObjectUid = -2;
|
||||
int trackObjectFlag = -1;
|
||||
double rootPos[3];
|
||||
double rootOrn[4];
|
||||
|
||||
static char* kwlist[] = {"rootPosition", "rootOrientation", "trackObject", "physicsClientId", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|OOii", kwlist, &rootPosObj, &rootOrnObj, &trackObjectUid, &physicsClientId))
|
||||
static char* kwlist[] = {"rootPosition", "rootOrientation", "trackObject", "trackObjectFlag","physicsClientId", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|OOiii", kwlist, &rootPosObj, &rootOrnObj, &trackObjectUid,&trackObjectFlag, &physicsClientId))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -3730,6 +3742,11 @@ static PyObject* pybullet_setVRCameraState(PyObject* self, PyObject* args, PyObj
|
||||
b3SetVRCameraTrackingObject(commandHandle, trackObjectUid);
|
||||
}
|
||||
|
||||
if (trackObjectFlag>=-1)
|
||||
{
|
||||
b3SetVRCameraTrackingObjectFlag(commandHandle, trackObjectFlag);
|
||||
}
|
||||
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
|
||||
statusType = b3GetStatusType(statusHandle);
|
||||
|
||||
@@ -4543,7 +4560,7 @@ static PyObject* pybullet_enableJointForceTorqueSensor(PyObject* self, PyObject*
|
||||
b3PhysicsClientHandle sm = 0;
|
||||
int numJoints = -1;
|
||||
|
||||
static char* kwlist[] = {"bodyUniqueId", "jointIndex", "enableSensor", "physicsClientId"};
|
||||
static char* kwlist[] = {"bodyUniqueId", "jointIndex", "enableSensor", "physicsClientId",NULL};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "ii|ii", kwlist, &bodyUniqueId, &jointIndex, &enableSensor, &physicsClientId))
|
||||
{
|
||||
@@ -4755,12 +4772,13 @@ static PyObject* pybullet_getCameraImage(PyObject* self, PyObject* args, PyObjec
|
||||
float projectionMatrix[16];
|
||||
float lightDir[3];
|
||||
float lightColor[3];
|
||||
float lightDist = 10.0;
|
||||
int hasShadow = 0;
|
||||
float lightAmbientCoeff = 0.6;
|
||||
float lightDiffuseCoeff = 0.35;
|
||||
float lightSpecularCoeff = 0.05;
|
||||
int renderer = 0;
|
||||
float lightDist = -1;
|
||||
int hasShadow = -1;
|
||||
float lightAmbientCoeff = -1;
|
||||
float lightDiffuseCoeff = -1;
|
||||
float lightSpecularCoeff = -1;
|
||||
|
||||
int renderer = -1;
|
||||
// inialize cmd
|
||||
b3SharedMemoryCommandHandle command;
|
||||
int physicsClientId = 0;
|
||||
@@ -4783,12 +4801,12 @@ static PyObject* pybullet_getCameraImage(PyObject* self, PyObject* args, PyObjec
|
||||
b3RequestCameraImageSetPixelResolution(command, width, height);
|
||||
|
||||
// set camera matrices only if set matrix function succeeds
|
||||
if (pybullet_internalSetMatrix(objViewMat, viewMatrix) && (pybullet_internalSetMatrix(objProjMat, projectionMatrix)))
|
||||
if (objViewMat && objProjMat && pybullet_internalSetMatrix(objViewMat, viewMatrix) && (pybullet_internalSetMatrix(objProjMat, projectionMatrix)))
|
||||
{
|
||||
b3RequestCameraImageSetCameraMatrices(command, viewMatrix, projectionMatrix);
|
||||
}
|
||||
//set light direction only if function succeeds
|
||||
if (pybullet_internalSetVector(lightDirObj, lightDir))
|
||||
if (lightDirObj && pybullet_internalSetVector(lightDirObj, lightDir))
|
||||
{
|
||||
b3RequestCameraImageSetLightDirection(command, lightDir);
|
||||
}
|
||||
@@ -4797,16 +4815,34 @@ static PyObject* pybullet_getCameraImage(PyObject* self, PyObject* args, PyObjec
|
||||
{
|
||||
b3RequestCameraImageSetLightColor(command, lightColor);
|
||||
}
|
||||
if (lightDist>=0)
|
||||
{
|
||||
b3RequestCameraImageSetLightDistance(command, lightDist);
|
||||
}
|
||||
|
||||
b3RequestCameraImageSetLightDistance(command, lightDist);
|
||||
if (hasShadow>=0)
|
||||
{
|
||||
b3RequestCameraImageSetShadow(command, hasShadow);
|
||||
}
|
||||
if (lightAmbientCoeff>=0)
|
||||
{
|
||||
b3RequestCameraImageSetLightAmbientCoeff(command, lightAmbientCoeff);
|
||||
}
|
||||
if (lightDiffuseCoeff>=0)
|
||||
{
|
||||
b3RequestCameraImageSetLightDiffuseCoeff(command, lightDiffuseCoeff);
|
||||
}
|
||||
|
||||
b3RequestCameraImageSetShadow(command, hasShadow);
|
||||
if (lightSpecularCoeff>=0)
|
||||
{
|
||||
b3RequestCameraImageSetLightSpecularCoeff(command, lightSpecularCoeff);
|
||||
}
|
||||
|
||||
b3RequestCameraImageSetLightAmbientCoeff(command, lightAmbientCoeff);
|
||||
b3RequestCameraImageSetLightDiffuseCoeff(command, lightDiffuseCoeff);
|
||||
b3RequestCameraImageSetLightSpecularCoeff(command, lightSpecularCoeff);
|
||||
|
||||
b3RequestCameraImageSelectRenderer(command, renderer);//renderer could be ER_BULLET_HARDWARE_OPENGL
|
||||
if (renderer>=0)
|
||||
{
|
||||
b3RequestCameraImageSelectRenderer(command, renderer);//renderer could be ER_BULLET_HARDWARE_OPENGL
|
||||
}
|
||||
//PyErr_Clear();
|
||||
|
||||
if (b3CanSubmitCommand(sm))
|
||||
{
|
||||
@@ -6332,6 +6368,8 @@ initpybullet(void)
|
||||
PyModule_AddIntConstant(m, "VR_DEVICE_HMD", VR_DEVICE_HMD);
|
||||
PyModule_AddIntConstant(m, "VR_DEVICE_GENERIC_TRACKER", VR_DEVICE_GENERIC_TRACKER);
|
||||
|
||||
PyModule_AddIntConstant(m, "VR_CAMERA_TRACK_OBJECT_ORIENTATION", VR_CAMERA_TRACK_OBJECT_ORIENTATION);
|
||||
|
||||
PyModule_AddIntConstant(m, "KEY_IS_DOWN", eButtonIsDown);
|
||||
PyModule_AddIntConstant(m, "KEY_WAS_TRIGGERED", eButtonTriggered);
|
||||
PyModule_AddIntConstant(m, "KEY_WAS_RELEASED", eButtonReleased);
|
||||
@@ -6346,6 +6384,11 @@ initpybullet(void)
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_GUI", COV_ENABLE_GUI);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_SHADOWS", COV_ENABLE_SHADOWS);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_WIREFRAME", COV_ENABLE_WIREFRAME);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_VR_PICKING", COV_ENABLE_VR_PICKING);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_VR_TELEPORTING", COV_ENABLE_VR_TELEPORTING);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_RENDERING", COV_ENABLE_RENDERING);
|
||||
PyModule_AddIntConstant(m, "COV_ENABLE_VR_RENDER_CONTROLLERS", COV_ENABLE_VR_RENDER_CONTROLLERS);
|
||||
|
||||
|
||||
PyModule_AddIntConstant(m, "ER_TINY_RENDERER", ER_TINY_RENDERER);
|
||||
PyModule_AddIntConstant(m, "ER_BULLET_HARDWARE_OPENGL", ER_BULLET_HARDWARE_OPENGL);
|
||||
|
||||
2
setup.py
2
setup.py
@@ -417,7 +417,7 @@ else:
|
||||
|
||||
setup(
|
||||
name = 'pybullet',
|
||||
version='1.0.4',
|
||||
version='1.0.7',
|
||||
description='Official Python Interface for the Bullet Physics SDK Robotics Simulator',
|
||||
long_description='pybullet is an easy to use Python module for physics simulation, robotics and machine learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.',
|
||||
url='https://github.com/bulletphysics/bullet3',
|
||||
|
||||
@@ -1514,6 +1514,8 @@ void btCollisionWorld::debugDrawWorld()
|
||||
{
|
||||
if (getDebugDrawer())
|
||||
{
|
||||
getDebugDrawer()->clearLines();
|
||||
|
||||
btIDebugDraw::DefaultColors defaultColors = getDebugDrawer()->getDefaultColors();
|
||||
|
||||
if ( getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)
|
||||
|
||||
@@ -798,6 +798,8 @@ void btMultiBodyDynamicsWorld::debugDrawWorld()
|
||||
{
|
||||
BT_PROFILE("btMultiBodyDynamicsWorld debugDrawWorld");
|
||||
|
||||
btDiscreteDynamicsWorld::debugDrawWorld();
|
||||
|
||||
bool drawConstraints = false;
|
||||
if (getDebugDrawer())
|
||||
{
|
||||
@@ -867,7 +869,7 @@ void btMultiBodyDynamicsWorld::debugDrawWorld()
|
||||
}
|
||||
}
|
||||
|
||||
btDiscreteDynamicsWorld::debugDrawWorld();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -469,6 +469,10 @@ class btIDebugDraw
|
||||
drawLine(transform*pt2,transform*pt3,color);
|
||||
}
|
||||
|
||||
virtual void clearLines()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void flushLines()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user