Skip to content

Commit 1d98be0

Browse files
authored
Merge updates for v0.3 (KhronosGroup#224)
* Updates for initial pass of GLTFWrapper * Added binary write support for Vector4 * Fix for empty images arraylist being converted to array * Added intellisense documentation to GLTFWrapper classes and methods * removed min and max properties for positions and normals * Removed image dependencies in Materials.ms and Common.ms * Adding Asset Generator Example project for demonstrating example usage of the GLTFWrapper * Squashed commit of the following: Removed AssetGeneratorExample project commit 775ca8360b3da10f177ec9a0a75b90d0d6c7cc96 Author: Kacey Coley <[email protected]> Date: Wed Aug 23 16:58:52 2017 -0700 Removed AssetGeneratorExamplesProject * Added image copying attribute logic to AssetGenerator * Removed ExampleProject references from gitignore * Added AlphaMode to GLTFMaterial * Reverted VS Version back to original (15) * Initial implementation of recursively creating models (KhronosGroup#3) * Save test values in objects and generate powerset of models to create * Set model parameters using power set * Remove need for Materials.cs and Add switch for test types * Remove completed TODO comment * Switched from string to enum for tracking names of parameters * Add general materials test model creation * Place models in folders named for their test group * Add check that removes duplicate combos for non-binary parameter sets * Action if statement feedback * Commiting initial set of unit tests * Add PowerSet support for required parameters (KhronosGroup#15) * PowerSet now supports required parameters * Remove debug test * add transform support for GLTFMeshPrimitive * Switching order of ItemGroup compile includes to help resolve merge conflict * Removing whitespace in last itemgroup commit * Added material parameters for name, alphaCutoff and doubleSided to GLTFMaterial * Changed emissiveFactor to Vector3 from Vector4 (based on spec) * Switch over to using wrapper to build gtTL models (KhronosGroup#21) * Switch from raw glTF building to using the API * Remove code wrapper replaced * Add missing 'else' * Added missing fields for the wrapper texture, image and sampler classes * Add missing comments for types in GLTFSampler * Added name for mesh * Refactored mesh to support passing in custom names * Making source and sampler parameters optional * re-add name setting for Texture * fixed typo with assigning indices to the wrong texture and texture coords for metallicroughness * Added initial classes for Accessors and Buffer wrappers * Move meshprimitive creation logic to mesh primitive wrapper * Create models that use PBR materials textures (KhronosGroup#29) * Add parameters for BaseColorTexture test * Null Sampler crash * Add support for prerequisites on parameters * Add texture attribute else if checks * Fix isPrerequisite name bug * Fix bug removing combos containing no prerequisite * Combo bug fixes and Add function to check if two combos are equal * Add - between attributes in file name * Set image to copy on build * Add source attribute * Renable materials test * Added initial classes for Accessors and Buffer wrappers * Move meshprimitive creation logic to mesh primitive wrapper * refactored to use GLTFBuffer wrapper in building gltf * moved mesh creation to mesh wrapper * Name models by number and list attributes in asset info (KhronosGroup#33) * Added initial classes for Accessors and Buffer wrappers * Move meshprimitive creation logic to mesh primitive wrapper * refactored to use GLTFBuffer wrapper in building gltf * moved mesh creation to mesh wrapper * using wrapper for positions and normals in mesh primitive * Added byteoffset to bufferview wrapper * Implemented material textures (KhronosGroup#35) * Add parameters for BaseColorTexture test * Null Sampler crash * Add support for prerequisites on parameters * Add texture attribute else if checks * Fix isPrerequisite name bug * Fix bug removing combos containing no prerequisite * Combo bug fixes and Add function to check if two combos are equal * Add - between attributes in file name * Set image to copy on build * Add source attribute * Renable materials test * Add texture parameters to materials test * Add if switches for mat texture attributes * Fix typo * switched int values to enums in Sampler wrapper * Implement Sampler test group (KhronosGroup#46) * Setup sampler test values * Remove redudant lines of code * Add sampler test if statement block * Remove required param logic and instead use required param array separately from powerset * Remove commented out code for Required Params * Use Sampler Enum for values * Sampler test uses cusome texture coord sets * Add a more practical test UV map * Add powerset summary * implement sampler index search * converted SamplerSearch to ObjectSearch generic * implement texture index search * implement image index search and unit test * Removed hard-coded enum in sampler wrapper * Change from all combinations to only make full sets and singles (KhronosGroup#48) * Covert PowerSet function and dependants to use lists all the way through. * Add stopwatch to track perf against * Create basicset function * Cleanup * Stevk/logging (KhronosGroup#49) * Write log to relate model number to attributes * Switch attribute listing from the generator field to the copyright * Remove old code * Really remove old code * refactored wrapper to support multiple scenes * Added missing comment documentation for wrapper components * adding additional comments * Stabilise creation of combos for textures and materials (KhronosGroup#58) * Collapse PBR texture attributes into one check * Fix bug where the full set was being culled due to non-binary attributes * Add Alphamode Opaque test * Prevent combos that consist only of the name attribute * Fix textures to include all optional attributes * Replace bool check for if attribute is required with bool to track if it has dependant attributes * Remove previous bool check and cleanup * Create combos for prerequisite sets and fix prerequisite checks * Undo if statement change and fix issue KhronosGroup#50 * Add full texture attribute combos * Remove extra binary attributes in the full combo * Give all texture assignments a source * Create custom combos for a few specific cases * Remove green texture in favor of UVmap2017 * Remove duplicate hardcoding of texture name * Refactor ParameterCombos to untangle some if statements * Flag the Sampler test as including non-binary attributes * Add the test name to log files * Basecolorfactor had alpha set to 0, which should make models not render (KhronosGroup#60) * Set up new runtime directory with separate classes for each runtime object * add modified asset generator * removed GLTFAccessor and GLTFBuffer, and GLTFBufferView dependencies * fixing name issues in Mesh Runtime * removing name violation warnings in runtime classes and creating Runtime Scene and GLTF class * moved unittest directory * refactored classes to switch to using Runtime classes * Removed GLTFWrapper dependency * removed tests for gltfwrapper material, mesh primitives and wrapper * updated unit tests to use runtime classes and updated gitignore file paths for unit tests * Updated comments * removed commented out gltfwrapper line * switched to using glTF2Loader NuGet package instead of gltfLoader NuGet package * removed another commented out import statement * updated readme * added path to NuGet url for glTF2Loader * Removed Materials.cs file * switched min max for accessors to boolean toggle and enabled only for positions * Move PBR attributes into the materials test and tweak alpha test models (KhronosGroup#68) * Set alpha factor to 1 in pbr test * Move PBR attributes into the materials test and fix MRT attribute that was set incorrectly * Add model to test alphamode_BLEND with a basecolorfactor * Fix typo in BaseColorFactor alpha value * added missing variables in unit test * Created derived Extras class with attribute data * fixed name violation with derived class * putting extra info within the Assets group * Per test, create md table of models and their attributes (KhronosGroup#75) * Setup header for md * Add hyphens for header row * Prep header for a String,Join later * Use String.Join and an array to name the attributes used * Implement md logging * Add Extras class to avoid merge conflicts * Readd space to name in asset * Center md columns * Fix csv log to use array by using String.join * Fix md bug where attributes with the same name but different prerequisites were treated as the same in logging * Add prerequisite name to attribute name in md header where appropriate * Add spaces to attribute names in md log, to make them more readable * Make Nonbinary attributes share a single column * Merge source into texture parameter for materials and sampler tests * Stop setting name attribute * Stop setting sampler and texcoord * Reorder material test models * Have md log use blanks instead of red X for unused attributes * Fix bug with md output order * Insert full prereq sets next to the basic version * Include basecolorfactor when testing alphamask * Remove Opaque and create an empty set * Clean up code * Use a plane instead of triangle for models * Reorder MRT combo * Change mesh and UV order for plane * Changed mesh and UV order for plane again * Fix bug with nonbinary attributes in full sets * Remove Repeat WrapS and WrapT in Sampler test (KhronosGroup#82) * removed texture coords values in Samplers Test * flipped plane model * updated uvs coords * fixed uvs - reversed them * Delete old output each time the app is run (KhronosGroup#88) * adding initial commit for morph target support * added unit tests for morph targets * added weights to unittests * Name md files README.md so that github will display their contents and make samplers plural * referenced generated-assets branch in README * using relative path to generated-assets branch * using abs path to generated-assets path * fixed bug with buffer offset for multiple mesh primitives * updated unit tests * tangents and colors to mesh primitives (KhronosGroup#107) * added tangents support * added tangents support to morph target * Added Colors to Mesh Primitives * add ubyte and short support for MeshPrimitive * cleaning up some old comments * added missing case for texturecoordsets * redoing using enums to set the accessor modes for colors and texture coords * fixed name violation * adding comments for enums * Move the directory before deleting it, to prevent lockouts (KhronosGroup#109) * removing unused models from Common * removing cube model * switched tangents to vec4 * first pass * use normalize variable and dictionary to determine which accessor to create * Changing Color Accessor Mode to use Enum Flags. Reorg-ed color accessor logic to be switch statements * Have texture coords accessor logic match syntax of color accessor * removed unused line in unit tests * Added unit test for color enum * squeezing out extra line breaks * use struct to represent image index data * Adding Indices to MeshPrimitive * using camel case instead of underscores in variable names * more underscore removal * Adding additional unit test for indices to verify count in accessor * removing min max from all params except position * clean up code * Adding byte align logic for color and texture coords * fixed bug in incorrect byte size * Implement Primitive Attributes Test (KhronosGroup#112) * Initial implementation of parameter attribute test * Change test values to rely on wrapper to convert float to byte or uShort in testvalues * Implement Tangent test * Use all positive values for UV Coords so byte and ushort don't cause a crash * MD log creation no longer consolidates parentchild parameters that are nonbinary * Fix bug where no uvCoords were being set * Change uvCoords so they apply texture to different parts of the model * Use emissive as a second texture * Use new Enum settings for color * Use Vec4 for color * Change requiredParameters to use List instead of array and apply emissive texture only as needed * Use occlusion instead of emissive * Include a basecolor texture and UV in every test model * Remove commented out code * Add combos with TexCoords and Color for both byte and short * MD column names now are more readable for attributes with prerequisites * MD column names now add a space before a number * Readd newline at the end of testvalues.cs * Ensuring that color accessor enum has a 0 value * Switching enum to two in mesh primitive * updating unit tests and program.cs * Name change for color component type and texture coords component type * Changed comment for Mode * Centered coordinates for plane * Split some tests, rename the tests/folders, and improve the MD log's formatting (KhronosGroup#137) * Split the materials test into mats and PBR * Set up tangent so that normal isn't included in its name * Make md header text smaller * Split Materials into Materials and Alphas * Expand MD table to show attributes used in all models * Add linebreak to md header * Fix the md header linebreak again * Fix bug with prerequsite name in md log * Output values in Prereq header in md log and tweaks * Use attribute values in prerequ table * Format image string so that it links and is resized * Put brackets around vectors in the log * Use name of image to create link in mn instead of a static link * Reduce image size and lock height instead of width * Tweak image height and values for all attributes in MD table * Rename PBR to MEtallicRoughtnessMaterial * Add s to MRM * MD log formats floats in vec to show two digits * Rename all tests to a Parent_Test structure * Use normal casing for enum names * Add note detailing that byte and short are always normalized unsigned * Use a normal texture instead of occlusion in Primitive_attribute test * Fix bug with alpha attribute names in md log still being in all caps * Fix bug with Sampler attribute names getting linebreaks when they shouldn't * Fix linebreak in md log * Fixed bug where the md table would write an extra space into the front of some attributes * Improve image centering in md table * Remove linebreak in md table from color attribute values * Change md header text * Only show Byte/Short message if those attributes are used * Fix spacing for color attributes in md table * Link table to relevant model * Added Cube model * removed wrapper from model function names * removed unused parameters from SinglePlane, SingleCube and SingleTriangel * Added asset and extras to runtime abstraction * prefixing schema gltf variable to help with code clarity * Refactor TestValues.cs and Program.cs into more logical classes (KhronosGroup#149) * Create LogStringHelper and move table string functions into it * Use optional parameters when creating a Parameter object * Use the word Attribute instead of Parameter and Param * Use optional parameters for custom combo creation * Create Attribute, ComboHelper and Enums files and move relevant functions from TestValues into them * Break the values for each test into its own subclass * Split logic for making logs into its own class * Remove commented out log code * Split logic for setting model attributes into the relevant test classes * Move enums into attribute.cs and TestValues.cs * Rename attribute to property * Use reflection to create test classes * Use the new textures and use reflection to copy them into the output folders * Move logic for deleting old output and copying in image files into a new helper class * Use switches when applying attributes for some tests * Action feedback * Action more feedback * use VEC4 instead of VEC3 for Tangents * switch to using geometryData to get the byte offset in meshprimitive * do not set buffer bytelength if equal to 0 or exception gets raised * fix bug in setting the bufferOffset too late * Fix textures so that none of them give the apperance of being broken when viewed (KhronosGroup#164) * Simplify basecolor texture used for sampler test * Textures use 1:1 mapping for all tests unless specified in the test * Make UV tests in Primitive_Attributes use 1:1 mapping * Collapse Primitive_Attribute switch into if checks * Switch second texture in Primitive_Attribute to metallicRoughness for higher visibility * Make changes with alpha attributes more apparent and remove unneeded emissive texture model (KhronosGroup#169) * Use a basecolortexture instead of normal for alpha test models * Remove solo emissive texture model because the default emissive factor is none * Make changes in alpha easier to see and add an alpha specific texture * Remove alpha factor from most alpha tests, since we're using a texture now instead * use indices for plane * Fixed bug in bytelength calculation for Color for non-float types * use four vertices instead of 6 for overrides * Increace alpha cuttoff value enough so that we can see the significant figure in the md table (KhronosGroup#178) * Fix bug with colorfactor label in Alpha test (KhronosGroup#177) * Bug fixes for v0.2 milestone (KhronosGroup#183) * Use normal texture with normalcoord and tangent coord * Show the Tex coord 0 as float everywhere in the log for Primitive_Attribute * Big change which allows explicit inserting of properties into combos * Hide TexCoord required property from the MD tabel * Pad number in model names * Add new textures * Fix bug where some primitive attribute models had TexCoord0 set twice * Fix bug with value used for emissive factor * Make BaseColorFactor 0.2 in Material_MetallicRoughness * Fix bug where normal texture wasn't correctly set in Primitive_Attribute * Quadruple size of textures in MD tabels * Remove normal from the base model and only add as needed * Remove normal texture line from Material_Alpha * Fix bug where float was left off of table in primitive_attributes * Change metallic roughness factors to 0.0 and remove test when both factors are set * Only declare normal texture if it is being used in Primitive_Attribute * Fix bad merge * Don't show basecolortexture as a required property in Primitive_Attribute * added scale for normal and strength for occlusion (KhronosGroup#189) * update readme with more covered requirements * Remove some unnecessary primitive attributes tests * Add material base color factor and adjust normal scale * Update vertex color values * Update to the latest textures and update alpha factor values * Delete unnecessary add files from merge * moved initialization of metallic roughness property * added mode enum support in meshprimitive * added support for points * changed order for points * Use templates for creating MD logs (KhronosGroup#209) * Initial implementation of using templates for MD logs * Remove unused parameter * Remove extra lines from templates and remove header table from MetallicRoughness * Use .md for the templates for easier editing * Use images as embedded resources * Move images to Tests folder * Remove old static log header strings * Add combos involving vertex color to Alpha and MetallicRoughness, and change how we test UV1 (KhronosGroup#202) * Add color property into alpha test set * Rename color to VertexColor and use different alpha values for each vertex * Renamed other properties to include the word vertex * Move Normal Texture next to other textures in Primitive_Attribute log * Don't test texture/vertexcolor in combo in Primitive_Attribute * Add Vertex color combos to PBR * Switch between two UVs of a single texture instead of trying to apply multiple textures in Primitive_Attribute * Lock image width in MD log * Add cutoff value to Material_Alpha 08 so that it gets a hole * Test normal texture without setting a vertex normal * Fix bug where texture was declared but not used in Primitive_Attribute * Move UV texture next to other UV textures in log for Primitive_Attribute * Fix normal texture order issue with Primitve_Attribute * Move models that use the basecolortexture next to each other in the MD log for MetallicRoughness * Move models that use the basecolortexture next to each other in the md log for Material_Alpha * initial commit wip * new updates for spec gloss * updates on internal - only at class level * renaming materialPbrSpecularGlossiness to PbrSpecularGlossiness * making test class constructors back to public and removing older spec gloss extension implementation * changed conversion function name to ConvertToSchema * Set the extension when used in the gltf file * changed Program.cs back to internal * ignore .vs location * removing .vs from version control * Initial implementation of Material_SpecGloss test set * Use casting to set values for PBRSpecGloss * Add PBRSpecGloss textures * Split occlusion/metallicRoughness texture * Add UV icons to Primitive_Attribute MD log to show how we're mapping textures (KhronosGroup#216) * Add UV icon to Primitive_Attribute MD log * Shorten UV explaination in Primitive_Attribute * Refer to the UV textures as 0 and 1 to be consistant * Add Material_SpecularGlossiness test set (KhronosGroup#214) * Initial implementation of Material_SpecGloss test set * Use casting to set values for PBRSpecGloss * Add PBRSpecGloss textures * Rename textures to match glTF names * Fix new texture filename case * Override the default value of SpecFactor when testing Diffuse Texture * Use a shallow copy to set SpecGloss properties * Resolve more merge conflicts * Merge conflicts * Merge conflicts * Add occlusion tests to MetallicRoughness * Add occlusion tests to SpecGloss * Remove occlusion from PBR and update Material to use the right texture * Limit the types of VertexColor we test in Alpha, MetallicRough, and SpecGloss * Remove outdated header from Material_Alpha * Fix bugs for v0.3 release (KhronosGroup#222) * Remove Diffuse Factor from model 5 in SpecGloss * Fix empty set for SpecGloss and MetallicRough * Move VertexColor to the front of the log in SpecGloss/MetallicRough/Alpha * Change case on textures * Remove basecolorfactor from test with colorfactor and basecolortexture * Remove lambert2 from the texture names * Update README.md * Add line break in primitive attribute template so UV texture table renders properly on GitHub
1 parent e8ab968 commit 1d98be0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1426
-308
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
33
################################################################################
44

5+
/.vs
56
/Source/.vs
67
/Source/bin
78
/Source/obj

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ So far, this project covers these requirements, with more to come:
1414
- Material Alphas
1515
- Primitive Attributes
1616
- Texture Samplers
17+
- Specular Glossiness
1718

1819
## What is the feature roadmap?
1920
Please refer to the [Feature Roadmap](https://github.com/bghgary/glTF-Asset-Generator/issues/63)

Source/AssetGenerator.csproj

+26-13
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,24 @@
5959
<Compile Include="Program.cs" />
6060
<Compile Include="Properties\AssemblyInfo.cs" />
6161
<Compile Include="Runtime\Asset.cs" />
62+
<Compile Include="Runtime\Extensions\Extension.cs" />
6263
<Compile Include="Runtime\Extras.cs" />
6364
<Compile Include="Runtime\GLTF.cs" />
6465
<Compile Include="Runtime\Image.cs" />
6566
<Compile Include="Runtime\Material.cs" />
67+
<Compile Include="Schema\MaterialPbrSpecularGlossiness.cs" />
68+
<Compile Include="Runtime\Extensions\PbrSpecularGlossiness.cs" />
6669
<Compile Include="Runtime\Mesh.cs" />
6770
<Compile Include="Runtime\MeshPrimitive.cs" />
68-
<Compile Include="Runtime\MetallicRoughnessMaterial.cs" />
71+
<Compile Include="Runtime\PbrMetallicRoughness.cs" />
6972
<Compile Include="Runtime\ObjectSearch.cs" />
7073
<Compile Include="Runtime\Sampler.cs" />
7174
<Compile Include="Runtime\Scene.cs" />
7275
<Compile Include="Runtime\Texture.cs" />
7376
<Compile Include="LogStringHelper.cs" />
7477
<Compile Include="Tests\Material.cs" />
7578
<Compile Include="Tests\Material_Alpha.cs" />
79+
<Compile Include="Tests\Material_SpecularGlossiness.cs" />
7680
<Compile Include="Tests\Material_MetallicRoughness.cs" />
7781
<Compile Include="Tests\Primitive_Attribute.cs" />
7882
<Compile Include="Tests\Texture_Sampler.cs" />
@@ -81,20 +85,29 @@
8185
<ItemGroup>
8286
<None Include="App.config" />
8387
<None Include="packages.config" />
88+
<EmbeddedResource Include="Tests\Material.md" />
89+
<EmbeddedResource Include="Tests\Material_Alpha.md" />
90+
<EmbeddedResource Include="Tests\Material_MetallicRoughness.md" />
91+
<EmbeddedResource Include="Tests\Primitive_Attribute.md" />
92+
<EmbeddedResource Include="Tests\Texture_Sampler.md" />
93+
<EmbeddedResource Include="Tests\Material_SpecularGlossiness.md" />
8494
</ItemGroup>
8595
<ItemGroup>
86-
<Content Include="ImageDependencies\lambert2_baseColor.png">
87-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
88-
</Content>
89-
<Content Include="ImageDependencies\lambert2_emissive.png">
90-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
91-
</Content>
92-
<Content Include="ImageDependencies\lambert2_normal.png">
93-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
94-
</Content>
95-
<Content Include="ImageDependencies\lambert2_occlusionRoughnessMetallic.png">
96-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
97-
</Content>
96+
<EmbeddedResource Include="Tests\panel_baseColor.png" />
97+
<EmbeddedResource Include="Tests\panel_emissive.png" />
98+
<EmbeddedResource Include="Tests\panel_normal.png" />
99+
</ItemGroup>
100+
<ItemGroup>
101+
<EmbeddedResource Include="Tests\UVspaceIcon-0.png" />
102+
<EmbeddedResource Include="Tests\UVspaceIcon-1.png" />
103+
</ItemGroup>
104+
<ItemGroup>
105+
<EmbeddedResource Include="Tests\panel_metallicRoughness.png" />
106+
<EmbeddedResource Include="Tests\panel_occlusion.png" />
107+
</ItemGroup>
108+
<ItemGroup>
109+
<EmbeddedResource Include="Tests\panel_diffuse.png" />
110+
<EmbeddedResource Include="Tests\panel_specularGlossiness.png" />
98111
</ItemGroup>
99112
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
100113
</Project>

Source/AssetGeneratorTests/Runtime/GLTFTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void BuildGLTFTest()
2727
Generator = "Unit Test",
2828
Copyright = "Unit Tester",
2929
};
30-
gltf.Asset = asset.ConvertToAsset();
30+
gltf.Asset = asset.ConvertToSchema();
3131
Data geometryData = new Data("test.bin");
3232
Runtime.GLTF wrapper = new GLTF();
3333
wrapper.BuildGLTF(ref gltf, geometryData);

Source/AssetGeneratorTests/Runtime/ImageTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void ConvertToImageTest()
1717

1818
Runtime.Image rImage = new Runtime.Image();
1919
rImage.Uri = "test.png";
20-
glTFLoader.Schema.Image image = rImage.ConvertToImage();
20+
glTFLoader.Schema.Image image = rImage.ConvertToSchema();
2121
Assert.IsTrue(image.Uri.Equals(rImage.Uri));
2222
}
2323
}

