14 using System.Collections.Generic;
37 shaderDifuse = Shader.Find(
"Diffuse");
38 shaderTransparent = Shader.Find(
"Transparent/Diffuse");
47 for(
int i=0; i<c; i++)
50 o = (GameObject) AtomsHit[i];
51 o.GetComponent<Renderer>().material.shader = shaderTransparent;
52 Color k = o.GetComponent<Renderer>().material.color;
54 o.GetComponent<Renderer>().material.color = k;
56 UnityEngine.Debug.LogWarning(
"Position: "+ o.transform.position);
58 if(!TransparentAtoms.Contains(o))
60 TransparentAtoms.Add(o);
71 for(
int i=0; i<TransparentAtoms.Count; i++)
73 if(!AtomsHitCurrent.Contains(TransparentAtoms[i]))
76 o = (GameObject) TransparentAtoms[i];
77 o.GetComponent<Renderer>().material.shader = shaderDifuse;
78 Color k = o.GetComponent<Renderer>().material.color;
80 o.GetComponent<Renderer>().material.color = k;
82 TransparentAtoms.Remove(o);
86 AtomsHitCurrent.Clear();
97 double distance = Vector3.Distance(transform.position, target) * 0.50;
99 sphere_start = transform.position -
target;
100 float radius = (float) distance / 4;
103 sphere_start = sphere_start.normalized * radius;
108 hits = Physics.SphereCastAll(sphere_start, radius, target - transform.position, (Vector3.Distance(sphere_start, target) - radius) *0.98f, 1);
110 if(hits.Length == 128)
112 while (hits.Length > 0)
114 for(
int j = 0; j<hits.Length; j++)
116 o = hits[j].collider.gameObject;
117 if(o.GetComponent<Renderer>().material.color.a != 0.1f)
119 if(o.GetComponent<Renderer>().material.color.a != 0.1f)
127 hits = Physics.SphereCastAll(sphere_start, radius, target - transform.position, (Vector3.Distance(sphere_start, target) - radius) *0.98f, 1);
130 UnityEngine.Debug.LogWarning(
"Number of hits: "+count);
136 else if(hits.Length > 0)
138 for(
int j = 0; j<hits.Length; j++)
140 o = hits[j].collider.gameObject;
141 if(o.GetComponent<Renderer>().material.color.a != 0.1f)
164 hits = Physics.SphereCastAll(sphere_start, radius, target - transform.position, (Vector3.Distance(sphere_start, target) - radius) *0.98f, 2);
165 while(hits.Length > 0){
166 for(
int j = 0; j<hits.Length; j++)
168 o = hits[j].collider.gameObject;
170 AtomsHitCurrent.Add(o);
172 hits = Physics.SphereCastAll(sphere_start, radius, target - transform.position, (Vector3.Distance(sphere_start, target) - radius) *0.98f, 2);
174 for(
int k=0; k < AtomsHitCurrent.Count; k++)
176 o = (GameObject) AtomsHitCurrent[k];
185 if(f.GetComponent<Renderer>().material.color.a == 1)
187 f.GetComponent<Renderer>().material.shader = shaderDifuse;
193 Gizmos.color = Color.red;
194 Gizmos.DrawRay(sphere_start, target - sphere_start);
void SetDifuseShading(GameObject f)
ArrayList TransparentAtoms
static Vector3 optim_target
3D coordinates of the target.
ArrayList AtomsHitCurrent
!WiP Includes FLAGS of GUI.
void MakeOpaque()
Apply opacity on atoms previously transparent but not in the focus anymore
The GNParameters class regroups settings used for Guided Navigation and GLIC spreading.
void MakeTransparent(int c)
Apply transparence on atoms located between the camera and the target