3 using System.Collections.Generic;
29 hstick_meshes =
new GameObject[0];
35 public override void Init () {
37 texturesToUpdate =
new List<int>();
38 materialsSticks =
new Material[hstick_meshes.Length];
39 texturesSticks =
new Texture2D[hstick_meshes.Length];
40 for(
int i=0;i<hstick_meshes.Length;i++){
41 materialsSticks[i] = hstick_meshes[i].GetComponent<Renderer>().material;
42 texturesSticks[i] = (Texture2D)materialsSticks[i].mainTexture;
52 for(
int i=0;i<hstick_meshes.Length;i++)
53 GameObject.Destroy(hstick_meshes[i]);
54 hstick_meshes =
new GameObject[0];
61 attenuation = enabling? 1f : 0f;
62 for (
int i=0; i<hstick_meshes.Length; i++)
63 hstick_meshes[i].GetComponent<Renderer>().material.SetFloat(
"_Attenuation", attenuation);
81 public override void SetColor(Color col, List<string> atom,
string residue =
"All",
string chain =
"All"){
94 public override void SetColor(Color col,
int atomNum) {
109 public override void SetRadii(List<string> atom,
string residue =
"All",
string chain =
"All"){
140 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
148 if(coordStickTexture.TryGetValue(i,out res)){
159 texturesToUpdate.Add(res.Key);
171 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
172 Vector3 atomOne = Vector3.zero;
173 Vector3 atomTwo = Vector3.zero;
179 if(coordStickTexture.TryGetValue(i,out res)){
190 texturesToUpdate.Add(res.Key);
203 for (
int i=0; i< hstick_meshes.Length; i++)
204 hstick_meshes[i].GetComponent<Renderer>().enabled =
false;
213 for (
int i=0; i< hstick_meshes.Length; i++)
214 hstick_meshes[i].GetComponent<Renderer>().enabled =
true;
219 for (
int i=0; i< hstick_meshes.Length; i++){
220 hstick_meshes[i].GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.On;
221 hstick_meshes[i].GetComponent<Renderer>().receiveShadows =
true;
222 hstick_meshes[i].GetComponent<Renderer>().material.shader = Shader.Find(
"FvNano/Sticks HyperBalls Shadow Merged");
226 for (
int i=0; i< hstick_meshes.Length; i++){
227 hstick_meshes[i].GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.Off;
228 hstick_meshes[i].GetComponent<Renderer>().receiveShadows =
false;
229 hstick_meshes[i].GetComponent<Renderer>().material.shader = Shader.Find(
"FvNano/Sticks HyperBalls Merged");
235 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
243 if(coordStickTexture.TryGetValue(i,out res)){
245 texturesSticks[res.Key].SetPixel(10,res.Value,Vector4.zero);
247 texturesSticks[res.Key].SetPixel(10,res.Value,Vector4.one);
249 texturesToUpdate.Add(res.Key);
258 for(
int i=0;i<materialsSticks.Length;i++)
260 resetBrightness =
false;
263 for(
int i=0;i<materialsSticks.Length;i++){
264 materialsSticks[i].SetTexture(
"_MatCap",texture);
265 materialsSticks[i].SetTexture(
"_MatCap2",texture);
268 resetTexture =
false;
271 for(
int i=0;i<materialsSticks.Length;i++)
277 for(
int i=0;i<materialsSticks.Length;i++)
283 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
289 if(coordStickTexture.TryGetValue(i,out res)){
299 texturesToUpdate.Add(res.Key);
308 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
316 if(coordStickTexture.TryGetValue(i,out res)){
317 texturesSticks[res.Key].SetPixel(2,res.Value,colAtom1);
318 texturesSticks[res.Key].SetPixel(3,res.Value,colAtom2);
319 texturesToUpdate.Add(res.Key);
327 for(
int i=0;i<materialsSticks.Length;i++)
328 materialsSticks[i].SetFloat(
"_Shininess",shininess);
329 resetShininess =
false;
334 List<int> idtex = texturesToUpdate.Distinct().ToList();
335 foreach(
int id in idtex){
337 texturesSticks[id].Apply(
false,
false);
340 texturesToUpdate.Clear();
344 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
350 if(idAtom1 == idAtom || idAtom2 == idAtom) {
351 if(coordStickTexture.TryGetValue(i,out res)){
353 texturesSticks[res.Key].SetPixel(10,res.Value,Vector4.one);
355 texturesSticks[res.Key].SetPixel(10,res.Value,Vector4.zero);
357 texturesToUpdate.Add(res.Key);
363 KeyValuePair<int,int> res =
new KeyValuePair<int,int>();
365 if(coordStickTexture.TryGetValue(i,out res)){
366 texturesSticks[res.Key].SetPixel(10,res.Value,Vector4.one);
367 texturesToUpdate.Add(res.Key);
override void DisableRenderers()
Disables the renderers for the entire set of balls and sticks.
static bool resetShininess
override GameObject GetBall(int id)
Gets the GameObject from hballs at the position "id".
override void showHydrogens(bool hide)
override void ResetPositions()
Resets the positions of all balls.
override void SetColor(Color col, int atomNum)
Sets the color of a specific atom.
override void ResetRadii()
GameObject[] hstick_meshes
override void Init()
Initalizes this instance.
override void SetRadii(List< string > atom, string residue="All", string chain="All")
Changes the scale of the atoms.
Dictionary< int, KeyValuePair< int, int > > coordStickTexture
override void ToggleDistanceCueing(bool enabling)
override void DisableShadows()
static List< AtomModel > atomsTypelist
The type of each atom.
Texture2D[] texturesSticks
static List< Vector3 > atomsIMDSimulationLocationlist
The coordinates of each atom, simulated through an IMD simulation.
override void ResetIMDSimulationPositions()
Resets the positions of all balls.
static Vector4 EncodeFloatRGBA(float v)
override void DestroyAll()
Disable and destroys all the Sticks.
override void SetColor(Color col, List< string > atom, string residue="All", string chain="All")
Sets the color of atoms.
void hideBondForAtom(int idAtom, bool show)
override void EnableRenderers()
Enables the renderers for the entire set of balls and sticks.
static bool resetBrightness
static void setCurrentBondManager(GenericManager manager)
Material[] materialsSticks
static List< Color > atomsColorList
The color of each atom.
List< int > texturesToUpdate
override void SetRadii(int id)
Changes the scale for Atom selection.
static List< int[]> bondEPList
The bonds between atoms.
override void EnableShadows()
static float globalRadius
static List< float > atomsLocalScaleList
static List< float[]> atomsLocationlist
The coordinates of each atom.