Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreTerrainSceneManager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                         terrainscenemanager.h  -  description
00003                            -------------------
00004   begin                : Mon Sep 23 2002
00005   copyright            : (C) 2002 by Jon Anderson
00006   email                : janders@users.sf.net
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef TERRAINSCENEMANAGER_H
00019 #define TERRAINSCENEMANAGER_H
00020 
00021 #include <OgreOctreeSceneManager.h>
00022 #include <OgreTerrainRenderable.h>
00023 
00024 
00025 namespace Ogre
00026 {
00027 
00028 class Image;
00029 
00030 typedef std::vector < TerrainRenderable * > TerrainRow;
00031 typedef std::vector < TerrainRow > Terrain2D;
00032 
00033 
00039 class TerrainSceneManager : public OctreeSceneManager
00040 {
00041 public:
00042     TerrainSceneManager( );
00043     virtual ~TerrainSceneManager( );
00044 
00047     void setWorldGeometry( const String& filename );
00048 
00050     virtual void _updateSceneGraph( Camera * cam );
00051 
00053     virtual void _renderVisibleObjects( void );
00054 
00056     virtual void _findVisibleObjects ( Camera * cam );
00057 
00059     float getHeightAt( float x, float y );
00060 
00061 
00062     bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result );
00063 
00064 
00066     Vector3 & getNormalAt( float x, float y )
00067     {
00068         return mTempNormal;
00069     };
00070 
00074     TerrainRenderable * getTerrainTile( const Vector3 & pt );
00075 
00076 
00077 protected:
00078 
00079     bool _checkSize( int s )
00080     {
00081         for ( int i = 0; i < 16; i++ )
00082         {
00083             printf( "Checking...%d\n", ( 1 << i ) + 1 );
00084 
00085             if ( s == ( 1 << i ) + 1 )
00086                 return true;
00087         }
00088 
00089         return false;
00090 
00091     }
00092 
00093 
00094     int mNumTiles;
00095 
00096     int mTileSize;
00097 
00098     Vector3 mTempNormal;
00099 
00100     Vector3 mScale;
00101 
00102     Material *mTerrainMaterial;
00103 
00104     SceneNode * mTerrainRoot;
00105 
00106     Terrain2D mTiles;
00107 
00108 };
00109 
00110 }
00111 
00112 #endif

Copyright © 2002 by The OGRE Team