mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 13:50:04 +00:00
Merge remote-tracking branch 'bp/master'
This commit is contained in:
commit
25cb37a0d7
@ -6,13 +6,9 @@ in Fragment
|
||||
vec4 color;
|
||||
} fragment;
|
||||
|
||||
in Vert
|
||||
{
|
||||
vec2 texcoord;
|
||||
} vert;
|
||||
|
||||
uniform sampler2D Diffuse;
|
||||
uniform mat4 ViewMatrixInverse;
|
||||
uniform mat4 TextureMVP;
|
||||
|
||||
in vec3 lightPos,cameraPosition, normal,ambient;
|
||||
in vec4 vertexPos;
|
||||
@ -23,10 +19,11 @@ in vec3 materialSpecularColor;
|
||||
out vec4 color;
|
||||
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 texel = fragment.color*texture(Diffuse,vert.texcoord.xy);
|
||||
vec4 projcoords = TextureMVP * vertexPos;
|
||||
vec2 texturecoords = projcoords.xy/max(projcoords.z,0.1);
|
||||
vec4 texel = fragment.color*texture(Diffuse,texturecoords);
|
||||
vec3 ct,cf;
|
||||
float intensity,at,af;
|
||||
if (fragment.color.w==0)
|
||||
|
@ -6,12 +6,9 @@ static const char* projectiveTextureInstancingFragmentShader= \
|
||||
"{\n"
|
||||
" vec4 color;\n"
|
||||
"} fragment;\n"
|
||||
"in Vert\n"
|
||||
"{\n"
|
||||
" vec2 texcoord;\n"
|
||||
"} vert;\n"
|
||||
"uniform sampler2D Diffuse;\n"
|
||||
"uniform mat4 ViewMatrixInverse;\n"
|
||||
"uniform mat4 TextureMVP;\n"
|
||||
"in vec3 lightPos,cameraPosition, normal,ambient;\n"
|
||||
"in vec4 vertexPos;\n"
|
||||
"in float materialShininess;\n"
|
||||
@ -20,7 +17,9 @@ static const char* projectiveTextureInstancingFragmentShader= \
|
||||
"out vec4 color;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" vec4 texel = fragment.color*texture(Diffuse,vert.texcoord.xy);\n"
|
||||
" vec4 projcoords = TextureMVP * vertexPos;\n"
|
||||
" vec2 texturecoords = projcoords.xy/max(projcoords.z,0.1);\n"
|
||||
" vec4 texel = fragment.color*texture(Diffuse,texturecoords);\n"
|
||||
" vec3 ct,cf;\n"
|
||||
" float intensity,at,af;\n"
|
||||
" if (fragment.color.w==0)\n"
|
||||
|
@ -93,7 +93,5 @@ void main(void)
|
||||
gl_Position = vertexLoc;
|
||||
|
||||
fragment.color = instance_color;
|
||||
vec4 projcoords = TextureMVP * vec4((instance_position+localcoord).xyz,1);
|
||||
vert.texcoord = projcoords.xy/projcoords.z;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,5 @@ static const char* projectiveTextureInstancingVertexShader= \
|
||||
" vec4 vertexLoc = MVP* vec4((instance_position+localcoord).xyz,1);\n"
|
||||
" gl_Position = vertexLoc;\n"
|
||||
" fragment.color = instance_color;\n"
|
||||
" vec4 projcoords = TextureMVP * vec4((instance_position+localcoord).xyz,1);\n"
|
||||
" vert.texcoord = projcoords.xy/projcoords.z;\n"
|
||||
"}\n"
|
||||
;
|
||||
|
@ -211,7 +211,7 @@ IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
|
||||
#VR/OpenVR only on Windows and Mac OSX for now
|
||||
#VR/OpenVR on Windows and Mac OSX
|
||||
IF (WIN32 OR APPLE)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
@ -325,4 +325,80 @@ IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
#VR/OpenVR on Linux
|
||||
ELSE(WIN32 OR APPLE)
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/linux64)
|
||||
ELSE()
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/linux32)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_VR
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/hellovr_opengl_main.cpp
|
||||
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../RenderingExamples/TinyVRGui.cpp
|
||||
../RenderingExamples/TinyVRGui.h
|
||||
../RenderingExamples/TimeSeriesCanvas.cpp
|
||||
../RenderingExamples/TimeSeriesFontData.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/lodepng.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/lodepng.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/Matrices.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/Matrices.h
|
||||
../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/Vectors.h
|
||||
)
|
||||
|
||||
target_include_directories(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||
${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
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
)
|
||||
|
||||
target_compile_definitions(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
POSIX
|
||||
LINUX
|
||||
BT_ENABLE_VR
|
||||
GLEW_STATIC
|
||||
GLEW_INIT_OPENGL11_FUNCTIONS=1
|
||||
GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1
|
||||
)
|
||||
|
||||
target_compile_options(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
-std=c++11
|
||||
)
|
||||
|
||||
target_link_libraries(App_PhysicsServer_SharedMemory_VR PRIVATE
|
||||
openvr_api
|
||||
pthread
|
||||
${DL}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${OPENGL_glu_LIBRARY}
|
||||
Bullet3Common
|
||||
BulletWorldImporter
|
||||
BulletInverseDynamicsUtils
|
||||
BulletInverseDynamics
|
||||
BulletDynamics
|
||||
BulletCollision
|
||||
LinearMath
|
||||
BussIK
|
||||
OpenGLWindow
|
||||
)
|
||||
|
||||
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||
SET_TARGET_PROPERTIES(App_PhysicsServer_SharedMemory_VR PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
|
||||
ENDIF(WIN32 OR APPLE)
|
||||
|
@ -59,6 +59,9 @@ static vr::VRControllerState_t sPrevStates[vr::k_unMaxTrackedDeviceCount] = { 0
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
void ThreadSleep( unsigned long nMilliseconds )
|
||||
{
|
||||
@ -1804,13 +1807,11 @@ void CMainApplication::RenderStereoTargets()
|
||||
}
|
||||
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, leftEyeDesc.m_nRenderFramebufferId );
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
|
||||
|
||||
|
||||
m_app->m_window->startRendering();
|
||||
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
|
||||
RenderScene( vr::Eye_Left );
|
||||
|
||||
@ -1863,9 +1864,9 @@ void CMainApplication::RenderStereoTargets()
|
||||
}
|
||||
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, rightEyeDesc.m_nRenderFramebufferId );
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
m_app->m_window->startRendering();
|
||||
glViewport(0, 0, m_nRenderWidth, m_nRenderHeight );
|
||||
|
||||
RenderScene( vr::Eye_Right );
|
||||
|
||||
@ -2081,6 +2082,7 @@ void CMainApplication::UpdateHMDMatrixPose()
|
||||
case vr::TrackedDeviceClass_HMD: m_rDevClassChar[nDevice] = 'H'; break;
|
||||
case vr::TrackedDeviceClass_Invalid: m_rDevClassChar[nDevice] = 'I'; break;
|
||||
case vr::TrackedDeviceClass_TrackingReference: m_rDevClassChar[nDevice] = 'T'; break;
|
||||
case vr::TrackedDeviceClass_GenericTracker: m_rDevClassChar[nDevice] = 'G'; break;
|
||||
default: m_rDevClassChar[nDevice] = '?'; break;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1,6 +1,5 @@
|
||||
import pybullet as p
|
||||
from time import sleep
|
||||
from PIL import Image
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
@ -9,7 +8,7 @@ physicsClient = p.connect(p.GUI)
|
||||
p.setGravity(0,0,0)
|
||||
bearStartPos1 = [-3.3,0,0]
|
||||
bearStartOrientation1 = p.getQuaternionFromEuler([0,0,0])
|
||||
bearId1 = p.loadURDF("teddy_large.urdf", bearStartPos1, bearStartOrientation1)
|
||||
bearId1 = p.loadURDF("plane.urdf", bearStartPos1, bearStartOrientation1)
|
||||
bearStartPos2 = [0,0,0]
|
||||
bearStartOrientation2 = p.getQuaternionFromEuler([0,0,0])
|
||||
bearId2 = p.loadURDF("teddy_large.urdf",bearStartPos2, bearStartOrientation2)
|
||||
|
@ -121,12 +121,19 @@ void btRaycastVehicle::updateWheelTransform( int wheelIndex , bool interpolatedT
|
||||
btQuaternion rotatingOrn(right,-wheel.m_rotation);
|
||||
btMatrix3x3 rotatingMat(rotatingOrn);
|
||||
|
||||
btMatrix3x3 basis2(
|
||||
right[0],fwd[0],up[0],
|
||||
right[1],fwd[1],up[1],
|
||||
right[2],fwd[2],up[2]
|
||||
);
|
||||
|
||||
btMatrix3x3 basis2;
|
||||
basis2[0][m_indexRightAxis] = -right[0];
|
||||
basis2[1][m_indexRightAxis] = -right[1];
|
||||
basis2[2][m_indexRightAxis] = -right[2];
|
||||
|
||||
basis2[0][m_indexUpAxis] = up[0];
|
||||
basis2[1][m_indexUpAxis] = up[1];
|
||||
basis2[2][m_indexUpAxis] = up[2];
|
||||
|
||||
basis2[0][m_indexForwardAxis] = fwd[0];
|
||||
basis2[1][m_indexForwardAxis] = fwd[1];
|
||||
basis2[2][m_indexForwardAxis] = fwd[2];
|
||||
|
||||
wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
|
||||
wheel.m_worldTransform.setOrigin(
|
||||
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength
|
||||
@ -567,7 +574,7 @@ void btRaycastVehicle::updateFriction(btScalar timeStep)
|
||||
const btTransform& wheelTrans = getWheelTransformWS( i );
|
||||
|
||||
btMatrix3x3 wheelBasis0 = wheelTrans.getBasis();
|
||||
m_axle[i] = btVector3(
|
||||
m_axle[i] = -btVector3(
|
||||
wheelBasis0[0][m_indexRightAxis],
|
||||
wheelBasis0[1][m_indexRightAxis],
|
||||
wheelBasis0[2][m_indexRightAxis]);
|
||||
|
Loading…
Reference in New Issue
Block a user