GrassQuad.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace MTE
  5. {
  6. [Serializable]
  7. public class GrassQuad
  8. {
  9. [Header("Basic")]
  10. [SerializeField]
  11. private Material material;
  12. [SerializeField]
  13. private Vector3 position;
  14. [SerializeField]
  15. private float rotationY;
  16. [SerializeField]
  17. private float width;
  18. [SerializeField]
  19. private float height;
  20. [Space(10)]
  21. [Header("Lightmap")]
  22. [SerializeField]
  23. private int lightmapIndex;
  24. [SerializeField]
  25. private Vector4 lightmapScaleOffset;
  26. public Material Material
  27. {
  28. get { return this.material; }
  29. }
  30. public Vector3 Position
  31. {
  32. get { return this.position; }
  33. set { this.position = value; }
  34. }
  35. public float RotationY
  36. {
  37. get { return this.rotationY; }
  38. set { this.rotationY = value; }
  39. }
  40. public float Width
  41. {
  42. get { return this.width; }
  43. }
  44. public float Height
  45. {
  46. get { return this.height; }
  47. }
  48. public int LightmapIndex
  49. {
  50. get { return this.lightmapIndex; }
  51. set { this.lightmapIndex = value; }
  52. }
  53. public Vector4 LightmapScaleOffset
  54. {
  55. get { return this.lightmapScaleOffset; }
  56. set { this.lightmapScaleOffset = value; }
  57. }
  58. /// <summary>Save lightmapping data to this GrassStar.</summary>
  59. /// <param name="lightmapIndex"></param>
  60. /// <param name="lightmapScaleOffset"></param>
  61. public void SaveLightmapData(int lightmapIndex, Vector4 lightmapScaleOffset)
  62. {
  63. this.lightmapIndex = lightmapIndex;
  64. this.lightmapScaleOffset = lightmapScaleOffset;
  65. }
  66. /// <summary>Initialize this GrassStar.</summary>
  67. /// <param name="material"></param>
  68. /// <param name="position">position in world space</param>
  69. /// <param name="rotationY">rotation Y (Euler angles Y)</param>
  70. /// <param name="width">width of a quad</param>
  71. /// <param name="height">height of a quad</param>
  72. public void Init(Material material, Vector3 position, float rotationY, float width, float height)
  73. {
  74. this.material = material;
  75. this.position = position;
  76. this.rotationY = rotationY;
  77. this.width = width;
  78. this.height = height;
  79. }
  80. }
  81. }