Exemplo n.º 1
0
 public override void Render(StringBuilder sb)
 {
     if (string.IsNullOrWhiteSpace(DEF) && string.IsNullOrWhiteSpace(USE) && DiffuseColor != null)
     {
         DEF = "Mat" + Guid.NewGuid().ToString();
     }
     AddProperty("DEF", DEF);
     AddProperty("USE", USE);
     AddProperty("diffuseColor", Vector3.ToString(DiffuseColor));
     AddProperty("emissiveColor", Vector3.ToString(EmissiveColor));
     AddProperty("specularColor", Vector3.ToString(SpecularColor));
     AddProperty("textureScale", Vector2.ToString(TextureScale));
     AddProperty("transparency", Transparency == null ? null : Transparency.ToString());
     AddProperty("ambientIntensity", AmbientIntensity == null ? null : AmbientIntensity.ToString());
     AddProperty("shininess", Shininess == null ? null : Shininess.ToString());
     AddProperty("occluded", Occluded.ToSlamString());
     base.Render(sb);
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // update ViewField to camera position
        ViewField.Transform.position    = Camera.main.transform.position;
        ViewField.Transform.eulerAngles = Camera.main.transform.eulerAngles;

        // run intersection analysis
        Inter.Intersection(ViewField, Points, out InView, out OutView, out Occluded,
                           out VV, out Pvecs);

        // paint points accordingly
        for (int i = 0; i < Vertices; i++)
        {
            GameObject child = Parent.transform.Find("Marker" + i.ToString()).gameObject;
            if (InView.FindIndex(x => x == Points[i]) != -1)
            {
                child.GetComponent <MeshRenderer>().material = InViewMaterial;
            }
            else if (Occluded.FindIndex(x => x == Points[i]) != -1)
            {
                child.GetComponent <MeshRenderer>().material = OccludedMaterial;
            }
            else
            {
                child.GetComponent <MeshRenderer>().material = OutViewMaterial;
            }
        }

        if (ViewVectorLabels)
        {
            // control View Vector Labels
            for (int i = 0; i < Points.Count; i++)
            {
                Vector3    pt          = Points[i];
                GameObject VVLabelText = Parent.transform.Find("Text" + i.ToString()).gameObject;
                VVLabelText.GetComponent <TextMesh>().text = viewVectorToStr(VV[i]) +
                                                             "\nP. vector: " + pointToStr(Pvecs[i]);
            }
        }
    }