Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kcoley committed Nov 1, 2017
2 parents d825a27 + c7e7670 commit 79fffe4
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 41 deletions.
8 changes: 4 additions & 4 deletions Source/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ public static Runtime.GLTF SinglePlane()
{
new List<Vector2>
{
new Vector2(0.0f, 1.0f),
new Vector2(1.0f, 1.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 0.0f)
new Vector2(0.0f, 1.0f),
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f)
},
};

List<int> PlaneIndices = new List<int>
{
0, 1, 3, 1, 2, 3
1, 0, 3, 1, 3, 2
};
Runtime.GLTF wrapper = new Runtime.GLTF();
Runtime.Scene scene = new Runtime.Scene();
Expand Down
26 changes: 13 additions & 13 deletions Source/Runtime/MeshPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ public glTFLoader.Schema.MeshPrimitive ConvertToSchema(Runtime.GLTF gltf, List<g

foreach (Vector4 color in Colors)
{
geometryData.Writer.Write(Convert.ToByte(color.x));
geometryData.Writer.Write(Convert.ToByte(color.y));
geometryData.Writer.Write(Convert.ToByte(color.z));
geometryData.Writer.Write(Convert.ToByte(Math.Round(color.x * byte.MaxValue)));
geometryData.Writer.Write(Convert.ToByte(Math.Round(color.y * byte.MaxValue)));
geometryData.Writer.Write(Convert.ToByte(Math.Round(color.z * byte.MaxValue)));
if (colorAccessorType == glTFLoader.Schema.Accessor.TypeEnum.VEC4)
{
geometryData.Writer.Write(Convert.ToByte(color.w));
geometryData.Writer.Write(Convert.ToByte(Math.Round(color.w * byte.MaxValue)));
}
}
break;
Expand All @@ -322,12 +322,12 @@ public glTFLoader.Schema.MeshPrimitive ConvertToSchema(Runtime.GLTF gltf, List<g

foreach (Vector4 color in Colors)
{
geometryData.Writer.Write(Convert.ToUInt16(color.x));
geometryData.Writer.Write(Convert.ToUInt16(color.y));
geometryData.Writer.Write(Convert.ToUInt16(color.z));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(color.x * ushort.MaxValue)));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(color.y * ushort.MaxValue)));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(color.z * ushort.MaxValue)));
if (colorAccessorType == glTFLoader.Schema.Accessor.TypeEnum.VEC4)
{
geometryData.Writer.Write(Convert.ToUInt16(color.w));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(color.w * ushort.MaxValue)));
}
}
break;
Expand Down Expand Up @@ -412,16 +412,16 @@ public glTFLoader.Schema.MeshPrimitive ConvertToSchema(Runtime.GLTF gltf, List<g
{
foreach (Vector2 tcs in textureCoordSetArr)
{
geometryData.Writer.Write(Convert.ToByte(tcs.x));
geometryData.Writer.Write(Convert.ToByte(tcs.y));
geometryData.Writer.Write(Convert.ToByte(Math.Round(tcs.x * byte.MaxValue)));
geometryData.Writer.Write(Convert.ToByte(Math.Round(tcs.y * byte.MaxValue)));
}
}
else if (accessor.ComponentType == glTFLoader.Schema.Accessor.ComponentTypeEnum.UNSIGNED_SHORT)
{
foreach(Vector2 tcs in textureCoordSetArr)
foreach (Vector2 tcs in textureCoordSetArr)
{
geometryData.Writer.Write(Convert.ToUInt16(tcs.x));
geometryData.Writer.Write(Convert.ToUInt16(tcs.y));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(tcs.x * ushort.MaxValue)));
geometryData.Writer.Write(Convert.ToUInt16(Math.Round(tcs.y * ushort.MaxValue)));
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Tests/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public Material()
usedImages.Add(occlusionTexture);
List<Vector3> planeNormals = new List<Vector3>()
{
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f)
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f)
};
requiredProperty = new List<Property>
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Tests/Material_Alpha.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public Material_Alpha()
usedImages.Add(baseColorTexture);
List<Vector4> colorCoord = new List<Vector4>()
{
new Vector4( 0.3f, 0.3f, 0.3f, 0.2f),
new Vector4( 0.3f, 0.3f, 0.3f, 0.4f),
new Vector4( 0.3f, 0.3f, 0.3f, 0.6f),
new Vector4( 0.3f, 0.3f, 0.3f, 0.8f)
new Vector4( 0.3f, 0.3f, 0.3f, 0.2f),
new Vector4( 0.3f, 0.3f, 0.3f, 0.8f),
new Vector4( 0.3f, 0.3f, 0.3f, 0.6f)
};
properties = new List<Property>
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Tests/Material_MetallicRoughness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public Material_MetallicRoughness()
usedImages.Add(metallicRoughnessTexture);
List<Vector4> colorCoord = new List<Vector4>()
{
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f),
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f)
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f),
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f)
};
properties = new List<Property>
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Tests/Material_SpecularGlossiness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public Material_SpecularGlossiness()
usedImages.Add(specularGlossinessTexture);
List<Vector4> colorCoord = new List<Vector4>()
{
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f),
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f)
new Vector4( 0.0f, 0.0f, 1.0f, 0.8f),
new Vector4( 1.0f, 0.0f, 0.0f, 0.8f)
};
properties = new List<Property>
{
Expand Down
21 changes: 11 additions & 10 deletions Source/Tests/Primitive_Attribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ public Primitive_Attribute()
usedImages.Add(uvIcon1);
List<Vector3> planeNormals = new List<Vector3>()
{
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f),
new Vector3( 0.0f, 0.0f,-1.0f)
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f),
new Vector3( 0.0f, 0.0f,1.0f)
};
List<Vector2> uvCoord2 = new List<Vector2>()
{
new Vector2(0.5f, 0.5f),
new Vector2(1.0f, 0.5f),
new Vector2(1.0f, 0.0f),
new Vector2(0.5f, 0.0f)
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.0f),
new Vector2(1.0f, 0.0f)
};
List<Vector4> colorCoord = new List<Vector4>()
{
new Vector4( 1.0f, 0.0f, 0.0f, 0.2f),
new Vector4( 0.0f, 1.0f, 0.0f, 0.2f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.2f),
new Vector4( 1.0f, 1.0f, 0.0f, 0.2f)
new Vector4( 1.0f, 0.0f, 0.0f, 0.2f),
new Vector4( 1.0f, 1.0f, 0.0f, 0.2f),
new Vector4( 0.0f, 0.0f, 1.0f, 0.2f)

};
List<Vector4> tanCoord = new List<Vector4>()
{
Expand Down
2 changes: 2 additions & 0 deletions Source/Tests/Primitive_Attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ No attributes are explicitly set in every model generated by this test, other th

If both Vertex UV 0 and 1 are set on a model, then all of the textures will use Vertex UV 1.

All values of Byte and Short are normalized unsigned.

Vertex UV 0 | Vertex UV 1
:---: | :---:
<img src="./UVspaceIcon-0.png" height="72" width="72" align="middle"> | <img src="./UVspaceIcon-1.png" height="72" width="72" align="middle">
Expand Down
6 changes: 3 additions & 3 deletions Source/Tests/Texture_Sampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public Texture_Sampler()
usedImages.Add(baseColorTexture);
List<Vector2> uvCoord = new List<Vector2>()
{
new Vector2(-0.3f, 1.3f),
new Vector2( 1.3f, 1.3f),
new Vector2( 1.3f,-0.3f),
new Vector2(-0.3f,-0.3f)
new Vector2(-0.3f, 1.3f),
new Vector2(-0.3f,-0.3f),
new Vector2( 1.3f,-0.3f)
};
requiredProperty = new List<Property>
{
Expand Down

0 comments on commit 79fffe4

Please sign in to comment.