Ejemplo n.º 1
0
    private void Start()
    {
        UIT_TouchConsole.InitDefaultCommands();
        UIT_TouchConsole.NewPage("Data Persistent");
        UIT_TouchConsole.Command("Read").Button(() => { m_SaveTest.ReadPersistentData(); Debug.Log(m_SaveTest.Test1); });
        UIT_TouchConsole.Command("Save").Slider(0, 10, m_SaveTest.Test1, value =>
        {
            m_SaveTest.Test1           = value;
            m_SaveTest.m_Test1.m_Test1 = value * value;
            m_SaveTest.SavePersistentData();
        });

        UIT_TouchConsole.NewPage("Touch Input");
        UIT_TouchConsole.Command("Single").
        Button(() => TouchInputManager.Instance.SwitchToSingle().Init((down, pos) => Debug.LogFormat("Single{0}{1}", down, pos), pos => Debug.LogFormat("Single Tick{0}", pos)));
        UIT_TouchConsole.Command("Stretch").
        Button(() => TouchInputManager.Instance.SwitchToDualStretch().Init((down, pos1, pos2) => Debug.LogFormat("Stretch{0},{1},{2}", down, pos1, pos2), (pos1, pos2) => Debug.LogFormat("Stretch Tick{0} {1}", pos1, pos2)));
        UIT_TouchConsole.Command("Dual LR").
        Button(() => TouchInputManager.Instance.SwitchToTrackers().Init(new TouchTracker(vec2 => Debug.LogFormat("Dual L{0}", vec2), TouchTracker.s_LeftTrack), new TouchTracker(vec2 => Debug.LogFormat("Dual R{0}", vec2), TouchTracker.s_RightTrack)));
        UIT_TouchConsole.Command("Dual LR Joystick").
        Button(() => TouchInputManager.Instance.SwitchToTrackers().Init(new TouchTracker_Joystick(UIT_TouchConsole.GetHelperJoystick(), enum_Option_JoyStickMode.Retarget, vec2 => Debug.LogFormat("Dual L Joystick{0}", vec2), TouchTracker.s_LeftTrack), new TouchTracker(vec2 => Debug.LogFormat("Dual R Joystick{0}", vec2), TouchTracker.s_RightTrack)));

        UIT_TouchConsole.NewPage("Color Grading");
        UIT_TouchConsole.InitSerializeCommands(Camera.main.GetComponent <PostProcess_ColorGrading>(), effect => effect.OnValidate());
        UIT_TouchConsole.NewPage("Depth Of Field");
        UIT_TouchConsole.InitSerializeCommands(Camera.main.GetComponent <PostProcess_DepthOfField>(), effect => effect.OnValidate());
        UIT_TouchConsole.NewPage("VHS");
        UIT_TouchConsole.InitSerializeCommands(Camera.main.GetComponent <PostProcess_VHS>(), effect => effect.OnValidate());

        m_Texture = RenderTexture.GetTemporary(1920, 1080);
        m_Texture.enableRandomWrite = true;
        m_Texture.Create();

        m_KernalHandle = m_ComputeShader.FindKernel("CSMain");
        transform.Find("Image").GetComponent <RawImage>().texture = m_Texture;

        UIT_TouchConsole.NewPage("Compute Shader");
        UIT_TouchConsole.Command("Random Lights", KeyCode.Space).Button(() => {
            int randomCount = 5 + URandom.RandomInt(8);
            lights          = new Vector4[randomCount];
            for (int i = 0; i < randomCount; i++)
            {
                float randomPixelX    = URandom.RandomInt(Screen.width);
                float randomPixelY    = URandom.RandomInt(Screen.height);
                float randomRadius    = 50f + URandom.Random01() * 200f;
                randomRadius         *= randomRadius;
                float randomIntenisty = .5f + URandom.Random01() * 2f;
                lights[i]             = new Vector4(randomPixelX, randomPixelY, randomRadius, randomIntenisty);
            }
        });
    }
Ejemplo n.º 2
0
        public override void OnValidate(PPData_SSAO ppDataSsao)
        {
            base.OnValidate(ppDataSsao);
            Random random = new Random(ppDataSsao.m_RandomVectorKeywords?.GetHashCode() ?? "AOCodeDefault".GetHashCode());

            Vector4[] randomVectors = new Vector4[m_MaxArraySize];
            for (int i = 0; i < m_MaxArraySize; i++)
            {
                randomVectors[i] = URandom.RandomVector3(random) * Mathf.Lerp(1f - ppDataSsao.m_Radius, 1f, URandom.Random01(random));
            }
            m_Material.SetFloat(ID_Bias, ppDataSsao.m_Radius + ppDataSsao.m_Bias);
            m_Material.SetFloat(ID_Radius, ppDataSsao.m_Radius);
            m_Material.SetInt(ID_SampleCount, ppDataSsao.m_SampleCount);
            m_Material.SetVectorArray(ID_SampleSphere, randomVectors);
            m_Material.SetColor(ID_Color, ppDataSsao.m_Color);
            m_Material.SetFloat(ID_Intensity, ppDataSsao.m_Intensity);
            m_Material.EnableKeyword(KW_Dither, ppDataSsao.m_Dither);
        }
Ejemplo n.º 3
0
    protected void Awake()
    {
        int totalCount = m_Y * m_X;

        m_Matrixs    = new Matrix4x4[totalCount];
        m_Timers     = new GPUAnimationTimer[totalCount];
        curFrames    = new float[totalCount];
        nextFrames   = new float[totalCount];
        interpolates = new float[totalCount];
        m_Blocks     = new MaterialPropertyBlock();
        for (int i = 0; i < m_X; i++)
        {
            for (int j = 0; j < m_Y; j++)
            {
                int index = i * m_Y + j;
                m_Matrixs[index] = Matrix4x4.TRS(transform.position + new Vector3(i * 10, 0, j * 10), transform.rotation, Vector3.one * (.8f + URandom.RandomUnit() * .2f));
                m_Timers[index]  = new GPUAnimationTimer();
                m_Timers[index].Setup(m_Data.m_Animations);
                m_Timers[index].SetAnimation(m_Data.m_Animations.RandomIndex());
                m_Timers[index].SetNormalizedTime(Random.value);
            }
        }
    }
 public void AddRecoil(float recoilAmount) => v3_Recoil += new Vector3(0, (URandom.RandomBool() ? 1 : -1) * recoilAmount, 0);