Skip to content

Commit

Permalink
smoothing
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Mar 25, 2022
1 parent 86448c0 commit 0f11fcf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
36 changes: 29 additions & 7 deletions MeshIO.FBX/Converters/NodeConverterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,15 @@ public Element BuildMaterial(FbxNode node)
{
switch (n.Name)
{
case string value when this._propertiesRegex.IsMatch(n.Name):
properties = this.BuildProperties(n);
break;
case "ShadingModel":
material.ShadingModel = (string)n.Value;
break;
case "MultiLayer":
material.MultiLayer = Convert.ToInt32(n.Value);
break;
default:
this.notify($"Unknow node while building Material:: with name {n.Name}");
if (!this.isCommonElementField(material, n, properties))
this.notify($"Unknow node while building Material:: with name {n.Name}");
break;
}
}
Expand Down Expand Up @@ -545,7 +543,7 @@ public LayerElement BuildLayerElementUV(FbxNode node)
switch (n.Name)
{
case "UV":
layer.UV = this.arrToXY(this.arrToDoubleArray(n.Value as IEnumerable));
layer.UV.AddRange(this.arrToXY(this.arrToDoubleArray(n.Value as IEnumerable)));
break;
case "UVIndex":
layer.Indices.AddRange(this.toArr<int>(n.Value as IEnumerable));
Expand All @@ -560,6 +558,27 @@ public LayerElement BuildLayerElementUV(FbxNode node)
return layer;
}

public LayerElement BuildLayerElementSmoothing(FbxNode node)
{
LayerElementSmoothing layer = new LayerElementSmoothing();

foreach (FbxNode n in node)
{
switch (n.Name)
{
case "Smoothing":
layer.Smoothing.AddRange(this.toArr<int>(n.Value as IEnumerable));
break;
default:
if (!this.isCommonLayerField(layer, n))
this.notify($"Unknow node while building LayerElement with name {n.Name}");
break;
}
}

return layer;
}

public LayerElement BuildLayerElementMaterial(FbxNode node)
{
LayerElementMaterial layer = new LayerElementMaterial();
Expand Down Expand Up @@ -762,6 +781,9 @@ private bool isCommonGeometryField(Geometry geometry, FbxNode node, List<Propert
{
switch (node.Name)
{
case "Layer":
//TODO: Process the layer node in the geometry
return true;
case "LayerElementNormal":
geometry.Layers.Add(this.BuildLayerElementNormal(node));
return true;
Expand All @@ -778,8 +800,8 @@ private bool isCommonGeometryField(Geometry geometry, FbxNode node, List<Propert
geometry.Layers.Add(this.BuildLayerElementUV(node));
return true;
case "LayerElementSmoothing":
//geometry.Layers.Add(this.BuildLayerElementSmoothing(node));
//return true;
geometry.Layers.Add(this.BuildLayerElementSmoothing(node));
return true;
default:
return this.isCommonElementField(geometry, node, properties);
}
Expand Down
12 changes: 8 additions & 4 deletions MeshIO/Elements/Geometries/Layers/LayerElementSmoothing.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
namespace MeshIO.Elements.Geometries.Layers
using System.Collections.Generic;

namespace MeshIO.Elements.Geometries.Layers
{
public class LayerElementSmoothing : LayerElement
{
public LayerElementSmoothing(Geometry owner) : base(owner)
{
}
public List<int> Smoothing { get; set; } = new List<int>();

public LayerElementSmoothing() : base() { }

public LayerElementSmoothing(Geometry owner) : base(owner) { }
}
}

0 comments on commit 0f11fcf

Please sign in to comment.