Пример #1
0
    void OnSceneGUI()
    {
        //得到test脚本的对象
        CubeCS test = (CubeCS)target;

        //绘制文本框
        Handles.Label(test.transform.position + Vector3.up,
                      test.transform.name + " : " + test.transform.position.ToString());

        //开始绘制GUI
        Handles.BeginGUI();

        //规定GUI显示区域
        GUILayout.BeginArea(new Rect(100, 100, 100, 100));

        //GUI绘制一个按钮
        if (GUILayout.Button("这是一个按钮!"))
        {
            Debug.Log("test");
        }
        //GUI绘制文本框
        GUILayout.Label("我在编辑Scene视图");

        GUILayout.EndArea();

        Handles.EndGUI();
    }
Пример #2
0
        /// <summary>
        /// Execute Init kernel
        /// </summary>
        protected override void ExecuteInitKernel()
        {
            int kernel = CubeCS.FindKernel("Init");

            CubeCS.SetVector("_CubeNumXYZ", CubeNumEachDir);
            CubeCS.SetVector("_PosStepXYZ", PosStep);
            CubeCS.SetVector("_ArangeCenterXYZ", ArangeCenter);
            CubeCS.SetBuffer(kernel, "_CubeBuffer", cubeBuffer);
            CubeCS.Dispatch(kernel, threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
        }
Пример #3
0
        /// <summary>
        /// Execute Init kernel
        /// </summary>
        protected override void ExecuteInitKernel()
        {
            int kernel = CubeCS.FindKernel("Init");

            CubeCS.SetInt("_CubeNumX", (int)CubeNumEachDir.x);
            CubeCS.SetFloat("_PosStep", PosStep.x);
            CubeCS.SetFloat("_ArangeCenter", ArangeCenter.x);
            CubeCS.SetBuffer(kernel, "_CubeBuffer", cubeBuffer);
            CubeCS.Dispatch(kernel, threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
        }
Пример #4
0
        /// <summary>
        /// Execute Update kernel
        /// </summary>
        protected override void ExecuteUpdateKernel()
        {
            int kernel = CubeCS.FindKernel("Update");

            CubeCS.SetFloat("_TimeSpeed", TimeSpeed);
            CubeCS.SetFloat("_ElapsedTime", elapsedTime);
            CubeCS.SetVector("_CubeNumXYZ", CubeNumEachDir);
            CubeCS.SetVector("_CubeSizeXYZ", CubeSize);
            CubeCS.SetBuffer(kernel, "_CubeBuffer", cubeBuffer);
            CubeCS.Dispatch(kernel, threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
        }
Пример #5
0
        /// <summary>
        /// Execute Init kernel
        /// </summary>
        protected override void ExecuteInitKernel()
        {
            int kernel = CubeCS.FindKernel("Init");

            // 注意点
            // SetVectorで渡す変数の型を間違えないように。
            // Vector3はFloat型になるから、基本GPU側で受け取る変数の型もfloat3とかにしておく
            CubeCS.SetVector("_CubeNumXY", CubeNumEachDir);
            CubeCS.SetVector("_PosStepXY", PosStep);
            CubeCS.SetVector("_ArangeCenterXY", ArangeCenter);
            CubeCS.SetBuffer(kernel, "_CubeBuffer", cubeBuffer);
            CubeCS.Dispatch(kernel, threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
        }
Пример #6
0
        /// <summary>
        /// Execute Update kernel
        /// </summary>
        protected override void ExecuteUpdateKernel()
        {
            int kernel = CubeCS.FindKernel("Update");

            CubeCS.SetInt("_BlockCenterID", blockCenterID);
            CubeCS.SetInt("_CenterID", centerID);
            CubeCS.SetFloat("_DistWeight", DistWeight);
            CubeCS.SetFloat("_DistWeight2", DistWeight2);
            CubeCS.SetFloat("_ColorIntensity", ColorIntensity);
            CubeCS.SetFloat("_ColorIntensity2", ColorIntensity2);
            CubeCS.SetFloat("_TimeSpeed", TimeSpeed);
            CubeCS.SetFloat("_DeltaTime", Time.deltaTime);
            CubeCS.SetFloat("_ElapsedTime", elapsedTime);
            CubeCS.SetFloat("_NoiseWeight", NoiseWeight);
            CubeCS.SetVector("_CubeNumXYZ", CubeNumEachDir);
            CubeCS.SetVector("_CubeSizeXYZ", CubeSize);
            CubeCS.SetBuffer(kernel, "_CubeBuffer", cubeBuffer);
            CubeCS.Dispatch(kernel, threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
        }