Problem with setHeightFunction

Lexo

10-04-2012 11:05:28

Hello,

I use Ogre 1.7.3 and ogre-paged 1.1.4
For the Terrain i used the new Terrain system.

I created a Class which create the Terrain and this class also should create the Grass.
In this Class i can't make mTerrainGroup static, but the getTerrainFunction must be static.

Compile Error VS shows me is:
Error 1 error LNK2001: unresolved external symbol "protected: static class Ogre::TerrainGroup * ForestTerrainLoader::mTerrainGroup" (?mTerrainGroup@ForestTerrainLoader@@1PAVTerrainGroup@Ogre@@A) D:\ProjectForest\ProjectForest\ForestTerrainLoader.obj ProjectForest
Error 2 error LNK1120: 1 unresolved externals D:\ProjectForest\ProjectForest\bin\Release\\ProjectForest.exe ProjectForest


TerrainLoaderClass
#ifndef __ForestTerrainLoader_h_
#define __ForestTerrainLoader_h_

#include "ForestLevelLoader.h"
#include "ForestCameraManager.h"

#include <Terrain/OgreTerrain.h>
#include <Terrain/OgreTerrainGroup.h>

#include <PagedGeometryConfig.h>
#include <PagedGeometry.h>
#include <GrassLoader.h>

class ForestTerrainLoader
{
private:
ForestLevelLoader* Levelloader;
ForestCameraManager* CamMgr;
Ogre::SceneManager* mSceneMgr;
Ogre::TerrainGlobalOptions* mTerrainGlobals;
bool mTerrainsImported;

void defineTerrain(long x, long y);
void initBlendMaps(Ogre::Terrain* terrain);
void configureTerrainDefaults(Ogre::Light* light);

public:
ForestTerrainLoader(void);
ForestTerrainLoader(Ogre::SceneManager* mSceneMgr, ForestCameraManager* CamMgr, ForestLevelLoader* Levelloader);
virtual ~ForestTerrainLoader(void);
virtual void setForestTerrainLoader(Ogre::SceneManager* mSceneMgr, ForestCameraManager* CamMgr, ForestLevelLoader* Levelloader);
virtual void createTerrain(void);
virtual void createGrass(void);
virtual void destroyTerrain(void);

protected:
static Ogre::TerrainGroup* mTerrainGroup;
Forests::PagedGeometry *grass;
Forests::GrassLoader *grassLoader;
static float getTerrainHeight(const float x, const float z, void *userData = NULL);
Ogre::Vector3 mTerrainPos;
};

#endif // #ifndef __ForestTerrainLoader_h_

getTerrainFunction
float ForestTerrainLoader::getTerrainHeight(const float x, const float z, void *userData)
{
return mTerrainGroup->getHeightAtWorldPosition(x, 1000, z);
}


i hope somebody can help me.

Lexo

10-04-2012 15:23:28

sorry
i forget to define the static TerrainGroup in the cpp! now it works fine