ogremeshmanagerwrapper.h

来自「使用stl技术,(还没看,是听说的)」· C头文件 代码 · 共 78 行

H
78
字号
#ifndef PYOGRE_OGREMESHMANAGERWRAPPER_H_INCLUDED
# define PYOGRE_OGREMESHMANAGERWRAPPER_H_INCLUDED

# include <OgreMeshManager.h>
# include <OgrePlane.h>


struct PlaneSpecification
{
   PlaneSpecification( const Ogre::Plane &plane_,
                       Ogre::Real width_, 
                       Ogre::Real height_ )
      : plane( plane_ )
      , width( width_ )
      , height( height_ )
      , xsegments( 1 )
      , ysegments( 1 )
      , normals( true )
      , numTexCoordSets( 1 )
      , uTile( 1.0f )
      , vTile( 1.0f )
      , upVector( Ogre::Vector3::UNIT_Y )
      , vertexBufferUsage( Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY )
	   , indexBufferUsage( Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY )
      , vertexShadowBuffer( true ) 
      , indexShadowBuffer( true )
   {
   }

   void setTesselation( int xsegments_, int ysegments_ )
   {
      xsegments = xsegments_;
      ysegments = ysegments_;
   }

   void setTiling( Ogre::Real uTile_, Ogre::Real vTile_ )
   {
      uTile = uTile_;
      vTile = vTile_;
   }

   Ogre::Plane plane;
   Ogre::Real width;
   Ogre::Real height;
   int xsegments;
   int ysegments;
   bool normals;
   int numTexCoordSets;
   Ogre::Real uTile;
   Ogre::Real vTile;
   Ogre::Vector3 upVector;
   Ogre::HardwareBuffer::Usage vertexBufferUsage;
   Ogre::HardwareBuffer::Usage indexBufferUsage;
	bool vertexShadowBuffer;
   bool indexShadowBuffer;
};


inline 
Ogre::Mesh *MeshManager_createPlane_wrapper( Ogre::MeshManager *manager, 
                                             const Ogre::String &name,
                                             const PlaneSpecification &specification )
{
   return manager->createPlane( 
                         name, specification.plane, 
                         specification.width, specification.height, 
                         specification.xsegments, specification.ysegments, 
                         specification.normals, specification.numTexCoordSets, 
                         specification.uTile, specification.vTile, 
                         specification.upVector, 
                         specification.vertexBufferUsage, specification.indexBufferUsage, 
                         specification.vertexShadowBuffer, specification.indexShadowBuffer );
}



#endif // PYOGRE_OGREMESHMANAGERWRAPPER_H_INCLUDED

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?