add Tutorial.cpp files
load textured sphere8.obj by default as a test tiny_obj_loader don't crash when mtl is not found fix camera perspectives for some examples
This commit is contained in:
@@ -27,6 +27,8 @@ SET(App_ExampleBrowser_SRCS
|
||||
../BasicDemo/BasicExample.h
|
||||
../ForkLift/ForkLiftDemo.cpp
|
||||
../ForkLift/ForkLiftDemo.h
|
||||
../Tutorial/Tutorial.cpp
|
||||
../Tutorial/Tutorial.h
|
||||
../GyroscopicDemo/GyroscopicSetup.cpp
|
||||
../GyroscopicDemo/GyroscopicSetup.h
|
||||
../Planar2D/Planar2D.cpp
|
||||
@@ -41,6 +43,7 @@ SET(App_ExampleBrowser_SRCS
|
||||
../FractureDemo/btFractureDynamicsWorld.h
|
||||
../DynamicControlDemo/MotorDemo.cpp
|
||||
../DynamicControlDemo/MotorDemo.h
|
||||
|
||||
../RenderingExamples/CoordinateSystemDemo.cpp
|
||||
../RenderingExamples/CoordinateSystemDemo.h
|
||||
../RenderingExamples/RaytracerSetup.cpp
|
||||
@@ -118,6 +121,9 @@ SET(App_ExampleBrowser_SRCS
|
||||
../Constraints/ConstraintPhysicsSetup.h
|
||||
|
||||
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.h
|
||||
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
||||
|
||||
@@ -76,8 +76,6 @@ struct ExampleEntry
|
||||
static ExampleEntry gDefaultExamples[]=
|
||||
{
|
||||
|
||||
ExampleEntry(0,"Tutorial"),
|
||||
ExampleEntry(1,"Free Rigid Body","Free moving rigid body, without external or constraint forces", TutorialCreateFunc,0),
|
||||
|
||||
|
||||
|
||||
@@ -110,6 +108,10 @@ static ExampleEntry gDefaultExamples[]=
|
||||
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(0,"Tutorial"),
|
||||
ExampleEntry(1,"Free Rigid Body","(Preliminary work in progress) Free moving rigid body, without external or constraint forces", TutorialCreateFunc,0),
|
||||
|
||||
|
||||
#ifdef INCLUDE_CLOTH_DEMOS
|
||||
ExampleEntry(0,"Soft Body"),
|
||||
ExampleEntry(1,"Cloth","Simulate a patch of cloth.", SoftDemoCreateFunc,0),
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Wavefront2GLInstanceGraphicsShape.h"
|
||||
#include "../../Utils/b3ResourcePath.h"
|
||||
#include "Bullet3Common/b3FileUtils.h"
|
||||
|
||||
#include "stb_image/stb_image.h"
|
||||
|
||||
#include "../CommonInterfaces/CommonRigidBodyBase.h"
|
||||
@@ -24,10 +25,10 @@ public:
|
||||
|
||||
virtual void resetCamera()
|
||||
{
|
||||
float dist = 50;
|
||||
float pitch = 61;
|
||||
float yaw = 18;
|
||||
float targetPos[3]={-15,-15,47};
|
||||
float dist = 18;
|
||||
float pitch = 120;
|
||||
float yaw = 46;
|
||||
float targetPos[3]={-2,-2,-2};
|
||||
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ void ImportObjSetup::initPhysics()
|
||||
m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
|
||||
|
||||
|
||||
const char* fileName = "sphere8.obj";
|
||||
const char* fileName = "sphere8.obj";//sponza_closed.obj";//sphere8.obj";
|
||||
char relativeFileName[1024];
|
||||
if (b3ResourcePath::findResourcePath(fileName, relativeFileName, 1024))
|
||||
{
|
||||
|
||||
@@ -606,8 +606,8 @@ LoadObj(
|
||||
|
||||
std::string err_mtl = LoadMtl(material_map, namebuf, mtl_basepath);
|
||||
if (!err_mtl.empty()) {
|
||||
faceGroup.resize(0); // for safety
|
||||
return err_mtl;
|
||||
//faceGroup.resize(0); // for safety
|
||||
//return err_mtl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
#include "../CommonInterfaces/CommonExampleInterface.h"
|
||||
#include "LinearMath/btTransform.h"
|
||||
#include "stb_image/stb_image.h"
|
||||
|
||||
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
||||
|
||||
#include "stb_image/stb_image.h"
|
||||
|
||||
struct LWPose
|
||||
{
|
||||
btVector3 m_worldPosition;
|
||||
@@ -227,7 +228,7 @@ public:
|
||||
|
||||
virtual void resetCamera()
|
||||
{
|
||||
float dist = 3.5;
|
||||
float dist = 10.5;
|
||||
float pitch = 136;
|
||||
float yaw = 32;
|
||||
float targetPos[3]={0,0,0};
|
||||
|
||||
Reference in New Issue
Block a user