/// TimeSpan timeItTook = (DateTime.Now - start); public void Reloader_Main(OpenGL gl) { if (StaticSettings.S.RequiredReloader && !newThread.IsAlive && !DoWork_IsAlive) { if (!SS.Main.CopiedLastResult) { SS.Main.scene_info.vertexBufferArray.Delete(gl); SS.Main.CopyToReady(); SS.Main.scene_info.CreateVerticesForSquare_not_angled(); DataForDraw_FreshlyPlacedCubes.TemporalList.Clear(); Reloader_TemporalList(); } float scalar = GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.LastPlayerLook, Scene.SS.env.player.coords.NormalizedLook); if (SS.env.player.coords.Player_chunk_position.x >= 0 && SS.env.player.coords.Player_chunk_position.x < CubicalMemory.World.Quantity_of_chunks_in_root && SS.env.player.coords.Player_chunk_position.z >= 0 && SS.env.player.coords.Player_chunk_position.z < CubicalMemory.World.Quantity_of_chunks_in_root) { if ((StaticSettings.S.ReloaderCauseOfChunkRare && ((float)Math.Abs(SS.env.player.coords.Player_chunk_position.x - SS.env.player.coords.Player_chunk_position_OLD.x) > ((float)StaticSettings.S.RangeOfView / 2 - 1) || (float)Math.Abs(SS.env.player.coords.Player_chunk_position.z - SS.env.player.coords.Player_chunk_position_OLD.z) > ((float)StaticSettings.S.RangeOfView / 2 - 1))) || (StaticSettings.S.ReloaderCauseOfChangingChunk && SS.env.player.coords.Player_chunk_position != SS.env.player.coords.Player_chunk_position_OLD) || (StaticSettings.S.RealoderCauseOfPointOfView && scalar < StaticSettings.S.PointOfViewCoefOfDifference) || (StaticSettings.S.RealoderCauseOfSunSided && SS.env.player.coords.Player_cubical_position.y != SS.env.player.coords.Player_cubical_position_OLD.y) || StaticSettings.S.RealoderCauseOfBuildingBlocks || StaticSettings.S.RangeOfView_Old != StaticSettings.S.RangeOfView) { StaticSettings.S.RangeOfView_Old = StaticSettings.S.RangeOfView; newThread = new Thread(Scene.DoWork); newThread.Start(42); SS.env.player.coords.Player_chunk_position_OLD.x = SS.env.player.coords.Player_chunk_position.x; SS.env.player.coords.Player_chunk_position_OLD.z = SS.env.player.coords.Player_chunk_position.z; SS.env.player.coords.Player_cubical_position_OLD.x = SS.env.player.coords.Player_cubical_position.x; SS.env.player.coords.Player_cubical_position_OLD.y = SS.env.player.coords.Player_cubical_position.y; SS.env.player.coords.Player_cubical_position_OLD.z = SS.env.player.coords.Player_cubical_position.z; Console.WriteLine($"Inting My CoThread #{CounterMyCoThread++}"); StaticSettings.S.RealoderCauseOfBuildingBlocks = false; } } } else { } }
public override void initialization() { START_initialization(); int i = 0; int j = 0; int value = 0; if ((value = Scene.SS.env.player.coords.Player_chunk_position.x - StaticSettings.S.RangeOfView) > 0) { i = value + 1; } else { i = 0; } for (; i < Scene.SS.env.cub_mem.world.World_as_Whole.Count() && i < Scene.SS.env.player.coords.Player_chunk_position.x + StaticSettings.S.RangeOfView; i++) { if ((value = Scene.SS.env.player.coords.Player_chunk_position.z - StaticSettings.S.RangeOfView) > 0) { j = value + 1; } else { j = 0; } for (; j < Scene.SS.env.cub_mem.world.World_as_Whole[i].Count() && j < Scene.SS.env.player.coords.Player_chunk_position.z + StaticSettings.S.RangeOfView; j++) { var XYworld = Scene.SS.env.cub_mem.world.World_as_Whole[i][j]; if (Math.Abs(XYworld.xz.x - Scene.SS.env.player.coords.Player_chunk_position.x) < StaticSettings.S.RangeOfView && Math.Abs(XYworld.xz.z - Scene.SS.env.player.coords.Player_chunk_position.z) < StaticSettings.S.RangeOfView) { foreach (var Xcube in XYworld.cubes) { foreach (var XYcube in Xcube) { foreach (var XYZcube in XYcube) { if (XYZcube.IsFilled && !XYZcube.IsTakenForExplosion) { ShaderedScene.CalculateFromMaptoGraphical(XYZcube, ref x, ref y, ref z); //POINT OF VIEWER Scene.SS.env.player.NormalizedToXYWorld.x = Scene.SS.env.player.coords.Player_precise_stepback.x - x; Scene.SS.env.player.NormalizedToXYWorld.y = Scene.SS.env.player.coords.Player_precise_stepback.y - y; Scene.SS.env.player.NormalizedToXYWorld.z = Scene.SS.env.player.coords.Player_precise_stepback.z - z; float range = GeneralProgrammingStuff.vec3_range(Scene.SS.env.player.NormalizedToXYWorld); GeneralProgrammingStuff.vec3_normalize(ref Scene.SS.env.player.NormalizedToXYWorld, range); Scene.SS.env.player.coords.LookForCube(); float scalar = GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.NormalizedToXYWorld, Scene.SS.env.player.coords.NormalizedLook); //POINT OF VIEWER if (!StaticSettings.S.RealoderCauseOfPointOfView || scalar > 0) { //if (!StaticSettings.S.RealoderCauseOfSunSided || // XYworld.xz.x == Scene.SS.env.player.coords.Player_chunk_position.x // && XYworld.xz.z == Scene.SS.env.player.coords.Player_chunk_position.z) // Draw_Quad_Full_Sunsided(x, y, z, localed_range, XYZcube.color, true); //Вроде обычный куб. //else if (!StaticSettings.S.PointOfView_Circled_Visible_Cubes || range < CubicalMemory.Cube.rangeOfTheEdge * CubicalMemory.Chunk.Width * (StaticSettings.S.RangeOfView)) { Draw_Quad_Full_Sunsided_not_angled(x, y, z, localed_range, XYZcube.color); } } } } } } } } } END_initialization(); }
public virtual void Draw_Quad_Full_Sunsided( float x, float y, float z, float localed_range, System.Drawing.Color _colour, bool SunSided_DRAWFULL = false) { //Front if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(0, 0, -1)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSz ( x, //Start_x y, //Start_z x + localed_range, //End_x y + localed_range, //End_z z, //Height _colour); } //Back if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(0, 0, 1)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSz ( x, //Start_x y, //Start_z x + localed_range, //End_x y + localed_range, //End_z z + localed_range, //Height _colour //Height ); } //Left if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(-1, 0, 0)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSx ( y, //Start_x z, //Start_z y + localed_range, //End_x z + localed_range, //End_z x, //Height _colour //Height ); } //Right if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(1, 0, 0)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSx ( y, //Start_x z, //Start_z y + localed_range, //End_x z + localed_range, //End_z x + localed_range, //Height _colour //Height ); } //Top if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(0, 1, 0)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSy ( x, //Start_x z, //Start_z x + localed_range, //End_x z + localed_range, //End_z y + localed_range, //Height _colour //Height ); } //Bottom if (SunSided_DRAWFULL || -GeneralProgrammingStuff.vec3_scalar(Scene.SS.env.player.coords.NormalizedLook, new vec3(0, -1, 0)) < StaticSettings.S.SunSidedCoef) { Draw_Quad_Perpendecular_to_OSy ( x, //Start_x z, //Start_z x + localed_range, //End_x z + localed_range, //End_z y, //Height _colour //Height ); } }