本文整理汇总了C++中Terrain::addSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ Terrain::addSurface方法的具体用法?C++ Terrain::addSurface怎么用?C++ Terrain::addSurface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terrain
的用法示例。
在下文中一共展示了Terrain::addSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void load(string filename, Terrain &terr, Renderer &r, PathHandler& p, LightHandler &l, ParticleHandler &part,MeshHandler &m)
{
ifstream stream;
string fullPath = path+filename+".txt";
stream.open(fullPath.c_str());
if(stream.is_open())
{
r.clear();
l.clear();
p.clear();
part.clear();
int mapsize=0;
int highBind=0;
string bmp1="";
string bmp2="";
int width=0;
while(!stream.eof())
{
char buf[1024];
char key[1024];
stream.getline(buf, 1024);
sscanf(buf, "%s", key);
if(strcmp(key, "bmp1:") == 0)
{
char file[100];
sscanf(buf, "bmp1: %s", &file);
bmp1= string(file);
}
else if(strcmp(key, "bmp2:") == 0)
{
char file[100];
sscanf(buf, "bmp2: %s", &file);
bmp2= string(file);
if(width == 128)
mapsize=1;
if(width==256)
mapsize=2;
terr.createNewMap(mapsize);
terr.loadMaps(path+bmp1,path+bmp2,path+filename+"gm.png");
}
else if(strcmp(key, "width:") == 0)
{
sscanf(buf, "width: %d", &width);
}
else if(strcmp(key, "Surfaceplanes:") == 0)
{
string texture;
int surfCounter=-1;
bool done = false;
while(!done)
{
stream.getline(buf, 1024);
sscanf(buf, "%s", key);
if(strcmp(key, "SF:") == 0)
{
char in[100];
sscanf(buf, "SF: %s", &in);
texture = string(in);
surfCounter++;
}
else if(strcmp(key, "end") == 0)
{
done = true;
}
else // Else its an actual road piece (at least we hope so because else we are screwed)
{
float rot,scale;
float x, z;
sscanf(buf, "%f %f %f %f", &rot, &x, &z,&scale);
terr.addSurface(vec3(x,0,z),rot,surfCounter,scale);
//m_roads.push_back(g_graphicsEngine->createRoad(texture, FLOAT3(x, 0.0f, -z), rot));
}
}
}
else if(strcmp(key, "MODELS:") == 0)
{
string s;
bool done = false;
while(!done)
{
stream.getline(buf, 1024);
sscanf(buf, "%s", key);
if(strcmp(key, "end") == 0)
{
done = true;
}
else
{
char in[100];
vec3 position;
vec3 rotation;
float scale;
int id = 0;
//.........这里部分代码省略.........