浏览代码

HDRenderPipeline: push small improvement to color Picker debug mode

/main
sebastienlagarde 7 年前
当前提交
3bf6049c
共有 3 个文件被更改,包括 23 次插入5 次删除
  1. 16
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader
  2. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs

16
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader


{
uint4 mouseValue = int4(mouseResult * 255.5);
DrawCharacter('R', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawInteger(mouseValue.x, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
if (_ColorPickerMode == COLORPICKERDEBUGMODE_BYTE4)

DrawCharacter('G', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('B', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('A', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('X', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('Y', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('Z', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('W', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawFloat(mouseResult.w, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
}
}

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl


#define DEBUG_FONT_TEXT_COUNT_Y 8
#define DEBUG_FONT_TEXT_ASCII_START 32
#define DEBUG_FONT_TEXT_SCALE_WIDTH 10 // This control the spacing between characters (if a character fill the text block it will overlap).
// Only support ASCII symbol from DEBUG_FONT_TEXT_ASCII_START to 126
// return black or white depends if we hit font character or not
// currentUnormCoord is current unormalized screen position

color = color * (1.0 - charColor) + charColor * fontColor;
}
fixedUnormCoord.x += DEBUG_FONT_TEXT_WIDTH * direction;
fixedUnormCoord.x += DEBUG_FONT_TEXT_SCALE_WIDTH * direction;
}
// Shortcut to not have to file direction

int numEntries = min((intValue == 0 ? 0 : log10(absIntValue)) + (intValue < 0 ? 1 : 0), maxStringSize);
// 2. Shift curseur to last location as we will go reverse
fixedUnormCoord.x += numEntries * DEBUG_FONT_TEXT_WIDTH;
fixedUnormCoord.x += numEntries * DEBUG_FONT_TEXT_SCALE_WIDTH;
// 3. Display the number
for (uint i = 0; i < maxStringSize; ++i)

}
// 5. Reset cursor at end location
fixedUnormCoord.x += (numEntries + 2) * DEBUG_FONT_TEXT_WIDTH;
fixedUnormCoord.x += (numEntries + 2) * DEBUG_FONT_TEXT_SCALE_WIDTH;
}
void DrawFloat(float floatValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, inout float3 color)

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


public void ApplyDebugDisplaySettings(HDCamera hdCamera, CommandBuffer cmd)
{
if (m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ||
if (m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ||
m_CurrentDebugDisplaySettings.fullScreenDebugMode != FullScreenDebugMode.None ||
m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None)
{

}
void PushFullScreenDebugDepthMip(CommandBuffer cmd, RenderTargetIdentifier textureID, int lodCount, RenderTextureDescriptor desc, FullScreenDebugMode debugMode)
{
{
if (debugMode == m_CurrentDebugDisplaySettings.fullScreenDebugMode)
{
var mipIndex = Mathf.FloorToInt(m_CurrentDebugDisplaySettings.fullscreenDebugMip * (lodCount));

正在加载...
取消
保存