GrassStar.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace MTE
  5. {
  6. [Serializable]
  7. public class GrassStar
  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 = -1;
  24. [SerializeField]
  25. private Vector4 lightmapScaleOffset = new Vector4(1, 1, 0, 0);
  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. }
  52. public Vector4 LightmapScaleOffset
  53. {
  54. get { return this.lightmapScaleOffset; }
  55. }
  56. /// <summary>Save lightmapping data to this GrassStar.</summary>
  57. /// <param name="lightmapIndex"></param>
  58. /// <param name="lightmapScaleOffset"></param>
  59. public void SaveLightmapData(int lightmapIndex, Vector4 lightmapScaleOffset)
  60. {
  61. this.lightmapIndex = lightmapIndex;
  62. this.lightmapScaleOffset = lightmapScaleOffset;
  63. }
  64. /// <summary>Initialize this GrassStar.</summary>
  65. /// <param name="material"></param>
  66. /// <param name="position">position in world space</param>
  67. /// <param name="rotationY">rotation Y (Euler angles Y)</param>
  68. /// <param name="width">width of a quad</param>
  69. /// <param name="height">height of a quad</param>
  70. public void Init(Material material,
  71. Vector3 position, float rotationY, float width, float height)
  72. {
  73. this.material = material;
  74. this.position = position;
  75. this.rotationY = rotationY;
  76. this.width = width;
  77. this.height = height;
  78. }
  79. }
  80. }