Пример #1
0
pl_Obj *setup_landscape(pl_Mat *m, pl_Mat *sm, pl_Mat *sm2) {
  int i;
  // make our root object the land
  pl_Obj *o = plMakePlane(LAND_SIZE,LAND_SIZE,LAND_DIV-1,m); 
  // give it a nice random bumpy effect
  for (i = 0; i < o->Vertices.GetSize(); i ++)
    o->Vertices.Get()[i].y += (float) (rand()%1400)-700;
  // gotta recalculate normals for backface culling to work right
  o->CalculateNormals();

  // Make our first child the first sky
  o->Children.Add(plMakePlane(LAND_SIZE,LAND_SIZE,30,sm));
  o->Children.Get(0)->Yp = 2000;

  // and the second the second sky
  o->Children.Add(plMakeSphere(LAND_SIZE,10,10,sm2));
  o->Children.Get(1)->Yp = 2000;
  o->Children.Get(1)->FlipNormals();

  return (o);
}
Пример #2
0
pl_Obj *setup_landscape(pl_Mat *m, pl_Mat *sm, pl_Mat *sm2) {
  int i;
  // make our root object the land
  pl_Obj *o = plMakePlane(LAND_SIZE,LAND_SIZE,LAND_DIV-1,m);
  // give it a nice random bumpy effect
  for (i = 0; i < o->NumVertices; i ++)
    o->Vertices[i].y += (float) (rand()%1400)-700;
  // gotta recalculate normals for backface culling to work right
  plObjCalcNormals(o);

  // Make our first child the first sky
  o->Children[0] = plMakePlane(LAND_SIZE,LAND_SIZE,1,sm);
  o->Children[0]->Yp = 2000;
  o->Children[0]->BackfaceCull = 0;

  // and the second the second sky
  o->Children[1] = plMakeSphere(LAND_SIZE,10,10,sm2);
  o->Children[1]->Yp = 2000;
  plObjFlipNormals(o->Children[1]);

  return (o);
}