|
|
|
|
|
|
MaterialProperty[] layerTexWorldScale = new MaterialProperty[kMaxLayerCount]; |
|
|
|
MaterialProperty[] layerUVBase = new MaterialProperty[kMaxLayerCount]; |
|
|
|
MaterialProperty[] layerUVMappingMask = new MaterialProperty[kMaxLayerCount]; |
|
|
|
MaterialProperty[] layerUVMappingPlanar = new MaterialProperty[kMaxLayerCount]; |
|
|
|
MaterialProperty[] layerUVDetail = new MaterialProperty[kMaxLayerCount]; |
|
|
|
MaterialProperty[] layerUVDetailsMappingMask = new MaterialProperty[kMaxLayerCount]; |
|
|
|
|
|
|
|
|
|
|
layerTexWorldScale[i] = FindProperty(string.Format("{0}{1}", kTexWorldScale, i), props); |
|
|
|
layerUVBase[i] = FindProperty(string.Format("{0}{1}", kUVBase, i), props); |
|
|
|
layerUVMappingMask[i] = FindProperty(string.Format("{0}{1}", kUVMappingMask, i), props); |
|
|
|
layerUVMappingPlanar[i] = FindProperty(string.Format("{0}{1}", kUVMappingPlanar, i), props); |
|
|
|
layerUVDetail[i] = FindProperty(string.Format("{0}{1}", kUVDetail, i), props); |
|
|
|
layerUVDetailsMappingMask[i] = FindProperty(string.Format("{0}{1}", kUVDetailsMappingMask, i), props); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
((UVDetailMapping)material.GetFloat(uvDetail) == UVDetailMapping.UV2) || |
|
|
|
((LayerUVBaseMapping)material.GetFloat(uvBase) == LayerUVBaseMapping.UV2) |
|
|
|
) |
|
|
|
((LayerUVBaseMapping)material.GetFloat(uvBase) == LayerUVBaseMapping.UV2) || |
|
|
|
((UVDetailMapping)material.GetFloat(uvDetail) == UVDetailMapping.UV3) || |
|
|
|
((LayerUVBaseMapping)material.GetFloat(uvBase) == LayerUVBaseMapping.UV3) |
|
|
|
) |
|
|
|
SetKeyword(material, "_REQUIRE_UV2", true); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if ( |
|
|
|
((UVDetailMapping)material.GetFloat(uvDetail) == UVDetailMapping.UV3) || |
|
|
|
((LayerUVBaseMapping)material.GetFloat(uvBase) == LayerUVBaseMapping.UV3) |
|
|
|
) |
|
|
|
{ |
|
|
|
SetKeyword(material, "_REQUIRE_UV3", true); |
|
|
|
SetKeyword(material, "_REQUIRE_UV2_OR_UV3", true); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
SetKeyword(material, "_LAYEREDLIT_3_LAYERS", false); |
|
|
|
} |
|
|
|
|
|
|
|
const string kLayerMappingPlanar = "_LAYER_MAPPING_PLANAR_"; |
|
|
|
const string kLayerMappingTriplanar = "_LAYER_MAPPING_TRIPLANAR_"; |
|
|
|
|
|
|
|
for (int i = 0 ; i < numLayer; ++i) |
|
|
|
|
|
|
LayerUVBaseMapping layerUVBaseMapping = (LayerUVBaseMapping)material.GetFloat(layerUVBaseParam); |
|
|
|
string layerUVDetailParam = string.Format("{0}{1}", kUVDetail, i); |
|
|
|
UVDetailMapping layerUVDetailMapping = (UVDetailMapping)material.GetFloat(layerUVDetailParam); |
|
|
|
string currentLayerMappingPlanar = string.Format("{0}{1}", kLayerMappingPlanar, i); |
|
|
|
string currentLayerMappingTriplanar = string.Format("{0}{1}", kLayerMappingTriplanar, i); |
|
|
|
|
|
|
|
float X, Y, Z, W; |
|
|
|
|
|
|
W = (layerUVBaseMapping == LayerUVBaseMapping.UV3) ? 1.0f : 0.0f; |
|
|
|
W = (layerUVBaseMapping == LayerUVBaseMapping.UV3) ? 1.0f : 0.0f; |
|
|
|
layerUVMappingPlanar[i].floatValue = (layerUVBaseMapping == LayerUVBaseMapping.Planar) ? 1.0f : 0.0f; |
|
|
|
SetKeyword(material, currentLayerMappingPlanar, layerUVBaseMapping == LayerUVBaseMapping.Planar); |
|
|
|
SetKeyword(material, currentLayerMappingTriplanar, layerUVBaseMapping == LayerUVBaseMapping.Triplanar); |
|
|
|
|
|
|
|
X = (layerUVDetailMapping == UVDetailMapping.UV0) ? 1.0f : 0.0f; |
|
|
|