remove a lot of warnings (more todo in demos and serialization code)
This commit is contained in:
@@ -126,9 +126,13 @@ static int loadCurrentDemoEntry(const char* startFileName)
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
result = fscanf(f,"%d",¤tEntry);
|
result = fscanf(f,"%d",¤tEntry);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return currentEntry;
|
||||||
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
return currentEntry;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif//BULLET_DEMO_ENTRIES_H
|
#endif//BULLET_DEMO_ENTRIES_H
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ GraphingTexture::~GraphingTexture()
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphingTexture::destroy()
|
void GraphingTexture::destroy()
|
||||||
{
|
{
|
||||||
//TODO(erwincoumans) release memory etc...
|
//TODO(erwincoumans) release memory etc...
|
||||||
m_width = 0;
|
m_width = 0;
|
||||||
@@ -58,21 +58,18 @@ bool GraphingTexture::create(int texWidth, int texHeight)
|
|||||||
glGenTextures(1,(GLuint*)&m_textureId);
|
glGenTextures(1,(GLuint*)&m_textureId);
|
||||||
|
|
||||||
uploadImageData();
|
uploadImageData();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingTexture::uploadImageData()
|
void GraphingTexture::uploadImageData()
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D,m_textureId);
|
glBindTexture(GL_TEXTURE_2D,m_textureId);
|
||||||
GLint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width,m_height,0,GL_RGBA,GL_UNSIGNED_BYTE,&m_imageData[0]);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width,m_height,0,GL_RGBA,GL_UNSIGNED_BYTE,&m_imageData[0]);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct GraphingTexture
|
|||||||
virtual ~GraphingTexture();
|
virtual ~GraphingTexture();
|
||||||
|
|
||||||
bool create(int texWidth, int texHeight);
|
bool create(int texWidth, int texHeight);
|
||||||
bool destroy();
|
void destroy();
|
||||||
|
|
||||||
void setPixel(int x, int y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
|
void setPixel(int x, int y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void GwenParameterInterface::registerSliderFloatParameter(SliderParams& params)
|
|||||||
|
|
||||||
pSlider->onValueChanged.Add( handler, &MySliderEventHandler<btScalar>::SliderMoved );
|
pSlider->onValueChanged.Add( handler, &MySliderEventHandler<btScalar>::SliderMoved );
|
||||||
handler->SliderMoved(pSlider);
|
handler->SliderMoved(pSlider);
|
||||||
float v = pSlider->GetValue();
|
// float v = pSlider->GetValue();
|
||||||
m_gwenInternalData->m_curYposition+=22;
|
m_gwenInternalData->m_curYposition+=22;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ protected:
|
|||||||
|
|
||||||
void SliderMoved(Gwen::Controls::Base* pControl )
|
void SliderMoved(Gwen::Controls::Base* pControl )
|
||||||
{
|
{
|
||||||
Gwen::Controls::Slider* pSlider = (Gwen::Controls::Slider*)pControl;
|
// Gwen::Controls::Slider* pSlider = (Gwen::Controls::Slider*)pControl;
|
||||||
//this->m_app->scaleYoungModulus(pSlider->GetValue());
|
//this->m_app->scaleYoungModulus(pSlider->GetValue());
|
||||||
// printf("Slider Value: %.2f", pSlider->GetValue() );
|
// printf("Slider Value: %.2f", pSlider->GetValue() );
|
||||||
}
|
}
|
||||||
@@ -35,8 +35,8 @@ protected:
|
|||||||
|
|
||||||
void OnCheckChangedStiffnessWarping (Gwen::Controls::Base* pControl)
|
void OnCheckChangedStiffnessWarping (Gwen::Controls::Base* pControl)
|
||||||
{
|
{
|
||||||
Gwen::Controls::CheckBox* labeled = (Gwen::Controls::CheckBox* )pControl;
|
// Gwen::Controls::CheckBox* labeled = (Gwen::Controls::CheckBox* )pControl;
|
||||||
bool checked = labeled->IsChecked();
|
// bool checked = labeled->IsChecked();
|
||||||
//m_app->m_stiffness_warp_on = checked;
|
//m_app->m_stiffness_warp_on = checked;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@@ -148,13 +148,13 @@ public:
|
|||||||
void UpdateText(CProfileIterator* profileIterator, bool idle)
|
void UpdateText(CProfileIterator* profileIterator, bool idle)
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool update=true;
|
// static bool update=true;
|
||||||
|
|
||||||
m_ctrl->SetBounds(0,0,this->GetInnerBounds().w,this->GetInnerBounds().h);
|
m_ctrl->SetBounds(0,0,this->GetInnerBounds().w,this->GetInnerBounds().h);
|
||||||
|
|
||||||
// if (!update)
|
// if (!update)
|
||||||
// return;
|
// return;
|
||||||
update=false;
|
// update=false;
|
||||||
|
|
||||||
|
|
||||||
static int test = 1;
|
static int test = 1;
|
||||||
@@ -170,18 +170,18 @@ public:
|
|||||||
{
|
{
|
||||||
//recompute profiling data, and store profile strings
|
//recompute profiling data, and store profile strings
|
||||||
|
|
||||||
char blockTime[128];
|
// char blockTime[128];
|
||||||
|
|
||||||
double totalTime = 0;
|
// double totalTime = 0;
|
||||||
|
|
||||||
int frames_since_reset = CProfileManager::Get_Frame_Count_Since_Reset();
|
// int frames_since_reset = CProfileManager::Get_Frame_Count_Since_Reset();
|
||||||
|
|
||||||
profileIterator->First();
|
profileIterator->First();
|
||||||
|
|
||||||
double parent_time = profileIterator->Is_Root() ? time_since_reset : profileIterator->Get_Current_Parent_Total_Time();
|
double parent_time = profileIterator->Is_Root() ? time_since_reset : profileIterator->Get_Current_Parent_Total_Time();
|
||||||
|
|
||||||
|
|
||||||
Gwen::Controls::TreeNode* curParent = m_node;
|
// Gwen::Controls::TreeNode* curParent = m_node;
|
||||||
|
|
||||||
double accumulated_time = dumpRecursive(profileIterator,m_node);
|
double accumulated_time = dumpRecursive(profileIterator,m_node);
|
||||||
|
|
||||||
|
|||||||
@@ -238,13 +238,13 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
|||||||
|
|
||||||
void onButtonA(Gwen::Controls::Base* pControl)
|
void onButtonA(Gwen::Controls::Base* pControl)
|
||||||
{
|
{
|
||||||
const Gwen::String& name = pControl->GetName();
|
//const Gwen::String& name = pControl->GetName();
|
||||||
Gwen::Controls::TreeNode* node = (Gwen::Controls::TreeNode*)pControl;
|
Gwen::Controls::TreeNode* node = (Gwen::Controls::TreeNode*)pControl;
|
||||||
Gwen::Controls::Label* l = node->GetButton();
|
// Gwen::Controls::Label* l = node->GetButton();
|
||||||
|
|
||||||
Gwen::UnicodeString la = node->GetButton()->GetText();// node->GetButton()->GetName();// GetText();
|
Gwen::UnicodeString la = node->GetButton()->GetText();// node->GetButton()->GetName();// GetText();
|
||||||
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
||||||
const char* ha = laa.c_str();
|
// const char* ha = laa.c_str();
|
||||||
|
|
||||||
//printf("selected %s\n", ha);
|
//printf("selected %s\n", ha);
|
||||||
//int dep = but->IsDepressed();
|
//int dep = but->IsDepressed();
|
||||||
@@ -257,7 +257,7 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
|||||||
Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
||||||
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
||||||
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
||||||
const char* ha = laa.c_str();
|
//const char* ha = laa.c_str();
|
||||||
|
|
||||||
|
|
||||||
selectDemo(sCurrentHightlighted);
|
selectDemo(sCurrentHightlighted);
|
||||||
@@ -265,10 +265,10 @@ struct MyMenuItemHander :public Gwen::Event::Handler
|
|||||||
}
|
}
|
||||||
void onButtonC(Gwen::Controls::Base* pControl)
|
void onButtonC(Gwen::Controls::Base* pControl)
|
||||||
{
|
{
|
||||||
Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
// Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
||||||
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
// Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
||||||
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
// Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
||||||
const char* ha = laa.c_str();
|
// const char* ha = laa.c_str();
|
||||||
|
|
||||||
|
|
||||||
// printf("onButtonC ! %s\n", ha);
|
// printf("onButtonC ! %s\n", ha);
|
||||||
@@ -334,7 +334,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
b3Clock clock;
|
b3Clock clock;
|
||||||
|
|
||||||
float dt = 1./120.f;
|
//float dt = 1./120.f;
|
||||||
int width = 1024;
|
int width = 1024;
|
||||||
int height=768;
|
int height=768;
|
||||||
|
|
||||||
@@ -348,8 +348,7 @@ int main(int argc, char* argv[])
|
|||||||
app->m_window->setKeyboardCallback(MyKeyboardCallback);
|
app->m_window->setKeyboardCallback(MyKeyboardCallback);
|
||||||
|
|
||||||
|
|
||||||
GLint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
sth_stash* fontstash=app->getFontStash();
|
sth_stash* fontstash=app->getFontStash();
|
||||||
gui = new GwenUserInterface;
|
gui = new GwenUserInterface;
|
||||||
@@ -376,7 +375,8 @@ int main(int argc, char* argv[])
|
|||||||
gt->create(256,256);
|
gt->create(256,256);
|
||||||
int texId = gt->getTextureId();
|
int texId = gt->getTextureId();
|
||||||
myTexLoader->m_hashMap.insert("graph1", texId);
|
myTexLoader->m_hashMap.insert("graph1", texId);
|
||||||
MyGraphWindow* gw = setupTextureWindow(input);
|
//MyGraphWindow* gw =
|
||||||
|
setupTextureWindow(input);
|
||||||
}
|
}
|
||||||
if (1)
|
if (1)
|
||||||
{
|
{
|
||||||
@@ -403,7 +403,8 @@ int main(int argc, char* argv[])
|
|||||||
int texId = gt->getTextureId();
|
int texId = gt->getTextureId();
|
||||||
input.m_xPos = width-input.m_width;
|
input.m_xPos = width-input.m_width;
|
||||||
myTexLoader->m_hashMap.insert("graph2", texId);
|
myTexLoader->m_hashMap.insert("graph2", texId);
|
||||||
MyGraphWindow* gw = setupTextureWindow(input);
|
//MyGraphWindow* gw =
|
||||||
|
setupTextureWindow(input);
|
||||||
}
|
}
|
||||||
//destroyTextureWindow(gw);
|
//destroyTextureWindow(gw);
|
||||||
|
|
||||||
@@ -414,8 +415,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
int numDemos = sizeof(allDemos)/sizeof(BulletDemoEntry);
|
int numDemos = sizeof(allDemos)/sizeof(BulletDemoEntry);
|
||||||
|
|
||||||
char nodeText[1024];
|
//char nodeText[1024];
|
||||||
int curDemo = 0;
|
//int curDemo = 0;
|
||||||
int selectedDemo = loadCurrentDemoEntry(startFileName);
|
int selectedDemo = loadCurrentDemoEntry(startFileName);
|
||||||
Gwen::Controls::TreeNode* curNode = tree;
|
Gwen::Controls::TreeNode* curNode = tree;
|
||||||
MyMenuItemHander* handler2 = new MyMenuItemHander(-1);
|
MyMenuItemHander* handler2 = new MyMenuItemHander(-1);
|
||||||
@@ -476,8 +477,7 @@ int main(int argc, char* argv[])
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
GLint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
app->m_instancingRenderer->init();
|
app->m_instancingRenderer->init();
|
||||||
DrawGridData dg;
|
DrawGridData dg;
|
||||||
dg.upAxis = app->getUpAxis();
|
dg.upAxis = app->getUpAxis();
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ struct MyButtonHander :public Gwen::Event::Handler
|
|||||||
void onButtonA( Gwen::Controls::Base* pControl )
|
void onButtonA( Gwen::Controls::Base* pControl )
|
||||||
{
|
{
|
||||||
Gwen::Controls::Button* but = (Gwen::Controls::Button*) pControl;
|
Gwen::Controls::Button* but = (Gwen::Controls::Button*) pControl;
|
||||||
int dep = but->IsDepressed();
|
// int dep = but->IsDepressed();
|
||||||
int tog = but->GetToggleState();
|
int tog = but->GetToggleState();
|
||||||
if (m_data->m_toggleButtonCallback)
|
if (m_data->m_toggleButtonCallback)
|
||||||
(*m_data->m_toggleButtonCallback)(m_buttonId,tog);
|
(*m_data->m_toggleButtonCallback)(m_buttonId,tog);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static GLInstanceGraphicsShape* gCreateGraphicsShapeFromWavefrontObj(std::vector
|
|||||||
// int numIndices = 0;
|
// int numIndices = 0;
|
||||||
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
|
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
|
||||||
|
|
||||||
for (int s=0;s<shapes.size();s++)
|
for (int s=0;s<(int)shapes.size();s++)
|
||||||
{
|
{
|
||||||
tinyobj::shape_t& shape = shapes[s];
|
tinyobj::shape_t& shape = shapes[s];
|
||||||
int faceCount = shape.mesh.indices.size();
|
int faceCount = shape.mesh.indices.size();
|
||||||
@@ -151,7 +151,7 @@ void ImportObjDemo::initPhysics(GraphicsPhysicsBridge& gfxBridge)
|
|||||||
|
|
||||||
btVector3 shift(0,0,0);
|
btVector3 shift(0,0,0);
|
||||||
btVector3 scaling(1,1,1);
|
btVector3 scaling(1,1,1);
|
||||||
int index=10;
|
// int index=10;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -172,7 +172,8 @@ void ImportObjDemo::initPhysics(GraphicsPhysicsBridge& gfxBridge)
|
|||||||
int shapeId = m_app->m_instancingRenderer->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices);
|
int shapeId = m_app->m_instancingRenderer->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices);
|
||||||
|
|
||||||
|
|
||||||
int id = m_app->m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
//int id =
|
||||||
|
m_app->m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void ImportSTLDemo::initPhysics(GraphicsPhysicsBridge& gfxBridge)
|
|||||||
|
|
||||||
btVector3 shift(0,0,0);
|
btVector3 shift(0,0,0);
|
||||||
btVector3 scaling(10,10,10);
|
btVector3 scaling(10,10,10);
|
||||||
int index=10;
|
// int index=10;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -161,7 +161,8 @@ void ImportSTLDemo::initPhysics(GraphicsPhysicsBridge& gfxBridge)
|
|||||||
int shapeId = m_app->m_instancingRenderer->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices);
|
int shapeId = m_app->m_instancingRenderer->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices);
|
||||||
|
|
||||||
|
|
||||||
int id = m_app->m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
// int id =
|
||||||
|
m_app->m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ bool Bullet2MultiBodyDemo::mouseMoveCallback(float x,float y)
|
|||||||
//keep it at the same picking distance
|
//keep it at the same picking distance
|
||||||
btVector3 newRayTo = getRayTo(x,y);
|
btVector3 newRayTo = getRayTo(x,y);
|
||||||
btVector3 rayFrom;
|
btVector3 rayFrom;
|
||||||
btVector3 oldPivotInB = pickCon->getPivotInB();
|
// btVector3 oldPivotInB = pickCon->getPivotInB();
|
||||||
btVector3 newPivotB;
|
btVector3 newPivotB;
|
||||||
m_glApp->m_instancingRenderer->getCameraPosition(rayFrom);
|
m_glApp->m_instancingRenderer->getCameraPosition(rayFrom);
|
||||||
btVector3 dir = newRayTo-rayFrom;
|
btVector3 dir = newRayTo-rayFrom;
|
||||||
@@ -186,7 +186,7 @@ bool Bullet2MultiBodyDemo::mouseMoveCallback(float x,float y)
|
|||||||
|
|
||||||
btVector3 newRayTo = getRayTo(x,y);
|
btVector3 newRayTo = getRayTo(x,y);
|
||||||
btVector3 rayFrom;
|
btVector3 rayFrom;
|
||||||
btVector3 oldPivotInB = m_pickingMultiBodyPoint2Point->getPivotInB();
|
// btVector3 oldPivotInB = m_pickingMultiBodyPoint2Point->getPivotInB();
|
||||||
btVector3 newPivotB;
|
btVector3 newPivotB;
|
||||||
btVector3 camPos;
|
btVector3 camPos;
|
||||||
m_glApp->m_instancingRenderer->getCameraPosition(camPos);
|
m_glApp->m_instancingRenderer->getCameraPosition(camPos);
|
||||||
@@ -438,7 +438,7 @@ btMultiBody* FeatherstoneDemo1::createFeatherstoneMultiBody(class btMultiBodyDyn
|
|||||||
btVector4 halfExtents(7.5,0.45,4.5,1);
|
btVector4 halfExtents(7.5,0.45,4.5,1);
|
||||||
{
|
{
|
||||||
|
|
||||||
float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
|
// float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
|
||||||
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
||||||
|
|
||||||
|
|
||||||
@@ -484,7 +484,7 @@ btMultiBody* FeatherstoneDemo1::createFeatherstoneMultiBody(class btMultiBodyDyn
|
|||||||
{
|
{
|
||||||
|
|
||||||
btVector3 posr = local_origin[i+1];
|
btVector3 posr = local_origin[i+1];
|
||||||
float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
//float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
||||||
|
|
||||||
float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()};
|
float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()};
|
||||||
|
|
||||||
@@ -531,8 +531,8 @@ void FeatherstoneDemo1::createGround()
|
|||||||
{
|
{
|
||||||
//create ground
|
//create ground
|
||||||
int cubeShapeId = m_glApp->registerCubeShape();
|
int cubeShapeId = m_glApp->registerCubeShape();
|
||||||
float pos[]={0,0,0};
|
//float pos[]={0,0,0};
|
||||||
float orn[]={0,0,0,1};
|
//float orn[]={0,0,0,1};
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -575,7 +575,8 @@ void FeatherstoneDemo1::initPhysics()
|
|||||||
settings.m_isFixedBase = false;
|
settings.m_isFixedBase = false;
|
||||||
settings.m_basePosition.setValue(0,10,0);
|
settings.m_basePosition.setValue(0,10,0);
|
||||||
settings.m_numLinks = 10;
|
settings.m_numLinks = 10;
|
||||||
btMultiBody* mb = createFeatherstoneMultiBody(m_dynamicsWorld,settings);
|
//btMultiBody* mb =
|
||||||
|
createFeatherstoneMultiBody(m_dynamicsWorld,settings);
|
||||||
|
|
||||||
|
|
||||||
m_glApp->m_instancingRenderer->writeTransforms();
|
m_glApp->m_instancingRenderer->writeTransforms();
|
||||||
@@ -727,7 +728,7 @@ class RagDoll2
|
|||||||
hull->buildHull(0.01);
|
hull->buildHull(0.01);
|
||||||
|
|
||||||
{
|
{
|
||||||
int strideInBytes = 9*sizeof(float);
|
// int strideInBytes = 9*sizeof(float);
|
||||||
int numVertices = hull->numVertices();
|
int numVertices = hull->numVertices();
|
||||||
int numIndices =hull->numIndices();
|
int numIndices =hull->numIndices();
|
||||||
|
|
||||||
@@ -988,7 +989,7 @@ public:
|
|||||||
|
|
||||||
virtual ~RagDoll2 ()
|
virtual ~RagDoll2 ()
|
||||||
{
|
{
|
||||||
int i;
|
//int i;
|
||||||
/*
|
/*
|
||||||
// Remove all constraints
|
// Remove all constraints
|
||||||
for ( i = 0; i < JOINT_COUNT; ++i)
|
for ( i = 0; i < JOINT_COUNT; ++i)
|
||||||
@@ -1027,8 +1028,8 @@ void FeatherstoneDemo2::initPhysics()
|
|||||||
settings.m_usePrismatic = true;
|
settings.m_usePrismatic = true;
|
||||||
btMultiBody* mb = createFeatherstoneMultiBody(m_dynamicsWorld,settings);
|
btMultiBody* mb = createFeatherstoneMultiBody(m_dynamicsWorld,settings);
|
||||||
*/
|
*/
|
||||||
btVector3 offset(0,2,0);
|
// btVector3 offset(0,2,0);
|
||||||
RagDoll2* doll = new RagDoll2(m_dynamicsWorld,offset,m_glApp);
|
//RagDoll2* doll = new RagDoll2(m_dynamicsWorld,offset,m_glApp);
|
||||||
|
|
||||||
|
|
||||||
m_glApp->m_instancingRenderer->writeTransforms();
|
m_glApp->m_instancingRenderer->writeTransforms();
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ void MultiDofDemo::addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBod
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
|
// float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
|
||||||
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
||||||
|
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ void MultiDofDemo::addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBod
|
|||||||
{
|
{
|
||||||
|
|
||||||
btVector3 posr = local_origin[i+1];
|
btVector3 posr = local_origin[i+1];
|
||||||
float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
// float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
||||||
|
|
||||||
float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()};
|
float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()};
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ void CrossSplitter::Layout( Skin::Base* /*skin*/ )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//This should probably use Fill docking instead
|
//This should probably use Fill docking instead
|
||||||
m_Sections[m_iZoomedSection]->SetBounds( 0, 0, Width(), Height() );
|
m_Sections[(int)m_iZoomedSection]->SetBounds( 0, 0, Width(), Height() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void Resizer::OnMouseMoved( int x, int y, int /*deltaX*/, int /*deltaY*/ )
|
|||||||
if ( !m_pTarget ) return;
|
if ( !m_pTarget ) return;
|
||||||
if ( !m_bDepressed ) return;
|
if ( !m_bDepressed ) return;
|
||||||
|
|
||||||
Gwen::Rect oldBounds = m_pTarget->GetBounds();
|
// Gwen::Rect oldBounds = m_pTarget->GetBounds();
|
||||||
Gwen::Rect pBounds = m_pTarget->GetBounds();
|
Gwen::Rect pBounds = m_pTarget->GetBounds();
|
||||||
|
|
||||||
Gwen::Point pntMin = m_pTarget->GetMinimumSize();
|
Gwen::Point pntMin = m_pTarget->GetMinimumSize();
|
||||||
|
|||||||
@@ -101,12 +101,12 @@ bool TreeControl::OnKeyUp( bool bDown )
|
|||||||
if (bDown)
|
if (bDown)
|
||||||
{
|
{
|
||||||
ForceUpdateScrollBars();
|
ForceUpdateScrollBars();
|
||||||
int maxIndex = 0;
|
// int maxIndex = 0;
|
||||||
int newIndex = 0;
|
int newIndex = 0;
|
||||||
int maxItem=0;
|
int maxItem=0;
|
||||||
int curItem=-1;
|
int curItem=-1;
|
||||||
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
||||||
maxIndex = maxItem;
|
// maxIndex = maxItem;
|
||||||
int targetItem = curItem;
|
int targetItem = curItem;
|
||||||
if (curItem>0)
|
if (curItem>0)
|
||||||
{
|
{
|
||||||
@@ -121,15 +121,15 @@ bool TreeControl::OnKeyUp( bool bDown )
|
|||||||
iterate(ITERATE_ACTION_DESELECT_INDEX,&maxItem,&deselectIndex);
|
iterate(ITERATE_ACTION_DESELECT_INDEX,&maxItem,&deselectIndex);
|
||||||
}
|
}
|
||||||
curItem = newIndex;
|
curItem = newIndex;
|
||||||
float amount = float(newIndex)/float(maxIndex);
|
// float amount = float(newIndex)/float(maxIndex);
|
||||||
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
||||||
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
||||||
|
|
||||||
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
||||||
float minCoordViewableWindow = curAmount*contSize;
|
// float minCoordViewableWindow = curAmount*contSize;
|
||||||
float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
//float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
||||||
float minCoordSelectedItem = curItem*16.f;
|
float minCoordSelectedItem = curItem*16.f;
|
||||||
float maxCoordSelectedItem = (curItem+1)*16.f;
|
// float maxCoordSelectedItem = (curItem+1)*16.f;
|
||||||
{
|
{
|
||||||
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
||||||
if (newAmount<curAmount)
|
if (newAmount<curAmount)
|
||||||
@@ -157,12 +157,12 @@ bool TreeControl::OnKeyDown( bool bDown )
|
|||||||
if (bDown)
|
if (bDown)
|
||||||
{
|
{
|
||||||
ForceUpdateScrollBars();
|
ForceUpdateScrollBars();
|
||||||
int maxIndex = 0;
|
// int maxIndex = 0;
|
||||||
int newIndex = 0;
|
int newIndex = 0;
|
||||||
int maxItem=0;
|
int maxItem=0;
|
||||||
int curItem=-1;
|
int curItem=-1;
|
||||||
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
||||||
maxIndex = maxItem;
|
// maxIndex = maxItem;
|
||||||
int targetItem = curItem;
|
int targetItem = curItem;
|
||||||
if (curItem>=0)
|
if (curItem>=0)
|
||||||
{
|
{
|
||||||
@@ -177,15 +177,15 @@ bool TreeControl::OnKeyDown( bool bDown )
|
|||||||
iterate(ITERATE_ACTION_DESELECT_INDEX,&maxItem,&deselectIndex);
|
iterate(ITERATE_ACTION_DESELECT_INDEX,&maxItem,&deselectIndex);
|
||||||
}
|
}
|
||||||
curItem= newIndex;
|
curItem= newIndex;
|
||||||
float amount = (int)float(newIndex)/float(maxIndex);
|
// float amount = (int)float(newIndex)/float(maxIndex);
|
||||||
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
||||||
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
||||||
|
|
||||||
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
||||||
float minCoordViewableWindow = curAmount*contSize;
|
// float minCoordViewableWindow = curAmount*contSize;
|
||||||
float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
//float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
||||||
float minCoordSelectedItem = curItem*16.f;
|
float minCoordSelectedItem = curItem*16.f;
|
||||||
float maxCoordSelectedItem = (curItem+1)*16.f;
|
//float maxCoordSelectedItem = (curItem+1)*16.f;
|
||||||
{
|
{
|
||||||
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
||||||
if (newAmount<curAmount)
|
if (newAmount<curAmount)
|
||||||
@@ -219,15 +219,15 @@ bool TreeControl::OnKeyRight( bool bDown )
|
|||||||
int maxItem=0;
|
int maxItem=0;
|
||||||
int curItem=0;
|
int curItem=0;
|
||||||
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItem,&curItem);
|
||||||
float amount = float(curItem)/float(maxItem);
|
// float amount = float(curItem)/float(maxItem);
|
||||||
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
||||||
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
||||||
|
|
||||||
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
||||||
float minCoordViewableWindow = curAmount*contSize;
|
// float minCoordViewableWindow = curAmount*contSize;
|
||||||
float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
// float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
||||||
float minCoordSelectedItem = curItem*16.f;
|
float minCoordSelectedItem = curItem*16.f;
|
||||||
float maxCoordSelectedItem = (curItem+1)*16.f;
|
// float maxCoordSelectedItem = (curItem+1)*16.f;
|
||||||
{
|
{
|
||||||
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
||||||
if (newAmount<curAmount)
|
if (newAmount<curAmount)
|
||||||
@@ -262,17 +262,17 @@ bool TreeControl::OnKeyLeft( bool bDown )
|
|||||||
int maxItems=0;
|
int maxItems=0;
|
||||||
int curItem=0;
|
int curItem=0;
|
||||||
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItems,&curItem);
|
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX,&maxItems,&curItem);
|
||||||
float amount = float(curItem)/float(maxItems);
|
// float amount = float(curItem)/float(maxItems);
|
||||||
|
|
||||||
// m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(amount,true);
|
// m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(amount,true);
|
||||||
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
|
||||||
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
|
||||||
|
|
||||||
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
|
||||||
float minCoordViewableWindow = curAmount*contSize;
|
// float minCoordViewableWindow = curAmount*contSize;
|
||||||
float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
// float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
|
||||||
float minCoordSelectedItem = curItem*16.f;
|
float minCoordSelectedItem = curItem*16.f;
|
||||||
float maxCoordSelectedItem = (curItem+1)*16.f;
|
// float maxCoordSelectedItem = (curItem+1)*16.f;
|
||||||
|
|
||||||
{
|
{
|
||||||
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
float newAmount = float(minCoordSelectedItem)/(contSize-viewSize);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void TreeNode::Render( Skin::Base* skin )
|
|||||||
|
|
||||||
TreeNode* TreeNode::AddNode( const UnicodeString& strLabel )
|
TreeNode* TreeNode::AddNode( const UnicodeString& strLabel )
|
||||||
{
|
{
|
||||||
int sz = sizeof(TreeNode);
|
// int sz = sizeof(TreeNode);
|
||||||
TreeNode* node = new TreeNode( this );
|
TreeNode* node = new TreeNode( this );
|
||||||
node->SetText( strLabel );
|
node->SetText( strLabel );
|
||||||
node->Dock( Pos::Top );
|
node->Dock( Pos::Top );
|
||||||
@@ -231,7 +231,7 @@ void TreeNode::iterate(int action, int* curIndex, int* targetIndex)
|
|||||||
|
|
||||||
Gwen::String name = Gwen::Utility::UnicodeToString(m_Title->GetText());
|
Gwen::String name = Gwen::Utility::UnicodeToString(m_Title->GetText());
|
||||||
|
|
||||||
int actualIndex = curIndex? *curIndex : -1;
|
// int actualIndex = curIndex? *curIndex : -1;
|
||||||
//printf("iterated over item %d with name = %s\n", actualIndex, name.c_str());
|
//printf("iterated over item %d with name = %s\n", actualIndex, name.c_str());
|
||||||
|
|
||||||
if (action==ITERATE_ACTION_SELECT)
|
if (action==ITERATE_ACTION_SELECT)
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ namespace Gwen
|
|||||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
GLenum format = GL_RGB;
|
//GLenum format = GL_RGB;
|
||||||
unsigned char* texdata = new unsigned char[256*256*4];
|
unsigned char* texdata = new unsigned char[256*256*4];
|
||||||
for (int i=0;i<256*256;i++)
|
for (int i=0;i<256*256;i++)
|
||||||
{
|
{
|
||||||
@@ -316,11 +316,11 @@ namespace Gwen
|
|||||||
Gwen::String converted_string = Gwen::Utility::UnicodeToString( text );
|
Gwen::String converted_string = Gwen::Utility::UnicodeToString( text );
|
||||||
|
|
||||||
float yOffset=0.0f;
|
float yOffset=0.0f;
|
||||||
for ( int i=0; i<text.length(); i++ )
|
for ( int i=0; i<(int)text.length(); i++ )
|
||||||
{
|
{
|
||||||
wchar_t chr = text[i];
|
// wchar_t chr = text[i];
|
||||||
char ch = converted_string[i];
|
char ch = converted_string[i];
|
||||||
float curSpacing = sGwenDebugFontSpacing[ch] * m_fLetterSpacing * fSize * m_fFontScale[0];
|
float curSpacing = sGwenDebugFontSpacing[(int)ch] * m_fLetterSpacing * fSize * m_fFontScale[0];
|
||||||
Gwen::Rect r( pos.x + yOffset, pos.y-fSize*0.2f, (fSize * m_fFontScale[0]), fSize * m_fFontScale[1] );
|
Gwen::Rect r( pos.x + yOffset, pos.y-fSize*0.2f, (fSize * m_fFontScale[0]), fSize * m_fFontScale[1] );
|
||||||
|
|
||||||
if ( m_pFontTexture )
|
if ( m_pFontTexture )
|
||||||
@@ -390,10 +390,10 @@ namespace Gwen
|
|||||||
Gwen::String converted_string = Gwen::Utility::UnicodeToString( text );
|
Gwen::String converted_string = Gwen::Utility::UnicodeToString( text );
|
||||||
float spacing = 0.0f;
|
float spacing = 0.0f;
|
||||||
|
|
||||||
for ( int i=0; i<text.length(); i++ )
|
for ( int i=0; i<(int)text.length(); i++ )
|
||||||
{
|
{
|
||||||
char ch = converted_string[i];
|
char ch = converted_string[i];
|
||||||
spacing += sGwenDebugFontSpacing[ch];
|
spacing += sGwenDebugFontSpacing[(int)ch];
|
||||||
}
|
}
|
||||||
|
|
||||||
p.x = spacing*m_fLetterSpacing*fSize * m_fFontScale[0];
|
p.x = spacing*m_fLetterSpacing*fSize * m_fFontScale[0];
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Gwen
|
|||||||
m_Render->DrawLinedRect( control->GetRenderBounds() );
|
m_Render->DrawLinedRect( control->GetRenderBounds() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Gwen::Rect rect = control->GetRenderBounds();
|
// Gwen::Rect rect = control->GetRenderBounds();
|
||||||
if ( bChecked )
|
if ( bChecked )
|
||||||
{
|
{
|
||||||
m_Render->SetDrawColor( Color( 0, 0, 0, 255) );
|
m_Render->SetDrawColor( Color( 0, 0, 0, 255) );
|
||||||
@@ -490,7 +490,7 @@ namespace Gwen
|
|||||||
virtual void DrawSlider( Gwen::Controls::Base* control, bool bIsHorizontal, int numNotches, int barSize)
|
virtual void DrawSlider( Gwen::Controls::Base* control, bool bIsHorizontal, int numNotches, int barSize)
|
||||||
{
|
{
|
||||||
Gwen::Rect rect = control->GetRenderBounds();
|
Gwen::Rect rect = control->GetRenderBounds();
|
||||||
Gwen::Rect notchRect = rect;
|
// Gwen::Rect notchRect = rect;
|
||||||
|
|
||||||
if ( bIsHorizontal )
|
if ( bIsHorizontal )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ int sth_add_font(struct sth_stash* stash, const char* path)
|
|||||||
FILE* fp = 0;
|
FILE* fp = 0;
|
||||||
int datasize;
|
int datasize;
|
||||||
unsigned char* data = NULL;
|
unsigned char* data = NULL;
|
||||||
int idx;
|
int idx=0;
|
||||||
|
|
||||||
// Read in the font data.
|
// Read in the font data.
|
||||||
fp = fopen(path, "rb");
|
fp = fopen(path, "rb");
|
||||||
@@ -231,10 +231,14 @@ int sth_add_font(struct sth_stash* stash, const char* path)
|
|||||||
if (data == NULL) goto error;
|
if (data == NULL) goto error;
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
bytesRead = fread(data, 1, datasize, fp);
|
bytesRead = fread(data, 1, datasize, fp);
|
||||||
|
if (bytesRead)
|
||||||
|
{
|
||||||
|
idx = sth_add_font_from_memory(stash, data);
|
||||||
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = 0;
|
fp = 0;
|
||||||
|
|
||||||
idx = sth_add_font_from_memory(stash, data);
|
|
||||||
// Modify type of the loaded font.
|
// Modify type of the loaded font.
|
||||||
if (idx)
|
if (idx)
|
||||||
stash->fonts->type = TTFONT_FILE;
|
stash->fonts->type = TTFONT_FILE;
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ InternalOpenGL2RenderCallbacks::~InternalOpenGL2RenderCallbacks()
|
|||||||
void InternalOpenGL2RenderCallbacks::display2()
|
void InternalOpenGL2RenderCallbacks::display2()
|
||||||
{
|
{
|
||||||
|
|
||||||
GLint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
// glViewport(0,0,10,10);
|
// glViewport(0,0,10,10);
|
||||||
|
|
||||||
//const float timeScale = 0.008f;
|
//const float timeScale = 0.008f;
|
||||||
@@ -48,39 +47,31 @@ void InternalOpenGL2RenderCallbacks::display2()
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
||||||
glBindVertexArray(s_vertexArrayObject);
|
glBindVertexArray(s_vertexArrayObject);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
// glBindTexture(GL_TEXTURE_2D,m_texturehandle);
|
// glBindTexture(GL_TEXTURE_2D,m_texturehandle);
|
||||||
|
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
vec2 p( 0.f,0.f);//?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
|
vec2 p( 0.f,0.f);//?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
|
||||||
glUniform2fv(data->m_positionUniform, 1, (const GLfloat *)&p);
|
glUniform2fv(data->m_positionUniform, 1, (const GLfloat *)&p);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(data->m_positionAttribute);
|
glEnableVertexAttribArray(data->m_positionAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(data->m_colourAttribute);
|
glEnableVertexAttribArray(data->m_colourAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(data->m_textureAttribute);
|
glEnableVertexAttribArray(data->m_textureAttribute);
|
||||||
|
|
||||||
glVertexAttribPointer(data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
glVertexAttribPointer(data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
||||||
glVertexAttribPointer(data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
glVertexAttribPointer(data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
||||||
glVertexAttribPointer(data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
glVertexAttribPointer(data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
|
||||||
@@ -101,10 +92,7 @@ void InternalOpenGL2RenderCallbacks::display2()
|
|||||||
|
|
||||||
void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_glyph* glyph, int textureWidth, int textureHeight)
|
void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_glyph* glyph, int textureWidth, int textureHeight)
|
||||||
{
|
{
|
||||||
GLint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
if (glyph)
|
if (glyph)
|
||||||
@@ -114,13 +102,11 @@ void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_gly
|
|||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, *gltexture);
|
glBindTexture(GL_TEXTURE_2D, *gltexture);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0, GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0, GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
|
||||||
|
|
||||||
GLenum err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -132,8 +118,7 @@ void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_gly
|
|||||||
|
|
||||||
//create new texture
|
//create new texture
|
||||||
glGenTextures(1, texId);
|
glGenTextures(1, texId);
|
||||||
GLenum err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -143,8 +128,7 @@ void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_gly
|
|||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0, GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0, GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//create the other data
|
//create the other data
|
||||||
@@ -155,8 +139,7 @@ void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_gly
|
|||||||
glGenBuffers(1, &s_vertexBuffer);
|
glGenBuffers(1, &s_vertexBuffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, VERT_COUNT * sizeof(Vertex), texture->newverts, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, VERT_COUNT * sizeof(Vertex), texture->newverts, GL_DYNAMIC_DRAW);
|
||||||
GLuint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
for (int i=0;i<INDEX_COUNT;i++)
|
for (int i=0;i<INDEX_COUNT;i++)
|
||||||
{
|
{
|
||||||
@@ -167,8 +150,7 @@ void InternalOpenGL2RenderCallbacks::updateTexture(sth_texture* texture, sth_gly
|
|||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,INDEX_COUNT*sizeof(int), s_indexData,GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER,INDEX_COUNT*sizeof(int), s_indexData,GL_STATIC_DRAW);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -196,13 +178,10 @@ void InternalOpenGL2RenderCallbacks::render(sth_texture* texture)
|
|||||||
|
|
||||||
GLuint* texId = (GLuint*) texture->m_userData;
|
GLuint* texId = (GLuint*) texture->m_userData;
|
||||||
|
|
||||||
GLint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, *texId);
|
glBindTexture(GL_TEXTURE_2D, *texId);
|
||||||
bool useFiltering = false;
|
bool useFiltering = false;
|
||||||
@@ -215,25 +194,21 @@ void InternalOpenGL2RenderCallbacks::render(sth_texture* texture)
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
}
|
}
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
|
||||||
glBindVertexArray(s_vertexArrayObject);
|
glBindVertexArray(s_vertexArrayObject);
|
||||||
glBufferData(GL_ARRAY_BUFFER, texture->nverts * sizeof(Vertex), &texture->newverts[0].position.p[0], GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, texture->nverts * sizeof(Vertex), &texture->newverts[0].position.p[0], GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
|
||||||
|
|
||||||
//glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
//glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
int indexCount = texture->nverts;
|
int indexCount = texture->nverts;
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
|
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
|
|||||||
@@ -131,9 +131,8 @@ void GLPrimitiveRenderer::loadBufferData()
|
|||||||
glGenBuffers(1, &m_data->m_vertexBuffer);
|
glGenBuffers(1, &m_data->m_vertexBuffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vertexBuffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(Vertex), vertexData, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(Vertex), vertexData, GL_DYNAMIC_DRAW);
|
||||||
GLuint err;
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -143,16 +142,14 @@ void GLPrimitiveRenderer::loadBufferData()
|
|||||||
|
|
||||||
glEnableVertexAttribArray(m_data->m_positionAttribute);
|
glEnableVertexAttribArray(m_data->m_positionAttribute);
|
||||||
glEnableVertexAttribArray(m_data->m_colourAttribute);
|
glEnableVertexAttribArray(m_data->m_colourAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_data->m_textureAttribute);
|
glEnableVertexAttribArray(m_data->m_textureAttribute);
|
||||||
|
|
||||||
glVertexAttribPointer(m_data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
glVertexAttribPointer(m_data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
||||||
glVertexAttribPointer(m_data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
glVertexAttribPointer(m_data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
||||||
glVertexAttribPointer(m_data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
glVertexAttribPointer(m_data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -192,8 +189,7 @@ void GLPrimitiveRenderer::loadBufferData()
|
|||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256,256,0,GL_RGB,GL_UNSIGNED_BYTE,image);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256,256,0,GL_RGB,GL_UNSIGNED_BYTE,image);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
delete[] image;
|
delete[] image;
|
||||||
|
|
||||||
@@ -218,36 +214,25 @@ void GLPrimitiveRenderer::drawLine()
|
|||||||
|
|
||||||
void GLPrimitiveRenderer::drawRect(float x0, float y0, float x1, float y1, float color[4])
|
void GLPrimitiveRenderer::drawRect(float x0, float y0, float x1, float y1, float color[4])
|
||||||
{
|
{
|
||||||
GLint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D,m_data->m_texturehandle);
|
glBindTexture(GL_TEXTURE_2D,m_data->m_texturehandle);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
drawTexturedRect(x0,y0,x1,y1,color,0,0,1,1);
|
drawTexturedRect(x0,y0,x1,y1,color,0,0,1,1);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLPrimitiveRenderer::drawTexturedRect(float x0, float y0, float x1, float y1, float color[4], float u0,float v0, float u1, float v1, int useRGBA)
|
void GLPrimitiveRenderer::drawTexturedRect(float x0, float y0, float x1, float y1, float color[4], float u0,float v0, float u1, float v1, int useRGBA)
|
||||||
{
|
{
|
||||||
GLint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(m_data->m_shaderProg);
|
glUseProgram(m_data->m_shaderProg);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vertexBuffer);
|
||||||
glBindVertexArray(m_data->m_vertexArrayObject);
|
glBindVertexArray(m_data->m_vertexArrayObject);
|
||||||
@@ -277,8 +262,7 @@ void GLPrimitiveRenderer::drawTexturedRect(float x0, float y0, float x1, float y
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
vec2 p( 0.f,0.f);//?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
|
vec2 p( 0.f,0.f);//?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
|
||||||
if (useRGBA)
|
if (useRGBA)
|
||||||
@@ -291,60 +275,47 @@ void GLPrimitiveRenderer::drawTexturedRect(float x0, float y0, float x1, float y
|
|||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_data->m_positionAttribute);
|
glEnableVertexAttribArray(m_data->m_positionAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_data->m_colourAttribute);
|
glEnableVertexAttribArray(m_data->m_colourAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_data->m_textureAttribute);
|
glEnableVertexAttribArray(m_data->m_textureAttribute);
|
||||||
|
|
||||||
glVertexAttribPointer(m_data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
glVertexAttribPointer(m_data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)0);
|
||||||
glVertexAttribPointer(m_data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
glVertexAttribPointer(m_data->m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
|
||||||
glVertexAttribPointer(m_data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
glVertexAttribPointer(m_data->m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_data->m_indexBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_data->m_indexBuffer);
|
||||||
|
|
||||||
//glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
//glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
int indexCount = 6;
|
int indexCount = 6;
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
|
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
//glDisableVertexAttribArray(m_data->m_textureAttribute);
|
//glDisableVertexAttribArray(m_data->m_textureAttribute);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,55 +119,37 @@ public:
|
|||||||
{
|
{
|
||||||
m_yOffset=0;
|
m_yOffset=0;
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
GLint err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
//glColor4ub(255,0,0,255);
|
//glColor4ub(255,0,0,255);
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
// saveOpenGLState(width,height);//m_glutScreenWidth,m_glutScreenHeight);
|
// saveOpenGLState(width,height);//m_glutScreenWidth,m_glutScreenHeight);
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void End()
|
virtual void End()
|
||||||
{
|
{
|
||||||
@@ -375,10 +357,7 @@ public:
|
|||||||
glBindTexture(GL_TEXTURE_2D,texHandle);
|
glBindTexture(GL_TEXTURE_2D,texHandle);
|
||||||
// glDisable(GL_DEPTH_TEST);
|
// glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
GLint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
/* bool useFiltering = true;
|
/* bool useFiltering = true;
|
||||||
@@ -406,8 +385,8 @@ public:
|
|||||||
m_primitiveRenderer->drawTexturedRect(rect.x, rect.y+m_yOffset, rect.x+rect.w, rect.y+rect.h+m_yOffset, color,0+add,0,1+add,1,true);
|
m_primitiveRenderer->drawTexturedRect(rect.x, rect.y+m_yOffset, rect.x+rect.w, rect.y+rect.h+m_yOffset, color,0+add,0,1+add,1,true);
|
||||||
|
|
||||||
|
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ void gltLoadShaderSrc(const char *szShaderSrc, GLuint shader)
|
|||||||
GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg)
|
GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg)
|
||||||
{
|
{
|
||||||
|
|
||||||
GLuint err;
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
err = glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
// Temporary Shader objects
|
// Temporary Shader objects
|
||||||
GLuint hVertexShader;
|
GLuint hVertexShader;
|
||||||
@@ -37,7 +35,7 @@ GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg)
|
|||||||
|
|
||||||
// Compile them
|
// Compile them
|
||||||
glCompileShader(hVertexShader);
|
glCompileShader(hVertexShader);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
glGetShaderiv(hVertexShader, GL_COMPILE_STATUS, &testVal);
|
glGetShaderiv(hVertexShader, GL_COMPILE_STATUS, &testVal);
|
||||||
if(testVal == GL_FALSE)
|
if(testVal == GL_FALSE)
|
||||||
@@ -52,10 +50,10 @@ GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg)
|
|||||||
return (GLuint)NULL;
|
return (GLuint)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(err==GL_NO_ERROR);
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
glCompileShader(hFragmentShader);
|
glCompileShader(hFragmentShader);
|
||||||
err = glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
glGetShaderiv(hFragmentShader, GL_COMPILE_STATUS, &testVal);
|
glGetShaderiv(hFragmentShader, GL_COMPILE_STATUS, &testVal);
|
||||||
if(testVal == GL_FALSE)
|
if(testVal == GL_FALSE)
|
||||||
@@ -70,7 +68,7 @@ GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg)
|
|||||||
return (GLuint)NULL;
|
return (GLuint)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(err==GL_NO_ERROR);
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
|
|
||||||
|
|||||||
@@ -430,19 +430,17 @@ static void writeTextureToFile(int textureWidth, int textureHeight, const char*
|
|||||||
{
|
{
|
||||||
int numComponents = 4;
|
int numComponents = 4;
|
||||||
//glPixelStorei(GL_PACK_ALIGNMENT,1);
|
//glPixelStorei(GL_PACK_ALIGNMENT,1);
|
||||||
GLuint err=glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
b3Assert(glGetError()==GL_NO_ERROR);
|
||||||
//glReadBuffer(GL_BACK);//COLOR_ATTACHMENT0);
|
//glReadBuffer(GL_BACK);//COLOR_ATTACHMENT0);
|
||||||
err=glGetError();
|
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
float* orgPixels = (float*)malloc(textureWidth*textureHeight*numComponents*4);
|
float* orgPixels = (float*)malloc(textureWidth*textureHeight*numComponents*4);
|
||||||
glReadPixels(0,0,textureWidth, textureHeight, GL_RGBA, GL_FLOAT, orgPixels);
|
glReadPixels(0,0,textureWidth, textureHeight, GL_RGBA, GL_FLOAT, orgPixels);
|
||||||
//it is useful to have the actual float values for debugging purposes
|
//it is useful to have the actual float values for debugging purposes
|
||||||
|
|
||||||
//convert float->char
|
//convert float->char
|
||||||
char* pixels = (char*)malloc(textureWidth*textureHeight*numComponents);
|
char* pixels = (char*)malloc(textureWidth*textureHeight*numComponents);
|
||||||
err=glGetError();
|
assert(glGetError()==GL_NO_ERROR);
|
||||||
assert(err==GL_NO_ERROR);
|
|
||||||
|
|
||||||
for (int j=0;j<textureHeight;j++)
|
for (int j=0;j<textureHeight;j++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -381,8 +381,8 @@ void btKinematicCharacterController::stepForwardAndStrafe ( btCollisionWorld* co
|
|||||||
if (callback.hasHit())
|
if (callback.hasHit())
|
||||||
{
|
{
|
||||||
// we moved only a fraction
|
// we moved only a fraction
|
||||||
btScalar hitDistance;
|
//btScalar hitDistance;
|
||||||
hitDistance = (callback.m_hitPointWorld - m_currentPosition).length();
|
//hitDistance = (callback.m_hitPointWorld - m_currentPosition).length();
|
||||||
|
|
||||||
// m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
|
// m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
|
||||||
|
|
||||||
|
|||||||
@@ -540,8 +540,8 @@ void btConeTwistConstraint::calcAngleInfo()
|
|||||||
m_solveTwistLimit = false;
|
m_solveTwistLimit = false;
|
||||||
m_solveSwingLimit = false;
|
m_solveSwingLimit = false;
|
||||||
|
|
||||||
btVector3 b1Axis1,b1Axis2,b1Axis3;
|
btVector3 b1Axis1(0,0,0),b1Axis2(0,0,0),b1Axis3(0,0,0);
|
||||||
btVector3 b2Axis1,b2Axis2;
|
btVector3 b2Axis1(0,0,0),b2Axis2(0,0,0);
|
||||||
|
|
||||||
b1Axis1 = getRigidBodyA().getCenterOfMassTransform().getBasis() * this->m_rbAFrame.getBasis().getColumn(0);
|
b1Axis1 = getRigidBodyA().getCenterOfMassTransform().getBasis() * this->m_rbAFrame.getBasis().getColumn(0);
|
||||||
b2Axis1 = getRigidBodyB().getCenterOfMassTransform().getBasis() * this->m_rbBFrame.getBasis().getColumn(0);
|
b2Axis1 = getRigidBodyB().getCenterOfMassTransform().getBasis() * this->m_rbBFrame.getBasis().getColumn(0);
|
||||||
@@ -983,8 +983,8 @@ void btConeTwistConstraint::adjustSwingAxisToUseEllipseNormal(btVector3& vSwingA
|
|||||||
|
|
||||||
void btConeTwistConstraint::setMotorTarget(const btQuaternion &q)
|
void btConeTwistConstraint::setMotorTarget(const btQuaternion &q)
|
||||||
{
|
{
|
||||||
btTransform trACur = m_rbA.getCenterOfMassTransform();
|
//btTransform trACur = m_rbA.getCenterOfMassTransform();
|
||||||
btTransform trBCur = m_rbB.getCenterOfMassTransform();
|
//btTransform trBCur = m_rbB.getCenterOfMassTransform();
|
||||||
// btTransform trABCur = trBCur.inverse() * trACur;
|
// btTransform trABCur = trBCur.inverse() * trACur;
|
||||||
// btQuaternion qABCur = trABCur.getRotation();
|
// btQuaternion qABCur = trABCur.getRotation();
|
||||||
// btTransform trConstraintCur = (trBCur * m_rbBFrame).inverse() * (trACur * m_rbAFrame);
|
// btTransform trConstraintCur = (trBCur * m_rbBFrame).inverse() * (trACur * m_rbAFrame);
|
||||||
|
|||||||
@@ -155,8 +155,7 @@ void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1,
|
|||||||
body1.getCenterOfMassTransform().getBasis().transpose() * body1.getAngularVelocity(),
|
body1.getCenterOfMassTransform().getBasis().transpose() * body1.getAngularVelocity(),
|
||||||
body2.getLinearVelocity(),
|
body2.getLinearVelocity(),
|
||||||
body2.getCenterOfMassTransform().getBasis().transpose() * body2.getAngularVelocity());
|
body2.getCenterOfMassTransform().getBasis().transpose() * body2.getAngularVelocity());
|
||||||
btScalar a;
|
|
||||||
a=jacDiagABInv;
|
|
||||||
|
|
||||||
|
|
||||||
rel_vel = normal.dot(vel);
|
rel_vel = normal.dot(vel);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void btFixedConstraint::getInfo2 (btConstraintInfo2* info)
|
|||||||
btVector3 kvA = transA.getBasis() * m_frameInA.getBasis().getColumn(2);
|
btVector3 kvA = transA.getBasis() * m_frameInA.getBasis().getColumn(2);
|
||||||
btVector3 ivB = transB.getBasis() * m_frameInB.getBasis().getColumn(0);
|
btVector3 ivB = transB.getBasis() * m_frameInB.getBasis().getColumn(0);
|
||||||
btVector3 target;
|
btVector3 target;
|
||||||
btScalar x = ivB.dot(ivA);
|
//btScalar x = ivB.dot(ivA);//??
|
||||||
btScalar y = ivB.dot(jvA);
|
btScalar y = ivB.dot(jvA);
|
||||||
btScalar z = ivB.dot(kvA);
|
btScalar z = ivB.dot(kvA);
|
||||||
btVector3 swingAxis(0,0,0);
|
btVector3 swingAxis(0,0,0);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ btGeneric6DofSpring2Constraint::btGeneric6DofSpring2Constraint(btRigidBody& rbA,
|
|||||||
: btTypedConstraint(D6_SPRING_2_CONSTRAINT_TYPE, rbA, rbB)
|
: btTypedConstraint(D6_SPRING_2_CONSTRAINT_TYPE, rbA, rbB)
|
||||||
, m_frameInA(frameInA)
|
, m_frameInA(frameInA)
|
||||||
, m_frameInB(frameInB)
|
, m_frameInB(frameInB)
|
||||||
, m_flags(0)
|
|
||||||
, m_rotateOrder(rotOrder)
|
, m_rotateOrder(rotOrder)
|
||||||
|
, m_flags(0)
|
||||||
{
|
{
|
||||||
calculateTransforms();
|
calculateTransforms();
|
||||||
}
|
}
|
||||||
@@ -60,8 +60,8 @@ btGeneric6DofSpring2Constraint::btGeneric6DofSpring2Constraint(btRigidBody& rbA,
|
|||||||
btGeneric6DofSpring2Constraint::btGeneric6DofSpring2Constraint(btRigidBody& rbB, const btTransform& frameInB, RotateOrder rotOrder)
|
btGeneric6DofSpring2Constraint::btGeneric6DofSpring2Constraint(btRigidBody& rbB, const btTransform& frameInB, RotateOrder rotOrder)
|
||||||
: btTypedConstraint(D6_SPRING_2_CONSTRAINT_TYPE, getFixedBody(), rbB)
|
: btTypedConstraint(D6_SPRING_2_CONSTRAINT_TYPE, getFixedBody(), rbB)
|
||||||
, m_frameInB(frameInB)
|
, m_frameInB(frameInB)
|
||||||
, m_flags(0)
|
|
||||||
, m_rotateOrder(rotOrder)
|
, m_rotateOrder(rotOrder)
|
||||||
|
, m_flags(0)
|
||||||
{
|
{
|
||||||
///not providing rigidbody A means implicitly using worldspace for body A
|
///not providing rigidbody A means implicitly using worldspace for body A
|
||||||
m_frameInA = rbB.getCenterOfMassTransform() * m_frameInB;
|
m_frameInA = rbB.getCenterOfMassTransform() * m_frameInB;
|
||||||
@@ -776,7 +776,7 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2(
|
|||||||
btScalar kd = limot->m_springDamping;
|
btScalar kd = limot->m_springDamping;
|
||||||
btScalar ks = limot->m_springStiffness;
|
btScalar ks = limot->m_springStiffness;
|
||||||
btScalar vel = rotational ? angVelA.dot(ax1) - angVelB.dot(ax1) : linVelA.dot(ax1) - linVelB.dot(ax1);
|
btScalar vel = rotational ? angVelA.dot(ax1) - angVelB.dot(ax1) : linVelA.dot(ax1) - linVelB.dot(ax1);
|
||||||
btScalar erp = 0.1;
|
// btScalar erp = 0.1;
|
||||||
btScalar cfm = 0.0;
|
btScalar cfm = 0.0;
|
||||||
btScalar mA = 1.0 / m_rbA.getInvMass();
|
btScalar mA = 1.0 / m_rbA.getInvMass();
|
||||||
btScalar mB = 1.0 / m_rbB.getInvMass();
|
btScalar mB = 1.0 / m_rbB.getInvMass();
|
||||||
|
|||||||
@@ -217,6 +217,14 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasLimit() const {
|
||||||
|
#ifdef _BT_USE_CENTER_LIMIT_
|
||||||
|
return m_limit.getHalfRange() > 0;
|
||||||
|
#else
|
||||||
|
return m_lowerLimit <= m_upperLimit;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
btScalar getLowerLimit() const
|
btScalar getLowerLimit() const
|
||||||
{
|
{
|
||||||
#ifdef _BT_USE_CENTER_LIMIT_
|
#ifdef _BT_USE_CENTER_LIMIT_
|
||||||
|
|||||||
@@ -364,9 +364,9 @@ void btSequentialImpulseConstraintSolver::resolveSplitPenetrationImpulseCacheFri
|
|||||||
|
|
||||||
|
|
||||||
btSequentialImpulseConstraintSolver::btSequentialImpulseConstraintSolver()
|
btSequentialImpulseConstraintSolver::btSequentialImpulseConstraintSolver()
|
||||||
:m_btSeed2(0),
|
: m_resolveSingleConstraintRowGeneric(gResolveSingleConstraintRowGeneric_scalar_reference),
|
||||||
m_resolveSingleConstraintRowGeneric(gResolveSingleConstraintRowGeneric_scalar_reference),
|
m_resolveSingleConstraintRowLowerLimit(gResolveSingleConstraintRowLowerLimit_scalar_reference),
|
||||||
m_resolveSingleConstraintRowLowerLimit(gResolveSingleConstraintRowLowerLimit_scalar_reference)
|
m_btSeed2(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef USE_SIMD
|
#ifdef USE_SIMD
|
||||||
@@ -761,8 +761,8 @@ void btSequentialImpulseConstraintSolver::setupContactConstraint(btSolverConstra
|
|||||||
const btVector3& rel_pos1, const btVector3& rel_pos2)
|
const btVector3& rel_pos1, const btVector3& rel_pos2)
|
||||||
{
|
{
|
||||||
|
|
||||||
const btVector3& pos1 = cp.getPositionWorldOnA();
|
// const btVector3& pos1 = cp.getPositionWorldOnA();
|
||||||
const btVector3& pos2 = cp.getPositionWorldOnB();
|
// const btVector3& pos2 = cp.getPositionWorldOnB();
|
||||||
|
|
||||||
btSolverBody* bodyA = &m_tmpSolverBodyPool[solverBodyIdA];
|
btSolverBody* bodyA = &m_tmpSolverBodyPool[solverBodyIdA];
|
||||||
btSolverBody* bodyB = &m_tmpSolverBodyPool[solverBodyIdB];
|
btSolverBody* bodyB = &m_tmpSolverBodyPool[solverBodyIdB];
|
||||||
|
|||||||
@@ -206,10 +206,10 @@ m_solverIslandCallback ( NULL ),
|
|||||||
m_constraintSolver(constraintSolver),
|
m_constraintSolver(constraintSolver),
|
||||||
m_gravity(0,-10,0),
|
m_gravity(0,-10,0),
|
||||||
m_localTime(0),
|
m_localTime(0),
|
||||||
|
m_fixedTimeStep(0),
|
||||||
m_synchronizeAllMotionStates(false),
|
m_synchronizeAllMotionStates(false),
|
||||||
m_applySpeculativeContactRestitution(false),
|
m_applySpeculativeContactRestitution(false),
|
||||||
m_profileTimings(0),
|
m_profileTimings(0),
|
||||||
m_fixedTimeStep(0),
|
|
||||||
m_latencyMotionStateInterpolation(true)
|
m_latencyMotionStateInterpolation(true)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1196,7 +1196,7 @@ void btDiscreteDynamicsWorld::debugDrawConstraint(btTypedConstraint* constraint)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bool drawSect = true;
|
bool drawSect = true;
|
||||||
if(minAng > maxAng)
|
if(!pHinge->hasLimit())
|
||||||
{
|
{
|
||||||
minAng = btScalar(0.f);
|
minAng = btScalar(0.f);
|
||||||
maxAng = SIMD_2_PI;
|
maxAng = SIMD_2_PI;
|
||||||
|
|||||||
@@ -87,7 +87,10 @@ btMultiBody::btMultiBody(int n_links,
|
|||||||
bool fixedBase,
|
bool fixedBase,
|
||||||
bool canSleep,
|
bool canSleep,
|
||||||
bool multiDof)
|
bool multiDof)
|
||||||
: m_baseQuat(0, 0, 0, 1),
|
:
|
||||||
|
m_baseCollider(0),
|
||||||
|
m_basePos(0,0,0),
|
||||||
|
m_baseQuat(0, 0, 0, 1),
|
||||||
m_baseMass(mass),
|
m_baseMass(mass),
|
||||||
m_baseInertia(inertia),
|
m_baseInertia(inertia),
|
||||||
|
|
||||||
@@ -95,18 +98,19 @@ btMultiBody::btMultiBody(int n_links,
|
|||||||
m_awake(true),
|
m_awake(true),
|
||||||
m_canSleep(canSleep),
|
m_canSleep(canSleep),
|
||||||
m_sleepTimer(0),
|
m_sleepTimer(0),
|
||||||
m_baseCollider(0),
|
|
||||||
m_linearDamping(0.04f),
|
m_linearDamping(0.04f),
|
||||||
m_angularDamping(0.04f),
|
m_angularDamping(0.04f),
|
||||||
m_useGyroTerm(true),
|
m_useGyroTerm(true),
|
||||||
m_maxAppliedImpulse(1000.f),
|
m_maxAppliedImpulse(1000.f),
|
||||||
m_maxCoordinateVelocity(100.f),
|
m_maxCoordinateVelocity(100.f),
|
||||||
m_hasSelfCollision(true),
|
m_hasSelfCollision(true),
|
||||||
m_dofCount(0),
|
|
||||||
__posUpdated(false),
|
|
||||||
m_isMultiDof(multiDof),
|
m_isMultiDof(multiDof),
|
||||||
|
__posUpdated(false),
|
||||||
|
m_dofCount(0),
|
||||||
m_posVarCnt(0),
|
m_posVarCnt(0),
|
||||||
m_useRK4(false), m_useGlobalVelocities(false)
|
m_useRK4(false),
|
||||||
|
m_useGlobalVelocities(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!m_isMultiDof)
|
if(!m_isMultiDof)
|
||||||
@@ -119,7 +123,7 @@ btMultiBody::btMultiBody(int n_links,
|
|||||||
m_links.resize(n_links);
|
m_links.resize(n_links);
|
||||||
m_matrixBuf.resize(n_links + 1);
|
m_matrixBuf.resize(n_links + 1);
|
||||||
|
|
||||||
m_basePos.setValue(0, 0, 0);
|
|
||||||
m_baseForce.setValue(0, 0, 0);
|
m_baseForce.setValue(0, 0, 0);
|
||||||
m_baseTorque.setValue(0, 0, 0);
|
m_baseTorque.setValue(0, 0, 0);
|
||||||
}
|
}
|
||||||
@@ -1257,7 +1261,7 @@ void btMultiBody::stepVelocitiesMultiDof(btScalar dt,
|
|||||||
zeroAccSpatFrc[i+1].addAngular(spatVel[i+1].getAngular().cross(m_baseInertia * spatVel[i+1].getAngular()));
|
zeroAccSpatFrc[i+1].addAngular(spatVel[i+1].getAngular().cross(m_baseInertia * spatVel[i+1].getAngular()));
|
||||||
//
|
//
|
||||||
zeroAccSpatFrc[i+1].addLinear(m_links[i].m_mass * spatVel[i+1].getAngular().cross(spatVel[i+1].getLinear()));
|
zeroAccSpatFrc[i+1].addLinear(m_links[i].m_mass * spatVel[i+1].getAngular().cross(spatVel[i+1].getLinear()));
|
||||||
btVector3 temp = m_links[i].m_mass * spatVel[i+1].getAngular().cross(spatVel[i+1].getLinear());
|
//btVector3 temp = m_links[i].m_mass * spatVel[i+1].getAngular().cross(spatVel[i+1].getLinear());
|
||||||
////clamp parent's omega
|
////clamp parent's omega
|
||||||
//btScalar parOmegaMod = temp.length();
|
//btScalar parOmegaMod = temp.length();
|
||||||
//btScalar parOmegaModMax = 1000;
|
//btScalar parOmegaModMax = 1000;
|
||||||
@@ -2010,7 +2014,7 @@ void btMultiBody::calcAccelerationDeltasMultiDof(const btScalar *force, btScalar
|
|||||||
{
|
{
|
||||||
for(int dof = 0; dof < m_links[i].m_dofCount; ++dof)
|
for(int dof = 0; dof < m_links[i].m_dofCount; ++dof)
|
||||||
{
|
{
|
||||||
btScalar sdp = -SpatialDotProduct(m_links[i].getAxisTop(dof), m_links[i].getAxisBottom(dof), zeroAccForce[i+1], zeroAccTorque[i+1]);
|
//?? btScalar sdp = -SpatialDotProduct(m_links[i].getAxisTop(dof), m_links[i].getAxisBottom(dof), zeroAccForce[i+1], zeroAccTorque[i+1]);
|
||||||
|
|
||||||
Y[m_links[i].m_dofOffset + dof] = force[6 + m_links[i].m_dofOffset + dof]
|
Y[m_links[i].m_dofOffset + dof] = force[6 + m_links[i].m_dofOffset + dof]
|
||||||
- SpatialDotProduct(m_links[i].getAxisTop(dof), m_links[i].getAxisBottom(dof), zeroAccForce[i+1], zeroAccTorque[i+1])
|
- SpatialDotProduct(m_links[i].getAxisTop(dof), m_links[i].getAxisBottom(dof), zeroAccForce[i+1], zeroAccTorque[i+1])
|
||||||
@@ -2352,7 +2356,7 @@ void btMultiBody::calcAccelerationDeltas(const btScalar *force, btScalar *output
|
|||||||
// 'Downward' loop.
|
// 'Downward' loop.
|
||||||
for (int i = num_links - 1; i >= 0; --i)
|
for (int i = num_links - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
btScalar sdp = -SpatialDotProduct(m_links[i].getAxisTop(0), m_links[i].getAxisBottom(0), zero_acc_top_angular[i+1], zero_acc_bottom_linear[i+1]);
|
// btScalar sdp = -SpatialDotProduct(m_links[i].getAxisTop(0), m_links[i].getAxisBottom(0), zero_acc_top_angular[i+1], zero_acc_bottom_linear[i+1]);
|
||||||
Y[i] = - SpatialDotProduct(m_links[i].getAxisTop(0), m_links[i].getAxisBottom(0), zero_acc_top_angular[i+1], zero_acc_bottom_linear[i+1]);
|
Y[i] = - SpatialDotProduct(m_links[i].getAxisTop(0), m_links[i].getAxisBottom(0), zero_acc_top_angular[i+1], zero_acc_bottom_linear[i+1]);
|
||||||
Y[i] += force[6 + i]; // add joint torque
|
Y[i] += force[6 + i]; // add joint torque
|
||||||
|
|
||||||
@@ -2437,7 +2441,7 @@ void btMultiBody::calcAccelerationDeltas(const btScalar *force, btScalar *output
|
|||||||
/////////////////
|
/////////////////
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int dummy = 0;
|
//int dummy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btMultiBody::stepPositions(btScalar dt)
|
void btMultiBody::stepPositions(btScalar dt)
|
||||||
|
|||||||
@@ -510,7 +510,14 @@ public:
|
|||||||
void useGlobalVelocities(bool use) { m_useGlobalVelocities = use; }
|
void useGlobalVelocities(bool use) { m_useGlobalVelocities = use; }
|
||||||
bool isUsingGlobalVelocities() const { return m_useGlobalVelocities; }
|
bool isUsingGlobalVelocities() const { return m_useGlobalVelocities; }
|
||||||
|
|
||||||
bool __posUpdated;
|
bool isPosUpdated() const
|
||||||
|
{
|
||||||
|
return __posUpdated;
|
||||||
|
}
|
||||||
|
void setPosUpdated(bool updated)
|
||||||
|
{
|
||||||
|
__posUpdated = updated;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
btMultiBody(const btMultiBody &); // not implemented
|
btMultiBody(const btMultiBody &); // not implemented
|
||||||
@@ -535,6 +542,7 @@ private:
|
|||||||
|
|
||||||
void mulMatrix(btScalar *pA, btScalar *pB, int rowsA, int colsA, int rowsB, int colsB, btScalar *pC) const;
|
void mulMatrix(btScalar *pA, btScalar *pB, int rowsA, int colsA, int rowsB, int colsB, btScalar *pC) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
btMultiBodyLinkCollider* m_baseCollider;//can be NULL
|
btMultiBodyLinkCollider* m_baseCollider;//can be NULL
|
||||||
@@ -550,9 +558,7 @@ private:
|
|||||||
|
|
||||||
btAlignedObjectArray<btMultibodyLink> m_links; // array of m_links, excluding the base. index from 0 to num_links-1.
|
btAlignedObjectArray<btMultibodyLink> m_links; // array of m_links, excluding the base. index from 0 to num_links-1.
|
||||||
btAlignedObjectArray<btMultiBodyLinkCollider*> m_colliders;
|
btAlignedObjectArray<btMultiBodyLinkCollider*> m_colliders;
|
||||||
int m_dofCount, m_posVarCnt;
|
|
||||||
|
|
||||||
bool m_useRK4, m_useGlobalVelocities;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// realBuf:
|
// realBuf:
|
||||||
@@ -596,6 +602,9 @@ private:
|
|||||||
btScalar m_maxCoordinateVelocity;
|
btScalar m_maxCoordinateVelocity;
|
||||||
bool m_hasSelfCollision;
|
bool m_hasSelfCollision;
|
||||||
bool m_isMultiDof;
|
bool m_isMultiDof;
|
||||||
|
bool __posUpdated;
|
||||||
|
int m_dofCount, m_posVarCnt;
|
||||||
|
bool m_useRK4, m_useGlobalVelocities;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,16 +2,18 @@
|
|||||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||||
#include "btMultiBodyPoint2Point.h" //for testing (BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST macro)
|
#include "btMultiBodyPoint2Point.h" //for testing (BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST macro)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
btMultiBodyConstraint::btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral)
|
btMultiBodyConstraint::btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral)
|
||||||
:m_bodyA(bodyA),
|
:m_bodyA(bodyA),
|
||||||
m_bodyB(bodyB),
|
m_bodyB(bodyB),
|
||||||
m_linkA(linkA),
|
m_linkA(linkA),
|
||||||
m_linkB(linkB),
|
m_linkB(linkB),
|
||||||
m_numRows(numRows),
|
m_numRows(numRows),
|
||||||
m_isUnilateral(isUnilateral),
|
|
||||||
m_maxAppliedImpulse(100),
|
|
||||||
m_jacSizeA(0),
|
m_jacSizeA(0),
|
||||||
m_jacSizeBoth(0)
|
m_jacSizeBoth(0),
|
||||||
|
m_isUnilateral(isUnilateral),
|
||||||
|
m_maxAppliedImpulse(100)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(bodyA)
|
if(bodyA)
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl
|
|||||||
//resolveSingleConstraintRowGenericMultiBody(constraint);
|
//resolveSingleConstraintRowGenericMultiBody(constraint);
|
||||||
resolveSingleConstraintRowGeneric(constraint);
|
resolveSingleConstraintRowGeneric(constraint);
|
||||||
if(constraint.m_multiBodyA)
|
if(constraint.m_multiBodyA)
|
||||||
constraint.m_multiBodyA->__posUpdated = false;
|
constraint.m_multiBodyA->setPosUpdated(false);
|
||||||
if(constraint.m_multiBodyB)
|
if(constraint.m_multiBodyB)
|
||||||
constraint.m_multiBodyB->__posUpdated = false;
|
constraint.m_multiBodyB->setPosUpdated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//solve featherstone normal contact
|
//solve featherstone normal contact
|
||||||
@@ -50,9 +50,9 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl
|
|||||||
resolveSingleConstraintRowGeneric(constraint);
|
resolveSingleConstraintRowGeneric(constraint);
|
||||||
|
|
||||||
if(constraint.m_multiBodyA)
|
if(constraint.m_multiBodyA)
|
||||||
constraint.m_multiBodyA->__posUpdated = false;
|
constraint.m_multiBodyA->setPosUpdated(false);
|
||||||
if(constraint.m_multiBodyB)
|
if(constraint.m_multiBodyB)
|
||||||
constraint.m_multiBodyB->__posUpdated = false;
|
constraint.m_multiBodyB->setPosUpdated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//solve featherstone frictional contact
|
//solve featherstone frictional contact
|
||||||
@@ -71,9 +71,9 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl
|
|||||||
resolveSingleConstraintRowGeneric(frictionConstraint);
|
resolveSingleConstraintRowGeneric(frictionConstraint);
|
||||||
|
|
||||||
if(frictionConstraint.m_multiBodyA)
|
if(frictionConstraint.m_multiBodyA)
|
||||||
frictionConstraint.m_multiBodyA->__posUpdated = false;
|
frictionConstraint.m_multiBodyA->setPosUpdated(false);
|
||||||
if(frictionConstraint.m_multiBodyB)
|
if(frictionConstraint.m_multiBodyB)
|
||||||
frictionConstraint.m_multiBodyB->__posUpdated = false;
|
frictionConstraint.m_multiBodyB->setPosUpdated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -629,15 +629,15 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold*
|
|||||||
int solverBodyIdA = mbA? -1 : getOrInitSolverBody(*colObj0,infoGlobal.m_timeStep);
|
int solverBodyIdA = mbA? -1 : getOrInitSolverBody(*colObj0,infoGlobal.m_timeStep);
|
||||||
int solverBodyIdB = mbB ? -1 : getOrInitSolverBody(*colObj1,infoGlobal.m_timeStep);
|
int solverBodyIdB = mbB ? -1 : getOrInitSolverBody(*colObj1,infoGlobal.m_timeStep);
|
||||||
|
|
||||||
btSolverBody* solverBodyA = mbA ? 0 : &m_tmpSolverBodyPool[solverBodyIdA];
|
// btSolverBody* solverBodyA = mbA ? 0 : &m_tmpSolverBodyPool[solverBodyIdA];
|
||||||
btSolverBody* solverBodyB = mbB ? 0 : &m_tmpSolverBodyPool[solverBodyIdB];
|
// btSolverBody* solverBodyB = mbB ? 0 : &m_tmpSolverBodyPool[solverBodyIdB];
|
||||||
|
|
||||||
|
|
||||||
///avoid collision response between two static objects
|
///avoid collision response between two static objects
|
||||||
// if (!solverBodyA || (solverBodyA->m_invMass.isZero() && (!solverBodyB || solverBodyB->m_invMass.isZero())))
|
// if (!solverBodyA || (solverBodyA->m_invMass.isZero() && (!solverBodyB || solverBodyB->m_invMass.isZero())))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
int rollingFriction=1;
|
|
||||||
|
|
||||||
for (int j=0;j<manifold->getNumContacts();j++)
|
for (int j=0;j<manifold->getNumContacts();j++)
|
||||||
{
|
{
|
||||||
@@ -653,8 +653,8 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold*
|
|||||||
|
|
||||||
btMultiBodySolverConstraint& solverConstraint = m_multiBodyNormalContactConstraints.expandNonInitializing();
|
btMultiBodySolverConstraint& solverConstraint = m_multiBodyNormalContactConstraints.expandNonInitializing();
|
||||||
|
|
||||||
btRigidBody* rb0 = btRigidBody::upcast(colObj0);
|
// btRigidBody* rb0 = btRigidBody::upcast(colObj0);
|
||||||
btRigidBody* rb1 = btRigidBody::upcast(colObj1);
|
// btRigidBody* rb1 = btRigidBody::upcast(colObj1);
|
||||||
solverConstraint.m_solverBodyIdA = solverBodyIdA;
|
solverConstraint.m_solverBodyIdA = solverBodyIdA;
|
||||||
solverConstraint.m_solverBodyIdB = solverBodyIdB;
|
solverConstraint.m_solverBodyIdB = solverBodyIdB;
|
||||||
solverConstraint.m_multiBodyA = mbA;
|
solverConstraint.m_multiBodyA = mbA;
|
||||||
@@ -678,6 +678,7 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold*
|
|||||||
#ifdef ENABLE_FRICTION
|
#ifdef ENABLE_FRICTION
|
||||||
solverConstraint.m_frictionIndex = frictionIndex;
|
solverConstraint.m_frictionIndex = frictionIndex;
|
||||||
#if ROLLING_FRICTION
|
#if ROLLING_FRICTION
|
||||||
|
int rollingFriction=1;
|
||||||
btVector3 angVelA(0,0,0),angVelB(0,0,0);
|
btVector3 angVelA(0,0,0),angVelB(0,0,0);
|
||||||
if (rb0)
|
if (rb0)
|
||||||
angVelA = rb0->getAngularVelocity();
|
angVelA = rb0->getAngularVelocity();
|
||||||
@@ -795,7 +796,7 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold*
|
|||||||
|
|
||||||
void btMultiBodyConstraintSolver::convertContacts(btPersistentManifold** manifoldPtr,int numManifolds, const btContactSolverInfo& infoGlobal)
|
void btMultiBodyConstraintSolver::convertContacts(btPersistentManifold** manifoldPtr,int numManifolds, const btContactSolverInfo& infoGlobal)
|
||||||
{
|
{
|
||||||
btPersistentManifold* manifold = 0;
|
//btPersistentManifold* manifold = 0;
|
||||||
|
|
||||||
for (int i=0;i<numManifolds;i++)
|
for (int i=0;i<numManifolds;i++)
|
||||||
{
|
{
|
||||||
@@ -836,7 +837,7 @@ btScalar btMultiBodyConstraintSolver::solveGroup(btCollisionObject** bodies,int
|
|||||||
btScalar btMultiBodyConstraintSolver::solveGroupCacheFriendlyFinish(btCollisionObject** bodies,int numBodies,const btContactSolverInfo& infoGlobal)
|
btScalar btMultiBodyConstraintSolver::solveGroupCacheFriendlyFinish(btCollisionObject** bodies,int numBodies,const btContactSolverInfo& infoGlobal)
|
||||||
{
|
{
|
||||||
int numPoolConstraints = m_multiBodyNormalContactConstraints.size();
|
int numPoolConstraints = m_multiBodyNormalContactConstraints.size();
|
||||||
int i,j;
|
int j;
|
||||||
|
|
||||||
if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING)
|
if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ void btMultiBodyDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
|
|||||||
pRealBuf[i] = delta_q[i];
|
pRealBuf[i] = delta_q[i];
|
||||||
|
|
||||||
//bod->stepPositionsMultiDof(1, 0, &delta_q[0]);
|
//bod->stepPositionsMultiDof(1, 0, &delta_q[0]);
|
||||||
bod->__posUpdated = true;
|
bod->setPosUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ugly hack which resets the cached data to t0 (needed for constraint solver)
|
//ugly hack which resets the cached data to t0 (needed for constraint solver)
|
||||||
@@ -672,7 +672,7 @@ void btMultiBodyDynamicsWorld::integrateTransforms(btScalar timeStep)
|
|||||||
|
|
||||||
if(bod->isMultiDof())
|
if(bod->isMultiDof())
|
||||||
{
|
{
|
||||||
if(!bod->__posUpdated)
|
if(!bod->isPosUpdated())
|
||||||
bod->stepPositionsMultiDof(timeStep);
|
bod->stepPositionsMultiDof(timeStep);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -680,7 +680,7 @@ void btMultiBodyDynamicsWorld::integrateTransforms(btScalar timeStep)
|
|||||||
pRealBuf += 6 + bod->getNumDofs() + bod->getNumDofs()*bod->getNumDofs();
|
pRealBuf += 6 + bod->getNumDofs() + bod->getNumDofs()*bod->getNumDofs();
|
||||||
|
|
||||||
bod->stepPositionsMultiDof(1, 0, pRealBuf);
|
bod->stepPositionsMultiDof(1, 0, pRealBuf);
|
||||||
bod->__posUpdated = false;
|
bod->setPosUpdated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -692,7 +692,7 @@ void btMultiBodyDynamicsWorld::integrateTransforms(btScalar timeStep)
|
|||||||
if (bod->getBaseCollider())
|
if (bod->getBaseCollider())
|
||||||
{
|
{
|
||||||
btVector3 posr = local_origin[0];
|
btVector3 posr = local_origin[0];
|
||||||
float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
// float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
||||||
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
|
||||||
btTransform tr;
|
btTransform tr;
|
||||||
tr.setIdentity();
|
tr.setIdentity();
|
||||||
@@ -722,7 +722,7 @@ void btMultiBodyDynamicsWorld::integrateTransforms(btScalar timeStep)
|
|||||||
int index = link+1;
|
int index = link+1;
|
||||||
|
|
||||||
btVector3 posr = local_origin[index];
|
btVector3 posr = local_origin[index];
|
||||||
float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
// float pos[4]={posr.x(),posr.y(),posr.z(),1};
|
||||||
float quat[4]={-world_to_local[index].x(),-world_to_local[index].y(),-world_to_local[index].z(),world_to_local[index].w()};
|
float quat[4]={-world_to_local[index].x(),-world_to_local[index].y(),-world_to_local[index].z(),world_to_local[index].w()};
|
||||||
btTransform tr;
|
btTransform tr;
|
||||||
tr.setIdentity();
|
tr.setIdentity();
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void btMultiBodyJointMotor::createConstraintRows(btMultiBodyConstraintArray& con
|
|||||||
{
|
{
|
||||||
btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing();
|
btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing();
|
||||||
|
|
||||||
btScalar penetration = 0;
|
|
||||||
fillMultiBodyConstraint(constraintRow,data,jacobianA(row),jacobianB(row),dummy,dummy,dummy,posError,infoGlobal,-m_maxAppliedImpulse,m_maxAppliedImpulse,1,false,m_desiredVelocity);
|
fillMultiBodyConstraint(constraintRow,data,jacobianA(row),jacobianB(row),dummy,dummy,dummy,posError,infoGlobal,-m_maxAppliedImpulse,m_maxAppliedImpulse,1,false,m_desiredVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,8 +381,7 @@ struct btMultibodyLink
|
|||||||
eInvalid
|
eInvalid
|
||||||
};
|
};
|
||||||
|
|
||||||
eFeatherstoneJointType m_jointType;
|
|
||||||
int m_dofCount, m_posVarCount; //redundant but handy
|
|
||||||
|
|
||||||
// "axis" = spatial joint axis (Mirtich Defn 9 p104). (expressed in local frame.) constant.
|
// "axis" = spatial joint axis (Mirtich Defn 9 p104). (expressed in local frame.) constant.
|
||||||
// for prismatic: m_axesTop[0] = zero;
|
// for prismatic: m_axesTop[0] = zero;
|
||||||
@@ -430,6 +429,10 @@ struct btMultibodyLink
|
|||||||
class btMultiBodyLinkCollider* m_collider;
|
class btMultiBodyLinkCollider* m_collider;
|
||||||
int m_flags;
|
int m_flags;
|
||||||
|
|
||||||
|
|
||||||
|
int m_dofCount, m_posVarCount; //redundant but handy
|
||||||
|
eFeatherstoneJointType m_jointType;
|
||||||
|
|
||||||
// ctor: set some sensible defaults
|
// ctor: set some sensible defaults
|
||||||
btMultibodyLink()
|
btMultibodyLink()
|
||||||
: m_mass(1),
|
: m_mass(1),
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ int numDim = BTMBP2PCONSTRAINT_DIM;
|
|||||||
contactNormalOnB[i%3] = -1;
|
contactNormalOnB[i%3] = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
btScalar penetration = 0;
|
|
||||||
|
|
||||||
// Convert local points back to world
|
// Convert local points back to world
|
||||||
btVector3 pivotAworld = m_pivotInA;
|
btVector3 pivotAworld = m_pivotInA;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ ATTRIBUTE_ALIGNED16 (struct) btMultiBodySolverConstraint
|
|||||||
{
|
{
|
||||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||||
|
|
||||||
btMultiBodySolverConstraint() : m_solverBodyIdA(-1), m_solverBodyIdB(-1), m_multiBodyA(0), m_multiBodyB(0), m_linkA(-1), m_linkB(-1)
|
btMultiBodySolverConstraint() : m_solverBodyIdA(-1), m_multiBodyA(0), m_linkA(-1), m_solverBodyIdB(-1), m_multiBodyB(0), m_linkB(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int m_deltaVelAindex;//more generic version of m_relpos1CrossNormal/m_contactNormal1
|
int m_deltaVelAindex;//more generic version of m_relpos1CrossNormal/m_contactNormal1
|
||||||
|
|||||||
@@ -821,14 +821,15 @@ void btSolveL1T (const btScalar *L, btScalar *B, int n, int lskip1)
|
|||||||
/* declare variables - Z matrix, p and q vectors, etc */
|
/* declare variables - Z matrix, p and q vectors, etc */
|
||||||
btScalar Z11,m11,Z21,m21,Z31,m31,Z41,m41,p1,q1,p2,p3,p4,*ex;
|
btScalar Z11,m11,Z21,m21,Z31,m31,Z41,m41,p1,q1,p2,p3,p4,*ex;
|
||||||
const btScalar *ell;
|
const btScalar *ell;
|
||||||
int lskip2,lskip3,i,j;
|
int lskip2,i,j;
|
||||||
|
// int lskip3;
|
||||||
/* special handling for L and B because we're solving L1 *transpose* */
|
/* special handling for L and B because we're solving L1 *transpose* */
|
||||||
L = L + (n-1)*(lskip1+1);
|
L = L + (n-1)*(lskip1+1);
|
||||||
B = B + n-1;
|
B = B + n-1;
|
||||||
lskip1 = -lskip1;
|
lskip1 = -lskip1;
|
||||||
/* compute lskip values */
|
/* compute lskip values */
|
||||||
lskip2 = 2*lskip1;
|
lskip2 = 2*lskip1;
|
||||||
lskip3 = 3*lskip1;
|
//lskip3 = 3*lskip1;
|
||||||
/* compute all 4 x 1 blocks of X */
|
/* compute all 4 x 1 blocks of X */
|
||||||
for (i=0; i <= n-4; i+=4) {
|
for (i=0; i <= n-4; i+=4) {
|
||||||
/* compute all 4 x 1 block of X, from rows i..i+4-1 */
|
/* compute all 4 x 1 block of X, from rows i..i+4-1 */
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ btScalar btMLCPSolver::solveGroupCacheFriendlySetup(btCollisionObject** bodies,
|
|||||||
int numFrictionPerContact = m_tmpSolverContactConstraintPool.size()==m_tmpSolverContactFrictionConstraintPool.size()? 1 : 2;
|
int numFrictionPerContact = m_tmpSolverContactConstraintPool.size()==m_tmpSolverContactFrictionConstraintPool.size()? 1 : 2;
|
||||||
|
|
||||||
|
|
||||||
int numBodies = m_tmpSolverBodyPool.size();
|
// int numBodies = m_tmpSolverBodyPool.size();
|
||||||
m_allConstraintPtrArray.resize(0);
|
m_allConstraintPtrArray.resize(0);
|
||||||
m_limitDependencies.resize(m_tmpSolverNonContactConstraintPool.size()+m_tmpSolverContactConstraintPool.size()+m_tmpSolverContactFrictionConstraintPool.size());
|
m_limitDependencies.resize(m_tmpSolverNonContactConstraintPool.size()+m_tmpSolverContactConstraintPool.size()+m_tmpSolverContactFrictionConstraintPool.size());
|
||||||
btAssert(m_limitDependencies.size() == m_tmpSolverNonContactConstraintPool.size()+m_tmpSolverContactConstraintPool.size()+m_tmpSolverContactFrictionConstraintPool.size());
|
btAssert(m_limitDependencies.size() == m_tmpSolverNonContactConstraintPool.size()+m_tmpSolverContactConstraintPool.size()+m_tmpSolverContactFrictionConstraintPool.size());
|
||||||
@@ -178,8 +178,8 @@ void btMLCPSolver::createMLCPFast(const btContactSolverInfo& infoGlobal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btScalar* w = 0;
|
// btScalar* w = 0;
|
||||||
int nub = 0;
|
// int nub = 0;
|
||||||
|
|
||||||
m_lo.resize(numConstraintRows);
|
m_lo.resize(numConstraintRows);
|
||||||
m_hi.resize(numConstraintRows);
|
m_hi.resize(numConstraintRows);
|
||||||
@@ -354,8 +354,8 @@ void btMLCPSolver::createMLCPFast(const btContactSolverInfo& infoGlobal)
|
|||||||
int row__ = ofs[c];
|
int row__ = ofs[c];
|
||||||
int sbA = m_allConstraintPtrArray[i]->m_solverBodyIdA;
|
int sbA = m_allConstraintPtrArray[i]->m_solverBodyIdA;
|
||||||
int sbB = m_allConstraintPtrArray[i]->m_solverBodyIdB;
|
int sbB = m_allConstraintPtrArray[i]->m_solverBodyIdB;
|
||||||
btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
// btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
||||||
btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
// btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
||||||
|
|
||||||
numRows = i<m_tmpSolverNonContactConstraintPool.size() ? m_tmpConstraintSizesPool[c].m_numConstraintRows : numContactRows ;
|
numRows = i<m_tmpSolverNonContactConstraintPool.size() ? m_tmpConstraintSizesPool[c].m_numConstraintRows : numContactRows ;
|
||||||
|
|
||||||
@@ -410,9 +410,9 @@ void btMLCPSolver::createMLCPFast(const btContactSolverInfo& infoGlobal)
|
|||||||
for (;row__<numJointRows;)
|
for (;row__<numJointRows;)
|
||||||
{
|
{
|
||||||
|
|
||||||
int sbA = m_allConstraintPtrArray[row__]->m_solverBodyIdA;
|
//int sbA = m_allConstraintPtrArray[row__]->m_solverBodyIdA;
|
||||||
int sbB = m_allConstraintPtrArray[row__]->m_solverBodyIdB;
|
int sbB = m_allConstraintPtrArray[row__]->m_solverBodyIdB;
|
||||||
btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
// btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
||||||
btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
||||||
|
|
||||||
|
|
||||||
@@ -603,8 +603,8 @@ btScalar btMLCPSolver::solveGroupCacheFriendlyIterations(btCollisionObject** bod
|
|||||||
btSolverConstraint& c = *m_allConstraintPtrArray[i];
|
btSolverConstraint& c = *m_allConstraintPtrArray[i];
|
||||||
int sbA = c.m_solverBodyIdA;
|
int sbA = c.m_solverBodyIdA;
|
||||||
int sbB = c.m_solverBodyIdB;
|
int sbB = c.m_solverBodyIdB;
|
||||||
btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
//btRigidBody* orgBodyA = m_tmpSolverBodyPool[sbA].m_originalBody;
|
||||||
btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
// btRigidBody* orgBodyB = m_tmpSolverBodyPool[sbB].m_originalBody;
|
||||||
|
|
||||||
btSolverBody& solverBodyA = m_tmpSolverBodyPool[sbA];
|
btSolverBody& solverBodyA = m_tmpSolverBodyPool[sbA];
|
||||||
btSolverBody& solverBodyB = m_tmpSolverBodyPool[sbB];
|
btSolverBody& solverBodyB = m_tmpSolverBodyPool[sbB];
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
float aDiag = A(i,i);
|
float aDiag = A(i,i);
|
||||||
x [i] = (b [i] - delta) / A(i,i);
|
x [i] = (b [i] - delta) / aDiag;
|
||||||
float s = 1.f;
|
float s = 1.f;
|
||||||
|
|
||||||
if (limitDependency[i]>=0)
|
if (limitDependency[i]>=0)
|
||||||
|
|||||||
@@ -296,8 +296,9 @@ void btRaycastVehicle::updateVehicle( btScalar step )
|
|||||||
int i=0;
|
int i=0;
|
||||||
for (i=0;i<m_wheelInfo.size();i++)
|
for (i=0;i<m_wheelInfo.size();i++)
|
||||||
{
|
{
|
||||||
btScalar depth;
|
//btScalar depth;
|
||||||
depth = rayCast( m_wheelInfo[i]);
|
//depth =
|
||||||
|
rayCast( m_wheelInfo[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSuspension(step);
|
updateSuspension(step);
|
||||||
|
|||||||
@@ -354,11 +354,11 @@ struct btMatrixX
|
|||||||
for (int i=0; i < res.rows(); ++i)
|
for (int i=0; i < res.rows(); ++i)
|
||||||
{
|
{
|
||||||
T dotProd=0;
|
T dotProd=0;
|
||||||
T dotProd2=0;
|
// T dotProd2=0;
|
||||||
int waste=0,waste2=0;
|
//int waste=0,waste2=0;
|
||||||
|
|
||||||
{
|
{
|
||||||
bool useOtherCol = true;
|
// bool useOtherCol = true;
|
||||||
{
|
{
|
||||||
for (int v=0;v<rows();v++)
|
for (int v=0;v<rows();v++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user