/// <summary> /// Set shader input constants. /// </summary> /// <param name="cmd">CommandBuffer to store the commands.</param> /// <param name="input">Input parameters for the constants.</param> public void SetShaderDebugPrintInputConstants(CommandBuffer cmd, ShaderDebugPrintInput input) { var mouse = new Vector4(input.pos.x, input.pos.y, input.leftDown ? 1 : 0, input.rightDown ? 1 : 0); cmd.SetGlobalVector(m_ShaderPropertyIDInputMouse, mouse); cmd.SetGlobalInt(m_ShaderPropertyIDInputFrame, m_FrameCounter); }
/// <summary> /// Read system input. /// </summary> /// <returns>Input parameters for ShaderDebugPrintManager.</returns> static public ShaderDebugPrintInput Get() { var r = new ShaderDebugPrintInput(); #if ENABLE_LEGACY_INPUT_MANAGER r.pos = Input.mousePosition; r.leftDown = Input.GetMouseButton(0); r.rightDown = Input.GetMouseButton(1); r.middleDown = Input.GetMouseButton(2); #endif #if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE // NOTE: needs Unity.InputSystem asmdef reference. var mouse = InputSystem.Mouse.current; r.pos = mouse.position.ReadValue(); r.leftDown = mouse.leftButton.isPressed; r.rightDown = mouse.rightButton.isPressed; r.middleDown = mouse.middleButton.isPressed; #endif return(r); }