TinyRenderer: implement triangle clipping against near-plane

TinyRenderer: implement texture UV-repeat by default (instead of clamp(0,1))
This commit is contained in:
Erwin Coumans
2017-04-06 14:31:34 -07:00
parent 0f2771b1d1
commit deb95c758b
5 changed files with 254 additions and 44 deletions

View File

@@ -834,13 +834,16 @@ void PhysicsClientExample::stepSimulation(float deltaTime)
//todo: rescale the depthValue to [0..255]
if (depthValue>-1e20)
{
int rgb = (depthValue-minDepthValue)*(255. / (btFabs(maxDepthValue-minDepthValue)));
if (rgb<0 || rgb>255)
{
printf("rgb=%d\n",rgb);
}
int rgb = 0;
if (maxDepthValue!=minDepthValue)
{
rgb = (depthValue-minDepthValue)*(255. / (btFabs(maxDepthValue-minDepthValue)));
if (rgb<0 || rgb>255)
{
//printf("rgb=%d\n",rgb);
}
}
m_canvas->setPixel(m_canvasDepthIndex,i,j,
rgb,
rgb,