Beispiel #1
0
    void SendMoleculeDataToRenderer()
    {
        // Molecule data to be transfered to the renderer, do not modify
        var positions = new Vector4[GameObjects.Count];
        var rotations = new Vector4[GameObjects.Count];
        var states    = new int[GameObjects.Count];
        var types     = new int[GameObjects.Count];
        var colors    = _moleculeColors.ToArray();

        // Push the molecules information into the buffers
        int count = 0;

        foreach (var go in GameObjects.ToArray())
        {
            if (go == null)
            {
                GameObjects.Remove(go);
                continue;
            }

            var molecule = go.GetComponent <MoleculeScript>();

            positions[count] = go.transform.position;
            rotations[count] = Helper.QuanternionToVector4(go.transform.rotation);
            states[count]    = molecule.State;
            types[count]     = molecule.Type;

            count++;
        }

        // Send mol information to the renderer
        _moleculeDisplayScript.UpdateMoleculeData(count, positions, rotations, types, states, colors, Scale, ShowAtomColors);
    }
    void SendMoleculeDataToRenderer()
    {
        // Molecule data to be transfered to the renderer, do not modify
        var positions = new Vector4[_gameObjects.Count];
        var rotations = new Vector4[_gameObjects.Count];
        var states    = new int[_gameObjects.Count];
        var types     = new int[_gameObjects.Count];

        // Push the molecules information into the buffers
        foreach (var molObject in _gameObjects)
        {
            var molecule = molObject.GetComponent <MoleculeScript>();

            positions[molecule.Id] = molObject.transform.position;
            rotations[molecule.Id] = Helper.QuanternionToVector4(molObject.transform.rotation);
            states[molecule.Id]    = molecule.State;
            types[molecule.Id]     = molecule.Type;
        }

        // Send mol information to the renderer
        _moleculeDisplayScript.UpdateMoleculeData(positions, rotations, types, states, Scale, ShowAtomColors);
    }