Merge commit.
This commit is contained in:
@@ -165,6 +165,8 @@ SET(BulletExampleBrowser_SRCS
|
||||
../BasicDemo/BasicExample.h
|
||||
../InverseDynamics/InverseDynamicsExample.cpp
|
||||
../InverseDynamics/InverseDynamicsExample.h
|
||||
../InverseKinematics/InverseKinematicsExample.cpp
|
||||
../InverseKinematics/InverseKinematicsExample.h
|
||||
../ForkLift/ForkLiftDemo.cpp
|
||||
../ForkLift/ForkLiftDemo.h
|
||||
../Tutorial/Tutorial.cpp
|
||||
@@ -173,6 +175,8 @@ SET(BulletExampleBrowser_SRCS
|
||||
../Tutorial/Dof6ConstraintTutorial.h
|
||||
../Evolution/NN3DWalkers.cpp
|
||||
../Evolution/NN3DWalkers.h
|
||||
../ExtendedTutorials/NewtonsRopeCradle.cpp
|
||||
../ExtendedTutorials/NewtonsRopeCradle.h
|
||||
../Collision/CollisionSdkC_Api.cpp
|
||||
../Collision/CollisionSdkC_Api.h
|
||||
../Collision/CollisionTutorialBullet2.cpp
|
||||
@@ -204,7 +208,12 @@ SET(BulletExampleBrowser_SRCS
|
||||
../RenderingExamples/TimeSeriesCanvas.h
|
||||
../RenderingExamples/TimeSeriesFontData.cpp
|
||||
../RenderingExamples/TimeSeriesFontData.h
|
||||
|
||||
../RoboticsLearning/GripperGraspExample.cpp
|
||||
../RoboticsLearning/GripperGraspExample.h
|
||||
../RoboticsLearning/b3RobotSimAPI.cpp
|
||||
../RoboticsLearning/b3RobotSimAPI.h
|
||||
../RoboticsLearning/R2D2GraspExample.cpp
|
||||
../RoboticsLearning/R2D2GraspExample.h
|
||||
../RenderingExamples/CoordinateSystemDemo.cpp
|
||||
../RenderingExamples/CoordinateSystemDemo.h
|
||||
../RenderingExamples/RaytracerSetup.cpp
|
||||
@@ -291,6 +300,17 @@ SET(BulletExampleBrowser_SRCS
|
||||
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.h
|
||||
|
||||
../ThirdPartyLibs/BussIK/Jacobian.cpp
|
||||
../ThirdPartyLibs/BussIK/Tree.cpp
|
||||
../ThirdPartyLibs/BussIK/Node.cpp
|
||||
../ThirdPartyLibs/BussIK/LinearR2.cpp
|
||||
../ThirdPartyLibs/BussIK/LinearR3.cpp
|
||||
../ThirdPartyLibs/BussIK/LinearR4.cpp
|
||||
../ThirdPartyLibs/BussIK/MatrixRmn.cpp
|
||||
../ThirdPartyLibs/BussIK/VectorRn.cpp
|
||||
../ThirdPartyLibs/BussIK/Misc.cpp
|
||||
|
||||
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
||||
|
||||
@@ -167,6 +167,7 @@ void CollisionShape2TriangleMesh(btCollisionShape* collisionShape, const btTrans
|
||||
}
|
||||
}
|
||||
}
|
||||
delete hull;
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
#include "../Tutorial/Dof6ConstraintTutorial.h"
|
||||
#include "../MultiThreading/MultiThreadingExample.h"
|
||||
#include "../InverseDynamics/InverseDynamicsExample.h"
|
||||
#include "../RoboticsLearning/R2D2GraspExample.h"
|
||||
#include "../RoboticsLearning/GripperGraspExample.h"
|
||||
#include "../InverseKinematics/InverseKinematicsExample.h"
|
||||
|
||||
#ifdef ENABLE_LUA
|
||||
#include "../LuaDemo/LuaPhysicsSetup.h"
|
||||
#endif
|
||||
@@ -66,6 +70,7 @@
|
||||
#include "../ExtendedTutorials/RigidBodyFromObj.h"
|
||||
#include "../ExtendedTutorials/InclinedPlane.h"
|
||||
#include "../ExtendedTutorials/NewtonsCradle.h"
|
||||
#include "../ExtendedTutorials/NewtonsRopeCradle.h"
|
||||
#include "../ExtendedTutorials/MultiPendulum.h"
|
||||
#include "../Evolution/NN3DWalkers.h"
|
||||
|
||||
@@ -97,7 +102,6 @@ static ExampleEntry gDefaultExamples[]=
|
||||
|
||||
ExampleEntry(1,"Basic Example","Create some rigid bodies using box collision shapes. This is a good example to familiarize with the basic initialization of Bullet. The Basic Example can also be compiled without graphical user interface, as a console application. Press W for wireframe, A to show AABBs, I to suspend/restart physics simulation. Press D to toggle auto-deactivation of the simulation. ", BasicExampleCreateFunc),
|
||||
|
||||
|
||||
ExampleEntry(1,"Rolling Friction", "Damping is often not good enough to keep rounded objects from rolling down a sloped surface. Instead, you can set the rolling friction of a rigid body. Generally it is best to leave the rolling friction to zero, to avoid artifacts.", RollingFrictionCreateFunc),
|
||||
|
||||
ExampleEntry(1,"Constraints","Show the use of the various constraints in Bullet. Press the L key to visualize the constraint limits. Press the C key to visualize the constraint frames.",
|
||||
@@ -117,21 +121,30 @@ static ExampleEntry gDefaultExamples[]=
|
||||
|
||||
ExampleEntry(1,"Soft Contact", "Using the error correction parameter (ERP) and constraint force mixing (CFM) values for contacts to simulate compliant contact.",RigidBodySoftContactCreateFunc),
|
||||
|
||||
|
||||
|
||||
ExampleEntry(0,"MultiBody"),
|
||||
ExampleEntry(1,"MultiDofCreateFunc","Create a basic btMultiBody with 3-DOF spherical joints (mobilizers). The demo uses a fixed base or a floating base at restart.", MultiDofCreateFunc),
|
||||
ExampleEntry(1,"TestJointTorque","Apply a torque to a btMultiBody with 1-DOF joints (mobilizers). This setup is similar to API/TestHingeTorque.", TestJointTorqueCreateFunc),
|
||||
ExampleEntry(1,"TestPendulum","Simulate a pendulum using btMultiBody with a constant joint torque applied. The same code is also used as a unit test comparing Bullet with the numerical solution of second-order non-linear differential equation stored in pendulum_gold.h", TestPendulumCreateFunc),
|
||||
|
||||
ExampleEntry(1,"Constraint Feedback", "The example shows how to receive joint reaction forces in a btMultiBody. Also the applied impulse is available for a btMultiBodyJointMotor", MultiBodyConstraintFeedbackCreateFunc),
|
||||
ExampleEntry(1,"Constraint Feedback", "The example shows how to receive joint reaction forces in a btMultiBody. Also the applied impulse is available for a btMultiBodyJointMotor", MultiBodyConstraintFeedbackCreateFunc),
|
||||
ExampleEntry(1,"Inverted Pendulum PD","Keep an inverted pendulum up using open loop PD control", InvertedPendulumPDControlCreateFunc),
|
||||
ExampleEntry(1,"MultiBody Soft Contact", "Using the error correction parameter (ERP) and constraint force mixing (CFM) values for contacts to simulate compliant contact.",MultiBodySoftContactCreateFunc,0),
|
||||
ExampleEntry(1,"MultiBody Soft Contact", "Using the error correction parameter (ERP) and constraint force mixing (CFM) values for contacts to simulate compliant contact.",MultiBodySoftContactCreateFunc,0),
|
||||
|
||||
|
||||
ExampleEntry(0,"Inverse Dynamics"),
|
||||
ExampleEntry(1,"Inverse Dynamics URDF", "Create a btMultiBody from URDF. Create an inverse MultiBodyTree model from that. Use either decoupled PD control or computed torque control using the inverse model to track joint position targets", InverseDynamicsExampleCreateFunc,BT_ID_LOAD_URDF),
|
||||
ExampleEntry(1,"Inverse Dynamics Prog", "Create a btMultiBody programatically. Create an inverse MultiBodyTree model from that. Use either decoupled PD control or computed torque control using the inverse model to track joint position targets", InverseDynamicsExampleCreateFunc,BT_ID_PROGRAMMATICALLY),
|
||||
ExampleEntry(0,"Inverse Dynamics"),
|
||||
ExampleEntry(1,"Inverse Dynamics URDF", "Create a btMultiBody from URDF. Create an inverse MultiBodyTree model from that. Use either decoupled PD control or computed torque control using the inverse model to track joint position targets", InverseDynamicsExampleCreateFunc,BT_ID_LOAD_URDF),
|
||||
ExampleEntry(1,"Inverse Dynamics Prog", "Create a btMultiBody programatically. Create an inverse MultiBodyTree model from that. Use either decoupled PD control or computed torque control using the inverse model to track joint position targets", InverseDynamicsExampleCreateFunc,BT_ID_PROGRAMMATICALLY),
|
||||
|
||||
ExampleEntry(0, "Inverse Kinematics"),
|
||||
ExampleEntry(1, "SDLS", "Selectively Damped Least Squares by Sam Buss. Example configures the IK tree of a Kuka IIWA", InverseKinematicsExampleCreateFunc, IK_SDLS),
|
||||
ExampleEntry(1, "DLS", "Damped Least Squares by Sam Buss. Example configures the IK tree of a Kuka IIWA", InverseKinematicsExampleCreateFunc, IK_DLS),
|
||||
ExampleEntry(1, "DLS-SVD", "Damped Least Squares with Singular Value Decomposition by Sam Buss. Example configures the IK tree of a Kuka IIWA", InverseKinematicsExampleCreateFunc, IK_DLS_SVD),
|
||||
|
||||
|
||||
|
||||
ExampleEntry(1, "Jacobi Transpose", "Jacobi Transpose by Sam Buss. Example configures the IK tree of a Kuka IIWA", InverseKinematicsExampleCreateFunc, IK_JACOB_TRANS),
|
||||
ExampleEntry(1, "Jacobi Pseudo Inv", "Jacobi Pseudo Inverse Method by Sam Buss. Example configures the IK tree of a Kuka IIWA", InverseKinematicsExampleCreateFunc, IK_PURE_PSEUDO),
|
||||
|
||||
|
||||
ExampleEntry(0,"Tutorial"),
|
||||
ExampleEntry(1,"Constant Velocity","Free moving rigid body, without external or constraint forces", TutorialCreateFunc,TUT_VELOCITY),
|
||||
@@ -187,7 +200,7 @@ static ExampleEntry gDefaultExamples[]=
|
||||
#endif //INCLUDE_CLOTH_DEMOS
|
||||
|
||||
///we disable the benchmarks in debug mode, they are way too slow and benchmarking in debug mode is not recommended
|
||||
#ifndef _DEBUG
|
||||
//#ifndef _DEBUG
|
||||
ExampleEntry(0,"Benchmarks"),
|
||||
ExampleEntry(1,"3000 boxes", "Benchmark a stack of 3000 boxes. It will stress the collision detection, a specialized box-box implementation based on the separating axis test, and the constraint solver. ", BenchmarkCreateFunc, 1),
|
||||
ExampleEntry(1,"1000 stack", "Benchmark a stack of 3000 boxes. It will stress the collision detection, a specialized box-box implementation based on the separating axis test, and the constraint solver. ",
|
||||
@@ -197,7 +210,7 @@ static ExampleEntry gDefaultExamples[]=
|
||||
ExampleEntry(1,"Prim vs Mesh", "Benchmark the performance and stability of rigid bodies using primitive collision shapes (btSphereShape, btBoxShape), resting on a triangle mesh, btBvhTriangleMeshShape.", BenchmarkCreateFunc, 5),
|
||||
ExampleEntry(1,"Convex vs Mesh", "Benchmark the performance and stability of rigid bodies using convex hull collision shapes (btConvexHullShape), resting on a triangle mesh, btBvhTriangleMeshShape.", BenchmarkCreateFunc, 6),
|
||||
ExampleEntry(1,"Raycast", "Benchmark the performance of the btCollisionWorld::rayTest. Note that currently the rays are not rendered.", BenchmarkCreateFunc, 7),
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
|
||||
@@ -244,8 +257,13 @@ static ExampleEntry gDefaultExamples[]=
|
||||
PhysicsServerCreateFunc,PHYSICS_SERVER_ENABLE_COMMAND_LOGGING),
|
||||
ExampleEntry(1,"Physics Server (Replay Log)", "Create a physics server that replay a command log from disk.",
|
||||
PhysicsServerCreateFunc,PHYSICS_SERVER_REPLAY_FROM_COMMAND_LOG),
|
||||
ExampleEntry(1, "Physics Client (Shared Mem)", "Create a physics client that can communicate with a physics server over shared memory.", PhysicsClientCreateFunc),
|
||||
ExampleEntry(1, "Physics Client (Direct)", "Create a physics client that can communicate with a physics server directly in-process.", PhysicsClientCreateFunc,eCLIENTEXAMPLE_DIRECT),
|
||||
|
||||
ExampleEntry(1, "Physics Client", "Create a physics client that can communicate with a physics server over shared memory", PhysicsClientCreateFunc),
|
||||
ExampleEntry(1,"R2D2 Grasp","Load the R2D2 robot from URDF file and control it to grasp objects", R2D2GraspExampleCreateFunc, eROBOTIC_LEARN_GRASP),
|
||||
ExampleEntry(1,"URDF Compliant Contact","Work-in-progress, experiment/improve compliant rigid contact using parameters from URDF file (contact_cfm, contact_erp, lateral_friction, rolling_friction)", R2D2GraspExampleCreateFunc,eROBOTIC_LEARN_COMPLIANT_CONTACT),
|
||||
ExampleEntry(1,"Contact for Grasp","Grasp experiment to improve contact model", GripperGraspExampleCreateFunc),
|
||||
|
||||
|
||||
|
||||
#ifdef ENABLE_LUA
|
||||
@@ -279,8 +297,9 @@ static ExampleEntry gDefaultExamples[]=
|
||||
ExampleEntry(1,"Simple Chain", "Create a simple chain using a pair of point2point/distance constraints. You may click and drag any box to see the chain respond.", ET_ChainCreateFunc),
|
||||
ExampleEntry(1,"Simple Bridge", "Create a simple bridge using a pair of point2point/distance constraints. You may click and drag any plank to see the bridge respond.", ET_BridgeCreateFunc),
|
||||
ExampleEntry(1,"Inclined Plane", "Create an inclined plane to show restitution and different types of friction. Use the sliders to vary restitution and friction and press space to reset the scene.", ET_InclinedPlaneCreateFunc),
|
||||
ExampleEntry(1,"Newton's Cradle", "Create a Newton's Cradle using a pair of point2point/slider constraints. Press 1/2 to lengthen/shorten the pendula, press 3 to displace pendula. Use the sliders to select the number of pendula in total (reset simulation), the number of displaced pendula and other options.", ET_NewtonsCradleCreateFunc),
|
||||
ExampleEntry(1,"Multi-Pendulum", "Create a Multi-Pendulum using point2point/slider constraints. Press 1/2 to lengthen/shorten the pendula, press 3 to displace pendula. Use the sliders to select the number of pendula in total (reset simulation), the number of displaced pendula and other options.",ET_MultiPendulumCreateFunc),
|
||||
ExampleEntry(1,"Newton's Cradle", "Create a Newton's Cradle using a pair of point2point/slider constraints. Press 1/2 to lengthen/shorten the pendula, press 3 to displace pendula. Use the sliders to select the number (reset simulation), length and restitution of pendula, the number of displaced pendula and apply the displacement force.", ET_NewtonsCradleCreateFunc),
|
||||
ExampleEntry(1,"Newton's Rope Cradle", "Create a Newton's Cradle using ropes. Press 3 to displace pendula. Use the sliders to select the number (reset simulation), length and restitution of pendula and the number of displaced pendula and apply the displacement force.",ET_NewtonsRopeCradleCreateFunc),
|
||||
ExampleEntry(1,"Multi-Pendulum", "Create a Multi-Pendulum using point2point/slider constraints. Press 1/2 to lengthen/shorten the pendula, press 3 to displace pendula. Use the sliders to select the number (reset simulation), length and restitution of pendula, the number of displaced pendula and apply the displacement force.",ET_MultiPendulumCreateFunc),
|
||||
|
||||
ExampleEntry(9,"Evolution"),
|
||||
ExampleEntry(1,"Neural Network 3D Walkers","A simple example of using evolution to make a creature walk.",ET_NN3DWalkersCreateFunc),
|
||||
|
||||
@@ -21,6 +21,7 @@ void GraphingTexture::destroy()
|
||||
m_height=0;
|
||||
glDeleteTextures(1,(GLuint*)&m_textureId);
|
||||
m_textureId=0;
|
||||
|
||||
}
|
||||
|
||||
bool GraphingTexture::create(int texWidth, int texHeight)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
|
||||
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
|
||||
|
||||
class MyProfileWindow : public Gwen::Controls::WindowControl
|
||||
@@ -42,9 +42,10 @@ protected:
|
||||
}
|
||||
public:
|
||||
|
||||
|
||||
|
||||
CProfileIterator* profIter;
|
||||
|
||||
class MyMenuItems* m_menuItems;
|
||||
MyProfileWindow ( Gwen::Controls::Base* pParent)
|
||||
: Gwen::Controls::WindowControl( pParent ),
|
||||
profIter(0)
|
||||
@@ -83,6 +84,12 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual ~MyProfileWindow()
|
||||
{
|
||||
|
||||
delete m_node;
|
||||
delete m_ctrl;
|
||||
}
|
||||
|
||||
float dumpRecursive(CProfileIterator* profileIterator, Gwen::Controls::TreeNode* parentNode)
|
||||
{
|
||||
@@ -266,11 +273,16 @@ public:
|
||||
MyProfileWindow* setupProfileWindow(GwenInternalData* data)
|
||||
{
|
||||
MyMenuItems* menuItems = new MyMenuItems;
|
||||
|
||||
MyProfileWindow* profWindow = new MyProfileWindow(data->pCanvas);
|
||||
//profWindow->SetHidden(true);
|
||||
profWindow->profIter = CProfileManager::Get_Iterator();
|
||||
|
||||
profWindow->m_menuItems = menuItems;
|
||||
//profWindow->profIter = CProfileManager::Get_Iterator();
|
||||
data->m_viewMenu->GetMenu()->AddItem( L"Profiler", menuItems,(Gwen::Event::Handler::Function)&MyMenuItems::MenuItemSelect);
|
||||
|
||||
menuItems->m_profWindow = profWindow;
|
||||
|
||||
return profWindow;
|
||||
}
|
||||
|
||||
@@ -290,5 +302,8 @@ void profileWindowSetVisible(MyProfileWindow* window, bool visible)
|
||||
}
|
||||
void destroyProfileWindow(MyProfileWindow* window)
|
||||
{
|
||||
CProfileManager::Release_Iterator(window->profIter);
|
||||
delete window;
|
||||
}
|
||||
|
||||
#endif //BT_NO_PROFILE
|
||||
@@ -45,7 +45,10 @@ struct GwenInternalData
|
||||
Gwen::Controls::ListBox* m_TextOutput;
|
||||
Gwen::Controls::Label* m_exampleInfoGroupBox;
|
||||
Gwen::Controls::ListBox* m_exampleInfoTextOutput;
|
||||
|
||||
struct MyTestMenuBar* m_menubar;
|
||||
Gwen::Controls::StatusBar* m_bar;
|
||||
Gwen::Controls::ScrollControl* m_windowRight;
|
||||
Gwen::Controls::TabControl* m_tab;
|
||||
|
||||
int m_curYposition;
|
||||
|
||||
|
||||
@@ -17,6 +17,83 @@ GwenUserInterface::GwenUserInterface()
|
||||
|
||||
}
|
||||
|
||||
class MyMenuItems : public Gwen::Controls::Base
|
||||
{
|
||||
public:
|
||||
|
||||
b3FileOpenCallback m_fileOpenCallback;
|
||||
b3QuitCallback m_quitCallback;
|
||||
|
||||
MyMenuItems() :Gwen::Controls::Base(0), m_fileOpenCallback(0)
|
||||
{
|
||||
}
|
||||
void myQuitApp(Gwen::Controls::Base* pControl)
|
||||
{
|
||||
if (m_quitCallback)
|
||||
{
|
||||
(*m_quitCallback)();
|
||||
}
|
||||
}
|
||||
void fileOpen(Gwen::Controls::Base* pControl)
|
||||
{
|
||||
if (m_fileOpenCallback)
|
||||
{
|
||||
(*m_fileOpenCallback)();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct MyTestMenuBar : public Gwen::Controls::MenuStrip
|
||||
{
|
||||
|
||||
Gwen::Controls::MenuItem* m_fileMenu;
|
||||
Gwen::Controls::MenuItem* m_viewMenu;
|
||||
MyMenuItems* m_menuItems;
|
||||
|
||||
MyTestMenuBar(Gwen::Controls::Base* pParent)
|
||||
:Gwen::Controls::MenuStrip(pParent)
|
||||
{
|
||||
// Gwen::Controls::MenuStrip* menu = new Gwen::Controls::MenuStrip( pParent );
|
||||
{
|
||||
m_menuItems = new MyMenuItems();
|
||||
m_menuItems->m_fileOpenCallback = 0;
|
||||
m_menuItems->m_quitCallback = 0;
|
||||
|
||||
m_fileMenu = AddItem(L"File");
|
||||
|
||||
m_fileMenu->GetMenu()->AddItem(L"Open", m_menuItems, (Gwen::Event::Handler::Function)&MyMenuItems::fileOpen);
|
||||
m_fileMenu->GetMenu()->AddItem(L"Quit", m_menuItems, (Gwen::Event::Handler::Function)&MyMenuItems::myQuitApp);
|
||||
m_viewMenu = AddItem(L"View");
|
||||
|
||||
}
|
||||
}
|
||||
virtual ~MyTestMenuBar()
|
||||
{
|
||||
delete m_menuItems;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
void GwenUserInterface::exit()
|
||||
{
|
||||
//m_data->m_menubar->RemoveAllChildren();
|
||||
delete m_data->m_tab;
|
||||
delete m_data->m_windowRight;
|
||||
delete m_data->m_leftStatusBar;
|
||||
delete m_data->m_TextOutput;
|
||||
delete m_data->m_rightStatusBar;
|
||||
delete m_data->m_bar;
|
||||
delete m_data->m_menubar;
|
||||
|
||||
m_data->m_menubar = 0;
|
||||
delete m_data->pCanvas;
|
||||
m_data->pCanvas = 0;
|
||||
}
|
||||
|
||||
GwenUserInterface::~GwenUserInterface()
|
||||
{
|
||||
for (int i=0;i<m_data->m_handlers.size();i++)
|
||||
@@ -26,72 +103,15 @@ GwenUserInterface::~GwenUserInterface()
|
||||
|
||||
m_data->m_handlers.clear();
|
||||
|
||||
|
||||
delete m_data->pCanvas;
|
||||
|
||||
|
||||
|
||||
delete m_data;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class MyMenuItems : public Gwen::Controls::Base
|
||||
{
|
||||
public:
|
||||
|
||||
b3FileOpenCallback m_fileOpenCallback;
|
||||
b3QuitCallback m_quitCallback;
|
||||
|
||||
MyMenuItems() :Gwen::Controls::Base(0),m_fileOpenCallback(0)
|
||||
{
|
||||
}
|
||||
void myQuitApp( Gwen::Controls::Base* pControl )
|
||||
{
|
||||
if (m_quitCallback)
|
||||
{
|
||||
(*m_quitCallback)();
|
||||
}
|
||||
}
|
||||
void fileOpen( Gwen::Controls::Base* pControl )
|
||||
{
|
||||
if (m_fileOpenCallback)
|
||||
{
|
||||
(*m_fileOpenCallback)();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct MyTestMenuBar : public Gwen::Controls::MenuStrip
|
||||
{
|
||||
|
||||
Gwen::Controls::MenuItem* m_fileMenu;
|
||||
Gwen::Controls::MenuItem* m_viewMenu;
|
||||
MyMenuItems* m_menuItems;
|
||||
|
||||
MyTestMenuBar(Gwen::Controls::Base* pParent)
|
||||
:Gwen::Controls::MenuStrip(pParent)
|
||||
{
|
||||
// Gwen::Controls::MenuStrip* menu = new Gwen::Controls::MenuStrip( pParent );
|
||||
{
|
||||
m_menuItems = new MyMenuItems();
|
||||
m_menuItems->m_fileOpenCallback = 0;
|
||||
m_menuItems->m_quitCallback = 0;
|
||||
|
||||
m_fileMenu = AddItem( L"File" );
|
||||
|
||||
m_fileMenu->GetMenu()->AddItem(L"Open",m_menuItems,(Gwen::Event::Handler::Function)&MyMenuItems::fileOpen);
|
||||
m_fileMenu->GetMenu()->AddItem(L"Quit",m_menuItems,(Gwen::Event::Handler::Function)&MyMenuItems::myQuitApp);
|
||||
m_viewMenu = AddItem( L"View" );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void GwenUserInterface::resize(int width, int height)
|
||||
{
|
||||
@@ -232,6 +252,7 @@ void GwenUserInterface::setStatusBarMessage(const char* message, bool isLeft)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GwenUserInterface::registerFileOpenCallback(b3FileOpenCallback callback)
|
||||
{
|
||||
m_data->m_menuItems->m_fileOpenCallback = callback;
|
||||
@@ -249,35 +270,43 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
m_data->pRenderer = renderer;//new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale);
|
||||
|
||||
m_data->skin.SetRender( m_data->pRenderer );
|
||||
|
||||
|
||||
m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin );
|
||||
m_data->pCanvas->SetSize( width,height);
|
||||
m_data->pCanvas->SetDrawBackground( false);
|
||||
m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas);
|
||||
m_data->m_viewMenu = menubar->m_viewMenu;
|
||||
m_data->m_menuItems = menubar->m_menuItems;
|
||||
|
||||
m_data->m_menubar = menubar;
|
||||
|
||||
|
||||
|
||||
|
||||
Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas);
|
||||
m_data->m_bar = bar;
|
||||
|
||||
|
||||
m_data->m_rightStatusBar = new Gwen::Controls::Label( bar );
|
||||
|
||||
m_data->m_rightStatusBar->SetWidth(width/2);
|
||||
//m_data->m_rightStatusBar->SetText( L"Label Added to Right" );
|
||||
bar->AddControl( m_data->m_rightStatusBar, true );
|
||||
|
||||
|
||||
m_data->m_TextOutput = new Gwen::Controls::ListBox( m_data->pCanvas );
|
||||
|
||||
m_data->m_TextOutput->Dock( Gwen::Pos::Bottom );
|
||||
m_data->m_TextOutput->SetHeight( 100 );
|
||||
|
||||
|
||||
m_data->m_leftStatusBar = new Gwen::Controls::Label( bar );
|
||||
|
||||
//m_data->m_leftStatusBar->SetText( L"Label Added to Left" );
|
||||
m_data->m_leftStatusBar->SetWidth(width/2);
|
||||
bar->AddControl( m_data->m_leftStatusBar,false);
|
||||
|
||||
//Gwen::KeyboardFocus
|
||||
/*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas);
|
||||
box->SetText("text");
|
||||
@@ -289,11 +318,14 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
windowRight->SetWidth(250);
|
||||
windowRight->SetHeight(250);
|
||||
windowRight->SetScroll(false,true);
|
||||
|
||||
m_data->m_windowRight = windowRight;
|
||||
|
||||
|
||||
//windowLeft->SetSkin(
|
||||
Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowRight);
|
||||
m_data->m_tab = tab;
|
||||
|
||||
|
||||
|
||||
//tab->SetHeight(300);
|
||||
tab->SetWidth(240);
|
||||
@@ -304,7 +336,8 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
|
||||
Gwen::UnicodeString str1(L"Params");
|
||||
m_data->m_demoPage = tab->AddPage(str1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -348,7 +381,7 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
//windowLeft->SetClosable(false);
|
||||
// windowLeft->SetShouldDrawBackground(true);
|
||||
windowLeft->SetTabable(true);
|
||||
|
||||
|
||||
Gwen::Controls::TabControl* explorerTab = new Gwen::Controls::TabControl(windowLeft);
|
||||
|
||||
//tab->SetHeight(300);
|
||||
@@ -388,7 +421,6 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
m_data->m_exampleInfoGroupBox->SetText("Example Description");
|
||||
|
||||
m_data->m_exampleInfoTextOutput = new Gwen::Controls::ListBox(m_data->m_explorerPage->GetPage());
|
||||
|
||||
|
||||
//m_data->m_exampleInfoTextOutput->Dock( Gwen::Pos::Bottom );
|
||||
m_data->m_exampleInfoTextOutput->SetPos(2, 332);
|
||||
|
||||
@@ -26,6 +26,7 @@ class GwenUserInterface
|
||||
virtual ~GwenUserInterface();
|
||||
|
||||
void init(int width, int height,Gwen::Renderer::Base* gwenRenderer,float retinaScale);
|
||||
void exit();
|
||||
void setFocus();
|
||||
void forceUpdateScrollBars();
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ enum TestExampleBrowserCommunicationEnums
|
||||
|
||||
void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
{
|
||||
printf("thread started\n");
|
||||
printf("ExampleBrowserThreadFunc started\n");
|
||||
|
||||
ExampleBrowserThreadLocalStorage* localStorage = (ExampleBrowserThreadLocalStorage*) lsMemory;
|
||||
|
||||
@@ -369,7 +369,7 @@ void btShutDownExampleBrowser(btInProcessExampleBrowserInternalData* data)
|
||||
}
|
||||
};
|
||||
|
||||
printf("stopping threads\n");
|
||||
printf("btShutDownExampleBrowser stopping threads\n");
|
||||
delete data->m_threadSupport;
|
||||
delete data->m_sharedMem;
|
||||
delete data;
|
||||
|
||||
@@ -42,19 +42,65 @@
|
||||
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
||||
#include "../Importers/ImportBullet/SerializeSetup.h"
|
||||
|
||||
#include "Bullet3Common/b3HashMap.h"
|
||||
|
||||
struct GL3TexLoader : public MyTextureLoader
|
||||
{
|
||||
b3HashMap<b3HashString, GLint> m_hashMap;
|
||||
|
||||
virtual void LoadTexture(Gwen::Texture* pTexture)
|
||||
{
|
||||
Gwen::String namestr = pTexture->name.Get();
|
||||
const char* n = namestr.c_str();
|
||||
GLint* texIdPtr = m_hashMap[n];
|
||||
if (texIdPtr)
|
||||
{
|
||||
pTexture->m_intData = *texIdPtr;
|
||||
}
|
||||
}
|
||||
virtual void FreeTexture(Gwen::Texture* pTexture)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct OpenGLExampleBrowserInternalData
|
||||
{
|
||||
Gwen::Renderer::Base* m_gwenRenderer;
|
||||
CommonGraphicsApp* m_app;
|
||||
// MyProfileWindow* m_profWindow;
|
||||
btAlignedObjectArray<Gwen::Controls::TreeNode*> m_nodes;
|
||||
GwenUserInterface* m_gui;
|
||||
GL3TexLoader* m_myTexLoader;
|
||||
struct MyMenuItemHander* m_handler2;
|
||||
btAlignedObjectArray<MyMenuItemHander*> m_handlers;
|
||||
|
||||
OpenGLExampleBrowserInternalData()
|
||||
: m_gwenRenderer(0),
|
||||
m_app(0),
|
||||
// m_profWindow(0),
|
||||
m_gui(0),
|
||||
m_myTexLoader(0),
|
||||
m_handler2(0)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
static CommonGraphicsApp* s_app=0;
|
||||
|
||||
static CommonWindowInterface* s_window = 0;
|
||||
static CommonParameterInterface* s_parameterInterface=0;
|
||||
static CommonRenderInterface* s_instancingRenderer=0;
|
||||
static OpenGLGuiHelper* s_guiHelper=0;
|
||||
static MyProfileWindow* s_profWindow =0;
|
||||
//static MyProfileWindow* s_profWindow =0;
|
||||
static SharedMemoryInterface* sSharedMem = 0;
|
||||
|
||||
#define DEMO_SELECTION_COMBOBOX 13
|
||||
const char* startFileName = "0_Bullet3Demo.txt";
|
||||
char staticPngFileName[1024];
|
||||
static GwenUserInterface* gui = 0;
|
||||
//static GwenUserInterface* gui = 0;
|
||||
static GwenUserInterface* gui2 = 0;
|
||||
static int sCurrentDemoIndex = -1;
|
||||
static int sCurrentHightlighted = 0;
|
||||
static CommonExampleInterface* sCurrentDemo = 0;
|
||||
@@ -111,6 +157,7 @@ void deleteDemo()
|
||||
}
|
||||
|
||||
const char* gPngFileName = 0;
|
||||
int gPngSkipFrames = 0;
|
||||
|
||||
|
||||
|
||||
@@ -123,9 +170,9 @@ void MyKeyboardCallback(int key, int state)
|
||||
//b3Printf("key=%d, state=%d", key, state);
|
||||
bool handled = false;
|
||||
|
||||
if (gui && !handled )
|
||||
if (gui2 && !handled )
|
||||
{
|
||||
handled = gui->keyboardCallback(key, state);
|
||||
handled = gui2->keyboardCallback(key, state);
|
||||
}
|
||||
|
||||
if (!handled && sCurrentDemo)
|
||||
@@ -223,11 +270,11 @@ void MyKeyboardCallback(int key, int state)
|
||||
b3MouseMoveCallback prevMouseMoveCallback = 0;
|
||||
static void MyMouseMoveCallback( float x, float y)
|
||||
{
|
||||
bool handled = false;
|
||||
bool handled = false;
|
||||
if (sCurrentDemo)
|
||||
handled = sCurrentDemo->mouseMoveCallback(x,y);
|
||||
if (!handled && gui)
|
||||
handled = gui->mouseMoveCallback(x,y);
|
||||
if (!handled && gui2)
|
||||
handled = gui2->mouseMoveCallback(x,y);
|
||||
if (!handled)
|
||||
{
|
||||
if (prevMouseMoveCallback)
|
||||
@@ -244,8 +291,8 @@ static void MyMouseButtonCallback(int button, int state, float x, float y)
|
||||
if (sCurrentDemo)
|
||||
handled = sCurrentDemo->mouseButtonCallback(button,state,x,y);
|
||||
|
||||
if (!handled && gui)
|
||||
handled = gui->mouseButtonCallback(button,state,x,y);
|
||||
if (!handled && gui2)
|
||||
handled = gui2->mouseButtonCallback(button,state,x,y);
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
@@ -333,7 +380,10 @@ void selectDemo(int demoIndex)
|
||||
CommonExampleInterface::CreateFunc* func = gAllExamples->getExampleCreateFunc(demoIndex);
|
||||
if (func)
|
||||
{
|
||||
s_parameterInterface->removeAllParameters();
|
||||
if (s_parameterInterface)
|
||||
{
|
||||
s_parameterInterface->removeAllParameters();
|
||||
}
|
||||
int option = gAllExamples->getExampleOption(demoIndex);
|
||||
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
||||
CommonExampleOptions options(s_guiHelper, option);
|
||||
@@ -341,12 +391,15 @@ void selectDemo(int demoIndex)
|
||||
sCurrentDemo = (*func)(options);
|
||||
if (sCurrentDemo)
|
||||
{
|
||||
if (gui)
|
||||
if (gui2)
|
||||
{
|
||||
gui->setStatusBarMessage("Status: OK", false);
|
||||
gui2->setStatusBarMessage("Status: OK", false);
|
||||
}
|
||||
b3Printf("Selected demo: %s",gAllExamples->getExampleName(demoIndex));
|
||||
gui->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
||||
if (gui2)
|
||||
{
|
||||
gui2->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
||||
}
|
||||
|
||||
sCurrentDemo->initPhysics();
|
||||
if(resetCamera)
|
||||
@@ -399,7 +452,6 @@ static void loadCurrentSettings(const char* startFileName, b3CommandLineArgs& ar
|
||||
FILE* f = fopen(startFileName,"r");
|
||||
if (f)
|
||||
{
|
||||
int result;
|
||||
char oneline[1024];
|
||||
char* argv[] = {0,&oneline[0]};
|
||||
|
||||
@@ -438,10 +490,10 @@ void MyComboBoxCallback(int comboId, const char* item)
|
||||
void MyGuiPrintf(const char* msg)
|
||||
{
|
||||
printf("b3Printf: %s\n",msg);
|
||||
if (gui)
|
||||
if (gui2)
|
||||
{
|
||||
gui->textOutput(msg);
|
||||
gui->forceUpdateScrollBars();
|
||||
gui2->textOutput(msg);
|
||||
gui2->forceUpdateScrollBars();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,10 +502,10 @@ void MyGuiPrintf(const char* msg)
|
||||
void MyStatusBarPrintf(const char* msg)
|
||||
{
|
||||
printf("b3Printf: %s\n", msg);
|
||||
if (gui)
|
||||
if (gui2)
|
||||
{
|
||||
bool isLeft = true;
|
||||
gui->setStatusBarMessage(msg,isLeft);
|
||||
gui2->setStatusBarMessage(msg,isLeft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,13 +513,15 @@ void MyStatusBarPrintf(const char* msg)
|
||||
void MyStatusBarError(const char* msg)
|
||||
{
|
||||
printf("Warning: %s\n", msg);
|
||||
if (gui)
|
||||
if (gui2)
|
||||
{
|
||||
bool isLeft = false;
|
||||
gui->setStatusBarMessage(msg,isLeft);
|
||||
gui->textOutput(msg);
|
||||
gui->forceUpdateScrollBars();
|
||||
gui2->setStatusBarMessage(msg,isLeft);
|
||||
gui2->textOutput(msg);
|
||||
gui2->forceUpdateScrollBars();
|
||||
}
|
||||
btAssert(0);
|
||||
|
||||
}
|
||||
|
||||
struct MyMenuItemHander :public Gwen::Event::Handler
|
||||
@@ -535,7 +589,7 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
||||
{
|
||||
// printf("select %d\n",m_buttonId);
|
||||
sCurrentHightlighted = m_buttonId;
|
||||
gui->setExampleDescription(gAllExamples->getExampleDescription(sCurrentHightlighted));
|
||||
gui2->setExampleDescription(gAllExamples->getExampleDescription(sCurrentHightlighted));
|
||||
}
|
||||
|
||||
void onButtonF(Gwen::Controls::Base* pControl)
|
||||
@@ -550,26 +604,6 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
||||
|
||||
|
||||
|
||||
};
|
||||
#include "Bullet3Common/b3HashMap.h"
|
||||
|
||||
struct GL3TexLoader : public MyTextureLoader
|
||||
{
|
||||
b3HashMap<b3HashString,GLint> m_hashMap;
|
||||
|
||||
virtual void LoadTexture( Gwen::Texture* pTexture )
|
||||
{
|
||||
Gwen::String namestr = pTexture->name.Get();
|
||||
const char* n = namestr.c_str();
|
||||
GLint* texIdPtr = m_hashMap[n];
|
||||
if (texIdPtr)
|
||||
{
|
||||
pTexture->m_intData = *texIdPtr;
|
||||
}
|
||||
}
|
||||
virtual void FreeTexture( Gwen::Texture* pTexture )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void quitCallback()
|
||||
@@ -624,7 +658,7 @@ struct QuickCanvas : public Common2dCanvasInterface
|
||||
|
||||
m_curNumGraphWindows++;
|
||||
|
||||
MyGraphInput input(gui->getInternalData());
|
||||
MyGraphInput input(gui2->getInternalData());
|
||||
input.m_width=width;
|
||||
input.m_height=height;
|
||||
input.m_xPos = 10000;//GUI will clamp it to the right//300;
|
||||
@@ -644,7 +678,10 @@ struct QuickCanvas : public Common2dCanvasInterface
|
||||
virtual void destroyCanvas(int canvasId)
|
||||
{
|
||||
btAssert(canvasId>=0);
|
||||
delete m_gt[canvasId];
|
||||
m_gt[canvasId] = 0;
|
||||
destroyTextureWindow(m_gw[canvasId]);
|
||||
m_gw[canvasId] = 0;
|
||||
m_curNumGraphWindows--;
|
||||
}
|
||||
virtual void setPixel(int canvasId, int x, int y, unsigned char red, unsigned char green,unsigned char blue, unsigned char alpha)
|
||||
@@ -670,12 +707,51 @@ struct QuickCanvas : public Common2dCanvasInterface
|
||||
|
||||
OpenGLExampleBrowser::OpenGLExampleBrowser(class ExampleEntries* examples)
|
||||
{
|
||||
m_internalData = new OpenGLExampleBrowserInternalData;
|
||||
|
||||
gAllExamples = examples;
|
||||
}
|
||||
|
||||
OpenGLExampleBrowser::~OpenGLExampleBrowser()
|
||||
{
|
||||
deleteDemo();
|
||||
deleteDemo();
|
||||
for (int i = 0; i < m_internalData->m_nodes.size(); i++)
|
||||
{
|
||||
delete m_internalData->m_nodes[i];
|
||||
}
|
||||
delete m_internalData->m_handler2;
|
||||
for (int i = 0; i < m_internalData->m_handlers.size(); i++)
|
||||
{
|
||||
delete m_internalData->m_handlers[i];
|
||||
}
|
||||
m_internalData->m_handlers.clear();
|
||||
m_internalData->m_nodes.clear();
|
||||
delete s_parameterInterface;
|
||||
s_parameterInterface = 0;
|
||||
delete s_app->m_2dCanvasInterface;
|
||||
s_app->m_2dCanvasInterface = 0;
|
||||
|
||||
m_internalData->m_gui->exit();
|
||||
|
||||
|
||||
delete m_internalData->m_gui;
|
||||
delete m_internalData->m_gwenRenderer;
|
||||
delete m_internalData->m_myTexLoader;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
delete m_internalData->m_app;
|
||||
s_app = 0;
|
||||
|
||||
|
||||
|
||||
// delete m_internalData->m_profWindow;
|
||||
|
||||
delete m_internalData;
|
||||
|
||||
gFileImporterByExtension.clear();
|
||||
gAllExamples = 0;
|
||||
}
|
||||
|
||||
@@ -688,7 +764,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
loadCurrentSettings(startFileName, args);
|
||||
|
||||
args.GetCmdLineArgument("fixed_timestep",gFixedTimeStep);
|
||||
|
||||
args.GetCmdLineArgument("png_skip_frames", gPngSkipFrames);
|
||||
///The OpenCL rigid body pipeline is experimental and
|
||||
///most OpenCL drivers and OpenCL compilers have issues with our kernels.
|
||||
///If you have a high-end desktop GPU such as AMD 7970 or better, or NVIDIA GTX 680 with up-to-date drivers
|
||||
@@ -727,17 +803,17 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
s_app = new SimpleOpenGL2App(title,width,height);
|
||||
s_app->m_renderer = new SimpleOpenGL2Renderer(width,height);
|
||||
}
|
||||
|
||||
#ifndef NO_OPENGL3
|
||||
else
|
||||
{
|
||||
char title[1024];
|
||||
sprintf(title,"%s using OpenGL3+. %s", appTitle,optMode);
|
||||
simpleApp = new SimpleOpenGL3App(title,width,height, gAllowRetina);
|
||||
|
||||
|
||||
s_app = simpleApp;
|
||||
}
|
||||
#endif
|
||||
m_internalData->m_app = s_app;
|
||||
char* gVideoFileName = 0;
|
||||
args.GetCmdLineArgument("mp4",gVideoFileName);
|
||||
#ifndef NO_OPENGL3
|
||||
@@ -793,43 +869,67 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
|
||||
assert(glGetError()==GL_NO_ERROR);
|
||||
|
||||
{
|
||||
GL3TexLoader* myTexLoader = new GL3TexLoader;
|
||||
m_internalData->m_myTexLoader = myTexLoader;
|
||||
|
||||
gui = new GwenUserInterface;
|
||||
GL3TexLoader* myTexLoader = new GL3TexLoader;
|
||||
|
||||
Gwen::Renderer::Base* gwenRenderer = 0;
|
||||
if (sUseOpenGL2 )
|
||||
{
|
||||
gwenRenderer = new Gwen::Renderer::OpenGL_DebugFont();
|
||||
}
|
||||
sth_stash* fontstash = simpleApp->getFontStash();
|
||||
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
m_internalData->m_gwenRenderer = new Gwen::Renderer::OpenGL_DebugFont();
|
||||
}
|
||||
#ifndef NO_OPENGL3
|
||||
else
|
||||
{
|
||||
sth_stash* fontstash=simpleApp->getFontStash();
|
||||
gwenRenderer = new GwenOpenGL3CoreRenderer(simpleApp->m_primRenderer,fontstash,width,height,s_window->getRetinaScale(),myTexLoader);
|
||||
}
|
||||
else
|
||||
{
|
||||
sth_stash* fontstash = simpleApp->getFontStash();
|
||||
m_internalData->m_gwenRenderer = new GwenOpenGL3CoreRenderer(simpleApp->m_primRenderer, fontstash, width, height, s_window->getRetinaScale(), myTexLoader);
|
||||
}
|
||||
#endif
|
||||
|
||||
gui2 = new GwenUserInterface;
|
||||
|
||||
m_internalData->m_gui = gui2;
|
||||
|
||||
m_internalData->m_myTexLoader = myTexLoader;
|
||||
|
||||
|
||||
|
||||
gui2->init(width, height, m_internalData->m_gwenRenderer, s_window->getRetinaScale());
|
||||
|
||||
|
||||
}
|
||||
//gui = 0;// new GwenUserInterface;
|
||||
|
||||
GL3TexLoader* myTexLoader = m_internalData->m_myTexLoader;
|
||||
// = myTexLoader;
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
gui->init(width,height,gwenRenderer,s_window->getRetinaScale());
|
||||
|
||||
|
||||
|
||||
|
||||
// gui->getInternalData()->m_explorerPage
|
||||
Gwen::Controls::TreeControl* tree = gui->getInternalData()->m_explorerTreeCtrl;
|
||||
if (gui2)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// gui->getInternalData()->m_explorerPage
|
||||
Gwen::Controls::TreeControl* tree = gui2->getInternalData()->m_explorerTreeCtrl;
|
||||
|
||||
|
||||
//gui->getInternalData()->pRenderer->setTextureLoader(myTexLoader);
|
||||
|
||||
|
||||
// s_profWindow= setupProfileWindow(gui2->getInternalData());
|
||||
//m_internalData->m_profWindow = s_profWindow;
|
||||
// profileWindowSetVisible(s_profWindow,false);
|
||||
gui2->setFocus();
|
||||
|
||||
s_parameterInterface = s_app->m_parameterInterface = new GwenParameterInterface(gui2->getInternalData());
|
||||
s_app->m_2dCanvasInterface = new QuickCanvas(myTexLoader);
|
||||
|
||||
//gui->getInternalData()->pRenderer->setTextureLoader(myTexLoader);
|
||||
|
||||
|
||||
s_profWindow= setupProfileWindow(gui->getInternalData());
|
||||
profileWindowSetVisible(s_profWindow,false);
|
||||
gui->setFocus();
|
||||
|
||||
s_parameterInterface = s_app->m_parameterInterface = new GwenParameterInterface(gui->getInternalData());
|
||||
s_app->m_2dCanvasInterface = new QuickCanvas(myTexLoader);
|
||||
|
||||
|
||||
///add some demos to the gAllExamples
|
||||
|
||||
@@ -840,7 +940,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
//int curDemo = 0;
|
||||
int selectedDemo = 0;
|
||||
Gwen::Controls::TreeNode* curNode = tree;
|
||||
MyMenuItemHander* handler2 = new MyMenuItemHander(-1);
|
||||
m_internalData->m_handler2 = new MyMenuItemHander(-1);
|
||||
|
||||
char* demoNameFromCommandOption = 0;
|
||||
args.GetCmdLineArgument("start_demo_name", demoNameFromCommandOption);
|
||||
@@ -848,7 +948,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
selectedDemo = -1;
|
||||
}
|
||||
|
||||
tree->onReturnKeyDown.Add(handler2, &MyMenuItemHander::onButtonD);
|
||||
tree->onReturnKeyDown.Add(m_internalData->m_handler2, &MyMenuItemHander::onButtonD);
|
||||
int firstAvailableDemoIndex=-1;
|
||||
Gwen::Controls::TreeNode* firstNode=0;
|
||||
|
||||
@@ -895,13 +995,18 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
MyMenuItemHander* handler = new MyMenuItemHander(d);
|
||||
m_internalData->m_handlers.push_back(handler);
|
||||
|
||||
pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonA);
|
||||
pNode->GetButton()->onDoubleClick.Add(handler, &MyMenuItemHander::onButtonB);
|
||||
pNode->GetButton()->onDown.Add(handler, &MyMenuItemHander::onButtonC);
|
||||
pNode->onSelect.Add(handler, &MyMenuItemHander::onButtonE);
|
||||
pNode->onReturnKeyDown.Add(handler, &MyMenuItemHander::onButtonG);
|
||||
pNode->onSelectChange.Add(handler, &MyMenuItemHander::onButtonF);
|
||||
|
||||
#endif
|
||||
// pNode->onKeyReturn.Add(handler, &MyMenuItemHander::onButtonD);
|
||||
// pNode->GetButton()->onKeyboardReturn.Add(handler, &MyMenuItemHander::onButtonD);
|
||||
// pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonD);
|
||||
@@ -911,6 +1016,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
else
|
||||
{
|
||||
curNode = tree->AddNode(nodeUText);
|
||||
m_internalData->m_nodes.push_back(curNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,6 +1035,9 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
}
|
||||
|
||||
}
|
||||
free(demoNameFromCommandOption);
|
||||
demoNameFromCommandOption = 0;
|
||||
|
||||
btAssert(sCurrentDemo!=0);
|
||||
if (sCurrentDemo==0)
|
||||
{
|
||||
@@ -936,9 +1045,11 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
gui->registerFileOpenCallback(fileOpenCallback);
|
||||
gui->registerQuitCallback(quitCallback);
|
||||
|
||||
gui2->registerFileOpenCallback(fileOpenCallback);
|
||||
gui2->registerQuitCallback(quitCallback);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -971,14 +1082,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
s_instancingRenderer->updateCamera(dg.upAxis);
|
||||
}
|
||||
|
||||
if (renderGrid)
|
||||
{
|
||||
BT_PROFILE("Draw Grid");
|
||||
glPolygonOffset(3.0, 3);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
s_app->drawGrid(dg);
|
||||
|
||||
}
|
||||
|
||||
static int frameCount = 0;
|
||||
frameCount++;
|
||||
|
||||
@@ -998,24 +1102,6 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
//printf("---------------------------------------------------\n");
|
||||
//printf("Framecount = %d\n",frameCount);
|
||||
|
||||
if (gPngFileName)
|
||||
{
|
||||
|
||||
static int skip = 0;
|
||||
skip++;
|
||||
if (skip>4)
|
||||
{
|
||||
skip=0;
|
||||
//printf("gPngFileName=%s\n",gPngFileName);
|
||||
static int s_frameCount = 100;
|
||||
|
||||
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
||||
//b3Printf("Made screenshot %s",staticPngFileName);
|
||||
s_app->dumpNextFrameToPng(staticPngFileName);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gFixedTimeStep>0)
|
||||
{
|
||||
@@ -1026,6 +1112,14 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
}
|
||||
}
|
||||
|
||||
if (renderGrid)
|
||||
{
|
||||
BT_PROFILE("Draw Grid");
|
||||
glPolygonOffset(3.0, 3);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
s_app->drawGrid(dg);
|
||||
|
||||
}
|
||||
if (renderVisualGeometry && ((gDebugDrawFlags&btIDebugDraw::DBG_DrawWireframe)==0))
|
||||
{
|
||||
if (visualWireframe)
|
||||
@@ -1042,9 +1136,28 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
}
|
||||
}
|
||||
|
||||
if (gPngFileName)
|
||||
{
|
||||
|
||||
static int skip = 0;
|
||||
skip--;
|
||||
if (skip<0)
|
||||
{
|
||||
skip=gPngSkipFrames;
|
||||
//printf("gPngFileName=%s\n",gPngFileName);
|
||||
static int s_frameCount = 100;
|
||||
|
||||
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
||||
//b3Printf("Made screenshot %s",staticPngFileName);
|
||||
s_app->dumpNextFrameToPng(staticPngFileName);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
if (s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
||||
if (gui2 && s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
||||
{
|
||||
char msg[1024];
|
||||
float camDist = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraDistance();
|
||||
@@ -1053,7 +1166,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
float camTarget[3];
|
||||
s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraTargetPosition(camTarget);
|
||||
sprintf(msg,"dist=%f, pitch=%f, yaw=%f,target=%f,%f,%f", camDist,pitch,yaw,camTarget[0],camTarget[1],camTarget[2]);
|
||||
gui->setStatusBarMessage(msg, true);
|
||||
gui2->setStatusBarMessage(msg, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1061,16 +1174,24 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
static int toggle = 1;
|
||||
if (renderGui)
|
||||
{
|
||||
if (!pauseSimulation)
|
||||
processProfileData(s_profWindow,false);
|
||||
// if (!pauseSimulation)
|
||||
// processProfileData(s_profWindow,false);
|
||||
|
||||
if (sUseOpenGL2)
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
|
||||
saveOpenGLState(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
|
||||
saveOpenGLState(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
||||
}
|
||||
BT_PROFILE("Draw Gwen GUI");
|
||||
gui->draw(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
BT_PROFILE("Draw Gwen GUI");
|
||||
if (m_internalData->m_gui)
|
||||
{
|
||||
m_internalData->m_gui->draw(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
||||
}
|
||||
if (gui2)
|
||||
{
|
||||
gui2->draw(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
||||
}
|
||||
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
restoreOpenGLState();
|
||||
@@ -1084,14 +1205,20 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
toggle=1-toggle;
|
||||
{
|
||||
BT_PROFILE("Sync Parameters");
|
||||
s_parameterInterface->syncParameters();
|
||||
if (s_parameterInterface)
|
||||
{
|
||||
s_parameterInterface->syncParameters();
|
||||
}
|
||||
}
|
||||
{
|
||||
BT_PROFILE("Swap Buffers");
|
||||
s_app->swapBuffer();
|
||||
}
|
||||
|
||||
gui->forceUpdateScrollBars();
|
||||
if (gui2)
|
||||
{
|
||||
gui2->forceUpdateScrollBars();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
class OpenGLExampleBrowser : public ExampleBrowserInterface
|
||||
{
|
||||
|
||||
struct OpenGLExampleBrowserInternalData* m_internalData;
|
||||
|
||||
public:
|
||||
|
||||
OpenGLExampleBrowser(class ExampleEntries* examples);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "CollisionShape2TriangleMesh.h"
|
||||
|
||||
|
||||
|
||||
#include "../OpenGLWindow/SimpleCamera.h"
|
||||
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||
//backwards compatibility
|
||||
#include "GL_ShapeDrawer.h"
|
||||
@@ -144,8 +144,8 @@ struct OpenGLGuiHelperInternalData
|
||||
class MyDebugDrawer* m_debugDraw;
|
||||
GL_ShapeDrawer* m_gl2ShapeDrawer;
|
||||
|
||||
btAlignedObjectArray<unsigned char> m_rgbaPixelBuffer;
|
||||
btAlignedObjectArray<float> m_depthBuffer;
|
||||
btAlignedObjectArray<unsigned char> m_rgbaPixelBuffer1;
|
||||
btAlignedObjectArray<float> m_depthBuffer1;
|
||||
};
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ OpenGLGuiHelper::OpenGLGuiHelper(CommonGraphicsApp* glApp, bool useOpenGL2)
|
||||
|
||||
OpenGLGuiHelper::~OpenGLGuiHelper()
|
||||
{
|
||||
delete m_data->m_debugDraw;
|
||||
delete m_data->m_gl2ShapeDrawer;
|
||||
delete m_data;
|
||||
}
|
||||
@@ -199,9 +200,16 @@ void OpenGLGuiHelper::createCollisionObjectGraphicsObject(btCollisionObject* bod
|
||||
}
|
||||
}
|
||||
|
||||
int OpenGLGuiHelper::registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices)
|
||||
int OpenGLGuiHelper::registerTexture(const unsigned char* texels, int width, int height)
|
||||
{
|
||||
int shapeId = m_data->m_glApp->m_renderer->registerShape(vertices, numvertices,indices,numIndices);
|
||||
int textureId = m_data->m_glApp->m_renderer->registerTexture(texels,width,height);
|
||||
return textureId;
|
||||
}
|
||||
|
||||
|
||||
int OpenGLGuiHelper::registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId)
|
||||
{
|
||||
int shapeId = m_data->m_glApp->m_renderer->registerShape(vertices, numvertices,indices,numIndices,primitiveType, textureId);
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
@@ -210,6 +218,10 @@ int OpenGLGuiHelper::registerGraphicsInstance(int shapeIndex, const float* posit
|
||||
return m_data->m_glApp->m_renderer->registerGraphicsInstance(shapeIndex,position,quaternion,color,scaling);
|
||||
}
|
||||
|
||||
void OpenGLGuiHelper::removeAllGraphicsInstances()
|
||||
{
|
||||
m_data->m_glApp->m_renderer->removeAllInstances();
|
||||
}
|
||||
|
||||
void OpenGLGuiHelper::createCollisionShapeGraphicsObject(btCollisionShape* collisionShape)
|
||||
{
|
||||
@@ -247,7 +259,7 @@ void OpenGLGuiHelper::createCollisionShapeGraphicsObject(btCollisionShape* colli
|
||||
|
||||
if (gfxVertices.size() && indices.size())
|
||||
{
|
||||
int shapeId = registerGraphicsShape(&gfxVertices[0].xyzw[0],gfxVertices.size(),&indices[0],indices.size());
|
||||
int shapeId = registerGraphicsShape(&gfxVertices[0].xyzw[0],gfxVertices.size(),&indices[0],indices.size(),B3_GL_TRIANGLES,-1);
|
||||
collisionShape->setUserIndex(shapeId);
|
||||
}
|
||||
|
||||
@@ -326,19 +338,15 @@ void OpenGLGuiHelper::resetCamera(float camDist, float pitch, float yaw, float c
|
||||
}
|
||||
|
||||
|
||||
void OpenGLGuiHelper::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels, int startPixelIndex, int* widthPtr, int* heightPtr, int* numPixelsCopied)
|
||||
void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16], unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels, int startPixelIndex, int destinationWidth, int destinationHeight, int* numPixelsCopied)
|
||||
{
|
||||
int w = m_data->m_glApp->m_window->getWidth()*m_data->m_glApp->m_window->getRetinaScale();
|
||||
int h = m_data->m_glApp->m_window->getHeight()*m_data->m_glApp->m_window->getRetinaScale();
|
||||
int sourceWidth = m_data->m_glApp->m_window->getWidth()*m_data->m_glApp->m_window->getRetinaScale();
|
||||
int sourceHeight = m_data->m_glApp->m_window->getHeight()*m_data->m_glApp->m_window->getRetinaScale();
|
||||
|
||||
if (widthPtr)
|
||||
*widthPtr = w;
|
||||
if (heightPtr)
|
||||
*heightPtr = h;
|
||||
if (numPixelsCopied)
|
||||
*numPixelsCopied = 0;
|
||||
|
||||
int numTotalPixels = w*h;
|
||||
int numTotalPixels = destinationWidth*destinationHeight;
|
||||
int numRemainingPixels = numTotalPixels - startPixelIndex;
|
||||
int numBytesPerPixel = 4;//RGBA
|
||||
int numRequestedPixels = btMin(rgbaBufferSizeInPixels,numRemainingPixels);
|
||||
@@ -346,22 +354,58 @@ void OpenGLGuiHelper::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBuf
|
||||
{
|
||||
if (startPixelIndex==0)
|
||||
{
|
||||
|
||||
//quick test: render the scene
|
||||
CommonCameraInterface* oldCam = getRenderInterface()->getActiveCamera();
|
||||
SimpleCamera tempCam;
|
||||
getRenderInterface()->setActiveCamera(&tempCam);
|
||||
getRenderInterface()->getActiveCamera()->setVRCamera(viewMatrix,projectionMatrix);
|
||||
getRenderInterface()->renderScene();
|
||||
//copy the image into our local cache
|
||||
m_data->m_rgbaPixelBuffer.resize(w*h*numBytesPerPixel);
|
||||
m_data->m_depthBuffer.resize(w*h);
|
||||
m_data->m_glApp->getScreenPixels(&(m_data->m_rgbaPixelBuffer[0]),m_data->m_rgbaPixelBuffer.size());
|
||||
}
|
||||
for (int i=0;i<numRequestedPixels*numBytesPerPixel;i++)
|
||||
{
|
||||
if (pixelsRGBA)
|
||||
{
|
||||
pixelsRGBA[i] = m_data->m_rgbaPixelBuffer[i+startPixelIndex*numBytesPerPixel];
|
||||
getRenderInterface()->setActiveCamera(oldCam);
|
||||
|
||||
{
|
||||
btAlignedObjectArray<unsigned char> sourceRgbaPixelBuffer;
|
||||
btAlignedObjectArray<float> sourceDepthBuffer;
|
||||
//copy the image into our local cache
|
||||
sourceRgbaPixelBuffer.resize(sourceWidth*sourceHeight*numBytesPerPixel);
|
||||
sourceDepthBuffer.resize(sourceWidth*sourceHeight);
|
||||
m_data->m_glApp->getScreenPixels(&(sourceRgbaPixelBuffer[0]),sourceRgbaPixelBuffer.size(), &sourceDepthBuffer[0],sizeof(float)*sourceDepthBuffer.size());
|
||||
|
||||
m_data->m_rgbaPixelBuffer1.resize(destinationWidth*destinationHeight*numBytesPerPixel);
|
||||
m_data->m_depthBuffer1.resize(destinationWidth*destinationHeight);
|
||||
//rescale and flip
|
||||
|
||||
for (int i=0;i<destinationWidth;i++)
|
||||
{
|
||||
for (int j=0;j<destinationHeight;j++)
|
||||
{
|
||||
int xIndex = int(float(i)*(float(sourceWidth)/float(destinationWidth)));
|
||||
int yIndex = int(float(destinationHeight-1-j)*(float(sourceHeight)/float(destinationHeight)));
|
||||
btClamp(xIndex,0,sourceWidth);
|
||||
btClamp(yIndex,0,sourceHeight);
|
||||
int bytesPerPixel = 4; //RGBA
|
||||
|
||||
int sourcePixelIndex = (xIndex+yIndex*sourceWidth)*bytesPerPixel;
|
||||
m_data->m_rgbaPixelBuffer1[(i+j*destinationWidth)*4+0] = sourceRgbaPixelBuffer[sourcePixelIndex+0];
|
||||
m_data->m_rgbaPixelBuffer1[(i+j*destinationWidth)*4+1] = sourceRgbaPixelBuffer[sourcePixelIndex+1];
|
||||
m_data->m_rgbaPixelBuffer1[(i+j*destinationWidth)*4+2] = sourceRgbaPixelBuffer[sourcePixelIndex+2];
|
||||
m_data->m_rgbaPixelBuffer1[(i+j*destinationWidth)*4+3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pixelsRGBA)
|
||||
{
|
||||
for (int i=0;i<numRequestedPixels*numBytesPerPixel;i++)
|
||||
{
|
||||
pixelsRGBA[i] = m_data->m_rgbaPixelBuffer1[i+startPixelIndex*numBytesPerPixel];
|
||||
}
|
||||
}
|
||||
if (depthBuffer)
|
||||
{
|
||||
for (int i=0;i<numRequestedPixels;i++)
|
||||
{
|
||||
depthBuffer[i] = m_data->m_depthBuffer1[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (numPixelsCopied)
|
||||
*numPixelsCopied = numRequestedPixels;
|
||||
|
||||
|
||||
@@ -20,12 +20,11 @@ struct OpenGLGuiHelper : public GUIHelperInterface
|
||||
|
||||
virtual void createCollisionObjectGraphicsObject(btCollisionObject* body, const btVector3& color);
|
||||
|
||||
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices);
|
||||
|
||||
virtual int registerTexture(const unsigned char* texels, int width, int height);
|
||||
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId);
|
||||
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling);
|
||||
|
||||
virtual void removeAllGraphicsInstances();
|
||||
|
||||
|
||||
virtual void createCollisionShapeGraphicsObject(btCollisionShape* collisionShape);
|
||||
|
||||
virtual void syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld);
|
||||
@@ -45,7 +44,7 @@ struct OpenGLGuiHelper : public GUIHelperInterface
|
||||
|
||||
virtual void resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ);
|
||||
|
||||
virtual void copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels, int startPixelIndex, int* width, int* height, int* numPixelsCopied);
|
||||
virtual void copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16], unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels, int startPixelIndex, int destinationWidth, int destinationHeight, int* numPixelsCopied);
|
||||
|
||||
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) ;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
#include "OpenGLExampleBrowser.h"
|
||||
|
||||
#include "Bullet3Common/b3CommandLineArgs.h"
|
||||
@@ -13,36 +14,46 @@
|
||||
#include "../Importers/ImportSTLDemo/ImportSTLSetup.h"
|
||||
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
||||
#include "../Importers/ImportSDFDemo/ImportSDFSetup.h"
|
||||
#include "../Importers/ImportSTLDemo/ImportSTLSetup.h"
|
||||
#include "LinearMath/btAlignedAllocator.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
b3CommandLineArgs args(argc,argv);
|
||||
b3Clock clock;
|
||||
|
||||
|
||||
ExampleEntriesAll examples;
|
||||
examples.initExampleEntries();
|
||||
|
||||
OpenGLExampleBrowser* exampleBrowser = new OpenGLExampleBrowser(&examples);
|
||||
bool init = exampleBrowser->init(argc,argv);
|
||||
exampleBrowser->registerFileImporter(".urdf",ImportURDFCreateFunc);
|
||||
exampleBrowser->registerFileImporter(".sdf",ImportSDFCreateFunc);
|
||||
exampleBrowser->registerFileImporter(".obj",ImportObjCreateFunc);
|
||||
|
||||
clock.reset();
|
||||
if (init)
|
||||
{
|
||||
do
|
||||
{
|
||||
float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
|
||||
clock.reset();
|
||||
exampleBrowser->update(deltaTimeInSeconds);
|
||||
b3CommandLineArgs args(argc, argv);
|
||||
b3Clock clock;
|
||||
|
||||
|
||||
ExampleEntriesAll examples;
|
||||
examples.initExampleEntries();
|
||||
|
||||
OpenGLExampleBrowser* exampleBrowser = new OpenGLExampleBrowser(&examples);
|
||||
bool init = exampleBrowser->init(argc, argv);
|
||||
exampleBrowser->registerFileImporter(".urdf", ImportURDFCreateFunc);
|
||||
exampleBrowser->registerFileImporter(".sdf", ImportSDFCreateFunc);
|
||||
exampleBrowser->registerFileImporter(".obj", ImportObjCreateFunc);
|
||||
exampleBrowser->registerFileImporter(".stl", ImportSTLCreateFunc);
|
||||
|
||||
clock.reset();
|
||||
if (init)
|
||||
{
|
||||
do
|
||||
{
|
||||
float deltaTimeInSeconds = clock.getTimeMicroseconds() / 1000000.f;
|
||||
clock.reset();
|
||||
exampleBrowser->update(deltaTimeInSeconds);
|
||||
|
||||
} while (!exampleBrowser->requestedExit());
|
||||
}
|
||||
delete exampleBrowser;
|
||||
|
||||
} while (!exampleBrowser->requestedExit());
|
||||
}
|
||||
delete exampleBrowser;
|
||||
|
||||
#ifdef BT_DEBUG_MEMORY_ALLOCATIONS
|
||||
int numBytesLeaked = btDumpMemoryLeaks();
|
||||
btAssert(numBytesLeaked==0);
|
||||
#endif//BT_DEBUG_MEMORY_ALLOCATIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,10 @@ project "App_BulletExampleBrowser"
|
||||
defines {"INCLUDE_CLOTH_DEMOS"}
|
||||
|
||||
files {
|
||||
|
||||
"main.cpp",
|
||||
"ExampleEntries.cpp",
|
||||
|
||||
"../InverseKinematics/*",
|
||||
"../TinyRenderer/geometry.cpp",
|
||||
"../TinyRenderer/model.cpp",
|
||||
"../TinyRenderer/tgaimage.cpp",
|
||||
@@ -86,16 +87,11 @@ project "App_BulletExampleBrowser"
|
||||
"../InverseDynamics/InverseDynamicsExample.h",
|
||||
"../BasicDemo/BasicExample.*",
|
||||
"../Tutorial/*",
|
||||
"../ExtendedTutorials/SimpleBox.cpp",
|
||||
"../ExtendedTutorials/MultipleBoxes.cpp",
|
||||
"../ExtendedTutorials/SimpleJoint.cpp",
|
||||
"../ExtendedTutorials/SimpleCloth.cpp",
|
||||
"../ExtendedTutorials/Chain.cpp",
|
||||
"../ExtendedTutorials/Bridge.cpp",
|
||||
"../ExtendedTutorials/RigidBodyFromObj.cpp",
|
||||
"../ExtendedTutorials/*",
|
||||
"../Evolution/NN3DWalkers.cpp",
|
||||
"../Evolution/NN3DWalkers.h",
|
||||
"../Collision/*",
|
||||
"../RoboticsLearning/*",
|
||||
"../Collision/Internal/*",
|
||||
"../Benchmarks/*",
|
||||
"../CommonInterfaces/*",
|
||||
@@ -123,6 +119,7 @@ project "App_BulletExampleBrowser"
|
||||
"../ThirdPartyLibs/stb_image/*",
|
||||
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.*",
|
||||
"../ThirdPartyLibs/tinyxml/*",
|
||||
"../ThirdPartyLibs/BussIK/*",
|
||||
"../GyroscopicDemo/GyroscopicSetup.cpp",
|
||||
"../GyroscopicDemo/GyroscopicSetup.h",
|
||||
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
||||
|
||||
Reference in New Issue
Block a user