mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-05 23:31:06 +00:00
make standalone versions (console, tinyrender, opengl) of InverseDynamics/InverseDynamicsExample
This commit is contained in:
parent
8360e2e66d
commit
0a3efbe349
@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
include "../examples/HelloWorld"
|
include "../examples/HelloWorld"
|
||||||
include "../examples/BasicDemo"
|
include "../examples/BasicDemo"
|
||||||
|
include "../examples/InverseDynamics"
|
||||||
include "../examples/SharedMemory"
|
include "../examples/SharedMemory"
|
||||||
include "../examples/MultiThreading"
|
include "../examples/MultiThreading"
|
||||||
|
|
||||||
|
@ -501,6 +501,7 @@ CommonParameterInterface* OpenGLGuiHelper::getParameterInterface()
|
|||||||
void OpenGLGuiHelper::setUpAxis(int axis)
|
void OpenGLGuiHelper::setUpAxis(int axis)
|
||||||
{
|
{
|
||||||
m_data->m_glApp->setUpAxis(axis);
|
m_data->m_glApp->setUpAxis(axis);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLGuiHelper::resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)
|
void OpenGLGuiHelper::resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)
|
||||||
|
@ -20,7 +20,7 @@ subject to the following restrictions:
|
|||||||
#include <stdio.h> //fopen
|
#include <stdio.h> //fopen
|
||||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "tinyxml/tinyxml.h"
|
#include "../../ThirdPartyLibs/tinyxml/tinyxml.h"
|
||||||
|
|
||||||
#include "Bullet3Common/b3FileUtils.h"
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
#include "LinearMath/btHashMap.h"
|
#include "LinearMath/btHashMap.h"
|
||||||
|
@ -21,7 +21,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
#include "LinearMath/btAlignedObjectArray.h"
|
#include "LinearMath/btAlignedObjectArray.h"
|
||||||
#include "LinearMath/btTransform.h"
|
#include "LinearMath/btTransform.h"
|
||||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||||
#include "ColladaGraphicsInstance.h"
|
#include "ColladaGraphicsInstance.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "LoadMeshFromObj.h"
|
#include "LoadMeshFromObj.h"
|
||||||
#include"Wavefront/tiny_obj_loader.h"
|
#include"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h"
|
||||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||||
#include <stdio.h> //fopen
|
#include <stdio.h> //fopen
|
||||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "Wavefront2GLInstanceGraphicsShape.h"
|
#include "Wavefront2GLInstanceGraphicsShape.h"
|
||||||
|
|
||||||
#include "../OpenGLWindow/GLInstancingRenderer.h"
|
#include "../../OpenGLWindow/GLInstancingRenderer.h"
|
||||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "../OpenGLWindow/SimpleOpenGL3App.h"
|
#include "../../OpenGLWindow/SimpleOpenGL3App.h"
|
||||||
#include "Wavefront2GLInstanceGraphicsShape.h"
|
#include "Wavefront2GLInstanceGraphicsShape.h"
|
||||||
#include "../OpenGLWindow/GLInstancingRenderer.h"
|
#include "../../OpenGLWindow/GLInstancingRenderer.h"
|
||||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||||
|
|
||||||
GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes)
|
GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef WAVEFRONT2GRAPHICS_H
|
#ifndef WAVEFRONT2GRAPHICS_H
|
||||||
#define WAVEFRONT2GRAPHICS_H
|
#define WAVEFRONT2GRAPHICS_H
|
||||||
|
|
||||||
#include"Wavefront/tiny_obj_loader.h"
|
#include"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes);
|
struct GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef LOAD_MESH_FROM_STL_H
|
#ifndef LOAD_MESH_FROM_STL_H
|
||||||
#define LOAD_MESH_FROM_STL_H
|
#define LOAD_MESH_FROM_STL_H
|
||||||
|
|
||||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
#include "../../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||||
#include <stdio.h> //fopen
|
#include <stdio.h> //fopen
|
||||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ subject to the following restrictions:
|
|||||||
#include "../ImportSTLDemo/LoadMeshFromSTL.h"
|
#include "../ImportSTLDemo/LoadMeshFromSTL.h"
|
||||||
#include "../ImportColladaDemo/LoadMeshFromCollada.h"
|
#include "../ImportColladaDemo/LoadMeshFromCollada.h"
|
||||||
#include "BulletCollision/CollisionShapes/btShapeHull.h"//to create a tesselation of a generic btConvexShape
|
#include "BulletCollision/CollisionShapes/btShapeHull.h"//to create a tesselation of a generic btConvexShape
|
||||||
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
#include "../../CommonInterfaces/CommonGUIHelperInterface.h"
|
||||||
#include "Bullet3Common/b3FileUtils.h"
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../../Utils/b3ResourcePath.h"
|
#include "../../Utils/b3ResourcePath.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "MyMultiBodyCreator.h"
|
#include "MyMultiBodyCreator.h"
|
||||||
|
|
||||||
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
#include "../../CommonInterfaces/CommonGUIHelperInterface.h"
|
||||||
|
|
||||||
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
|
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
|
||||||
#include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h"
|
#include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "UrdfParser.h"
|
#include "UrdfParser.h"
|
||||||
|
|
||||||
#include "tinyxml/tinyxml.h"
|
#include "../../ThirdPartyLibs/tinyxml/tinyxml.h"
|
||||||
#include "urdfStringSplit.h"
|
#include "urdfStringSplit.h"
|
||||||
#include "urdfLexicalCast.h"
|
#include "urdfLexicalCast.h"
|
||||||
|
|
||||||
|
@ -129,13 +129,15 @@ void InverseDynamicsExample::initPhysics()
|
|||||||
SliderParams slider("Kp",&kp);
|
SliderParams slider("Kp",&kp);
|
||||||
slider.m_minVal=0;
|
slider.m_minVal=0;
|
||||||
slider.m_maxVal=2000;
|
slider.m_maxVal=2000;
|
||||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
if (m_guiHelper->getParameterInterface())
|
||||||
|
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SliderParams slider("Kd",&kd);
|
SliderParams slider("Kd",&kd);
|
||||||
slider.m_minVal=0;
|
slider.m_minVal=0;
|
||||||
slider.m_maxVal=50;
|
slider.m_maxVal=50;
|
||||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
if (m_guiHelper->getParameterInterface())
|
||||||
|
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_option == BT_ID_PROGRAMMATICALLY)
|
if (m_option == BT_ID_PROGRAMMATICALLY)
|
||||||
@ -148,6 +150,7 @@ void InverseDynamicsExample::initPhysics()
|
|||||||
|
|
||||||
switch (m_option)
|
switch (m_option)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
case BT_ID_LOAD_URDF:
|
case BT_ID_LOAD_URDF:
|
||||||
{
|
{
|
||||||
BulletURDFImporter u2b(m_guiHelper);
|
BulletURDFImporter u2b(m_guiHelper);
|
||||||
@ -189,9 +192,11 @@ void InverseDynamicsExample::initPhysics()
|
|||||||
|
|
||||||
if(m_multiBody) {
|
if(m_multiBody) {
|
||||||
{
|
{
|
||||||
m_timeSeriesCanvas = new TimeSeriesCanvas(m_guiHelper->getAppInterface()->m_2dCanvasInterface,512,230, "Joint Space Trajectory");
|
if (m_guiHelper->getAppInterface() && m_guiHelper->getParameterInterface())
|
||||||
m_timeSeriesCanvas ->setupTimeSeries(3,100, 0);
|
{
|
||||||
|
m_timeSeriesCanvas = new TimeSeriesCanvas(m_guiHelper->getAppInterface()->m_2dCanvasInterface,512,230, "Joint Space Trajectory");
|
||||||
|
m_timeSeriesCanvas ->setupTimeSeries(3,100, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct inverse model
|
// construct inverse model
|
||||||
@ -203,23 +208,30 @@ void InverseDynamicsExample::initPhysics()
|
|||||||
}
|
}
|
||||||
// add joint target controls
|
// add joint target controls
|
||||||
qd.resize(m_multiBody->getNumDofs());
|
qd.resize(m_multiBody->getNumDofs());
|
||||||
|
qd[3]=B3_HALF_PI;
|
||||||
qd_name.resize(m_multiBody->getNumDofs());
|
qd_name.resize(m_multiBody->getNumDofs());
|
||||||
q_name.resize(m_multiBody->getNumDofs());
|
q_name.resize(m_multiBody->getNumDofs());
|
||||||
for(std::size_t dof=0;dof<qd.size();dof++) {
|
|
||||||
qd[dof] = 0;
|
if (m_timeSeriesCanvas && m_guiHelper->getParameterInterface())
|
||||||
char tmp[25];
|
{
|
||||||
sprintf(tmp,"q_desired[%zu]",dof);
|
for(std::size_t dof=0;dof<qd.size();dof++)
|
||||||
qd_name[dof] = tmp;
|
{
|
||||||
SliderParams slider(qd_name[dof].c_str(),&qd[dof]);
|
qd[dof] = 0;
|
||||||
slider.m_minVal=-3.14;
|
char tmp[25];
|
||||||
slider.m_maxVal=3.14;
|
sprintf(tmp,"q_desired[%zu]",dof);
|
||||||
sprintf(tmp,"q[%zu]",dof);
|
qd_name[dof] = tmp;
|
||||||
q_name[dof] = tmp;
|
SliderParams slider(qd_name[dof].c_str(),&qd[dof]);
|
||||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
slider.m_minVal=-3.14;
|
||||||
btVector4 color = sJointCurveColors[dof&7];
|
slider.m_maxVal=3.14;
|
||||||
m_timeSeriesCanvas->addDataSource(q_name[dof].c_str(), color[0]*255,color[1]*255,color[2]*255);
|
|
||||||
}
|
sprintf(tmp,"q[%zu]",dof);
|
||||||
|
q_name[dof] = tmp;
|
||||||
|
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||||
|
btVector4 color = sJointCurveColors[dof&7];
|
||||||
|
m_timeSeriesCanvas->addDataSource(q_name[dof].c_str(), color[0]*255,color[1]*255,color[2]*255);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +258,8 @@ void InverseDynamicsExample::stepSimulation(float deltaTime)
|
|||||||
|
|
||||||
const btScalar qd_dot=0;
|
const btScalar qd_dot=0;
|
||||||
const btScalar qd_ddot=0;
|
const btScalar qd_ddot=0;
|
||||||
m_timeSeriesCanvas->insertDataAtCurrentTime(q[dof],dof,true);
|
if (m_timeSeriesCanvas)
|
||||||
|
m_timeSeriesCanvas->insertDataAtCurrentTime(q[dof],dof,true);
|
||||||
|
|
||||||
// pd_control is either desired joint torque for pd control,
|
// pd_control is either desired joint torque for pd control,
|
||||||
// or the feedback contribution to nu
|
// or the feedback contribution to nu
|
||||||
@ -330,3 +343,4 @@ CommonExampleInterface* InverseDynamicsExampleCreateFunc(CommonExampleOptions
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
B3_STANDALONE_EXAMPLE(InverseDynamicsExampleCreateFunc)
|
162
examples/InverseDynamics/premake4.lua
Normal file
162
examples/InverseDynamics/premake4.lua
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
|
||||||
|
project "App_InverseDynamicsExample"
|
||||||
|
|
||||||
|
if _OPTIONS["ios"] then
|
||||||
|
kind "WindowedApp"
|
||||||
|
else
|
||||||
|
kind "ConsoleApp"
|
||||||
|
end
|
||||||
|
defines {"B3_USE_STANDALONE_EXAMPLE"}
|
||||||
|
includedirs {"../../src"}
|
||||||
|
|
||||||
|
links {
|
||||||
|
"BulletInverseDynamicsUtils", "BulletInverseDynamics","Bullet3Common","BulletDynamics","BulletCollision", "LinearMath"
|
||||||
|
}
|
||||||
|
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
files {
|
||||||
|
"**.cpp",
|
||||||
|
"**.h",
|
||||||
|
"../StandaloneMain/main_console_single_example.cpp",
|
||||||
|
"../Utils/b3ResourcePath.cpp",
|
||||||
|
"../Utils/b3ResourcePath.h",
|
||||||
|
"../RenderingExamples/TimeSeriesCanvas.cpp",
|
||||||
|
"../RenderingExamples/TimeSeriesFontData.cpp",
|
||||||
|
"../MultiBody/InvertedPendulumPDControl.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
|
"../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
|
"../Importers/ImportObjDemo/LoadMeshFromObj.cpp",
|
||||||
|
"../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/BulletUrdfImporter.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/URDF2Bullet.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/UrdfParser.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/urdfStringSplit.cpp",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
project "App_InverseDynamicsExampleGui"
|
||||||
|
|
||||||
|
if _OPTIONS["ios"] then
|
||||||
|
kind "WindowedApp"
|
||||||
|
else
|
||||||
|
kind "ConsoleApp"
|
||||||
|
end
|
||||||
|
defines {"B3_USE_STANDALONE_EXAMPLE"}
|
||||||
|
|
||||||
|
includedirs {"../../src"}
|
||||||
|
|
||||||
|
links {
|
||||||
|
"BulletInverseDynamicsUtils", "BulletInverseDynamics","BulletDynamics","BulletCollision", "LinearMath", "OpenGL_Window","Bullet3Common"
|
||||||
|
}
|
||||||
|
|
||||||
|
initOpenGL()
|
||||||
|
initGlew()
|
||||||
|
|
||||||
|
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
files {
|
||||||
|
"InverseDynamicsExample.cpp",
|
||||||
|
"*.h",
|
||||||
|
"../StandaloneMain/main_opengl_single_example.cpp",
|
||||||
|
"../ExampleBrowser/OpenGLGuiHelper.cpp",
|
||||||
|
"../ExampleBrowser/GL_ShapeDrawer.cpp",
|
||||||
|
"../Utils/b3ResourcePath.cpp",
|
||||||
|
"../Utils/b3ResourcePath.h",
|
||||||
|
"../RenderingExamples/TimeSeriesCanvas.cpp",
|
||||||
|
"../RenderingExamples/TimeSeriesFontData.cpp",
|
||||||
|
"../MultiBody/InvertedPendulumPDControl.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
|
"../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
|
"../Importers/ImportObjDemo/LoadMeshFromObj.cpp",
|
||||||
|
"../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/BulletUrdfImporter.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/URDF2Bullet.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/UrdfParser.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/urdfStringSplit.cpp",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.is("Linux") then initX11() end
|
||||||
|
|
||||||
|
if os.is("MacOSX") then
|
||||||
|
links{"Cocoa.framework"}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
project "App_InverseDynamicsExampleGuiWithSoftwareRenderer"
|
||||||
|
|
||||||
|
if _OPTIONS["ios"] then
|
||||||
|
kind "WindowedApp"
|
||||||
|
else
|
||||||
|
kind "ConsoleApp"
|
||||||
|
end
|
||||||
|
defines {"B3_USE_STANDALONE_EXAMPLE"}
|
||||||
|
|
||||||
|
includedirs {"../../src"}
|
||||||
|
|
||||||
|
links {
|
||||||
|
"BulletInverseDynamicsUtils", "BulletInverseDynamics","BulletDynamics","BulletCollision", "LinearMath", "OpenGL_Window","Bullet3Common"
|
||||||
|
}
|
||||||
|
|
||||||
|
initOpenGL()
|
||||||
|
initGlew()
|
||||||
|
|
||||||
|
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
files {
|
||||||
|
"InverseDynamicsExample.cpp",
|
||||||
|
"*.h",
|
||||||
|
"../StandaloneMain/main_sw_tinyrenderer_single_example.cpp",
|
||||||
|
"../ExampleBrowser/OpenGLGuiHelper.cpp",
|
||||||
|
"../ExampleBrowser/GL_ShapeDrawer.cpp",
|
||||||
|
"../TinyRenderer/geometry.cpp",
|
||||||
|
"../TinyRenderer/model.cpp",
|
||||||
|
"../TinyRenderer/tgaimage.cpp",
|
||||||
|
"../TinyRenderer/our_gl.cpp",
|
||||||
|
"../TinyRenderer/TinyRenderer.cpp",
|
||||||
|
"../Utils/b3ResourcePath.cpp",
|
||||||
|
"../Utils/b3ResourcePath.cpp",
|
||||||
|
"../Utils/b3ResourcePath.h",
|
||||||
|
"../RenderingExamples/TimeSeriesCanvas.cpp",
|
||||||
|
"../RenderingExamples/TimeSeriesFontData.cpp",
|
||||||
|
"../MultiBody/InvertedPendulumPDControl.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
||||||
|
"../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
|
"../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
|
"../Importers/ImportObjDemo/LoadMeshFromObj.cpp",
|
||||||
|
"../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/BulletUrdfImporter.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/URDF2Bullet.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/UrdfParser.cpp",
|
||||||
|
"../Importers/ImportURDFDemo/urdfStringSplit.cpp",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.is("Linux") then initX11() end
|
||||||
|
|
||||||
|
if os.is("MacOSX") then
|
||||||
|
links{"Cocoa.framework"}
|
||||||
|
end
|
||||||
|
|
@ -72,13 +72,14 @@ struct TimeSeriesInternalData
|
|||||||
|
|
||||||
TimeSeriesCanvas::TimeSeriesCanvas(struct Common2dCanvasInterface* canvasInterface, int width, int height, const char* windowTitle)
|
TimeSeriesCanvas::TimeSeriesCanvas(struct Common2dCanvasInterface* canvasInterface, int width, int height, const char* windowTitle)
|
||||||
{
|
{
|
||||||
btAssert(canvasInterface);
|
|
||||||
|
|
||||||
m_internalData = new TimeSeriesInternalData(width,height);
|
m_internalData = new TimeSeriesInternalData(width,height);
|
||||||
|
|
||||||
m_internalData->m_canvasInterface = canvasInterface;
|
m_internalData->m_canvasInterface = canvasInterface;
|
||||||
|
|
||||||
m_internalData->m_canvasIndex = m_internalData->m_canvasInterface->createCanvas(windowTitle,m_internalData->m_width,m_internalData->m_height);
|
if (canvasInterface)
|
||||||
|
{
|
||||||
|
m_internalData->m_canvasIndex = m_internalData->m_canvasInterface->createCanvas(windowTitle,m_internalData->m_width,m_internalData->m_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeSeriesCanvas::addDataSource(const char* dataSourceLabel, unsigned char red,unsigned char green,unsigned char blue)
|
void TimeSeriesCanvas::addDataSource(const char* dataSourceLabel, unsigned char red,unsigned char green,unsigned char blue)
|
||||||
@ -105,6 +106,9 @@ void TimeSeriesCanvas::addDataSource(const char* dataSourceLabel, unsigned char
|
|||||||
}
|
}
|
||||||
void TimeSeriesCanvas::setupTimeSeries(float yScale, int ticksPerSecond, int startTime)
|
void TimeSeriesCanvas::setupTimeSeries(float yScale, int ticksPerSecond, int startTime)
|
||||||
{
|
{
|
||||||
|
if (0==m_internalData->m_canvasInterface)
|
||||||
|
return;
|
||||||
|
|
||||||
m_internalData->m_pixelsPerUnit = -(m_internalData->m_height/3.f)/yScale;
|
m_internalData->m_pixelsPerUnit = -(m_internalData->m_height/3.f)/yScale;
|
||||||
m_internalData->m_ticksPerSecond = ticksPerSecond;
|
m_internalData->m_ticksPerSecond = ticksPerSecond;
|
||||||
m_internalData->m_yScale = yScale;
|
m_internalData->m_yScale = yScale;
|
||||||
@ -282,6 +286,9 @@ void TimeSeriesCanvas::shift1PixelToLeft()
|
|||||||
|
|
||||||
void TimeSeriesCanvas::insertDataAtCurrentTime(float orgV, int dataSourceIndex, bool connectToPrevious)
|
void TimeSeriesCanvas::insertDataAtCurrentTime(float orgV, int dataSourceIndex, bool connectToPrevious)
|
||||||
{
|
{
|
||||||
|
if (0==m_internalData->m_canvasInterface)
|
||||||
|
return;
|
||||||
|
|
||||||
btAssert(dataSourceIndex < m_internalData->m_dataSources.size());
|
btAssert(dataSourceIndex < m_internalData->m_dataSources.size());
|
||||||
|
|
||||||
float zero = m_internalData->m_zero;
|
float zero = m_internalData->m_zero;
|
||||||
|
@ -35,7 +35,11 @@ int main(int argc, char* argv[])
|
|||||||
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
||||||
|
|
||||||
example->initPhysics();
|
example->initPhysics();
|
||||||
example->stepSimulation(1.f/60.f);
|
for (int i=0;i<1000;i++)
|
||||||
|
{
|
||||||
|
printf("Simulating step %d\n",i);
|
||||||
|
example->stepSimulation(1.f/60.f);
|
||||||
|
}
|
||||||
example->exitPhysics();
|
example->exitPhysics();
|
||||||
|
|
||||||
delete example;
|
delete example;
|
||||||
|
@ -41,19 +41,22 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
CommonExampleOptions options(&gui);
|
CommonExampleOptions options(&gui);
|
||||||
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
||||||
|
example->initPhysics();
|
||||||
example->initPhysics();
|
example->resetCamera();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
app->m_instancingRenderer->init();
|
app->m_instancingRenderer->init();
|
||||||
app->m_instancingRenderer->updateCamera();
|
app->m_instancingRenderer->updateCamera(app->getUpAxis());
|
||||||
|
|
||||||
example->stepSimulation(1./60.);
|
example->stepSimulation(1./60.);
|
||||||
|
|
||||||
example->renderScene();
|
example->renderScene();
|
||||||
|
|
||||||
app->drawGrid();
|
DrawGridData dg;
|
||||||
|
dg.upAxis = app->getUpAxis();
|
||||||
|
app->drawGrid(dg);
|
||||||
|
|
||||||
app->swapBuffer();
|
app->swapBuffer();
|
||||||
} while (!app->m_window->requestedExit());
|
} while (!app->m_window->requestedExit());
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ public:
|
|||||||
if (shapeIndex>=0)
|
if (shapeIndex>=0)
|
||||||
{
|
{
|
||||||
TinyRenderObjectData* swObj = new TinyRenderObjectData(m_swWidth,m_swHeight,m_rgbColorBuffer,m_depthBuffer);
|
TinyRenderObjectData* swObj = new TinyRenderObjectData(m_swWidth,m_swHeight,m_rgbColorBuffer,m_depthBuffer);
|
||||||
//swObj->registerMeshShape(vertices,numvertices,indices,numIndices);
|
swObj->registerMeshShape(vertices,numvertices,indices,numIndices);
|
||||||
swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices);
|
//swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices);
|
||||||
m_swRenderObjects.insert(shapeIndex,swObj);
|
m_swRenderObjects.insert(shapeIndex,swObj);
|
||||||
}
|
}
|
||||||
return shapeIndex;
|
return shapeIndex;
|
||||||
@ -242,18 +242,20 @@ int main(int argc, char* argv[])
|
|||||||
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
CommonExampleInterface* example = StandaloneExampleCreateFunc(options);
|
||||||
|
|
||||||
example->initPhysics();
|
example->initPhysics();
|
||||||
|
example->resetCamera();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
app->m_instancingRenderer->init();
|
app->m_instancingRenderer->init();
|
||||||
app->m_instancingRenderer->updateCamera();
|
app->m_instancingRenderer->updateCamera(app->getUpAxis());
|
||||||
|
|
||||||
example->stepSimulation(1./60.);
|
example->stepSimulation(1./60.);
|
||||||
|
|
||||||
|
|
||||||
example->renderScene();
|
example->renderScene();
|
||||||
|
|
||||||
app->drawGrid();
|
DrawGridData dg;
|
||||||
|
dg.upAxis = app->getUpAxis();
|
||||||
|
app->drawGrid(dg);
|
||||||
app->swapBuffer();
|
app->swapBuffer();
|
||||||
} while (!app->m_window->requestedExit());
|
} while (!app->m_window->requestedExit());
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ struct Shader : public IShader {
|
|||||||
|
|
||||||
Vec3f n = (B*m_model->normal(uv)).normalize();
|
Vec3f n = (B*m_model->normal(uv)).normalize();
|
||||||
|
|
||||||
//float diff = b3Min(b3Max(0.f, n*m_light_dir_local+0.3f),1.f);
|
float diff = b3Min(b3Max(0.f, n*m_light_dir_local+0.3f),1.f);
|
||||||
float diff = b3Max(0.f, n*m_light_dir_local);
|
//float diff = b3Max(0.f, n*m_light_dir_local);
|
||||||
color = m_model->diffuse(uv)*diff;
|
color = m_model->diffuse(uv)*diff;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user