5 using System.Collections.Generic;
12 public static bool xgmml =
false;
26 public override void Init () {
34 stickMaterials =
new Material[sticks.Length];
36 for (
int i=0; i< sticks.Length; i++){
37 sticks[i].GetComponent<Renderer>().enabled =
true;
38 sticks[i].GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.Off;
39 sticks[i].GetComponent<Renderer>().receiveShadows =
false;
40 stickMaterials[i] = sticks[i].GetComponent<Renderer>().material;
48 for(
int i=0;i<sticks.Length;i++)
49 GameObject.Destroy(sticks[i].gameObject);
53 public override void SetColor(Color col, List<string> atoms,
string residue =
"All",
string chain =
"All"){}
54 public override void SetColor(Color col,
int atomNum){}
55 public override void SetRadii(List<string> atoms,
string residue =
"All",
string chain =
"All"){}
58 public override GameObject
GetBall(
int id){
66 attenuation = enabling? 1f : 0f;
69 for (
int i=0; i< sticks.Length; i++)
70 stickMaterials[i].SetFloat(
"_Attenuation", attenuation);
78 for (
int i=0; i< sticks.Length; i++) {
82 stickMaterials[i].SetColor(
"_Color", atom1Color);
83 stickMaterials[i].SetColor(
"_Color2",atom2Color);
95 for (
int i=0; i< sticks.Length; i++) {
96 stickMaterials[i].SetTexture(
"_MatCap", (
MoleculeModel.
atoms[sticks[i].
atomnumber1] as GameObject).GetComponent<Renderer>().material.GetTexture(
"_MatCap"));
97 stickMaterials[i].SetTexture(
"_MatCap2", (
MoleculeModel.
atoms[sticks[i].
atomnumber2] as GameObject).GetComponent<Renderer>().material.GetTexture(
"_MatCap"));
101 for (
int i=0; i< sticks.Length; i++) {
102 stickMaterials[i].SetTexture(
"_MatCap", (Texture)Resources.Load(
"lit_spheres/divers/daphz05"));
103 stickMaterials[i].SetTexture(
"_MatCap2", (Texture)Resources.Load(
"lit_spheres/divers/daphz05"));
117 for (
int i=0; i< sticks.Length; i++) {
121 Vector3 posAtom1 =
new Vector3(fposAtom1[0],fposAtom1[1],fposAtom1[2]);
122 Vector3 posAtom2 =
new Vector3(fposAtom2[0],fposAtom2[1],fposAtom2[2]);
124 stickMaterials[i].SetVector(
"_TexPos1", posAtom1);
125 sticks[i].transform.position = posAtom1;
126 stickMaterials[i].SetVector(
"_TexPos2", posAtom2);
133 for (
int i=0; i< sticks.Length; i++) {
138 stickMaterials[i].SetVector(
"_TexPos1", posAtom1);
139 sticks[i].transform.position = posAtom1;
140 stickMaterials[i].SetVector(
"_TexPos2", posAtom2);
145 for (
int i=0; i< sticks.Length; i++) {
150 stickMaterials[i].SetColor(
"_Color", colAtom1);
151 stickMaterials[i].SetColor(
"_Color2",colAtom2);
155 Vector3 atomOne = Vector3.zero;
156 Vector3 atomTwo = Vector3.zero;
162 stickMaterials[i].SetVector(
"_TexPos1", posAtom1);
163 sticks[i].transform.position = posAtom1;
164 stickMaterials[i].SetVector(
"_TexPos2", posAtom2);
174 for(
int i=0;i<sticks.Length;i++){
190 stickMaterials[i].SetFloat(
"_Rayon1", radiusAtom1);
191 stickMaterials[i].SetFloat(
"_Rayon2", radiusAtom2);
195 stickMaterials[i].SetFloat(
"_Rayon1", radiusAtom1/2);
196 stickMaterials[i].SetFloat(
"_Rayon2", radiusAtom2/2);
245 for (
int i=0; i< sticks.Length; i++)
246 sticks[i].GetComponent<Renderer>().enabled =
true;
252 Debug.Log(
"StickManager: DisableRenderers()" + sticks.Length);
253 for (
int i=0; i< sticks.Length; i++)
254 sticks[i].GetComponent<Renderer>().enabled =
false;
259 for(
int i=0; i<sticks.Length; i++){
260 sticks[i].GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.On;
261 sticks[i].GetComponent<Renderer>().receiveShadows =
true;
262 sticks[i].GetComponent<Renderer>().material.shader = Shader.Find(
"FvNano/HyperSticks Shadow GL_D3D");
267 for(
int i=0; i<sticks.Length; i++){
268 sticks[i].GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.Off;
269 sticks[i].GetComponent<Renderer>().receiveShadows =
false;
270 sticks[i].GetComponent<Renderer>().material.shader = Shader.Find(
"FvNano/HyperSticks GL_D3D");
275 for(
int i=0; i<sticks.Length; i++){
280 sticks[i].GetComponent<Renderer>().enabled = ! hide;
285 for(
int i=0; i<sticks.Length; i++)
288 resetBrightness =
false;
291 for(
int i=0; i<sticks.Length; i++)
292 sticks[i].GetComponent<Renderer>().material.SetFloat(
"_Shininess", shininess);
317 wasInteractiveColored =
true;
319 else if(wasInteractiveColored){
321 wasInteractiveColored =
false;
324 wasInteractive =
true;
327 if (xgmml && (oldDepthFactor!=depthFactor)) {
337 for(
int i=0;i<sticks.Length;i++)
344 for(
int i=0;i<sticks.Length;i++)
void ResetColorsInteractive()
static StickUpdate[] sticks
Material[] stickMaterials
override void Init()
Initializes this instance of the manager.
override GameObject GetBall(int id)
static bool resetBrightness
override void DisableRenderers()
Disables the renderers for all objects managed by the instance of the manager.
override void ResetIMDSimulationPositions()
override void ResetRadii()
Adjusts the stick radii, which is needed to match the size of the balls when their radii are modified...
override void SetColor(Color col, List< string > atoms, string residue="All", string chain="All")
override void SetColor(Color col, int atomNum)
static List< AtomModel > atomsTypelist
The type of each atom.
override void DisableShadows()
static List< Vector3 > atomsIMDSimulationLocationlist
The coordinates of each atom, simulated through an IMD simulation.
override void ResetPositions()
Resets the bond vectors, which is necessary when the balls move.
override void EnableRenderers()
Enables the renderers for all objects managed by the instance of the manager.
override void showHydrogens(bool hide)
static void setCurrentBondManager(GenericManager manager)
!WiP Includes FLAGS of GUI.
override void EnableShadows()
static bool resetShininess
!WiP manage GUI, and provide static strings for the GUI.
static List< Color > atomsColorList
The color of each atom.
static string file_extension
override void DestroyAll()
static List< int[]> bondEPList
The bonds between atoms.
static bool bondsReadyToBeReset
static bool wasInteractiveColored
static float oldDepthFactor
static bool toggle_NA_INTERACTIVE
static bool wasInteractive
static float globalRadius
override void SetRadii(int atomNum)
override void SetRadii(List< string > atoms, string residue="All", string chain="All")
static List< float > atomsLocalScaleList
override void ToggleDistanceCueing(bool enabling)
static List< float[]> atomsLocationlist
The coordinates of each atom.
void ResetPositionsInteractive()