Source/AssetGeneratorTests/Runtime/MeshPrimitiveTests.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public void GetMinMaxPositionsTest()
3030
[TestMethod()]
3131
public void ConvertToMeshPrimitiveTest()
3232
{
33+
Runtime.GLTF gltf = new GLTF();
3334
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
3435
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
3536
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
@@ -41,7 +42,7 @@ public void ConvertToMeshPrimitiveTest()
4142
int bufferIndex = 0;
4243

4344
MeshPrimitive meshPrim = new MeshPrimitive();
44-
meshPrim.ConvertToMeshPrimitive(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
45+
meshPrim.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
4546
}
4647
[TestMethod()]
4748
public void GetMorphTargetsTest()
@@ -64,6 +65,7 @@ public void GetMorphTargetsTest()
6465
new Vector3(0.0f, 0.0f, -1.0f),
6566
new Vector3(0.0f, 0.0f, -1.0f)
6667
};
68+
Runtime.GLTF gltf = new GLTF();
6769
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
6870
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
6971
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
@@ -90,7 +92,7 @@ public void GetMorphTargetsTest()
9092
meshPrim.morphTargetWeight = 0;
9193
Mesh mesh = new Mesh();
9294
mesh.AddPrimitive(meshPrim);
93-
glTFLoader.Schema.Mesh m = mesh.ConvertToMesh(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
95+
glTFLoader.Schema.Mesh m = mesh.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
9496
Assert.IsTrue(m.Primitives[0].Targets.Count() > 0);
9597
Assert.IsTrue(m.Weights.Count() > 0);
9698
}
@@ -108,6 +110,7 @@ public void ColorAttributeEnumTest()
108110
[TestMethod()]
109111
public void IndicesTest()
110112
{
113+
Runtime.GLTF gltf = new GLTF();
111114
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
112115
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
113116
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
@@ -147,7 +150,7 @@ public void IndicesTest()
147150
new Vector2(0.0f, 0.0f)
148151
}
149152
};
150-
glTFLoader.Schema.MeshPrimitive sMeshPrimitive = meshPrimitive.ConvertToMeshPrimitive(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
153+
glTFLoader.Schema.MeshPrimitive sMeshPrimitive = meshPrimitive.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
151154
Assert.AreEqual(sMeshPrimitive.Indices, 2); // indices is third bufferview, or index 2
152155
Assert.AreEqual(accessors[2].Count, 6); // should be siz index values
153156

Source/AssetGeneratorTests/Runtime/MeshTests.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public void AddPrimitiveTest()
2828
[TestMethod()]
2929
public void ConvertToMeshTest()
3030
{
31+
Runtime.GLTF gltf = new GLTF();
3132
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
3233
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
3334
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
@@ -40,7 +41,7 @@ public void ConvertToMeshTest()
4041

4142
int buffer_index = 0;
4243

43-
m.ConvertToMesh(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, buffer_index);
44+
m.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, buffer_index);
4445
}
4546
}
4647
}

