Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image_proj.c
| Show First 20 Lines • Show All 5,352 Lines • ▼ Show 20 Lines | else { | ||||
| float texrgb[3]; | float texrgb[3]; | ||||
| float mask; | float mask; | ||||
| /* Extra mask for normal, layer stencil, etc. */ | /* Extra mask for normal, layer stencil, etc. */ | ||||
| float custom_mask = ((float)projPixel->mask) * (1.0f / 65535.0f); | float custom_mask = ((float)projPixel->mask) * (1.0f / 65535.0f); | ||||
| /* Mask texture. */ | /* Mask texture. */ | ||||
| if (ps->is_maskbrush) { | if (ps->is_maskbrush) { | ||||
| float texmask = BKE_brush_sample_masktex( | float texco[3] = {projPixel->projCoSS[0], projPixel->projCoSS[1], 0.0f}; | ||||
| ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool); | float texmask; | ||||
| BKE_brush_sample_tex_mask( | |||||
| ps->scene, ps->brush, 1, &texco, &texmask, thread_index, pool); | |||||
| CLAMP(texmask, 0.0f, 1.0f); | CLAMP(texmask, 0.0f, 1.0f); | ||||
| custom_mask *= texmask; | custom_mask *= texmask; | ||||
| } | } | ||||
| /* Color texture (alpha used as mask). */ | /* Color texture (alpha used as mask). */ | ||||
| if (ps->is_texbrush) { | if (ps->is_texbrush) { | ||||
| MTex *mtex = &brush->mtex; | MTex *mtex = &brush->mtex; | ||||
| float samplecos[3]; | float samplecos[3]; | ||||
| float texrgba[4]; | float texrgba[4]; | ||||
| /* taking 3d copy to account for 3D mapping too. | /* taking 3d copy to account for 3D mapping too. | ||||
| * It gets concatenated during sampling */ | * It gets concatenated during sampling */ | ||||
| if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) { | if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) { | ||||
| copy_v3_v3(samplecos, projPixel->worldCoSS); | copy_v3_v3(samplecos, projPixel->worldCoSS); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v2_v2(samplecos, projPixel->projCoSS); | copy_v2_v2(samplecos, projPixel->projCoSS); | ||||
| samplecos[2] = 0.0f; | samplecos[2] = 0.0f; | ||||
| } | } | ||||
| /* NOTE: for clone and smear, | /* NOTE: for clone and smear, | ||||
| * we only use the alpha, could be a special function */ | * we only use the alpha, could be a special function */ | ||||
| BKE_brush_sample_tex_3d(ps->scene, brush, samplecos, texrgba, thread_index, pool); | BKE_brush_sample_tex_rgba( | ||||
| ps->scene, brush, 1, &samplecos, &texrgba, thread_index, pool); | |||||
| copy_v3_v3(texrgb, texrgba); | copy_v3_v3(texrgb, texrgba); | ||||
| custom_mask *= texrgba[3]; | custom_mask *= texrgba[3]; | ||||
| } | } | ||||
| else { | else { | ||||
| zero_v3(texrgb); | zero_v3(texrgb); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,548 Lines • Show Last 20 Lines | |||||