diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index 7fb2fb30a..be95bab46 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -1208,13 +1208,17 @@ int b3GetNumJoints(b3PhysicsClientHandle physClient, int bodyId) return cl->getNumJoints(bodyId); } - int b3GetJointInfo(b3PhysicsClientHandle physClient, int bodyIndex, int jointIndex, struct b3JointInfo* info) { PhysicsClient* cl = (PhysicsClient* ) physClient; return cl->getJointInfo(bodyIndex, jointIndex, *info); } +int b3GetDynamicInfo(b3PhysicsClientHandle physClient, int bodyUniqueId, int linkIndex, struct b3DynamicInfo* info) +{ + return 0; +} + b3SharedMemoryCommandHandle b3InitResetDynamicInfo(b3PhysicsClientHandle physClient) { PhysicsClient* cl = (PhysicsClient* ) physClient; diff --git a/examples/SharedMemory/PhysicsClientExample.cpp b/examples/SharedMemory/PhysicsClientExample.cpp index d0090f6b5..b744a2d0b 100644 --- a/examples/SharedMemory/PhysicsClientExample.cpp +++ b/examples/SharedMemory/PhysicsClientExample.cpp @@ -53,6 +53,9 @@ protected: int m_canvasRGBIndex; int m_canvasDepthIndex; int m_canvasSegMaskIndex; + + float m_lightPos[3]; + float m_specularCoeff; void createButton(const char* name, int id, bool isTrigger ); @@ -257,7 +260,7 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId) case CMD_LOAD_SDF: { #ifdef BT_DEBUG - b3SharedMemoryCommandHandle commandHandle = b3LoadSdfCommandInit(m_physicsClientHandle, "two_cubes.sdf"); + b3SharedMemoryCommandHandle commandHandle = b3LoadSdfCommandInit(m_physicsClientHandle, "kuka_iiwa/model.sdf"); #else b3SharedMemoryCommandHandle commandHandle = b3LoadSdfCommandInit(m_physicsClientHandle, "kitchens/1.sdf");//two_cubes.sdf");//kitchens/1.sdf");//kuka_iiwa/model.sdf"); #endif @@ -278,6 +281,8 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId) b3RequestCameraImageSetCameraMatrices(commandHandle, viewMatrix,projectionMatrix); b3RequestCameraImageSetPixelResolution(commandHandle, camVisualizerWidth,camVisualizerHeight); + b3RequestCameraImageSetLightDirection(commandHandle, m_lightPos); + b3RequestCameraImageSetLightSpecularCoeff(commandHandle, m_specularCoeff); b3SubmitClientCommand(m_physicsClientHandle, commandHandle); break; } @@ -522,6 +527,7 @@ m_canvas(0), m_canvasRGBIndex(-1), m_canvasDepthIndex(-1), m_canvasSegMaskIndex(-1), +m_specularCoeff(1.0), m_numMotors(0), m_options(options), m_isOptionalServerConnected(false) @@ -660,6 +666,29 @@ void PhysicsClientExample::createButtons() } } } + + { + SliderParams sliderLightPosX("light source position x",&m_lightPos[0]); + SliderParams sliderLightPosY("light source position y",&m_lightPos[1]); + SliderParams sliderLightPosZ("light source position z",&m_lightPos[2]); + SliderParams sliderSpecularCoeff("specular coefficient",&m_specularCoeff); + sliderLightPosX.m_minVal=-1.5; + sliderLightPosX.m_maxVal=1.5; + sliderLightPosY.m_minVal=-1.5; + sliderLightPosY.m_maxVal=1.5; + sliderLightPosZ.m_minVal=-1.5; + sliderLightPosZ.m_maxVal=1.5; + sliderSpecularCoeff.m_minVal=0; + sliderSpecularCoeff.m_maxVal=5.0; + if (m_guiHelper && m_guiHelper->getParameterInterface()) + { + m_guiHelper->getParameterInterface()->registerSliderFloatParameter(sliderLightPosX); + m_guiHelper->getParameterInterface()->registerSliderFloatParameter(sliderLightPosY); + m_guiHelper->getParameterInterface()->registerSliderFloatParameter(sliderLightPosZ); + m_guiHelper->getParameterInterface()->registerSliderFloatParameter(sliderSpecularCoeff); + } + + } } } @@ -684,6 +713,10 @@ void PhysicsClientExample::initPhysics() m_selectedBody = -1; m_prevSelectedBody = -1; + + m_lightPos[0] = 1.0; + m_lightPos[1] = 1.0; + m_lightPos[2] = 1.0; { m_canvas = m_guiHelper->get2dCanvasInterface(); diff --git a/examples/SharedMemory/SharedMemoryCommands.h b/examples/SharedMemory/SharedMemoryCommands.h index c0a7a3315..5e339430a 100644 --- a/examples/SharedMemory/SharedMemoryCommands.h +++ b/examples/SharedMemory/SharedMemoryCommands.h @@ -832,6 +832,7 @@ struct SharedMemoryStatus struct StateLoggingResultArgs m_stateLoggingResultArgs; struct b3OpenGLVisualizerCameraInfo m_visualizerCameraResultArgs; struct b3ObjectArgs m_removeObjectArgs; + struct b3DynamicInfo m_dynamicInfo; }; }; diff --git a/examples/SharedMemory/SharedMemoryPublic.h b/examples/SharedMemory/SharedMemoryPublic.h index 410ca5d3e..7602e309e 100644 --- a/examples/SharedMemory/SharedMemoryPublic.h +++ b/examples/SharedMemory/SharedMemoryPublic.h @@ -224,6 +224,7 @@ struct b3DynamicInfo { double m_mass; double m_localInertialPosition[3]; + double m_lateralFrictionCoeff; }; // copied from btMultiBodyLink.h diff --git a/examples/TinyRenderer/model.cpp b/examples/TinyRenderer/model.cpp index 056ed001f..25c7701df 100644 --- a/examples/TinyRenderer/model.cpp +++ b/examples/TinyRenderer/model.cpp @@ -167,8 +167,12 @@ Vec2f Model::uv(int iface, int nthvert) { } float Model::specular(Vec2f uvf) { - Vec2i uv(uvf[0]*specularmap_.get_width(), uvf[1]*specularmap_.get_height()); - return specularmap_.get(uv[0], uv[1])[0]/1.f; + if (specularmap_.get_width() && specularmap_.get_height()) + { + Vec2i uv(uvf[0]*specularmap_.get_width(), uvf[1]*specularmap_.get_height()); + return specularmap_.get(uv[0], uv[1])[0]/1.f; + } + return 2.0; } Vec3f Model::normal(int iface, int nthvert) {