Exemplo n.º 1
0
 public override void Dispose()
 {
     TerrainRenderer.Dispose();
     TerrainUpdater.Dispose();
     TerrainSerializer.Dispose();
     Terrain.Dispose();
 }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            keyboard = new GameKeyboard(Keyboard);
            currentMap = new Map(AssetDirectory + "/DATA/MAPS4/MAP01.SWD");
            GL.ClearColor(Color.Black);
            float zoom = 1.0f;
            cameraPosition = new Vector3(0, -((cameraHeight * TerrainRenderer.triangleWidth) / TerrainRenderer.triangleHeight), cameraHeight);//new Vector3(0, -cameraHeight * (float)Math.Tan(Math.Asin(TerrainRenderer.triangleHeight / TerrainRenderer.triangleWidth)), cameraHeight);
            cameraTarget = new Vector3(0, 0, 0);
            //projection = Matrix4.CreatePerspectiveFieldOfView((float)(Math.PI / 2.0), (float)ClientSize.Width / (float)ClientSize.Height, 0.001f, 1000.0f);
            projection = Matrix4.CreateOrthographic((float)ClientSize.Width / (50 * zoom), (float)ClientSize.Height / (50 * zoom), 0.001f, 1000.0f);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);
            terrainRenderer = new TerrainRenderer(currentMap);
        }
Exemplo n.º 3
0
 public void Draw(Camera camera, int drawOrder)
 {
     if (TerrainRenderingEnabled)
     {
         if (drawOrder == m_drawOrders[0])
         {
             TerrainUpdater.PrepareForDrawing(camera);
             TerrainRenderer.PrepareForDrawing(camera);
             TerrainRenderer.DrawOpaque(camera);
             TerrainRenderer.DrawAlphaTested(camera);
         }
         else if (drawOrder == m_drawOrders[1])
         {
             TerrainRenderer.DrawTransparent(camera);
         }
     }
 }
Exemplo n.º 4
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemViews                = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     SubsystemGameInfo               = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemParticles            = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemPickables            = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemBlockBehaviors       = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     SubsystemAnimatedTextures       = base.Project.FindSubsystem <SubsystemAnimatedTextures>(throwOnError: true);
     SubsystemFurnitureBlockBehavior = base.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true);
     SubsystemPalette                = base.Project.FindSubsystem <SubsystemPalette>(throwOnError: true);
     Terrain                = new Terrain();
     TerrainRenderer        = new TerrainRenderer(this);
     TerrainUpdater         = new TerrainUpdater(this);
     TerrainSerializer      = new TerrainSerializer22(Terrain, SubsystemGameInfo.DirectoryName);
     BlockGeometryGenerator = new BlockGeometryGenerator(Terrain, this, base.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true), SubsystemFurnitureBlockBehavior, base.Project.FindSubsystem <SubsystemMetersBlockBehavior>(throwOnError: true), SubsystemPalette);
     if (string.CompareOrdinal(SubsystemGameInfo.WorldSettings.OriginalSerializationVersion, "2.1") <= 0)
     {
         TerrainGenerationMode terrainGenerationMode = SubsystemGameInfo.WorldSettings.TerrainGenerationMode;
         if (terrainGenerationMode == TerrainGenerationMode.FlatContinent || terrainGenerationMode == TerrainGenerationMode.FlatIsland)
         {
             TerrainContentsGenerator = new TerrainContentsGeneratorFlat(this);
         }
         else
         {
             TerrainContentsGenerator = new TerrainContentsGenerator21(this);
         }
     }
     else
     {
         TerrainGenerationMode terrainGenerationMode2 = SubsystemGameInfo.WorldSettings.TerrainGenerationMode;
         if (terrainGenerationMode2 == TerrainGenerationMode.FlatContinent || terrainGenerationMode2 == TerrainGenerationMode.FlatIsland)
         {
             TerrainContentsGenerator = new TerrainContentsGeneratorFlat(this);
         }
         else
         {
             TerrainContentsGenerator = new TerrainContentsGenerator22(this);
         }
     }
 }