RcHeightfield.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
  3. recast4j copyright (c) 2015-2019 Piotr Piastucki piotr@jtilia.org
  4. DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
  5. This software is provided 'as-is', without any express or implied
  6. warranty. In no event will the authors be held liable for any damages
  7. arising from the use of this software.
  8. Permission is granted to anyone to use this software for any purpose,
  9. including commercial applications, and to alter it and redistribute it
  10. freely, subject to the following restrictions:
  11. 1. The origin of this software must not be misrepresented; you must not
  12. claim that you wrote the original software. If you use this software
  13. in a product, an acknowledgment in the product documentation would be
  14. appreciated but is not required.
  15. 2. Altered source versions must be plainly marked as such, and must not be
  16. misrepresented as being the original software.
  17. 3. This notice may not be removed or altered from any source distribution.
  18. */
  19. using DotRecast.Core;
  20. namespace DotRecast.Recast
  21. {
  22. /** Represents a heightfield layer within a layer set. */
  23. public class RcHeightfield
  24. {
  25. /** The width of the heightfield. (Along the x-axis in cell units.) */
  26. public readonly int width;
  27. /** The height of the heightfield. (Along the z-axis in cell units.) */
  28. public readonly int height;
  29. /** The minimum bounds in world space. [(x, y, z)] */
  30. public readonly RcVec3f bmin;
  31. /** The maximum bounds in world space. [(x, y, z)] */
  32. public RcVec3f bmax;
  33. /** The size of each cell. (On the xz-plane.) */
  34. public readonly float cs;
  35. /** The height of each cell. (The minimum increment along the y-axis.) */
  36. public readonly float ch;
  37. /** Heightfield of spans (width*height). */
  38. public readonly RcSpan[] spans;
  39. /** Border size in cell units */
  40. public readonly int borderSize;
  41. public RcHeightfield(int width, int height, RcVec3f bmin, RcVec3f bmax, float cs, float ch, int borderSize)
  42. {
  43. this.width = width;
  44. this.height = height;
  45. this.bmin = bmin;
  46. this.bmax = bmax;
  47. this.cs = cs;
  48. this.ch = ch;
  49. this.borderSize = borderSize;
  50. spans = new RcSpan[width * height];
  51. }
  52. }
  53. }