Пример #1
0
    // Use this for initialization
    public void Live()
    {
        vBuf = gameObject.AddComponent <vBuffer>() as vBuffer;

        updater = gameObject.AddComponent <vBuffUpdater>() as vBuffUpdater;
        updater.computeShader = physicsShader;
        updater.update        = true;
        updater.resetOnStart  = true;


        vbt  = gameObject.AddComponent <vBuff_Transform>() as vBuff_Transform;
        tBuf = gameObject.AddComponent <tBuffer>() as tBuffer;


        dvbwt   = gameObject.AddComponent <DisplayVertBufferWithTriangles>() as DisplayVertBufferWithTriangles;
        dvbwt.m = new Material(renderer);
        //dvbwt.enabled = false;

        vbh       = gameObject.AddComponent <vBuff_Human>() as vBuff_Human;
        vbh.human = humanBuffer;

        vdo = gameObject.AddComponent <vBuff_DataOut>() as vBuff_DataOut;
        vdo.gatherShader = gatherShader;

        tBuf.Live();
        vBuf.Live();
        updater.Live();
        vbt.Live();
        vbh.Live();
        vdo.Live();
        dvbwt.Live();

        GetComponent <MeshRenderer>().enabled = false;
    }
Пример #2
0
    //public delegate void WhenReady(ComputeBuffer b);
    //public event WhenReady OnWhenReady;


    public override void Live()
    {
        buffersLoaded = 0;

        if (vBuf == null)
        {
            vBuf = GetComponent <vBuffer>();
        }
        if (tBuf == null)
        {
            tBuf = GetComponent <tBuffer>();
        }

//		print("vBufff");
//		print( vBuf.ready );

        if (vBuf.ready == true)
        {
            WhenBufferReady(vBuf._buffer);
        }

        if (tBuf.ready == true)
        {
            WhenBufferReady(tBuf._buffer);
        }


        vBuf.OnWhenReady += WhenBufferReady;
        tBuf.OnWhenReady += WhenBufferReady;
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        vBuffer vBuf = GetComponent <vBuffer>() as vBuffer;

        tBuffer tBuf = GetComponent <tBuffer>() as tBuffer;
        hBuffer hBuf = GetComponent <hBuffer>() as hBuffer;

        vBuffUpdater    baseUpdater = GetComponent <vBuffUpdater>() as vBuffUpdater;
        vBuff_Transform vbt         = GetComponent <vBuff_Transform>() as vBuff_Transform;

        hBuffUpdater    hairUpdater = GetComponent <hBuffUpdater>() as hBuffUpdater;
        hBuff_Transform hbt         = GetComponent <hBuff_Transform>() as hBuff_Transform;

        DisplayHairBufferWithLines dhbwl = GetComponent <DisplayHairBufferWithLines>() as DisplayHairBufferWithLines;
        DisplayVertBufferWithLines dvbwl = GetComponent <DisplayVertBufferWithLines>() as DisplayVertBufferWithLines;

        tBuf.Live();
        vBuf.Live();
        hBuf.Live();

        baseUpdater.Live();
        hairUpdater.Live();

        vbt.Live();
        hbt.Live();

        dhbwl.Live();
        dvbwl.Live();
    }
Пример #4
0
 public void Live()
 {
     if (tBuf == null)
     {
         tBuf = GetComponent <tBuffer>();
     }
     if (vBuf == null)
     {
         vBuf = GetComponent <vBuffer>();
     }
 }
Пример #5
0
    public void Live()
    {
        if (vBuf == null)
        {
            vBuf = gameObject.GetComponent <vBuffer>();

            vBuf.Live();

            gameObject.GetComponent <vBuffUpdater>().Live();
            gameObject.GetComponent <vBuff_Transform>().Live();
        }
    }
Пример #6
0
    public void Live()
    {
        if (vertBuffer == null)
        {
            vertBuffer = GetComponent <vBuffer>();
        }
        vertBuffer.OnWhenReady += WhenBufferReady;

        if (vertBuffer.ready == true)
        {
            WhenBufferReady(vertBuffer._buffer);
        }
    }
Пример #7
0
    public void Live()
    {
        if (particleVBuff == null)
        {
            particleVBuff = gameObject.GetComponent <vBuffer>();

            particleVBuff.Live();

            gameObject.GetComponent <vBuffUpdater>().Live();
            gameObject.GetComponent <vBuff_Transform>().Live();
        }

        meshVBuff = MeshToInstance.GetComponent <vBuffer>();
        meshTBuff = MeshToInstance.GetComponent <tBuffer>();

        meshVBuff.Live();
        meshTBuff.Live();
    }
Пример #8
0
    // Use this for initialization
    public void Live()
    {
        vBuf = gameObject.AddComponent <vBuffer>() as vBuffer;

        baseUpdater = gameObject.AddComponent <vBuffUpdater>() as vBuffUpdater;
        baseUpdater.computeShader = basePhysicsShader;
        baseUpdater.update        = true;


        vbt = gameObject.AddComponent <vBuff_Transform>() as vBuff_Transform;

        tBuf = gameObject.AddComponent <tBuffer>() as tBuffer;

        hBuf = gameObject.AddComponent <hBuffer>() as hBuffer;

        hBuf.tBuf = tBuf;
        hBuf.vBuf = vBuf;

        hBuf.numVertsPerHair = vertsPerHair;
        hBuf.hairLength      = hairLength;
        hBuf.totalHairs      = totalHairs;


//		print("HAHWS");

        hairUpdater = gameObject.AddComponent <hBuffUpdater>() as hBuffUpdater;

        hairUpdater.collisionShader  = hairCollisionShader;
        hairUpdater.constraintShader = hairConstraintShader;
        hairUpdater.update           = true;



        hbt = gameObject.AddComponent <hBuff_Transform>() as hBuff_Transform;
        hdo = gameObject.AddComponent <hBuff_DataOut>() as hBuff_DataOut;
        hdo.gatherShader = hairGatherShader;


        dhbwl   = gameObject.AddComponent <DisplayHairBufferWithLines>() as DisplayHairBufferWithLines;
        dhbwl.m = new Material(hairLineRenderer);


        dvbwl         = gameObject.AddComponent <DisplayVertBufferWithLines>() as DisplayVertBufferWithLines;
        dvbwl.m       = new Material(baseLineRenderer);
        dvbwl.enabled = false;


        dvbwt   = gameObject.AddComponent <DisplayVertBufferWithTriangles>() as DisplayVertBufferWithTriangles;
        dvbwt.m = new Material(baseRenderer);
        //dvbwt.enabled = false;

        hbh = gameObject.AddComponent <hBuff_Human>() as hBuff_Human;
        vbh = gameObject.AddComponent <vBuff_Human>() as vBuff_Human;

        hbh.human = humanBuffer;
        vbh.human = humanBuffer;

        tBuf.Live();
        vBuf.Live();
        hBuf.Live();

        baseUpdater.Live();
        hairUpdater.Live();

        vbt.Live();
        hbt.Live();

        vbh.Live();
        hbh.Live();

        hdo.Live();

        dhbwl.Live();
        dvbwl.Live();
        dvbwt.Live();

        GetComponent <MeshRenderer>().enabled = false;
    }
Пример #9
0
 public void Die()
 {
     tBuf = null; vBuf = null;
 }