|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
public static SurfaceMaterialOptions GetMaterialOptionsFromAlphaMode(AlphaMode alphaMode) |
|
|
|
public static SurfaceMaterialOptions GetMaterialOptions(AlphaMode alphaMode, bool twoSided) |
|
|
|
{ |
|
|
|
var materialOptions = new SurfaceMaterialOptions(); |
|
|
|
switch (alphaMode) |
|
|
|
|
|
|
materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; |
|
|
|
case AlphaMode.AlphaBlend: |
|
|
|
case AlphaMode.Fade: |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; |
|
|
|
case AlphaMode.AdditiveBlend: |
|
|
|
case AlphaMode.Additive: |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; |
|
|
|
materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; |
|
|
|
materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; |
|
|
|
materialOptions.renderType = SurfaceMaterialOptions.RenderType.Transparent; |
|
|
|
break; |
|
|
|
case AlphaMode.Multiply: |
|
|
|
materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.DstColor; |
|
|
|
materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; |
|
|
|
materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; |
|
|
|
materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; |
|
|
|
materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; |
|
|
|