|
@@ -394,6 +394,11 @@ namespace Unity3D2Babylon
|
|
|
bMat.useEmissiveAsIllumination = (material.GetInt("_UseEmissiveAsIllumination") != 0);
|
|
|
}
|
|
|
|
|
|
+ if (material.HasProperty("_BackFaceCulling"))
|
|
|
+ {
|
|
|
+ bMat.backFaceCulling = (material.GetInt("_BackFaceCulling") != 0);
|
|
|
+ }
|
|
|
+
|
|
|
if (material.mainTexture && !materialNotSupported)
|
|
|
{
|
|
|
var mainTexture2D = material.mainTexture as Texture2D;
|
|
@@ -519,6 +524,11 @@ namespace Unity3D2Babylon
|
|
|
babylonPbrMaterial.useEmissiveAsIllumination = (material.GetInt("_UseEmissiveAsIllumination") != 0);
|
|
|
}
|
|
|
|
|
|
+ if (material.HasProperty("_BackFaceCulling"))
|
|
|
+ {
|
|
|
+ babylonPbrMaterial.backFaceCulling = (material.GetInt("_BackFaceCulling") != 0);
|
|
|
+ }
|
|
|
+
|
|
|
// Albedo
|
|
|
if (material.HasProperty("_Color"))
|
|
|
{
|
|
@@ -766,7 +776,7 @@ namespace Unity3D2Babylon
|
|
|
string[] attributes = babylonLine.Split(':');
|
|
|
if (attributes != null && attributes.Length > 1)
|
|
|
{
|
|
|
- string abuffer = attributes[1].Replace("[", "").Replace("]", "");
|
|
|
+ string abuffer = attributes[1].Replace("[", "").Replace("]", "").Replace("\"", "");
|
|
|
if (!String.IsNullOrEmpty(abuffer))
|
|
|
{
|
|
|
abuffer = abuffer.Trim();
|
|
@@ -775,7 +785,7 @@ namespace Unity3D2Babylon
|
|
|
{
|
|
|
foreach (string aoption in adata)
|
|
|
{
|
|
|
- string aoption_buffer = aoption.Trim().Replace("\"", "").Trim();
|
|
|
+ string aoption_buffer = aoption.Trim();
|
|
|
if (!String.IsNullOrEmpty(aoption_buffer))
|
|
|
{
|
|
|
attributeList.Add(aoption_buffer);
|
|
@@ -790,7 +800,7 @@ namespace Unity3D2Babylon
|
|
|
string[] uniforms = babylonLine.Split(':');
|
|
|
if (uniforms != null && uniforms.Length > 1)
|
|
|
{
|
|
|
- string ubuffer = uniforms[1].Replace("[", "").Replace("]", "");
|
|
|
+ string ubuffer = uniforms[1].Replace("[", "").Replace("]", "").Replace("\"", "");
|
|
|
if (!String.IsNullOrEmpty(ubuffer))
|
|
|
{
|
|
|
ubuffer = ubuffer.Trim();
|
|
@@ -799,7 +809,7 @@ namespace Unity3D2Babylon
|
|
|
{
|
|
|
foreach (string uoption in udata)
|
|
|
{
|
|
|
- string uoption_buffer = uoption.Trim().Replace("\"", "").Trim();
|
|
|
+ string uoption_buffer = uoption.Trim();
|
|
|
if (!String.IsNullOrEmpty(uoption_buffer))
|
|
|
{
|
|
|
uniformList.Add(uoption_buffer);
|
|
@@ -814,7 +824,7 @@ namespace Unity3D2Babylon
|
|
|
string[] samplers = babylonLine.Split(':');
|
|
|
if (samplers != null && samplers.Length > 1)
|
|
|
{
|
|
|
- string sbuffer = samplers[1].Replace("[", "").Replace("]", "");
|
|
|
+ string sbuffer = samplers[1].Replace("[", "").Replace("]", "").Replace("\"", "");
|
|
|
if (!String.IsNullOrEmpty(sbuffer))
|
|
|
{
|
|
|
sbuffer = sbuffer.Trim();
|
|
@@ -823,7 +833,7 @@ namespace Unity3D2Babylon
|
|
|
{
|
|
|
foreach (string soption in sdata)
|
|
|
{
|
|
|
- string soption_buffer = soption.Trim().Replace("\"", "").Trim();
|
|
|
+ string soption_buffer = soption.Trim();
|
|
|
if (!String.IsNullOrEmpty(soption_buffer))
|
|
|
{
|
|
|
samplerList.Add(soption_buffer);
|
|
@@ -838,7 +848,7 @@ namespace Unity3D2Babylon
|
|
|
string[] defines = babylonLine.Split(':');
|
|
|
if (defines != null && defines.Length > 1)
|
|
|
{
|
|
|
- string dbuffer = defines[1].Replace("[", "").Replace("]", "");
|
|
|
+ string dbuffer = defines[1].Replace("[", "").Replace("]", "").Replace("\"", "");
|
|
|
if (!String.IsNullOrEmpty(dbuffer))
|
|
|
{
|
|
|
dbuffer = dbuffer.Trim();
|
|
@@ -847,7 +857,7 @@ namespace Unity3D2Babylon
|
|
|
{
|
|
|
foreach (string doption in ddata)
|
|
|
{
|
|
|
- string doption_buffer = doption.Trim().Replace("\"", "").Trim();
|
|
|
+ string doption_buffer = doption.Trim();
|
|
|
if (!String.IsNullOrEmpty(doption_buffer))
|
|
|
{
|
|
|
defineList.Add(doption_buffer);
|
|
@@ -870,6 +880,9 @@ namespace Unity3D2Babylon
|
|
|
if (material.HasProperty("_NeedsAlphaTesting")) {
|
|
|
needsAlphaTesting = (material.GetInt("_NeedsAlphaTesting") != 0);
|
|
|
}
|
|
|
+ if (material.HasProperty("_BackFaceCulling")) {
|
|
|
+ babylonShaderMaterial.backFaceCulling = (material.GetInt("_BackFaceCulling") != 0);
|
|
|
+ }
|
|
|
babylonShaderMaterial.options = new BabylonShaderOptions();
|
|
|
babylonShaderMaterial.options.needAlphaBlending = needsAlphaBlending;
|
|
|
babylonShaderMaterial.options.needAlphaTesting = needsAlphaTesting;
|