|
|
|
|
|
|
|
|
|
|
// Be sure that the compiler is aware that we don't use UV1 to UV3 for main layer so it can optimize code |
|
|
|
ComputeLayerTexCoord( texCoord0, texCoord1, texCoord2, texCoord3, float4(1.0, 0.0, 0.0, 0.0), _UVDetailsMappingMask, |
|
|
|
_BaseColorMap_ST.xy, _BaseColorMap_ST.zw, _DetailMap_ST.xy, _DetailMap_ST.zw, 1.0, |
|
|
|
_BaseColorMap_ST.xy, _BaseColorMap_ST.zw, _DetailMap_ST.xy, _DetailMap_ST.zw, 1.0, _LinkDetailsWithBase, |
|
|
|
positionWS, _TexWorldScale, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
} |
|
|
|
|
|
|
// Note: Blend mask have its dedicated mapping and tiling. |
|
|
|
// To share code, we simply call the regular code from the main layer for it then save the result, then do regular call for all layers. |
|
|
|
ComputeLayerTexCoord0( texCoord0, texCoord1, texCoord2, texCoord3, _UVMappingMaskBlendMask, _UVMappingMaskBlendMask, |
|
|
|
_LayerMaskMap_ST.xy, _LayerMaskMap_ST.zw, float2(0.0, 0.0), float2(0.0, 0.0), 1.0, |
|
|
|
_LayerMaskMap_ST.xy, _LayerMaskMap_ST.zw, float2(0.0, 0.0), float2(0.0, 0.0), 1.0, false, |
|
|
|
positionWS, _TexWorldScaleBlendMask, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
|
|
|
|
|
|
|
#if !defined(_MAIN_LAYER_INFLUENCE_MODE) |
|
|
|
* tileObjectScale // We only affect layer0 in case we are not in influence mode (i.e we should not change the base object) |
|
|
|
#endif |
|
|
|
, _LinkDetailsWithBase0 |
|
|
|
, positionWS, _TexWorldScale0, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
|
|
|
|
|
|
|
mappingType = UV_MAPPING_TRIPLANAR; |
|
|
|
#endif |
|
|
|
ComputeLayerTexCoord1( texCoord0, texCoord1, texCoord2, texCoord3, _UVMappingMask1, _UVDetailsMappingMask1, |
|
|
|
_BaseColorMap1_ST.xy, _BaseColorMap1_ST.zw, _DetailMap1_ST.xy, _DetailMap1_ST.zw, tileObjectScale, |
|
|
|
_BaseColorMap1_ST.xy, _BaseColorMap1_ST.zw, _DetailMap1_ST.xy, _DetailMap1_ST.zw, tileObjectScale, _LinkDetailsWithBase1, |
|
|
|
positionWS, _TexWorldScale1, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
|
|
|
|
|
|
|
mappingType = UV_MAPPING_TRIPLANAR; |
|
|
|
#endif |
|
|
|
ComputeLayerTexCoord2( texCoord0, texCoord1, texCoord2, texCoord3, _UVMappingMask2, _UVDetailsMappingMask2, |
|
|
|
_BaseColorMap2_ST.xy, _BaseColorMap2_ST.zw, _DetailMap2_ST.xy, _DetailMap2_ST.zw, tileObjectScale, |
|
|
|
_BaseColorMap2_ST.xy, _BaseColorMap2_ST.zw, _DetailMap2_ST.xy, _DetailMap2_ST.zw, tileObjectScale, _LinkDetailsWithBase2, |
|
|
|
positionWS, _TexWorldScale2, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
|
|
|
|
|
|
|
mappingType = UV_MAPPING_TRIPLANAR; |
|
|
|
#endif |
|
|
|
ComputeLayerTexCoord3( texCoord0, texCoord1, texCoord2, texCoord3, _UVMappingMask3, _UVDetailsMappingMask3, |
|
|
|
_BaseColorMap3_ST.xy, _BaseColorMap3_ST.zw, _DetailMap3_ST.xy, _DetailMap3_ST.zw, tileObjectScale, |
|
|
|
_BaseColorMap3_ST.xy, _BaseColorMap3_ST.zw, _DetailMap3_ST.xy, _DetailMap3_ST.zw, tileObjectScale, _LinkDetailsWithBase3, |
|
|
|
positionWS, _TexWorldScale3, |
|
|
|
mappingType, layerTexCoord); |
|
|
|
} |
|
|
|