2using System.Collections;
3using System.Collections.Generic;
4using System.Runtime.Serialization;
12 private string textureName;
14 internal Vector3 pos, scale = Vector3.one * 5;
15 internal float panoramaHeight = 7.0f;
16 private Material panoramaMaterial;
17 private bool loaded =
false;
22 panoramaMaterial = GetComponent<MeshRenderer>().material;
24 panoramaHeight = 7.0f;
34 if (panoramaMaterial.HasProperty(
"_PanoRotation"))
36 panoramaMaterial.SetFloat(
"_PanoRotation", value);
40 transform.eulerAngles = Vector3.up * value;
52 GetComponent<MeshRenderer>().material.mainTexture = value;
53 if (GetComponent<MeshRenderer>().material.HasProperty(
"_PanoTexture"))
54 GetComponent<MeshRenderer>().material.SetTexture(
"_PanoTexture", value);
60 GetComponent<MeshRenderer>().material.mainTexture =
null;
61 if (GetComponent<MeshRenderer>().material.HasProperty(
"_PanoTexture"))
62 GetComponent<MeshRenderer>().material.SetTexture(
"_PanoTexture",
null);
68 if (panoramaMaterial.HasProperty(
"_PanoWorldPos"))
70 panoramaMaterial.SetVector(
"_PanoWorldPos",
new Vector4(transform.position.x, transform.position.y + panoramaHeight, transform.position.z, 0));
82 if (panoramaMaterial ==
null)
88 textureName = pm.textureName;
89 transform.position = pm.pos;
90 transform.localScale = pm.scale;
92 panoramaHeight = pm.panoramaHeight;
94 if (
string.IsNullOrEmpty(textureName))
98 StartCoroutine(LoadPic());
101 IEnumerator LoadPic()
103 yield
return new WaitForEndOfFrame();
106 yield
return new WaitForEndOfFrame();
112 if (GetComponent<MeshRenderer>().material.HasProperty(
"_PanoTexture"))
124 [NaughtyAttributes.Button]
125 private void tesztLoad()
127 GetComponent<MeshRenderer>().material.SetTexture(
"_PanoTexture",
PreviewImage.texture);
133 info.AddValue(
"textureName", textureName);
134 info.AddValue(
"panoramaHeight", panoramaHeight);
142 textureName = info.GetString(
"textureName");
147 panoramaHeight = info.GetSingle(
"panoramaHeight");
static void SetSelection(IEnumerable< GameObject > selection)
Texture2D GetFullRes(string filename)
static GlobalTextureHolder instance
static float StoF(string value)
void GetObjectData(SerializationInfo info, StreamingContext context)
void SetRotation(float value)
void SetHeight(string text)
PanoramaManager(SerializationInfo info, StreamingContext context)
void SetTextureName(string value)
void SetTexture(Texture value)
Since unity doesn't flag the Vector3 as serializable, we need to create our own version....