Skip to content

Commit

Permalink
Merge updates for v0.3 (#224)
Browse files Browse the repository at this point in the history
* 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 <kcoley@users.noreply.github.com>
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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 #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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#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 (#178)

* Fix bug with colorfactor label in Alpha test (#177)

* Bug fixes for v0.2 milestone (#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 (#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 (#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 (#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 (#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 (#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 (#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
  • Loading branch information
kcoley authored Oct 18, 2017
1 parent e8ab968 commit 1d98be0
Show file tree
Hide file tree
Showing 59 changed files with 1,426 additions and 308 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/.vs
/Source/.vs
/Source/bin
/Source/obj
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ So far, this project covers these requirements, with more to come:
- Material Alphas
- Primitive Attributes
- Texture Samplers
- Specular Glossiness

## What is the feature roadmap?
Please refer to the [Feature Roadmap](https://github.com/bghgary/glTF-Asset-Generator/issues/63)
Expand Down
39 changes: 26 additions & 13 deletions Source/AssetGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,24 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Runtime\Asset.cs" />
<Compile Include="Runtime\Extensions\Extension.cs" />
<Compile Include="Runtime\Extras.cs" />
<Compile Include="Runtime\GLTF.cs" />
<Compile Include="Runtime\Image.cs" />
<Compile Include="Runtime\Material.cs" />
<Compile Include="Schema\MaterialPbrSpecularGlossiness.cs" />
<Compile Include="Runtime\Extensions\PbrSpecularGlossiness.cs" />
<Compile Include="Runtime\Mesh.cs" />
<Compile Include="Runtime\MeshPrimitive.cs" />
<Compile Include="Runtime\MetallicRoughnessMaterial.cs" />
<Compile Include="Runtime\PbrMetallicRoughness.cs" />
<Compile Include="Runtime\ObjectSearch.cs" />
<Compile Include="Runtime\Sampler.cs" />
<Compile Include="Runtime\Scene.cs" />
<Compile Include="Runtime\Texture.cs" />
<Compile Include="LogStringHelper.cs" />
<Compile Include="Tests\Material.cs" />
<Compile Include="Tests\Material_Alpha.cs" />
<Compile Include="Tests\Material_SpecularGlossiness.cs" />
<Compile Include="Tests\Material_MetallicRoughness.cs" />
<Compile Include="Tests\Primitive_Attribute.cs" />
<Compile Include="Tests\Texture_Sampler.cs" />
Expand All @@ -81,20 +85,29 @@
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<EmbeddedResource Include="Tests\Material.md" />
<EmbeddedResource Include="Tests\Material_Alpha.md" />
<EmbeddedResource Include="Tests\Material_MetallicRoughness.md" />
<EmbeddedResource Include="Tests\Primitive_Attribute.md" />
<EmbeddedResource Include="Tests\Texture_Sampler.md" />
<EmbeddedResource Include="Tests\Material_SpecularGlossiness.md" />
</ItemGroup>
<ItemGroup>
<Content Include="ImageDependencies\lambert2_baseColor.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ImageDependencies\lambert2_emissive.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ImageDependencies\lambert2_normal.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ImageDependencies\lambert2_occlusionRoughnessMetallic.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Tests\panel_baseColor.png" />
<EmbeddedResource Include="Tests\panel_emissive.png" />
<EmbeddedResource Include="Tests\panel_normal.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Tests\UVspaceIcon-0.png" />
<EmbeddedResource Include="Tests\UVspaceIcon-1.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Tests\panel_metallicRoughness.png" />
<EmbeddedResource Include="Tests\panel_occlusion.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Tests\panel_diffuse.png" />
<EmbeddedResource Include="Tests\panel_specularGlossiness.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion Source/AssetGeneratorTests/Runtime/GLTFTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void BuildGLTFTest()
Generator = "Unit Test",
Copyright = "Unit Tester",
};
gltf.Asset = asset.ConvertToAsset();
gltf.Asset = asset.ConvertToSchema();
Data geometryData = new Data("test.bin");
Runtime.GLTF wrapper = new GLTF();
wrapper.BuildGLTF(ref gltf, geometryData);
Expand Down
2 changes: 1 addition & 1 deletion Source/AssetGeneratorTests/Runtime/ImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void ConvertToImageTest()

Runtime.Image rImage = new Runtime.Image();
rImage.Uri = "test.png";
glTFLoader.Schema.Image image = rImage.ConvertToImage();
glTFLoader.Schema.Image image = rImage.ConvertToSchema();
Assert.IsTrue(image.Uri.Equals(rImage.Uri));
}
}
Expand Down
9 changes: 6 additions & 3 deletions Source/AssetGeneratorTests/Runtime/MeshPrimitiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void GetMinMaxPositionsTest()
[TestMethod()]
public void ConvertToMeshPrimitiveTest()
{
Runtime.GLTF gltf = new GLTF();
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
Expand All @@ -41,7 +42,7 @@ public void ConvertToMeshPrimitiveTest()
int bufferIndex = 0;

MeshPrimitive meshPrim = new MeshPrimitive();
meshPrim.ConvertToMeshPrimitive(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
meshPrim.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
}
[TestMethod()]
public void GetMorphTargetsTest()
Expand All @@ -64,6 +65,7 @@ public void GetMorphTargetsTest()
new Vector3(0.0f, 0.0f, -1.0f),
new Vector3(0.0f, 0.0f, -1.0f)
};
Runtime.GLTF gltf = new GLTF();
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
Expand All @@ -90,7 +92,7 @@ public void GetMorphTargetsTest()
meshPrim.morphTargetWeight = 0;
Mesh mesh = new Mesh();
mesh.AddPrimitive(meshPrim);
glTFLoader.Schema.Mesh m = mesh.ConvertToMesh(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
glTFLoader.Schema.Mesh m = mesh.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
Assert.IsTrue(m.Primitives[0].Targets.Count() > 0);
Assert.IsTrue(m.Weights.Count() > 0);
}
Expand All @@ -108,6 +110,7 @@ public void ColorAttributeEnumTest()
[TestMethod()]
public void IndicesTest()
{
Runtime.GLTF gltf = new GLTF();
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
Expand Down Expand Up @@ -147,7 +150,7 @@ public void IndicesTest()
new Vector2(0.0f, 0.0f)
}
};
glTFLoader.Schema.MeshPrimitive sMeshPrimitive = meshPrimitive.ConvertToMeshPrimitive(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
glTFLoader.Schema.MeshPrimitive sMeshPrimitive = meshPrimitive.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, bufferIndex);
Assert.AreEqual(sMeshPrimitive.Indices, 2); // indices is third bufferview, or index 2
Assert.AreEqual(accessors[2].Count, 6); // should be siz index values

