You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add script for validating models
* Validator results are save as raw .log files and a summary README
* Remove the validatedAt property from the validator output, to reduce diff noise
* Add launch configuration for validating models
* Add documentation on validating models
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+19-14Lines changed: 19 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,41 @@
1
-
# Contributing to the glTF Asset Generator
1
+
# Contributing to the glTF Asset Generator
2
+
3
+
## Dependencies
4
+
1. Install [Visual Studio Code.](https://code.visualstudio.com/Download) (VS Code)
5
+
2. Install the extension [C# for VS Code (powered by OmniSharp)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp).
6
+
3. Install [npm.](https://www.npmjs.com/get-npm)
2
7
3
8
## Set Up
4
-
1.Use `git clone https://github.com/KhronosGroup/glTF-Asset-Generator.git` to download the repro.
5
-
2.[Install and launch VS Code.](https://code.visualstudio.com/Download)
6
-
3. Open the local copy of the repro in VS Code.
7
-
1. Select `Explorer` from the sidebar.
8
-
2. Select `Open Folder`.
9
-
3. Select the location of the `glTF-Asset-Generator` folder.
10
-
4. Install the extension [C# for VS Code (powered by OmniSharp)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp). There will likely be a popup prompt to take this action.
11
-
1. After installation, either relaunch VS Code or reload the extension.
2. Run `npm install` from the [Tools](Tools) folder.
12
+
3. Launch VS Code.
13
+
1.Open the local copy of the repro in VS Code.
14
+
2. Select `Explorer` from the sidebar.
15
+
3. Select `Open Folder`.
16
+
4. Select the location of the [glTF-Asset-Generator](https://github.com/KhronosGroup/glTF-Asset-Generator) folder.
12
17
5. Press F5 or select `Start Debugging` from the debug menu.
13
18
14
19
## Best Practices
15
-
+ Write readable code.
20
+
+ Write readable code.
16
21
+ Developers that encounter issues with the models generated by this code will want to look into the code to see how that model is put together.
17
22
+ By default, add properties instead of removing properties when creating a model to reduce code complexity.
18
23
19
24
+ Aim to have fewer than thirteen rows and fewer than seven columns in the model group's readme table (not counting headers).
20
25
+ Each model added creates another row. Having too many rows in a table makes it difficult to read due to needing scrolling too much to view the entire model group's readme. Consider splitting the model group into two or more that are closely related.
21
26
+ Each property being tested adds another column, and usually adds another model as well. Having too many columns results in results in github's markdown squishing the table to make everything fit.
22
27
23
-
+ Clearly identify models that are designed to fail to load. (Negative tests)
24
-
+ A client that is conformant with the glTF 2.0 spec is expected to successfully render any model created by the glTF Asset Generator, unless explicitly noted otherwise.
28
+
+ Clearly identify models that are designed to fail to load. (Negative tests)
29
+
+ A client that is conformant with the glTF 2.0 spec is expected to successfully render any model created by the glTF Asset Generator, unless explicitly noted otherwise.
25
30
+ If a model (or entire group of models) are not expected to load on a conformant client, then the model(s) must be marked as such in the readme.
26
31
+ Models that are not valid need the `Valid` bool set to false, even if they are not necessarily expected to fail to load. See "Flag Model as Not Valid" in [Adding Models Advanced](Documents/Adding_Models_Advanced.md).
27
32
28
33
## Common Errors
29
-
+ The error message `Configured debug type 'coreclr'` is encountered when debugging in VS Code
34
+
+ The error message `Configured debug type 'coreclr'` is encountered when debugging in VS Code
30
35
+ This is caused by debugging without [C# for VS Code (powered by OmniSharp)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) being correctly installed and loaded.
31
36
+ Be sure to reload the extension after installing it, or relaunching VS Code.
32
37
+ Error message encountered while debugging `Unhandled Exception: System.UnauthorizedAccessException: Access to the path is denied.`
33
-
+ A file could not be overwritten.
38
+
+ A file could not be overwritten.
34
39
+ Check that the file isn't open in another program and that it isn't set to readonly.
35
40
+ Error message encountered while debugging `An unhandled exception of type 'System.IO.IOException' occurred in System.IO.FileSystem.dll: 'The requested operation cannot be performed on a file with a user-mapped section open'`
36
41
+ Encountered when running the debugger again too quickly after having just run it.
Copy file name to clipboardExpand all lines: Documentation/Adding_Models.md
+26-20Lines changed: 26 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
# Creating a New Model Group
2
2
1.[Create a Model Group Readme Template in Markdown.](#create-a-model-group-readme-template-in-markdown)
3
3
2.[Create a New Model Group Class.](#create-a-new-model-group-class)
4
-
3. Delete undesired models and screenshots from the local [Output](../Output) folder. (Files will be overwritten, but not deleted)
4
+
3. Delete undesired models and screenshots from the local [Output](../Output) folder. (Files will be overwritten, but not deleted)
5
5
4. Compile and run the build.
6
-
5.[Generate Screenshots.](#generate-screenshots)
6
+
5.[Validate Models](#validate-models)
7
+
6.[Generate Screenshots.](#generate-screenshots)
7
8
8
9
## Create a Model Group Readme Template in Markdown
9
10
Every model group will generate a readme. The code starts with a template specific to that model group, then inserts a generated table based on the models created.
@@ -15,7 +16,7 @@ Every model group will generate a readme. The code starts with a template specif
15
16
16
17
### Readme Tips
17
18
+ Models will be listed in the readme in the order they are created in code.
18
-
+ Property names and values as listed in the readme are formatted by the [ReadmeStringHelper](../Source/ReadmeStringHelper.cs) class, which adds spaces, fixes capitalization, and converts values into strings.
19
+
+ Property names and values as listed in the readme are formatted by the [ReadmeStringHelper](../Source/ReadmeStringHelper.cs) class, which adds spaces, fixes capitalization, and converts values into strings.
19
20
+ Use `":white_check_mark:"`:white_check_mark: to show that something is enabled or has a positive result. Use `":x:"`:x: to show something is disabled or has a negative result.
20
21
+ When including images in a table, use a thumbnail that is the size the image is expected to be viewed at, and link it to a full-size image. This avoids issues with images being stretched.
21
22
@@ -26,10 +27,10 @@ These models are intended to test...
26
27
The following table shows the properties that are set for every model.
27
28
28
29
~~HeaderTable~~
29
-
30
-
The following table shows the properties that are set for a given model.
31
30
32
-
~~Table~~
31
+
The following table shows the properties that are set for a given model.
32
+
33
+
~~Table~~
33
34
```
34
35
35
36
### Figures
@@ -44,25 +45,25 @@ Use images to better explain how a model is setup. This is especially useful for
44
45
3. Declare the images as being used in a model group.
45
46
+ At the top of the model group class that will be using this image, add `UseFigure(imageList, "IMAGEFILENAME");`
46
47
4. Insert the image into the readme template.
47
-
+ This can be done with either markdown or HTML formatting.
48
+
+ This can be done with either markdown or HTML formatting.
48
49
``
49
50
`<img src="Figures/IMAGEFILENAME.png">`
50
51
51
52
Be careful of adding images that are too large to a model group's readme, as this can cause weird spacing issues with markdown tables.
52
-
+ Clamp the size of the image to keep the image from changing cell widths and heights too much
53
+
+ Clamp the size of the image to keep the image from changing cell widths and heights too much.
1. Create a copy of the [ModelGroup_Template](../Source/Resources/Templates/ModelGroup_Template.cs) and place it under the [ModelGroups](../Source/ModelGroups) folder.
57
58
2. Name the Class and .cs file as appropriate for what is being tested. For related model groups, use a CATEGORY_NAME format.
58
59
3. Add the name of the model group to the `ModelGroupId` enum in [ModelGroup](../Source/ModelGroup.cs) (in alphabetical order). Then in the new class set the `Id` as that enum.
59
-
4. Call the class from [Program](../Source/Program.cs). This is done by creating an instance of the class to add to the `allModelGroups` list (in alphabetical order).
60
-
5. Add code to the new model group. Add new values to the `PropertyName` enum in `Property.cs` as needed.
60
+
4. Call the class from [Program](../Source/Program.cs). This is done by creating an instance of the class to add to the `allModelGroups` list (in alphabetical order).
61
+
5. Add code to the new model group. Add new values to the `PropertyName` enum in `Property.cs` as needed.
61
62
62
63
### Structure of a Model Group
63
64
Declare the following values at the beginning of the constructor
64
65
+ Add the figures being used to the `UseFigure` list (See [Figures](#figures) above)
65
-
+ Declare the textures being used and add them to the `UseTexture` list.
66
+
+ Declare the textures being used and add them to the `UseTexture` list.
+ Declare camera position(s) if a custom one will be used.
68
69
+ Declare property values that will be used in more than one model. Add properties used by every model to the `CommonProperties` list.
@@ -75,19 +76,19 @@ Assemble the model in the `CreateModel` function.
75
76
+ Call `setProperties`, which will set the desired test values on the component model objects.
76
77
+ Assemble and return the model, creating a new `Model` object using the component model objects.
77
78
78
-
Add helper functions that reduce duplicate code below `CreateModel`.
79
+
Add helper functions that reduce duplicate code below `CreateModel`.
79
80
+ Generally, this is where the properties list is populated, which is used in creating the model group readme (See [Properties](#properties) below)
80
81
+ These functions should be specific to the one model group.
81
82
82
83
Create the anonymous methods
83
-
Inside of the code block `this.Models = new List<Model>` is where the values for each specific model will be set.
84
+
Inside of the code block `this.Models = new List<Model>` is where the values for each specific model will be set.
84
85
If no values are set on a model, leave a comment to show that was intentional.
85
86
```C#
86
87
CreateModel((properties, meshPrimitive) => {
87
88
// There are no properties set on this model.
88
89
}),
89
90
```
90
-
Otherwise, modify the component model objects that were passed in with the desired test values.
91
+
Otherwise, modify the component model objects that were passed in with the desired test values.
91
92
Be careful to only modify the objects and not replace them! If the object is set equal to a new object, then the ref will point at a new object instead of updating the desired object. Instead only modify values of the object, or work with lists of objects.
92
93
93
94
At the bottom of the model group `GenerateUsedPropertiesList()` is called. This is used in creating the model group readme and won't need to be modified.
@@ -99,22 +100,27 @@ At the bottom of the model group `GenerateUsedPropertiesList()` is called. This
99
100
100
101
## Generate Screenshots
101
102
1. Download the [screenshotGenerator](https://github.com/kcoley/screenshotGenerator)
102
-
+ Follow the directions in that repro's readme on how to build the generator.
103
-
+ Place the folder containing the Screenshot Generator inside of the local glTF-Asset-Generator directory `.\glTF-Asset-Generator\ScreenshotGenerator\`
103
+
+ Follow the directions in that repro's readme on how to build the generator.
104
+
+ Place the folder containing the Screenshot Generator inside of the local glTF-Asset-Generator directory `.\glTF-Asset-Generator\ScreenshotGenerator\`
104
105
2. Run the PowerShell script [SampleImageHelper.ps1](../SampleImageHelper.ps1)
105
106
106
-
Screenshots are generated in a step separately from running the glTF Asset Generator, which also includes the moving of textures and figures into the output folders.
107
+
Screenshots are generated in a step separately from running the glTF Asset Generator, which also includes the moving of textures and figures into the output folders.
107
108
This is done to speed up debugging. The creation of screenshots is a time intensive process and often the screenshots are not needed until the majority of debugging has been completed.
108
109
110
+
## Validate Models
111
+
Run the `Validate Models` VS Code launch configuration in order to use the [glTF-Validator](https://github.com/KhronosGroup/glTF-Validator) to validate the generated models. The results are saved under in the [ValidatorResults folder](../ValidatorResults).
112
+
This script can also be run directly from the [Tools](../Tools) folder with the command `npm run validate`.
113
+
New and modified models are expected to have been validated before being checked in.
114
+
109
115
## Properties
110
116
Properties are attributes that can be set on a model. For example, Doublesided is a property and it can have a value of true or false.
111
117
112
-
For each tested property that is set on a model, a [Property](../Source/Property.cs) object needs to be created.
118
+
For each tested property that is set on a model, a [Property](../Source/Property.cs) object needs to be created.
0 commit comments