当前位置: 首页>>代码示例>>C++>>正文


C++ HeightMap::read方法代码示例

本文整理汇总了C++中HeightMap::read方法的典型用法代码示例。如果您正苦于以下问题:C++ HeightMap::read方法的具体用法?C++ HeightMap::read怎么用?C++ HeightMap::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HeightMap的用法示例。


在下文中一共展示了HeightMap::read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pfacet

//---------------------------------------------------------------------------
void OGLGeo::heightmap2(HeightMap &map_in)
{
//高さ地図の描画その2.ポリゴンを使う
PFacet facet1,facet2;
Vertex p00,p01,p10,p11;
double x0,y0,x1,y1;
 for(int j=0;j<map_in.mesh_j-1;j++)
 {
 for(int i=0;i<map_in.mesh_i-1;i++)
 {
  x0=map_in.itox(i);
  x1=map_in.itox(i+1);
  y0=map_in.jtoy(j);
  y1=map_in.jtoy(j+1);
  p00.x=x0;
  p00.y=y0;
  p01.x=x0;
  p01.y=y1;
  p10.x=x1;
  p10.y=y0;
  p11.x=x1;
  p11.y=y1;
   if(
    (map_in.read(&p00.z,i,j))&&
    (map_in.read(&p10.z,i+1,j))&&
    (map_in.read(&p01.z,i,j+1))
    )
   {
   facet1.a=p00;
   facet1.b=p10;
   facet1.c=p01;
   facet1.abgd();
   pfacet(facet1);
   }

   if(
    (map_in.read(&p10.z,i+1,j))&&
    (map_in.read(&p11.z,i+1,j+1))&&
    (map_in.read(&p01.z,i,j+1))
    )
   {
   facet2.a=p10;
   facet2.b=p11;
   facet2.c=p01;
   facet2.abgd();
   pfacet(facet2);
   }

 }
 }
}
开发者ID:t-doi,项目名称:OpenNI2-test,代码行数:52,代码来源:OGLGeo.cpp

示例2: glBegin

//---------------------------------------------------------------------------
void OGLGeo::heightmap3(HeightMap &map_in)
{
//高さ地図の描画.上面のみ
double x0,x1,y0,y1,z0,z1;
 for(int j=0;j<map_in.mesh_j;j++)
 {
 for(int i=0;i<map_in.mesh_i;i++)
 {
  x0=map_in.x0+i*map_in.dx;
  x1=map_in.x0+(i+1)*map_in.dx;
  y0=map_in.y0+j*map_in.dy;
  y1=map_in.y0+(j+1)*map_in.dy;
//  z0=map_in.z0;

   if(map_in.read(&z1,i,j))
   {
    //上面
    glBegin(GL_POLYGON);
    glNormal3d(0,0,1);
    glVertex3d(x0,y0,z1);
    glVertex3d(x1,y0,z1);
    glVertex3d(x1,y1,z1);
    glVertex3d(x0,y1,z1);
    glEnd();
   }
 }
 }
}
开发者ID:t-doi,项目名称:OpenNI2-test,代码行数:29,代码来源:OGLGeo.cpp

示例3: heightmap

//---------------------------------------------------------------------------
void OGLGeo::heightmap(HeightMap &map_in)
{
//高さ地図の描画
GLfloat materialTop[]={0.2f,1.0f,0.4f,0.5f};//上面の色
GLfloat materialSide[]={0.9f,0.8f,0.4f,0.5f};//側面

double x0,x1,y0,y1,z0,z1;
 for(int j=0;j<map_in.mesh_j;j++)
 {
 for(int i=0;i<map_in.mesh_i;i++)
 {
  x0=map_in.x0+i*map_in.dx;
  x1=map_in.x0+(i+1)*map_in.dx;
  y0=map_in.y0+j*map_in.dy;
  y1=map_in.y0+(j+1)*map_in.dy;
  z0=map_in.z0;

   if(map_in.read(&z1,i,j))
   {
    //上面
    glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,materialTop);
    glBegin(GL_POLYGON);
    glNormal3d(0,0,1);
    glVertex3d(x0,y0,z1);
    glVertex3d(x1,y0,z1);
    glVertex3d(x1,y1,z1);
    glVertex3d(x0,y1,z1);
    glEnd();

    //側面
    glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,materialSide);
    glBegin(GL_POLYGON);
    glNormal3d(1,0,0);
    glVertex3d(x1,y0,z0);
    glVertex3d(x1,y1,z0);
    glVertex3d(x1,y1,z1);
    glVertex3d(x1,y0,z1);
    glEnd();
    glBegin(GL_POLYGON);
    glNormal3d(-1,0,0);
    glVertex3d(x0,y0,z0);
    glVertex3d(x0,y0,z1);
    glVertex3d(x0,y1,z1);
    glVertex3d(x0,y1,z0);
    glEnd();
    glBegin(GL_POLYGON);
    glNormal3d(0,1,0);
    glVertex3d(x0,y1,z0);
    glVertex3d(x0,y1,z1);
    glVertex3d(x1,y1,z1);
    glVertex3d(x1,y1,z0);
    glEnd();
    glBegin(GL_POLYGON);
    glNormal3d(0,-1,0);
    glVertex3d(x0,y0,z0);
    glVertex3d(x1,y0,z0);
    glVertex3d(x1,y0,z1);
    glVertex3d(x0,y0,z1);
    glEnd();
   }
 }
 }
}
开发者ID:t-doi,项目名称:OpenNI2-test,代码行数:64,代码来源:OGLGeo.cpp


注:本文中的HeightMap::read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。