Expand Down
3 changes: 2 additions & 1 deletion Source/AssetGeneratorTests/Runtime/MeshTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void AddPrimitiveTest()
[TestMethod()]
public void ConvertToMeshTest()
{
Runtime.GLTF gltf = new GLTF();
List<glTFLoader.Schema.BufferView> bufferViews = new List<glTFLoader.Schema.BufferView>();
List<glTFLoader.Schema.Accessor> accessors = new List<glTFLoader.Schema.Accessor>();
List<glTFLoader.Schema.Texture> textures = new List<glTFLoader.Schema.Texture>();
Expand All @@ -40,7 +41,7 @@ public void ConvertToMeshTest()

int buffer_index = 0;

m.ConvertToMesh(bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, buffer_index);
m.ConvertToSchema(gltf, bufferViews, accessors, samplers, images, textures, materials, geometryData, ref buffer, buffer_index);
}
}
}
2 changes: 1 addition & 1 deletion Source/AssetGeneratorTests/Runtime/SamplerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SamplerTests
public void ConvertToSamplerTest()
{
Runtime.Sampler rsampler = new Runtime.Sampler();
glTFLoader.Schema.Sampler sampler = rsampler.ConvertToSampler();
glTFLoader.Schema.Sampler sampler = rsampler.ConvertToSchema();
}

}
Expand Down
31 changes: 18 additions & 13 deletions Source/ComboHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace AssetGenerator
{
public static class ComboHelper
internal static class ComboHelper
{
public static List<List<Property>> AttributeCombos(Test test)
{
Expand Down Expand Up @@ -108,17 +108,17 @@ public static List<List<Property>> AttributeCombos(Test test)
foreach (var x in combos[1])
{
// Keep property if it is the first found or is binary
if (x.attributeGroup == 0 || (x.attributeGroup > 0 && !keep.Any()))
if (x.propertyGroup == 0 || (x.propertyGroup > 0 && !keep.Any()))
{
keep.Add(x);
}
else if (x.attributeGroup > 0)
else if (x.propertyGroup > 0)
{
bool alreadyKept = false;
foreach (var y in keep)
{
// Don't keep the nonbinary property if there is already one of that set on the list
if (y.attributeGroup == x.attributeGroup)
if (y.propertyGroup == x.propertyGroup)
{
alreadyKept = true;
break;
Expand Down Expand Up @@ -168,16 +168,16 @@ public static List<List<Property>> AttributeCombos(Test test)
foreach (var attribute in combos[x])
{
// Remove combos that have multiple of the same binary combo
if (attribute.attributeGroup > 0)
if (attribute.propertyGroup > 0)
{
if (binarySets.Contains(attribute.attributeGroup))
if (binarySets.Contains(attribute.propertyGroup))
{
removeTheseCombos.Add(combos[x]);
break;
}
else
{
binarySets.Add(attribute.attributeGroup);
binarySets.Add(attribute.propertyGroup);
}
}
// Removes combos that have a property missing a prerequisite
Expand Down Expand Up @@ -242,20 +242,25 @@ public static List<List<Property>> AttributeCombos(Test test)
return finalResult;
}

public static List<Property> CustomComboCreation(Property attributeA, Property attributeB = null, Property attributeC = null)
public static List<Property> CustomComboCreation(Property propertyA, Property propertyB = null, Property propertyC = null, Property propertyD = null)
{
List<Property> newCombo = new List<Property>();

newCombo.Add(attributeA);
newCombo.Add(propertyA);

if (attributeB != null)
if (propertyB != null)
{
newCombo.Add(attributeB);
newCombo.Add(propertyB);
}

if (attributeC != null)
if (propertyC != null)
{
newCombo.Add(attributeC);
newCombo.Add(propertyC);
}

if (propertyD != null)
{
newCombo.Add(propertyD);
}

return newCombo;
Expand Down
2 changes: 1 addition & 1 deletion Source/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace AssetGenerator
{
public class Common
internal class Common
{
/// <summary>
/// Creates a triangle model using the glTF wrapper
Expand Down
12 changes: 6 additions & 6 deletions Source/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AssetGenerator
{
public class Data
internal class Data
{
public string Name { get; private set; }
public BinaryWriter Writer { get; private set; }
Expand All @@ -16,7 +16,7 @@ public Data(string name)
this.Writer = new BinaryWriter(new MemoryStream());
}
}
public struct Vector4
internal struct Vector4
{
public float x;
public float y;
Expand Down Expand Up @@ -57,7 +57,7 @@ public float[] ToArray()
}
}

public struct Vector3
internal struct Vector3
{
public float x;
public float y;
Expand Down Expand Up @@ -94,7 +94,7 @@ public float[] ToArray()
return result;
}
}
public struct Vector2
internal struct Vector2
{
public float x;
public float y;
Expand Down Expand Up @@ -133,7 +133,7 @@ public float[] ToArray()
/// <summary>
/// Matrix struct which represents a 4x4 matrix
/// </summary>
public class Matrix4x4
internal class Matrix4x4
{
public Vector4[] Rows { get; set; }

Expand Down Expand Up @@ -180,7 +180,7 @@ public float[] ToArray()
/// <summary>
/// Defines a Quaternion where x, y and z represent the axis, and w is the angle in radians
/// </summary>
public class Quaternion
internal class Quaternion
{
public Vector4 Components { get; private set; }
/// <summary>
Expand Down
25 changes: 16 additions & 9 deletions Source/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Reflection;

namespace AssetGenerator
{
public static class FileHelper
internal static class FileHelper
{
public static void ClearOldFiles(string executingAssemblyFolder, string assetFolder)
{
Expand Down Expand Up @@ -35,20 +36,26 @@ public static void ClearOldFiles(string executingAssemblyFolder, string assetFol
}
}

public static void CopyImageFiles(string executingAssemblyFolder, string assetFolder, List<Runtime.Image> usedImages)
public static void CopyImageFiles(Assembly executingAssembly, string executingAssemblyFolder, string assetFolder, List<Runtime.Image> usedImages)
{
var imageFolder = Path.Combine(executingAssemblyFolder, "ImageDependencies");
var imageFolder = Path.Combine(executingAssemblyFolder, "Tests");
if (usedImages.Count > 0)
{
foreach (var image in usedImages)
{
if (File.Exists(Path.Combine(imageFolder, image.Uri)))
// Reads the template file
string imageSourcePath = "AssetGenerator.Tests." + image.Uri;
string imageDestinationPath = Path.Combine(assetFolder, image.Uri);
using (Stream stream = executingAssembly.GetManifestResourceStream(imageSourcePath))
{
File.Copy(Path.Combine(imageFolder, image.Uri), Path.Combine(assetFolder, image.Uri), true);
}
else
{
Debug.WriteLine(imageFolder + " does not exist");
if (stream == null)
{
throw new ArgumentException("No such image", image.Uri);
}
using (Stream output = File.OpenWrite(imageDestinationPath))
{
stream.CopyTo(output);
}
}
}
}
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/LogStringHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static string ConvertTestValueToString(Property param)
valueType.Equals(typeof(List<Vector4>)))
{
// Generates a name for nonBinary attributes
if (param.attributeGroup > 0)
if (param.propertyGroup > 0)
{
output = GenerateNonbinaryName(param.name.ToString());
}
Expand All @@ -42,7 +42,7 @@ public static string ConvertTestValueToString(Property param)
else if (valueType.Equals(typeof(Runtime.Image)))
{
// 18 is normal cell height
output = String.Format("<img src=\"./{0}\" height=\"72\" align=\"middle\">", param.value.Uri);
output = String.Format("<img src=\"./{0}\" height=\"72\" width=\"72\" align=\"middle\">", param.value.Uri);
}
else // Likely a type that is easy to convert
{
Expand Down
Loading

0 comments on commit 1d98be0

Please sign in to comment.