implement specular, URDF non-standard specular part (see sphere2.urdf) and SDF specular support.

pybullet.changeVisualShape(obUid,linkIndex,specularColor=[R,G,B]) and Bullet C-API b3UpdateVisualShapeSpecularColor
Bug fixes in b3ResourcePath::findResourcePath resolution.
add stadium.sdf and roboschool/models_outdoor/stadium assets https://github.com/openai/roboschool/tree/master/roboschool/models_outdoor/stadium
minor fixes to obj2sdf
This commit is contained in:
Erwin Coumans
2017-06-01 12:32:44 -07:00
parent 439e8c84cf
commit 87293e835c
36 changed files with 78766 additions and 87 deletions

View File

@@ -16,6 +16,24 @@
#define MAX_PATH_LEN 1024
std::string StripExtension( const std::string & sPath )
{
for( std::string::const_reverse_iterator i = sPath.rbegin(); i != sPath.rend(); i++ )
{
if( *i == '.' )
{
return std::string( sPath.begin(), i.base() - 1 );
}
// if we find a slash there is no extension
if( *i == '\\' || *i == '/' )
break;
}
// we didn't find an extension
return sPath;
}
int main(int argc, char* argv[])
{
@@ -23,6 +41,8 @@ int main(int argc, char* argv[])
char* fileName;
args.GetCmdLineArgument("fileName",fileName);
std::string matLibName = StripExtension(fileName);
printf("fileName = %s\n", fileName);
if (fileName==0)
{
@@ -58,7 +78,13 @@ int main(int argc, char* argv[])
}
char objFileName[MAX_PATH_LEN];
sprintf(objFileName,"%s/part%d.obj",materialPrefixPath,s);
if (strlen(materialPrefixPath)>0)
{
sprintf(objFileName,"%s/part%d.obj",materialPrefixPath,s);
} else
{
sprintf(objFileName,"part%d.obj",s);
}
FILE* f = fopen(objFileName,"w");
if (f==0)
{
@@ -66,7 +92,15 @@ int main(int argc, char* argv[])
exit(0);
}
fprintf(f,"# Exported using automatic converter by Erwin Coumans\n");
fprintf(f,"mtllib bedroom.mtl\n");
if (matLibName.length())
{
fprintf(f,"mtllib %s.mtl\n", matLibName.c_str());
} else
{
fprintf(f,"mtllib bedroom.mtl\n");
}
int faceCount = shape.mesh.indices.size();
int vertexCount = shape.mesh.positions.size();