|
|
|
@ -505,6 +505,7 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas |
|
|
|
|
triViewed.col[0] = Pixel(triTransformed.col[0].r * dp * dp, triTransformed.col[0].g * dp * dp, triTransformed.col[0].b * dp * dp); |
|
|
|
|
triViewed.col[1] = Pixel(triTransformed.col[1].r * dp * dp, triTransformed.col[1].g * dp * dp, triTransformed.col[1].b * dp * dp); |
|
|
|
|
triViewed.col[2] = Pixel(triTransformed.col[2].r * dp * dp, triTransformed.col[2].g * dp * dp, triTransformed.col[2].b * dp * dp); |
|
|
|
|
Pixel originalCol[3] = { triViewed.col[0],triViewed.col[1],triViewed.col[2] }; |
|
|
|
|
float dist = std::sqrtf(std::powf((freeRoam ? freeRoamCamera : player.GetPos()).x - triTransformed.p[0].x, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).y - triTransformed.p[0].y, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).z - triTransformed.p[0].z, 2)); |
|
|
|
|
float dist2 = std::sqrtf(std::powf((freeRoam ? freeRoamCamera : player.GetPos()).x - triTransformed.p[1].x, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).y - triTransformed.p[1].y, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).z - triTransformed.p[1].z, 2)); |
|
|
|
|
float dist3 = std::sqrtf(std::powf((freeRoam ? freeRoamCamera : player.GetPos()).x - triTransformed.p[2].x, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).y - triTransformed.p[2].y, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).z - triTransformed.p[2].z, 2)); |
|
|
|
@ -519,12 +520,12 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas |
|
|
|
|
float dist = std::sqrtf(std::powf(b.pos.x - triTransformed.p[0].x, 2) + std::powf(b.pos.y - triTransformed.p[0].y, 2) + std::powf(b.pos.z - triTransformed.p[0].z, 2)); |
|
|
|
|
float dist2 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[1].x, 2) + std::powf(b.pos.y - triTransformed.p[1].y, 2) + std::powf(b.pos.z - triTransformed.p[1].z, 2)); |
|
|
|
|
float dist3 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[2].x, 2) + std::powf(b.pos.y - triTransformed.p[2].y, 2) + std::powf(b.pos.z - triTransformed.p[2].z, 2)); |
|
|
|
|
float colorMult = (dist < 1 ? std::sinf(1.5 * dist + PI / 2):1); |
|
|
|
|
float colorMult2 = (dist2 < 1 ? std::sinf(1.5 * dist2 + PI / 2) : 1); |
|
|
|
|
float colorMult3 = (dist3 < 1 ? std::sinf(1.5 * dist3 + PI / 2) : 1); |
|
|
|
|
triViewed.col[0] = Pixel(std::min(255, (int)(triViewed.col[0].r * colorMult)), std::min(255, (int)(triViewed.col[0].g * colorMult)), std::min(255, (int)(triViewed.col[0].b * colorMult))); |
|
|
|
|
triViewed.col[1] = Pixel(std::min(255, (int)(triViewed.col[1].r * colorMult2)), std::min(255, (int)(triViewed.col[1].g * colorMult2)), std::min(255, (int)(triViewed.col[1].b * colorMult2))); |
|
|
|
|
triViewed.col[2] = Pixel(std::min(255, (int)(triViewed.col[2].r * colorMult3)), std::min(255, (int)(triViewed.col[2].g * colorMult3)), std::min(255, (int)(triViewed.col[2].b * colorMult3))); |
|
|
|
|
float colorMult = (dist < 2 ? std::sinf(0.75 * dist + PI / 2) * 4 :1); |
|
|
|
|
float colorMult2 = (dist2 < 2 ? std::sinf(0.75 * dist2 + PI / 2) * 4 : 1); |
|
|
|
|
float colorMult3 = (dist3 < 2 ? std::sinf(0.75 * dist3 + PI / 2) * 4 : 1); |
|
|
|
|
if (dist < 2) {triViewed.col[0] = Pixel(std::min(255, std::max((int)originalCol[0].r, (int)(originalCol[0].r * colorMult / 2))), std::min(255, std::max((int)originalCol[0].g, (int)(originalCol[0].g * colorMult))), std::min(255, std::max((int)originalCol[0].b, (int)(originalCol[0].b * colorMult / 2))));} |
|
|
|
|
if (dist2 < 2) {triViewed.col[1] = Pixel(std::min(255, std::max((int)originalCol[1].r, (int)(originalCol[1].r * colorMult2 / 2))), std::min(255, std::max((int)originalCol[1].g, (int)(originalCol[1].g * colorMult2))), std::min(255, std::max((int)originalCol[1].b, (int)(originalCol[1].b * colorMult2 / 2))));} |
|
|
|
|
if (dist3 < 2) {triViewed.col[2] = Pixel(std::min(255, std::max((int)originalCol[2].r, (int)(originalCol[2].r * colorMult3 / 2))), std::min(255, std::max((int)originalCol[2].g, (int)(originalCol[2].g * colorMult3))), std::min(255, std::max((int)originalCol[2].b, (int)(originalCol[2].b * colorMult3 / 2))));} |
|
|
|
|
} |
|
|
|
|
//triViewed.col = triTransformed.col;
|
|
|
|
|
|
|
|
|
|