add SoftDemo examples
add example description for all examples (with word-wrap) add the VoronoiFractureDemo, note that the collision are disabled after breaking constraints. add optional GwenOpenGLTest, to make it easier to see Gwen user interface features.
This commit is contained in:
@@ -22,16 +22,25 @@
|
||||
#include "../MultiBody/TestJointTorqueSetup.h"
|
||||
#include "../MultiBody/MultiDofDemo.h"
|
||||
#include "../MultiBody/MultiBodyCustomURDFDemo.h"
|
||||
#include "../VoronoiFracture/VoronoiFractureDemo.h"
|
||||
#include "../SoftDemo/SoftDemo.h"
|
||||
|
||||
|
||||
struct ExampleEntry
|
||||
{
|
||||
int m_menuLevel;
|
||||
const char* m_name;
|
||||
const char* m_description;
|
||||
ExampleInterface::CreateFunc* m_createFunc;
|
||||
int m_option;
|
||||
|
||||
ExampleEntry(int menuLevel, const char* name,ExampleInterface::CreateFunc* createFunc, int option=0)
|
||||
:m_menuLevel(menuLevel), m_name(name), m_createFunc(createFunc), m_option(option)
|
||||
ExampleEntry(int menuLevel, const char* name)
|
||||
:m_menuLevel(menuLevel), m_name(name), m_description(0), m_createFunc(0), m_option(0)
|
||||
{
|
||||
}
|
||||
|
||||
ExampleEntry(int menuLevel, const char* name,const char* description, ExampleInterface::CreateFunc* createFunc, int option=0)
|
||||
:m_menuLevel(menuLevel), m_name(name), m_description(description), m_createFunc(createFunc), m_option(option)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -41,50 +50,101 @@ static ExampleEntry gDefaultExamples[]=
|
||||
{
|
||||
|
||||
|
||||
ExampleEntry(0,"API",0),
|
||||
ExampleEntry(1,"Basic Example",BasicExampleCreateFunc),
|
||||
ExampleEntry(0,"API"),
|
||||
ExampleEntry(1,"Basic Example","Create some rigid bodies using box collision shapes.", BasicExampleCreateFunc),
|
||||
|
||||
ExampleEntry(1,"Gyroscopic", GyroscopicCreateFunc),
|
||||
ExampleEntry(1,"Gyroscopic", "Show the Dzhanibekov effect using various settings of the gyroscopic mode.", GyroscopicCreateFunc),
|
||||
|
||||
ExampleEntry(1,"Planar 2D",Planar2DCreateFunc),
|
||||
ExampleEntry(1,"Constraints",ConstraintCreateFunc),
|
||||
ExampleEntry(1,"6DofSpring2",Dof6Spring2CreateFunc),
|
||||
ExampleEntry(1,"Planar 2D","Show the use of 2D collision shapes and rigid body simulation.",Planar2DCreateFunc),
|
||||
ExampleEntry(1,"Constraints","Basic use of a btHingeConstraint.", ConstraintCreateFunc),
|
||||
ExampleEntry(1,"6DofSpring2","Show the use of the btGeneric6DofSpring2Constraint.",
|
||||
Dof6Spring2CreateFunc),
|
||||
ExampleEntry(1,"Voronoi Fracture", "Automatically create a compound rigid body using voronoi tesselation. Individual parts are modeled as rigid bodies using a btConvexHullShape.",
|
||||
VoronoiFractureCreateFunc),
|
||||
|
||||
ExampleEntry(0,"MultiBody"),
|
||||
ExampleEntry(1,"MultiDofCreateFunc","Create a basic btMultiBody.", MultiDofCreateFunc),
|
||||
ExampleEntry(1,"TestJointTorque","Apply a torque to a btMultiBody.", TestJointTorqueCreateFunc),
|
||||
ExampleEntry(1,"Custom URDF","Load a URDF file to allow creation of custom data structures.", MultiBodyCustomURDFDemoCreateFunc),
|
||||
|
||||
ExampleEntry(0,"MultiBody",0),
|
||||
ExampleEntry(1,"TestJointTorque",TestJointTorqueCreateFunc),
|
||||
ExampleEntry(1,"MultiDofCreateFunc",MultiDofCreateFunc),
|
||||
ExampleEntry(1,"Custom URDF",MultiBodyCustomURDFDemoCreateFunc),
|
||||
|
||||
#ifdef INCLUDE_CLOTH_DEMOS
|
||||
ExampleEntry(0,"Soft Body"),
|
||||
ExampleEntry(1,"Cloth","Simulate a patch of cloth.", SoftDemoCreateFunc,0),
|
||||
|
||||
ExampleEntry(1,"Pressure","Simulate 3d soft body using a pressure constraint.",SoftDemoCreateFunc,1),
|
||||
ExampleEntry(1,"Volume","Simulate 3d soft body using a volume constraint.",SoftDemoCreateFunc,2),
|
||||
ExampleEntry(1,"Ropes","Simulate ropes", SoftDemoCreateFunc,3),
|
||||
ExampleEntry(1,"Rope Attach","Simulate a rigid body connected to a rope.", SoftDemoCreateFunc,4),
|
||||
ExampleEntry(1,"Cloth Attach","A rigid body attached to a cloth.", SoftDemoCreateFunc,5),
|
||||
ExampleEntry(1,"Sticks","Show simulation of ropes fixed to the ground.", SoftDemoCreateFunc,6),
|
||||
ExampleEntry(1,"Capsule Collision","Collision detection between a capsule shape and cloth.", SoftDemoCreateFunc,7),
|
||||
|
||||
ExampleEntry(1,"Collide","Soft body collision", SoftDemoCreateFunc,8),
|
||||
ExampleEntry(1,"Collide 2","Soft body collision",SoftDemoCreateFunc,9),
|
||||
ExampleEntry(1,"Collide 3","Soft body collision",SoftDemoCreateFunc,10),
|
||||
ExampleEntry(1,"Impact","Soft body impact",SoftDemoCreateFunc,11),
|
||||
ExampleEntry(1,"Aero","Rudimentary aero dynamics simulation", SoftDemoCreateFunc,12),
|
||||
ExampleEntry(1,"Aero 2","Rudimentary aero dynamics simulation",SoftDemoCreateFunc,13),
|
||||
ExampleEntry(1,"Friction","Simulate soft body friction with friction coefficients ranging from 0 to 1.", SoftDemoCreateFunc,14),
|
||||
ExampleEntry(1,"Torus","Simulate a soft body torus.",SoftDemoCreateFunc,15),
|
||||
ExampleEntry(1,"Torus (Shape Match)","Simulate a soft body torus using shape matching.", SoftDemoCreateFunc,16),
|
||||
ExampleEntry(1,"Bunny","Simulate the Stanford bunny as deformable object.", SoftDemoCreateFunc,17),
|
||||
ExampleEntry(1,"Bunny (Shape Match)","Simulate the Stanford bunny as deformable object including shape matching.", SoftDemoCreateFunc,18),
|
||||
ExampleEntry(1,"Cutting","Allow cutting of the soft body, by clicking on the cloth", SoftDemoCreateFunc,19),
|
||||
ExampleEntry(1,"Cluster Deform","Soft body collision detection using convex collision clusters.", SoftDemoCreateFunc,20),
|
||||
ExampleEntry(1,"Cluster Collide1","Collision detection between soft bodies using convex collision clusters.", SoftDemoCreateFunc,21),
|
||||
ExampleEntry(1,"Cluster Collide2","Collision detection between soft bodies using convex collision clusters.",SoftDemoCreateFunc,22),
|
||||
ExampleEntry(1,"Cluster Socket","Soft bodies connected by a point to point (ball-socket) constraints. This requires collision clusters, in order to define a frame of reference for the constraint."
|
||||
, SoftDemoCreateFunc,23),
|
||||
ExampleEntry(1,"Cluster Hinge","Soft bodies connected by a hinge constraints. This requires collision clusters, in order to define a frame of reference for the constraint.", SoftDemoCreateFunc,24),
|
||||
ExampleEntry(1,"Cluster Combine","Simulate soft bodies using collision clusters.", SoftDemoCreateFunc,25),
|
||||
ExampleEntry(1,"Cluster Car","Simulate the Stanford bunny by multiple soft bodies connected by constraints.", SoftDemoCreateFunc,26),
|
||||
ExampleEntry(1,"Cluster Robot","A rigid body base connected by soft body wheels, connected by constraints.", SoftDemoCreateFunc,27),
|
||||
ExampleEntry(1,"Cluster Stack Soft","Stacking of soft bodies.", SoftDemoCreateFunc,28),
|
||||
ExampleEntry(1,"Cluster Stack Mixed","Stacking of soft bodies and rigid bodies.",SoftDemoCreateFunc,29),
|
||||
ExampleEntry(1,"Tetra Cube","Simulate a volumetric soft body cube defined by tetrahedra.", SoftDemoCreateFunc,30),
|
||||
ExampleEntry(1,"Tetra Bunny","Simulate a volumetric soft body Stanford bunny defined by tetrahedra.", SoftDemoCreateFunc,31),
|
||||
|
||||
#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
|
||||
ExampleEntry(0,"Benchmarks", 0),
|
||||
ExampleEntry(1,"3000 boxes", BenchmarkCreateFunc, 1),
|
||||
ExampleEntry(1,"1000 stack", BenchmarkCreateFunc, 2),
|
||||
ExampleEntry(1,"Ragdolls", BenchmarkCreateFunc, 3),
|
||||
ExampleEntry(1,"Convex stack", BenchmarkCreateFunc, 4),
|
||||
ExampleEntry(1,"Prim vs Mesh", BenchmarkCreateFunc, 5),
|
||||
ExampleEntry(1,"Convex vs Mesh", BenchmarkCreateFunc, 6),
|
||||
ExampleEntry(1,"Raycast", BenchmarkCreateFunc, 7),
|
||||
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. ",
|
||||
BenchmarkCreateFunc, 2),
|
||||
ExampleEntry(1,"Ragdolls", "Benchmark the performance of the ragdoll constraints, btHingeConstraint and btConeTwistConstraint, in addition to capsule collision detection.", BenchmarkCreateFunc, 3),
|
||||
ExampleEntry(1,"Convex stack", "Benchmark the performance and stability of rigid bodies using btConvexHullShape.", BenchmarkCreateFunc, 4),
|
||||
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
|
||||
|
||||
|
||||
ExampleEntry(0,"Importers", 0),
|
||||
ExampleEntry(1,"Wavefront Obj", ImportObjCreateFunc, 0),
|
||||
ExampleEntry(0,"Importers"),
|
||||
ExampleEntry(1,"Wavefront Obj", "Import a Wavefront .obj file", ImportObjCreateFunc, 0),
|
||||
|
||||
ExampleEntry(1,"Quake BSP", ImportBspCreateFunc, 0),
|
||||
ExampleEntry(1,"COLLADA dae", ImportColladaCreateFunc, 0),
|
||||
ExampleEntry(1,"STL", ImportSTLCreateFunc, 0),
|
||||
ExampleEntry(1,"URDF (RigidBody)", ImportURDFCreateFunc, 0),
|
||||
ExampleEntry(1,"URDF (MultiBody)", ImportURDFCreateFunc, 1),
|
||||
ExampleEntry(1,"Quake BSP", "Import a Quake .bsp file", ImportBspCreateFunc, 0),
|
||||
ExampleEntry(1,"COLLADA dae", "Import the geometric mesh data from a COLLADA file. This is used as part of the URDF importer. This loader can also be used to import collision geometry in general. ",
|
||||
ImportColladaCreateFunc, 0),
|
||||
ExampleEntry(1,"STL", "Import the geometric mesh data from a STL file. This is used as part of the URDF importer. This loader can also be used to import collision geometry in general. ",ImportSTLCreateFunc, 0),
|
||||
ExampleEntry(1,"URDF (RigidBody)", "Import a URDF file, and create rigid bodies (btRigidBody) connected by constraints.", ImportURDFCreateFunc, 0),
|
||||
ExampleEntry(1,"URDF (MultiBody)", "Import a URDF file and create a single multibody (btMultiBody) with tree hierarchy of links (mobilizers).",
|
||||
ImportURDFCreateFunc, 1),
|
||||
|
||||
ExampleEntry(0,"Vehicles",0),
|
||||
ExampleEntry(0,"Vehicles"),
|
||||
|
||||
ExampleEntry(1,"ForkLift",ForkLiftCreateFunc),
|
||||
ExampleEntry(1,"ForkLift","Simulate a fork lift vehicle with a working fork lift that can be moved using the cursor keys. The wheels collision is simplified using ray tests."
|
||||
"There are currently some issues with the wheel rendering, the wheels rotate when picking up the object."
|
||||
"The demo implementation allows to choose various MLCP constraint solvers.",
|
||||
ForkLiftCreateFunc),
|
||||
|
||||
ExampleEntry(0,"Rendering",0),
|
||||
ExampleEntry(1,"Instanced Rendering", RenderInstancingCreateFunc),
|
||||
ExampleEntry(1,"CoordinateSystemDemo",CoordinateSystemCreateFunc),
|
||||
ExampleEntry(1,"Raytracer",RayTracerCreateFunc),
|
||||
ExampleEntry(0,"Rendering"),
|
||||
ExampleEntry(1,"Instanced Rendering", "Simple example of fast instanced rendering, only active when using OpenGL3+.",RenderInstancingCreateFunc),
|
||||
ExampleEntry(1,"CoordinateSystemDemo","Show the axis and positive rotation direction around the axis.", CoordinateSystemCreateFunc),
|
||||
ExampleEntry(1,"Raytracer","Implement an extremely simple ray tracer using the ray trace functionality in btCollisionWorld.",
|
||||
RayTracerCreateFunc),
|
||||
|
||||
};
|
||||
|
||||
@@ -124,21 +184,21 @@ void ExampleEntries::initExampleEntries()
|
||||
{
|
||||
|
||||
{
|
||||
ExampleEntry e(0,"Empty", 0);
|
||||
ExampleEntry e(0,"Empty");
|
||||
m_data->m_allExamples.push_back(e);
|
||||
}
|
||||
|
||||
{
|
||||
ExampleEntry e(1,"Empty",EmptyExample::CreateFunc);
|
||||
ExampleEntry e(1,"Empty","Empty Description", EmptyExample::CreateFunc);
|
||||
m_data->m_allExamples.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ExampleEntries::registerExampleEntry(int menuLevel, const char* name,ExampleInterface::CreateFunc* createFunc, int option)
|
||||
void ExampleEntries::registerExampleEntry(int menuLevel, const char* name,const char* description, ExampleInterface::CreateFunc* createFunc, int option)
|
||||
{
|
||||
ExampleEntry e( menuLevel,name,createFunc, option);
|
||||
ExampleEntry e( menuLevel,name,description, createFunc, option);
|
||||
gAdditionalRegisteredExamples.push_back(e);
|
||||
}
|
||||
|
||||
@@ -161,3 +221,8 @@ const char* ExampleEntries::getExampleName(int index)
|
||||
{
|
||||
return m_data->m_allExamples[index].m_name;
|
||||
}
|
||||
|
||||
const char* ExampleEntries::getExampleDescription(int index)
|
||||
{
|
||||
return m_data->m_allExamples[index].m_description;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
ExampleEntries();
|
||||
virtual ~ExampleEntries();
|
||||
|
||||
static void registerExampleEntry(int menuLevel, const char* name,ExampleInterface::CreateFunc* createFunc, int option=0);
|
||||
static void registerExampleEntry(int menuLevel, const char* name,const char* description, ExampleInterface::CreateFunc* createFunc, int option=0);
|
||||
|
||||
void initExampleEntries();
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
ExampleInterface::CreateFunc* getExampleCreateFunc(int index);
|
||||
|
||||
const char* getExampleName(int index);
|
||||
|
||||
const char* getExampleDescription(int index);
|
||||
|
||||
int getExampleOption(int index);
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ struct GwenInternalData
|
||||
Gwen::Controls::TreeControl* m_explorerTreeCtrl;
|
||||
Gwen::Controls::MenuItem* m_viewMenu;
|
||||
class MyMenuItems* m_menuItems;
|
||||
Gwen::Controls::ListBox* m_TextOutput;
|
||||
Gwen::Controls::Label* m_exampleInfoGroupBox;
|
||||
Gwen::Controls::ListBox* m_exampleInfoTextOutput;
|
||||
|
||||
|
||||
int m_curYposition;
|
||||
|
||||
|
||||
@@ -140,6 +140,78 @@ struct MyButtonHander :public Gwen::Event::Handler
|
||||
};
|
||||
|
||||
|
||||
void GwenUserInterface::textOutput(const char* message)
|
||||
{
|
||||
Gwen::UnicodeString msg = Gwen::Utility::StringToUnicode(message);
|
||||
m_data->m_TextOutput->AddItem( msg );
|
||||
m_data->m_TextOutput->Scroller()->ScrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
void GwenUserInterface::setExampleDescription(const char* message)
|
||||
{
|
||||
//Gwen apparently doesn't have text/word wrap, so do rudimentary brute-force implementation here.
|
||||
|
||||
std::string wrapmessage=message;
|
||||
int startPos = 0;
|
||||
|
||||
std::string lastFit = "";
|
||||
bool hasSpace = false;
|
||||
std::string lastFitSpace = "";
|
||||
int spacePos = 0;
|
||||
|
||||
m_data->m_exampleInfoTextOutput->Clear();
|
||||
int fixedWidth = m_data->m_exampleInfoTextOutput->GetBounds().w-25;
|
||||
|
||||
for (int endPos=0;endPos<=wrapmessage.length();endPos++)
|
||||
{
|
||||
std::string sub = wrapmessage.substr(startPos,(endPos-startPos));
|
||||
Gwen::Point pt = m_data->pRenderer->MeasureText(m_data->pCanvas->GetSkin()->GetDefaultFont(),sub);
|
||||
|
||||
if (pt.x <= fixedWidth)
|
||||
{
|
||||
lastFit = sub;
|
||||
|
||||
if (message[endPos]==' ' ||message[endPos]=='.' || message[endPos]==',' )
|
||||
{
|
||||
hasSpace = true;
|
||||
lastFitSpace = sub;
|
||||
spacePos = endPos;
|
||||
}
|
||||
} else
|
||||
{
|
||||
//submit and
|
||||
if (hasSpace)
|
||||
{
|
||||
endPos = spacePos+1;
|
||||
hasSpace = false;
|
||||
lastFit = lastFitSpace;
|
||||
startPos = endPos;
|
||||
} else
|
||||
{
|
||||
startPos = endPos-1;
|
||||
}
|
||||
Gwen::UnicodeString msg = Gwen::Utility::StringToUnicode(lastFit);
|
||||
|
||||
m_data->m_exampleInfoTextOutput->AddItem( msg );
|
||||
m_data->m_exampleInfoTextOutput->Scroller()->ScrollToBottom();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (lastFit.length())
|
||||
{
|
||||
Gwen::UnicodeString msg = Gwen::Utility::StringToUnicode(lastFit);
|
||||
m_data->m_exampleInfoTextOutput->AddItem( msg );
|
||||
m_data->m_exampleInfoTextOutput->Scroller()->ScrollToBottom();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void GwenUserInterface::setStatusBarMessage(const char* message, bool isLeft)
|
||||
{
|
||||
Gwen::UnicodeString msg = Gwen::Utility::StringToUnicode(message);
|
||||
@@ -171,10 +243,13 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas);
|
||||
@@ -183,6 +258,10 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
//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);
|
||||
@@ -266,6 +345,14 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
//tab->Dock(Gwen::Pos::Left);
|
||||
explorerTab->Dock(Gwen::Pos::Fill);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//m_data->m_exampleInfoTextOutput->SetBounds(2, 10, 236, 400);
|
||||
|
||||
//windowRight
|
||||
|
||||
Gwen::UnicodeString explorerStr1(L"Explorer");
|
||||
m_data->m_explorerPage = explorerTab->AddPage(explorerStr1);
|
||||
Gwen::UnicodeString shapesStr1(L"Shapes");
|
||||
@@ -279,6 +366,21 @@ void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* rendere
|
||||
ctrl->Focus();
|
||||
ctrl->SetBounds(2, 10, 236, 400);
|
||||
|
||||
m_data->m_exampleInfoGroupBox = new Gwen::Controls::Label( m_data->m_explorerPage->GetPage() );
|
||||
m_data->m_exampleInfoGroupBox->SetPos(2, 414);
|
||||
m_data->m_exampleInfoGroupBox->SetHeight( 15 );
|
||||
m_data->m_exampleInfoGroupBox->SetWidth(234);
|
||||
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, 432);
|
||||
m_data->m_exampleInfoTextOutput->SetHeight( 150 );
|
||||
m_data->m_exampleInfoTextOutput->SetWidth(233);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ class GwenUserInterface
|
||||
|
||||
void setStatusBarMessage(const char* message, bool isLeft=true);
|
||||
|
||||
void textOutput(const char* msg);
|
||||
void setExampleDescription(const char* msg);
|
||||
|
||||
|
||||
void registerFileOpenCallback(b3FileOpenCallback callback);
|
||||
|
||||
GwenInternalData* getInternalData()
|
||||
|
||||
@@ -246,7 +246,8 @@ void selectDemo(int demoIndex)
|
||||
bool isLeft = true;
|
||||
gui->setStatusBarMessage("Status: OK", false);
|
||||
}
|
||||
|
||||
b3Printf("Selected demo: %s",gAllExamples->getExampleName(demoIndex));
|
||||
gui->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
||||
sCurrentDemo->initPhysics();
|
||||
}
|
||||
}
|
||||
@@ -303,6 +304,17 @@ void MyComboBoxCallback(int comboId, const char* item)
|
||||
}
|
||||
|
||||
|
||||
void MyGuiPrintf(const char* msg)
|
||||
{
|
||||
printf("b3Printf: %s\n",msg);
|
||||
if (gui)
|
||||
{
|
||||
gui->textOutput(msg);
|
||||
gui->forceUpdateScrollBars();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MyStatusBarPrintf(const char* msg)
|
||||
{
|
||||
@@ -364,13 +376,14 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
||||
}
|
||||
void onButtonC(Gwen::Controls::Base* pControl)
|
||||
{
|
||||
// Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
||||
// Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
||||
// Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
||||
// const char* ha = laa.c_str();
|
||||
/*Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
||||
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
||||
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
||||
const char* ha = laa.c_str();
|
||||
|
||||
|
||||
// printf("onButtonC ! %s\n", ha);
|
||||
printf("onButtonC ! %s\n", ha);
|
||||
*/
|
||||
}
|
||||
void onButtonD(Gwen::Controls::Base* pControl)
|
||||
{
|
||||
@@ -390,6 +403,7 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
||||
{
|
||||
// printf("select %d\n",m_buttonId);
|
||||
sCurrentHightlighted = m_buttonId;
|
||||
gui->setExampleDescription(gAllExamples->getExampleDescription(sCurrentHightlighted));
|
||||
}
|
||||
|
||||
void onButtonF(Gwen::Controls::Base* pControl)
|
||||
@@ -559,7 +573,8 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
s_app->m_renderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
|
||||
|
||||
b3SetCustomWarningMessageFunc(MyStatusBarWarning);
|
||||
b3SetCustomPrintfFunc(MyStatusBarPrintf);
|
||||
//b3SetCustomPrintfFunc(MyStatusBarPrintf);
|
||||
b3SetCustomPrintfFunc(MyGuiPrintf);
|
||||
|
||||
|
||||
assert(glGetError()==GL_NO_ERROR);
|
||||
@@ -580,6 +595,10 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
||||
//
|
||||
|
||||
gui->init(width,height,gwenRenderer,s_window->getRetinaScale());
|
||||
|
||||
|
||||
|
||||
|
||||
// gui->getInternalData()->m_explorerPage
|
||||
Gwen::Controls::TreeControl* tree = gui->getInternalData()->m_explorerTreeCtrl;
|
||||
|
||||
@@ -727,6 +746,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
s_app->drawText(bla,10,10);
|
||||
}
|
||||
|
||||
|
||||
if (sCurrentDemo)
|
||||
{
|
||||
if (!pauseSimulation)
|
||||
@@ -758,19 +778,18 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
//if (!pauseSimulation)
|
||||
// processProfileData(profWindow,false);
|
||||
|
||||
{
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
|
||||
saveOpenGLState(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
}
|
||||
BT_PROFILE("Draw Gwen GUI");
|
||||
gui->draw(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
restoreOpenGLState();
|
||||
}
|
||||
saveOpenGLState(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
}
|
||||
BT_PROFILE("Draw Gwen GUI");
|
||||
gui->draw(s_instancingRenderer->getScreenWidth(),s_instancingRenderer->getScreenHeight());
|
||||
if (sUseOpenGL2)
|
||||
{
|
||||
restoreOpenGLState();
|
||||
}
|
||||
|
||||
}
|
||||
toggle=1-toggle;
|
||||
{
|
||||
@@ -781,7 +800,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
||||
BT_PROFILE("Swap Buffers");
|
||||
s_app->swapBuffer();
|
||||
}
|
||||
|
||||
|
||||
gui->forceUpdateScrollBars();
|
||||
|
||||
}
|
||||
|
||||
@@ -195,6 +195,11 @@ static void createCollisionShapeGraphicsObjectInternal(btCollisionShape* collisi
|
||||
//todo: support all collision shape types
|
||||
switch (collisionShape->getShapeType())
|
||||
{
|
||||
case SOFTBODY_SHAPE_PROXYTYPE:
|
||||
{
|
||||
//skip the soft body collision shape for now
|
||||
break;
|
||||
}
|
||||
case STATIC_PLANE_PROXYTYPE:
|
||||
{
|
||||
//draw a box, oriented along the plane normal
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
}
|
||||
|
||||
|
||||
links{"gwen", "OpenGL_Window","BulletDynamics","BulletCollision","LinearMath","Bullet3Common"}
|
||||
links{"gwen", "OpenGL_Window","BulletSoftBody", "BulletDynamics","BulletCollision","LinearMath","Bullet3Common"}
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
|
||||
defines {"INCLUDE_CLOTH_DEMOS"}
|
||||
|
||||
files {
|
||||
"**.cpp",
|
||||
"**.h",
|
||||
@@ -27,6 +28,8 @@
|
||||
"../Importers/**",
|
||||
"../Planar2D/Planar2D.*",
|
||||
"../RenderingExamples/*",
|
||||
"../VoronoiFracture/*",
|
||||
"../SoftDemo/*",
|
||||
"../Constraints/*",
|
||||
"../MultiBody/MultiBodyCustomURDFDemo.cpp",
|
||||
"../MultiBody/MultiDofDemo.cpp",
|
||||
|
||||
Reference in New Issue
Block a user