| 895 | } |
| 896 | |
| 897 | void drawDepth(IntRect* pLocation, IntPair* pPointer) |
| 898 | { |
| 899 | if (g_DrawConfig.Streams.Depth.Coloring != DEPTH_OFF) |
| 900 | { |
| 901 | if (!isDepthOn()) |
| 902 | { |
| 903 | drawClosedStream(pLocation, "Depth"); |
| 904 | return; |
| 905 | } |
| 906 | |
| 907 | const DepthMetaData* pDepthMD = getDepthMetaData(); |
| 908 | const XnDepthPixel* pDepth = pDepthMD->Data(); |
| 909 | XN_ASSERT(pDepth); |
| 910 | |
| 911 | if (pDepthMD->FrameID() == 0) |
| 912 | { |
| 913 | return; |
| 914 | } |
| 915 | |
| 916 | if (g_DrawConfig.Streams.Depth.Coloring == STANDARD_DEVIATION) |
| 917 | { |
| 918 | XnPixelStatistics* pStatistics = g_PixelStatistics; |
| 919 | |
| 920 | for (XnUInt16 nY = pDepthMD->YOffset(); nY < pDepthMD->YRes() + pDepthMD->YOffset(); nY++) |
| 921 | { |
| 922 | XnUInt8* pTexture = TextureMapGetLine(&g_texDepth, nY) + pDepthMD->XOffset()*4; |
| 923 | for (XnUInt16 nX = 0; nX < pDepthMD->XRes(); nX++, pTexture+=4, pStatistics++) |
| 924 | { |
| 925 | pTexture[0] = pTexture[1] = XN_MIN((int)pStatistics->dStdDev, 255); |
| 926 | pTexture[2] = 0; |
| 927 | pTexture[3] = g_DrawConfig.Streams.Depth.fTransparency*255; |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | else |
| 932 | { |
| 933 | // copy depth into texture-map |
| 934 | for (XnUInt16 nY = pDepthMD->YOffset(); nY < pDepthMD->YRes() + pDepthMD->YOffset(); nY++) |
| 935 | { |
| 936 | XnUInt8* pTexture = TextureMapGetLine(&g_texDepth, nY) + pDepthMD->XOffset()*4; |
| 937 | for (XnUInt16 nX = 0; nX < pDepthMD->XRes(); nX++, pDepth++, pTexture+=4) |
| 938 | { |
| 939 | XnUInt8 nRed = 0; |
| 940 | XnUInt8 nGreen = 0; |
| 941 | XnUInt8 nBlue = 0; |
| 942 | XnUInt8 nAlpha = g_DrawConfig.Streams.Depth.fTransparency*255; |
| 943 | |
| 944 | XnUInt16 nColIndex; |
| 945 | |
| 946 | switch (g_DrawConfig.Streams.Depth.Coloring) |
| 947 | { |
| 948 | case LINEAR_HISTOGRAM: |
| 949 | nRed = nGreen = g_pDepthHist[*pDepth]*255; |
| 950 | break; |
| 951 | case PSYCHEDELIC_SHADES: |
| 952 | nAlpha *= (((XnFloat)(*pDepth % 10) / 20) + 0.5); |
| 953 | case PSYCHEDELIC: |
| 954 |
no test coverage detected