Source/AssetGeneratorTests/Runtime/SamplerTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class SamplerTests
1515
public void ConvertToSamplerTest()
1616
{
1717
Runtime.Sampler rsampler = new Runtime.Sampler();
18-
glTFLoader.Schema.Sampler sampler = rsampler.ConvertToSampler();
18+
glTFLoader.Schema.Sampler sampler = rsampler.ConvertToSchema();
1919
}
2020

2121
}

Source/ComboHelper.cs

+18-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace AssetGenerator
55
{
6-
public static class ComboHelper
6+
internal static class ComboHelper
77
{
88
public static List<List<Property>> AttributeCombos(Test test)
99
{
@@ -108,17 +108,17 @@ public static List<List<Property>> AttributeCombos(Test test)
108108
foreach (var x in combos[1])
109109
{
110110
// Keep property if it is the first found or is binary
111-
if (x.attributeGroup == 0 || (x.attributeGroup > 0 && !keep.Any()))
111+
if (x.propertyGroup == 0 || (x.propertyGroup > 0 && !keep.Any()))
112112
{
113113
keep.Add(x);
114114
}
115-
else if (x.attributeGroup > 0)
115+
else if (x.propertyGroup > 0)
116116
{
117117
bool alreadyKept = false;
118118
foreach (var y in keep)
119119
{
120120
// Don't keep the nonbinary property if there is already one of that set on the list
121-
if (y.attributeGroup == x.attributeGroup)
121+
if (y.propertyGroup == x.propertyGroup)
122122
{
123123
alreadyKept = true;
124124
break;
@@ -168,16 +168,16 @@ public static List<List<Property>> AttributeCombos(Test test)
168168
foreach (var attribute in combos[x])
169169
{
170170
// Remove combos that have multiple of the same binary combo
171-
if (attribute.attributeGroup > 0)
171+
if (attribute.propertyGroup > 0)
172172
{
173-
if (binarySets.Contains(attribute.attributeGroup))
173+
if (binarySets.Contains(attribute.propertyGroup))
174174
{
175175
removeTheseCombos.Add(combos[x]);
176176
break;
177177
}
178178
else
179179
{
180-
binarySets.Add(attribute.attributeGroup);
180+
binarySets.Add(attribute.propertyGroup);
181181
}
182182
}
183183
// Removes combos that have a property missing a prerequisite
@@ -242,20 +242,25 @@ public static List<List<Property>> AttributeCombos(Test test)
242242
return finalResult;
243243
}
244244

245-
public static List<Property> CustomComboCreation(Property attributeA, Property attributeB = null, Property attributeC = null)
245+
public static List<Property> CustomComboCreation(Property propertyA, Property propertyB = null, Property propertyC = null, Property propertyD = null)
246246
{
247247
List<Property> newCombo = new List<Property>();
248248

249-
newCombo.Add(attributeA);
249+
newCombo.Add(propertyA);
250250

251-
if (attributeB != null)
251+
if (propertyB != null)
252252
{
253-
newCombo.Add(attributeB);
253+
newCombo.Add(propertyB);
254254
}
255255

256-
if (attributeC != null)
256+
if (propertyC != null)
257257
{
258-
newCombo.Add(attributeC);
258+
newCombo.Add(propertyC);
259+
}
260+
261+
if (propertyD != null)
262+
{
263+
newCombo.Add(propertyD);
259264
}
260265

261266
return newCombo;

Source/Common.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace AssetGenerator
55
{
6-
public class Common
6+
internal class Common
77
{
88
/// <summary>
99
/// Creates a triangle model using the glTF wrapper

Source/Data.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace AssetGenerator
77
{
8-
public class Data
8+
internal class Data
99
{
1010
public string Name { get; private set; }
1111
public BinaryWriter Writer { get; private set; }
@@ -16,7 +16,7 @@ public Data(string name)
1616
this.Writer = new BinaryWriter(new MemoryStream());
1717
}
1818
}
19-
public struct Vector4
19+
internal struct Vector4
2020
{
2121
public float x;
2222
public float y;
@@ -57,7 +57,7 @@ public float[] ToArray()
5757
}
5858
}
5959

60-
public struct Vector3
60+
internal struct Vector3
6161
{
6262
public float x;
6363
public float y;
@@ -94,7 +94,7 @@ public float[] ToArray()
9494
return result;
9595
}
9696
}
97-
public struct Vector2
97+
internal struct Vector2
9898
{
9999
public float x;
100100
public float y;
@@ -133,7 +133,7 @@ public float[] ToArray()
133133
/// <summary>
134134
/// Matrix struct which represents a 4x4 matrix
135135
/// </summary>
136-
public class Matrix4x4
136+
internal class Matrix4x4
137137
{
138138
public Vector4[] Rows { get; set; }
139139

@@ -180,7 +180,7 @@ public float[] ToArray()
180180
/// <summary>
181181
/// Defines a Quaternion where x, y and z represent the axis, and w is the angle in radians
182182
/// </summary>
183-
public class Quaternion
183+
internal class Quaternion
184184
{
185185
public Vector4 Components { get; private set; }
186186
/// <summary>

Source/FileHelper.cs

+16-9
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
using System.IO;
33
using System.Diagnostics;
44
using System.Collections.Generic;
5+
using System.Reflection;
56

67
namespace AssetGenerator
78
{
8-
public static class FileHelper
9+
internal static class FileHelper
910
{
1011
public static void ClearOldFiles(string executingAssemblyFolder, string assetFolder)
1112
{
@@ -35,20 +36,26 @@ public static void ClearOldFiles(string executingAssemblyFolder, string assetFol
3536
}
3637
}
3738

38-
public static void CopyImageFiles(string executingAssemblyFolder, string assetFolder, List<Runtime.Image> usedImages)
39+
public static void CopyImageFiles(Assembly executingAssembly, string executingAssemblyFolder, string assetFolder, List<Runtime.Image> usedImages)
3940
{
40-
var imageFolder = Path.Combine(executingAssemblyFolder, "ImageDependencies");
41+
var imageFolder = Path.Combine(executingAssemblyFolder, "Tests");
4142
if (usedImages.Count > 0)
4243
{
4344
foreach (var image in usedImages)
4445
{
45-
if (File.Exists(Path.Combine(imageFolder, image.Uri)))
46+
// Reads the template file
47+
string imageSourcePath = "AssetGenerator.Tests." + image.Uri;
48+
string imageDestinationPath = Path.Combine(assetFolder, image.Uri);
49+
using (Stream stream = executingAssembly.GetManifestResourceStream(imageSourcePath))
4650
{
47-
File.Copy(Path.Combine(imageFolder, image.Uri), Path.Combine(assetFolder, image.Uri), true);
48-
}
49-
else
50-
{
51-
Debug.WriteLine(imageFolder + " does not exist");
51+
if (stream == null)
52+
{
53+
throw new ArgumentException("No such image", image.Uri);
54+
}
55+
using (Stream output = File.OpenWrite(imageDestinationPath))
56+
{
57+
stream.CopyTo(output);
58+
}
5259
}
5360
}
5461
}
Binary file not shown.

Source/LogStringHelper.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static string ConvertTestValueToString(Property param)
3030
valueType.Equals(typeof(List<Vector4>)))
3131
{
3232
// Generates a name for nonBinary attributes
33-
if (param.attributeGroup > 0)
33+
if (param.propertyGroup > 0)
3434
{
3535
output = GenerateNonbinaryName(param.name.ToString());
3636
}
@@ -42,7 +42,7 @@ public static string ConvertTestValueToString(Property param)
4242
else if (valueType.Equals(typeof(Runtime.Image)))
4343
{
4444
// 18 is normal cell height
45-
output = String.Format("<img src=\"./{0}\" height=\"72\" align=\"middle\">", param.value.Uri);
45+
output = String.Format("<img src=\"./{0}\" height=\"72\" width=\"72\" align=\"middle\">", param.value.Uri);
4646
}
4747
else // Likely a type that is easy to convert
4848
{

0 commit comments

Comments
 (0)