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 float getHeightAt( float x, float y ); 00057 00058 00059 bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result ); 00060 00061 00063 Vector3 & getNormalAt( float x, float y ) 00064 { 00065 return mTempNormal; 00066 }; 00067 00071 TerrainRenderable * getTerrainTile( const Vector3 & pt ); 00072 00073 00074 protected: 00075 00076 bool _checkSize( int s ) 00077 { 00078 for ( int i = 0; i < 16; i++ ) 00079 { 00080 printf( "Checking...%d\n", ( 1 << i ) + 1 ); 00081 00082 if ( s == ( 1 << i ) + 1 ) 00083 return true; 00084 } 00085 00086 return false; 00087 00088 } 00089 00090 00091 int mNumTiles; 00092 00093 int mTileSize; 00094 00095 Vector3 mTempNormal; 00096 00097 Vector3 mScale; 00098 00099 Material *mTerrainMaterial; 00100 00101 SceneNode * mTerrainRoot; 00102 00103 Terrain2D mTiles; 00104 00105 }; 00106 00107 } 00108 00109 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:51 2004