File tree Expand file tree Collapse file tree 6 files changed +95
-0
lines changed
ext/KHR_materials_clearcoat
test/ext/KHR_materials_clearcoat Expand file tree Collapse file tree 6 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 42
42
| INVALID_EXTENSION_NAME_FORMAT| Extension name has invalid format.| Warning|
43
43
| INVALID_GL_VALUE| Invalid value ` %1 ` for GL type '` %2 ` '.| Error|
44
44
| KHR_LIGHTS_PUNCTUAL_LIGHT_SPOT_ANGLES| outerConeAngle (` %2 ` ) is less than or equal to innerConeAngle (` %1 ` ).| Error|
45
+ | KHR_MATERIALS_CLEARCOAT_CLEARCOAT_NORMAL_TEXTURE_TEXCOORD| Normal and clearcoat normal textures should use the same texture coords.| Warning|
45
46
| KHR_MATERIALS_DISPERSION_NO_VOLUME| The dispersion extension needs to be combined with the volume extension.| Warning|
46
47
| KHR_MATERIALS_EMISSIVE_STRENGTH_ZERO_FACTOR| Emissive strength has no effect when the emissive factor is zero or undefined.| Warning|
47
48
| KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_INVALID| Thickness maximum must be greater than or equal to the thickness minimum.| Error|
Original file line number Diff line number Diff line change @@ -489,6 +489,13 @@ class SemanticError extends IssueType {
489
489
(args) => 'outerConeAngle (${args [1 ]}) is less than or equal to '
490
490
'innerConeAngle (${args [0 ]}).' );
491
491
492
+ static final SemanticError
493
+ khrMaterialsClearcoatClearcoatNormalTextureTexCoord = SemanticError ._(
494
+ 'KHR_MATERIALS_CLEARCOAT_CLEARCOAT_NORMAL_TEXTURE_TEXCOORD' ,
495
+ (args) => 'Normal and clearcoat normal textures '
496
+ 'should use the same texture coords.' ,
497
+ Severity .Warning );
498
+
492
499
static final SemanticError khrMaterialsDispersionNoVolume = SemanticError ._(
493
500
'KHR_MATERIALS_DISPERSION_NO_VOLUME' ,
494
501
(args) => 'The dispersion extension needs to be combined with '
Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ class KhrMaterialsClearcoat extends GltfProperty {
97
97
if (clearcoatNormalTexture != null ) {
98
98
context.path.add (CLEARCOAT_NORMAL_TEXTURE );
99
99
clearcoatNormalTexture.link (gltf, context);
100
+
101
+ Object o = this ;
102
+ while (o != null ) {
103
+ o = context.owners[o];
104
+ if (o is Material ) {
105
+ final normalTexture = o.normalTexture;
106
+ if (normalTexture != null &&
107
+ normalTexture.texCoord != clearcoatNormalTexture.texCoord) {
108
+ context.addIssue (SemanticError
109
+ .khrMaterialsClearcoatClearcoatNormalTextureTexCoord);
110
+ }
111
+ break ;
112
+ }
113
+ }
100
114
context.path.removeLast ();
101
115
}
102
116
}
Original file line number Diff line number Diff line change 3
3
"name" : " material.KHR_materials_clearcoat" ,
4
4
"tests" : {
5
5
"custom_property.gltf" : " Custom property" ,
6
+ "different_texcoords.gltf" : " Normal and clearcoat normal textures with different texcoords" ,
6
7
"no_tangent_space.gltf" : " No tangent space" ,
7
8
"unexpected_extension.gltf" : " Unexpected extension object location" ,
8
9
"valid.gltf" : " Valid" ,
Original file line number Diff line number Diff line change
1
+ {
2
+ "asset" : {
3
+ "version" : " 2.0"
4
+ },
5
+ "extensionsUsed" : [
6
+ " KHR_materials_clearcoat"
7
+ ],
8
+ "materials" : [
9
+ {
10
+ "normalTexture" : {
11
+ "index" : 0
12
+ },
13
+ "extensions" : {
14
+ "KHR_materials_clearcoat" : {
15
+ "clearcoatNormalTexture" : {
16
+ "index" : 1 ,
17
+ "texCoord" : 1
18
+ }
19
+ }
20
+ }
21
+ }
22
+ ],
23
+ "textures" : [
24
+ {
25
+ }, {
26
+ }
27
+ ]
28
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "uri" : " test/ext/KHR_materials_clearcoat/data/material/different_texcoords.gltf" ,
3
+ "mimeType" : " model/gltf+json" ,
4
+ "validatorVersion" : " 2.0.0-dev.3.10" ,
5
+ "issues" : {
6
+ "numErrors" : 0 ,
7
+ "numWarnings" : 1 ,
8
+ "numInfos" : 1 ,
9
+ "numHints" : 0 ,
10
+ "messages" : [
11
+ {
12
+ "code" : " KHR_MATERIALS_CLEARCOAT_CLEARCOAT_NORMAL_TEXTURE_TEXCOORD" ,
13
+ "message" : " Normal and clearcoat normal textures should use the same texture coords." ,
14
+ "severity" : 1 ,
15
+ "pointer" : " /materials/0/extensions/KHR_materials_clearcoat/clearcoatNormalTexture"
16
+ },
17
+ {
18
+ "code" : " UNUSED_OBJECT" ,
19
+ "message" : " This object may be unused." ,
20
+ "severity" : 2 ,
21
+ "pointer" : " /materials/0"
22
+ }
23
+ ],
24
+ "truncated" : false
25
+ },
26
+ "info" : {
27
+ "version" : " 2.0" ,
28
+ "extensionsUsed" : [
29
+ " KHR_materials_clearcoat"
30
+ ],
31
+ "animationCount" : 0 ,
32
+ "materialCount" : 1 ,
33
+ "hasMorphTargets" : false ,
34
+ "hasSkins" : false ,
35
+ "hasTextures" : true ,
36
+ "hasDefaultScene" : false ,
37
+ "drawCallCount" : 0 ,
38
+ "totalVertexCount" : 0 ,
39
+ "totalTriangleCount" : 0 ,
40
+ "maxUVs" : 0 ,
41
+ "maxInfluences" : 0 ,
42
+ "maxAttributes" : 0
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments