Skip to content

Commit 843bc6e

Browse files
authored
Materials and textures test models (KhronosGroup#59)
Materials and Samplers test models
1 parent b90ef62 commit 843bc6e

33 files changed

+3634
-71
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
/Source/bin
77
/Source/obj
88
/Source/packages
9+
/Source/AssetGeneratorTests/.vs
10+
/Source/AssetGeneratorTests/bin
11+
/Source/AssetGeneratorTests/obj
12+
/Source/AssetGeneratorTests/packages

README.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
# glTF-Asset-Generator
1+
# glTF-Asset-Generator
2+
3+
## What is this project?
4+
This is a C# Visual Studio project for generating various glTF 2.0 assets for validating glTF 2.0 importers.
5+
6+
## Why was it created?
7+
In order to help ensure that glTF 2.0 importers meet the [glTF 2.0 Specification](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0) requirements, various types of asset files would need to be created that cover different aspects of the specification . This project is intended to create these various models.
8+
9+
## What does it currently cover?
10+
So far, this project covers these requirements, with more to come:
11+
- Materials
12+
- Textures
13+
- Images
14+
15+
## What is the feature roadmap?
16+
Please refer to the [Feature Roadmap](https://github.com/bghgary/glTF-Asset-Generator/issues/63)
17+
18+
## How to build the project?
19+
* The following are the project dependencies:
20+
- git (if you wish to clone this repository)
21+
- Visual Studio 2017
22+
- gltf2Loader NuGet package (available within Visual Studio 2017's NuGet Package Manager or [here](https://www.nuget.org/packages/glTF2Loader/))
23+
24+
25+
* Within Visual Studio, open the AssetGenerator.sln solution. Be sure to import the gltf2Loader NuGet package. Afterwards, you can Build and Run the solution.
26+
27+
## Where can I find the generated assets?
28+
* The generated assets wil be located in `glTF-Asset-Generator/Source/bin/Debug`, within their own subdirectories
29+
- i.e. Materials, PbrMetallicRoughness, Sampler
30+
31+
32+
33+
34+
35+
36+

Source/AssetGenerator.csproj

+19-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
2425
</PropertyGroup>
2526
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2627
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -33,10 +34,7 @@
3334
</PropertyGroup>
3435
<ItemGroup>
3536
<Reference Include="glTFLoader, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
36-
<HintPath>packages\glTFLoader.2.0.0\lib\net452\glTFLoader.dll</HintPath>
37-
</Reference>
38-
<Reference Include="glTFLoader_Shared, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
39-
<HintPath>packages\glTFLoader.2.0.0\lib\net452\glTFLoader_Shared.dll</HintPath>
37+
<HintPath>packages\glTF2Loader.1.0.0\lib\net452\glTFLoader.dll</HintPath>
4038
</Reference>
4139
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
4240
<HintPath>packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -54,13 +52,29 @@
5452
<Compile Include="Attributes.cs" />
5553
<Compile Include="Common.cs" />
5654
<Compile Include="Data.cs" />
57-
<Compile Include="Materials.cs" />
5855
<Compile Include="Program.cs" />
5956
<Compile Include="Properties\AssemblyInfo.cs" />
57+
<Compile Include="Runtime\GLTF.cs" />
58+
<Compile Include="Runtime\Image.cs" />
59+
<Compile Include="Runtime\Material.cs" />
60+
<Compile Include="Runtime\Mesh.cs" />
61+
<Compile Include="Runtime\MeshPrimitive.cs" />
62+
<Compile Include="Runtime\MetallicRoughnessMaterial.cs" />
63+
<Compile Include="Runtime\ObjectSearch.cs" />
64+
<Compile Include="Runtime\Sampler.cs" />
65+
<Compile Include="Runtime\Scene.cs" />
66+
<Compile Include="Runtime\Texture.cs" />
67+
<Compile Include="TestValues.cs" />
6068
</ItemGroup>
6169
<ItemGroup>
6270
<None Include="App.config" />
6371
<None Include="packages.config" />
6472
</ItemGroup>
73+
<ItemGroup />
74+
<ItemGroup>
75+
<Content Include="ImageDependencies\UVmap2017.png">
76+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
77+
</Content>
78+
</ItemGroup>
6579
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6680
</Project>

Source/AssetGenerator.sln

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26403.7
4+
VisualStudioVersion = 15.0.26730.10
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetGenerator", "AssetGenerator.csproj", "{3742898F-26BA-466B-A100-869B86F19F1A}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetGeneratorTests", "AssetGeneratorTests\AssetGeneratorTests.csproj", "{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,8 +17,15 @@ Global
1517
{3742898F-26BA-466B-A100-869B86F19F1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{3742898F-26BA-466B-A100-869B86F19F1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{3742898F-26BA-466B-A100-869B86F19F1A}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE
2127
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {1B5455A3-2212-42CE-95FE-335279D88247}
30+
EndGlobalSection
2231
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\Source\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\Source\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{B3E73F49-2836-4F34-97BF-45E5D8DE1E6A}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>AssetGeneratorTests</RootNamespace>
11+
<AssemblyName>AssetGeneratorTests</AssemblyName>
12+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
16+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
17+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
18+
<IsCodedUITest>False</IsCodedUITest>
19+
<TestProjectType>UnitTest</TestProjectType>
20+
<TargetFrameworkProfile />
21+
<NuGetPackageImportStamp>
22+
</NuGetPackageImportStamp>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25+
<DebugSymbols>true</DebugSymbols>
26+
<DebugType>full</DebugType>
27+
<Optimize>false</Optimize>
28+
<OutputPath>bin\Debug\</OutputPath>
29+
<DefineConstants>DEBUG;TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34+
<DebugType>pdbonly</DebugType>
35+
<Optimize>true</Optimize>
36+
<OutputPath>bin\Release\</OutputPath>
37+
<DefineConstants>TRACE</DefineConstants>
38+
<ErrorReport>prompt</ErrorReport>
39+
<WarningLevel>4</WarningLevel>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<Reference Include="glTFLoader, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
43+
<HintPath>..\packages\glTF2Loader.1.0.0\lib\net452\glTFLoader.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
46+
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
49+
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
50+
</Reference>
51+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
52+
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
53+
</Reference>
54+
<Reference Include="System" />
55+
</ItemGroup>
56+
<Choose>
57+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
58+
<ItemGroup>
59+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
60+
</ItemGroup>
61+
</When>
62+
<Otherwise />
63+
</Choose>
64+
<ItemGroup>
65+
<Compile Include="Matrix4x4Tests.cs" />
66+
<Compile Include="QuaternionTests.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
<Compile Include="Runtime\GLTFTests.cs" />
69+
<Compile Include="Runtime\ImageTests.cs" />
70+
<Compile Include="Runtime\MeshPrimitiveTests.cs" />
71+
<Compile Include="Runtime\MeshTests.cs" />
72+
<Compile Include="Runtime\SamplerTests.cs" />
73+
<Compile Include="Runtime\SceneTests.cs" />
74+
</ItemGroup>
75+
<ItemGroup>
76+
<None Include="packages.config" />
77+
</ItemGroup>
78+
<ItemGroup>
79+
<ProjectReference Include="..\AssetGenerator.csproj">
80+
<Project>{3742898F-26BA-466B-A100-869B86F19F1A}</Project>
81+
<Name>AssetGenerator</Name>
82+
</ProjectReference>
83+
</ItemGroup>
84+
<Choose>
85+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
86+
<ItemGroup>
87+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
88+
<Private>False</Private>
89+
</Reference>
90+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
91+
<Private>False</Private>
92+
</Reference>
93+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
94+
<Private>False</Private>
95+
</Reference>
96+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
97+
<Private>False</Private>
98+
</Reference>
99+
</ItemGroup>
100+
</When>
101+
</Choose>
102+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
103+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104+
<Import Project="..\Source\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\Source\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" />
105+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
106+
Other similar extension points exist, see Microsoft.Common.targets.
107+
<Target Name="BeforeBuild">
108+
</Target>
109+
<Target Name="AfterBuild">
110+
</Target>
111+
-->
112+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using AssetGenerator;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace AssetGenerator.Tests
10+
{
11+
[TestClass()]
12+
public class Matrix4x4Tests
13+
{
14+
[TestMethod()]
15+
public void Matrix4x4Test()
16+
{
17+
Matrix4x4 mat = new Matrix4x4(
18+
new Vector4(1.0f, 0.0f, 0.0f, 0.0f),
19+
new Vector4(0.0f, 2.0f, 0.0f, 0.0f),
20+
new Vector4(0.0f, 0.0f, 3.0f, 0.0f),
21+
new Vector4(0.0f, 0.0f, 0.0f, 4.0f)
22+
);
23+
24+
Assert.AreEqual(mat.Rows[0], new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
25+
Assert.AreEqual(mat.Rows[1], new Vector4(0.0f, 2.0f, 0.0f, 0.0f));
26+
Assert.AreEqual(mat.Rows[2], new Vector4(0.0f, 0.0f, 3.0f, 0.0f));
27+
Assert.AreEqual(mat.Rows[3], new Vector4(0.0f, 0.0f, 0.0f, 4.0f));
28+
}
29+
30+
[TestMethod()]
31+
public void IdentityTest()
32+
{
33+
Matrix4x4 identityMatrix = Matrix4x4.Identity();
34+
Assert.AreEqual(identityMatrix.Rows[0], new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
35+
Assert.AreEqual(identityMatrix.Rows[1], new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
36+
Assert.AreEqual(identityMatrix.Rows[2], new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
37+
Assert.AreEqual(identityMatrix.Rows[3], new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
38+
39+
}
40+
[TestMethod()]
41+
public void ToArrayTest()
42+
{
43+
Matrix4x4 mat = Matrix4x4.Identity();
44+
float[] entries = mat.ToArray();
45+
float[] entriesComparison =
46+
{
47+
1.0f, 0.0f, 0.0f, 0.0f,
48+
0.0f, 1.0f, 0.0f, 0.0f,
49+
0.0f, 0.0f, 1.0f, 0.0f,
50+
0.0f, 0.0f, 0.0f, 1.0f
51+
};
52+
Assert.IsTrue(entries.SequenceEqual(entriesComparison));
53+
54+
}
55+
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("AssetGeneratorTests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("AssetGeneratorTests")]
13+
[assembly: AssemblyCopyright("Copyright © 2017")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("b3e73f49-2836-4f34-97bf-45e5d8de1e6a")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using AssetGenerator;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace AssetGenerator.Tests
10+
{
11+
[TestClass()]
12+
public class QuaternionTests
13+
{
14+
[TestMethod()]
15+
public void QuaternionTest()
16+
{
17+
Quaternion quat = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
18+
Assert.AreEqual(quat.Components.x, 0.0f);
19+
Assert.AreEqual(quat.Components.y, 0.0f);
20+
Assert.AreEqual(quat.Components.z, 0.0f);
21+
Assert.AreEqual(quat.Components.w, 1.0f);
22+
}
23+
24+
[TestMethod()]
25+
public void IdentityTest()
26+
{
27+
Quaternion quat_identity = Quaternion.Identity();
28+
Assert.AreEqual(quat_identity.Components.x, 0.0f);
29+
Assert.AreEqual(quat_identity.Components.y, 0.0f);
30+
Assert.AreEqual(quat_identity.Components.z, 0.0f);
31+
Assert.AreEqual(quat_identity.Components.w, 1.0f);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)