Пример #1
0
        void LoadTerrain()
        {
            ResourceList LR = parentGame.LoadedResources;
            Dictionary<string, string> LLL = parentGame.Level_Loader.GetLevelLoadList();

            TerrainEngine.TerrainArguments terrainArgument = new TerrainEngine.TerrainArguments();

            terrainArgument.heightMap =         LR.Tex2dList[LLL["Terrain"]];

            terrainArgument.terrainTexture1 = LR.Tex2dList[LLL["TerrainTexture1"]];
            terrainArgument.terrainTexture2 = LR.Tex2dList[LLL["TerrainTexture2"]];
            terrainArgument.terrainTexture3 = LR.Tex2dList[LLL["TerrainTexture3"]];
            terrainArgument.terrainTexture4 = LR.Tex2dList[LLL["TerrainTexture4"]];
            terrainArgument.decalTexture =      LR.Tex2dList[LLL["DecalTexture"]];
            terrainArgument.skyTexture =        LR.Tex2dList[LLL["SkyTexture"]];
            terrainArgument.skyDome =           LR.ModelList[LLL["SkyDome"]].Model_rez;

            terrainArgument.terrainScale = parentGame.Level_Loader.myLevel.terrainScale;

            terrainEngine = new TerrainEngine(
                parentGame,
                MouseCam,
                terrainArgument);
            terrainEngine.LoadContent();

            terrainActor = new TriangleMeshActor(
                parentGame,
                new Vector3(terrainEngine.heightmapPosition.X, 0, terrainEngine.heightmapPosition.Z),
                terrainEngine.terrainScale,
                terrainEngine.heightMap,
                terrainEngine.heightData);
            terrainActor.Body.Immovable = true;
            //terrainActor.Skin.callbackFn += new CollisionCallbackFn(handleCollisionDetection);

            parentGame.Components.Add(terrainActor);
        }