Created
December 13, 2014 08:25
-
-
Save non117/54b128d930b1e554b956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int y = 0; y < depthHeight; ++y) | |
{ | |
for (int x = 0; x < depthWidth; ++x) | |
{ | |
int depthIndex = (y * depthWidth) + x; | |
byte player = bodyIndexBuffer[depthIndex]; | |
if (player != 0xff) | |
{ | |
ushort depth = depthBuffer[depthIndex]; | |
ColorSpacePoint colorPoint = this.coordinateMapper.MapDepthPointToColorSpace(x, y, depth); | |
// 値のチェックをここですべき | |
CameraSpacePoint worldPoint = this.coordinateMapper.MapDepthPointToCameraSpace(x, y, depth); | |
int colorX = (int)Math.Floor(colorPoint.X + 0.5); | |
int colorY = (int)Math.Floor(colorPoint.Y + 0.5); | |
// 境界値チェックすべき | |
int colorIndex = ((colorY * colorSize.Width) + colorX) * bytesPerPixel; // チャンネル数 | |
byte r = colorPixels[colorIndex + redOffset] | |
// .... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment