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


C++ ManualObject::getBoundingBox方法代码示例

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


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

示例1: EngineSetup


//.........这里部分代码省略.........
    southMost = MIN(groundCoords[SW][1], groundCoords[SE][1]);
    eastMostSample =  ((int) (eastMost / spatialResolution[0]))
		     * (int) spatialResolution[0];
    westMostSample =  ((int) ((westMost + comp) / spatialResolution[0]))
		     * (int) spatialResolution[0] ;
    northMostSample = ((int) (northMost / spatialResolution[1]))
		     * (int) spatialResolution[1] ;
    southMostSample = ((int) ((southMost + comp) / spatialResolution[1]))
		     * (int) spatialResolution[1] ;
    
	columnCount = (eastMostSample  - westMostSample)
		  / (int) spatialResolution[0] + 1;
    rowCount    = (northMostSample - southMostSample)
		  / (int) spatialResolution[1] + 1;

    if (columnCount != profileDimension[1])
	  columnCount =MIN( profileDimension[1], columnCount);

for (c = 1; c <= columnCount; c++) 
 {
  fscanf(File, "%d%d%d%d",
		 &profileID[0],        /* 1 */
		 &profileID[1],        /* 1 */
		 &profileSize[0],      /* 2 */
		 &profileSize[1]);     /* 2 */

       fscanf(File,"%24c", inText);
       Dest = strchr(inText,'D');  *Dest = 'E';
       planCoords[0]   = strtod(inText,&junk);     /* 3 */
	  fscanf(File,"%24c", inText);
       Dest = strchr(inText,'D');  *Dest = 'E';
       planCoords[1]   = strtod(inText,&junk);     /* 3 */
	   fscanf(File,"%24c", inText);
       Dest = strchr(inText,'D');  *Dest = 'E';
       localElevation  = strtod(inText,&junk);     /* 4 */
	 fscanf(File,"%24c", inText);
       Dest = strchr(inText,'D');  *Dest = 'E';
       elevExtremea[0] = strtod(inText,&junk);     /* 5 */
	   fscanf(File,"%24c", inText);
       Dest = strchr(inText,'D');  *Dest = 'E';
       elevExtremea[1] = strtod(inText,&junk);     /* 5 */

       lastProfile =  profileID[1];

       firstRow = abs(((int) (planCoords[1] - southMostSample))
		 / (int) spatialResolution[1]);
       lastRow = firstRow + profileSize[0] - 1;

       for ( r = 0 ; r < firstRow  ; r++ ) 
		   base[r] = 0;

/*     read in all the data for this column */
       for (r = firstRow; r <= lastRow; r++ )
       {
	  fscanf(File, "%6d",	&tempInt);
	   base[r] = tempInt;
       }

    double          tempFloat;

   for (r = firstRow; r <= lastRow; r += rowInt) 
   {
    tempFloat = (float) base[r]  * verticalScale;
 	Terrain->position(planCoords[0], tempFloat, planCoords[1]);

	Ogre::Real u = 0.0;
	Ogre::Real v = 0.0;

	if (planCoords[0] > LowerLeftX && planCoords[0] < UpperRightX)
	{
		u = (planCoords[0] - LowerLeftX) / (UpperRightX - LowerLeftX);
	}

	if (planCoords[1] > LowerLeftY && planCoords[1] < UpperRightY)
	{
		v = (planCoords[1] - LowerLeftY) / (UpperRightY - LowerLeftY);
	}

	Terrain->textureCoord(u, v); 
	planCoords[1] += deltaY;
   }
 }

 Terrain->end();
 fclose(File);

	Ogre::SceneNode* node = SceneManager->getRootSceneNode()->createChildSceneNode();
	node->setPosition(0, 0, 0);
	node->attachObject(Terrain);

	Ogre::AxisAlignedBox Box = Terrain->getBoundingBox();
	Ogre::Vector3 Center = Box.getCenter();

	Ogre::Vector3 Target = Center;
	Ogre::Vector3 Position = Center;

	Position[1] += 5000.0;
	m_Camera->setPosition(Position);
	m_Camera->lookAt(Target);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:101,代码来源:GeoImageView.cpp


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