@cesium/engine 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
- package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
- package/Build/ThirdParty/Workers/z-worker-pako.js +56 -105
- package/Build/Workers/{chunk-VR5RBW52.js → chunk-26NE4LRW.js} +7 -7
- package/Build/Workers/{chunk-P2YAAMT2.js → chunk-26XJDV3D.js} +15 -15
- package/Build/Workers/{chunk-L4BW3RUA.js → chunk-2TRB253J.js} +7 -7
- package/Build/Workers/{chunk-NP2GYYE5.js → chunk-3PV5HQ2R.js} +6 -6
- package/Build/Workers/{chunk-BCU2LH5T.js → chunk-3VDHTBY5.js} +10 -10
- package/Build/Workers/{chunk-WHUSTDIB.js → chunk-4RG6WOXH.js} +10 -10
- package/Build/Workers/{chunk-P4XKB3QZ.js → chunk-5OK5JFDP.js} +5 -5
- package/Build/Workers/{chunk-2ZBL3MVO.js → chunk-7HLZRYGD.js} +10 -12
- package/Build/Workers/chunk-7PFZ4Z7C.js +961 -0
- package/Build/Workers/{chunk-24YTYWNB.js → chunk-A5CSB5ZE.js} +11 -13
- package/Build/Workers/{chunk-RMOEYCZW.js → chunk-AROLUUGS.js} +2 -2
- package/Build/Workers/{chunk-3NCVAGDA.js → chunk-BBBTT36L.js} +14 -14
- package/Build/Workers/{chunk-QKBGRKKG.js → chunk-BNT2SNWU.js} +4 -4
- package/Build/Workers/{chunk-LQJ5FFFR.js → chunk-CFBGPZU6.js} +11 -13
- package/Build/Workers/{chunk-C6OI26DR.js → chunk-CVCVMOQA.js} +1 -1
- package/Build/Workers/{chunk-SS4ESNE3.js → chunk-DIVFF6DK.js} +2 -2
- package/Build/Workers/{chunk-PXB7T27O.js → chunk-EJZVBTX4.js} +6 -6
- package/Build/Workers/{chunk-TZORKRNK.js → chunk-EODIOQ35.js} +1 -1
- package/Build/Workers/{chunk-QCQUZGXI.js → chunk-ETC45PHH.js} +5 -6
- package/Build/Workers/{chunk-E6WXPSJS.js → chunk-G7IAO7CW.js} +7 -7
- package/Build/Workers/{chunk-X2F6BEPY.js → chunk-GOQEANLM.js} +16 -16
- package/Build/Workers/{chunk-7COR472O.js → chunk-GUFV24F4.js} +7197 -5096
- package/Build/Workers/{chunk-5TIV3L26.js → chunk-GX2BWBN2.js} +13 -13
- package/Build/Workers/{chunk-ADOVHYWO.js → chunk-GX5LMUGZ.js} +469 -6
- package/Build/Workers/{chunk-2632RVPI.js → chunk-I6CW7ZE5.js} +7 -7
- package/Build/Workers/{chunk-YDVSBWEO.js → chunk-IF2OX6R4.js} +3 -5
- package/Build/Workers/{chunk-RSJXEO2A.js → chunk-IXYFH7DV.js} +95 -155
- package/Build/Workers/{chunk-ZNVSKMQ2.js → chunk-K5F23SZO.js} +6 -6
- package/Build/Workers/{chunk-MWV7IZK4.js → chunk-KTZK2UDR.js} +7 -7
- package/Build/Workers/{chunk-HBQPB6IH.js → chunk-LZFFO4KB.js} +12 -12
- package/Build/Workers/{chunk-GFA4SMXV.js → chunk-OYP23VAL.js} +11 -11
- package/Build/Workers/{chunk-ZYPTP7GS.js → chunk-PHT53MCH.js} +11 -11
- package/Build/Workers/{chunk-TJBU6GML.js → chunk-PUQR43HZ.js} +6 -6
- package/Build/Workers/{chunk-CO35JNNE.js → chunk-QZIWFSRM.js} +4 -4
- package/Build/Workers/{chunk-C3XBUYBO.js → chunk-RDR4KVPA.js} +17 -17
- package/Build/Workers/{chunk-YV4H2Y7M.js → chunk-RRUO4QEK.js} +4 -4
- package/Build/Workers/{chunk-LAQP3SCC.js → chunk-RTIT7UDN.js} +2 -2
- package/Build/Workers/{chunk-Z7FQLK6N.js → chunk-SC3TBKST.js} +4 -4
- package/Build/Workers/{chunk-GXUXEOE2.js → chunk-TDIGL45B.js} +1 -1
- package/Build/Workers/{chunk-EOXYZ34O.js → chunk-TP4FFUAH.js} +2 -2
- package/Build/Workers/{chunk-N4KXMWQU.js → chunk-U2LSTOMA.js} +2 -2
- package/Build/Workers/{chunk-6WF3KIF5.js → chunk-U6MTSO6A.js} +47 -84
- package/Build/Workers/{chunk-I37B3MZ2.js → chunk-UICVDDCQ.js} +1 -1
- package/Build/Workers/{chunk-DPUSFA7S.js → chunk-UKJCFXVV.js} +6 -6
- package/Build/Workers/{chunk-EPKE7GE3.js → chunk-UYKG3UFK.js} +5 -5
- package/Build/Workers/{chunk-RV7ZOSS6.js → chunk-W4OS542B.js} +13 -13
- package/Build/Workers/{chunk-DGDUKCJJ.js → chunk-WHDEZSAL.js} +6 -6
- package/Build/Workers/{chunk-NZWNZA6S.js → chunk-WOYQB5HM.js} +5 -5
- package/Build/Workers/{chunk-M2AYBTNH.js → chunk-WP3LCUOE.js} +13 -13
- package/Build/Workers/{chunk-73FKKY52.js → chunk-YGNQJ4YI.js} +5 -5
- package/Build/Workers/{chunk-SE4PXOEA.js → chunk-YGTWKLFY.js} +19 -19
- package/Build/Workers/{chunk-5R6VWLMH.js → chunk-ZHJDE6JN.js} +6 -6
- package/Build/Workers/combineGeometry.js +22 -24
- package/Build/Workers/createBoxGeometry.js +16 -18
- package/Build/Workers/createBoxOutlineGeometry.js +14 -16
- package/Build/Workers/createCircleGeometry.js +24 -26
- package/Build/Workers/createCircleOutlineGeometry.js +17 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
- package/Build/Workers/createCorridorGeometry.js +27 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
- package/Build/Workers/createCylinderGeometry.js +18 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
- package/Build/Workers/createEllipseGeometry.js +24 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
- package/Build/Workers/createEllipsoidGeometry.js +17 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
- package/Build/Workers/createFrustumGeometry.js +16 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
- package/Build/Workers/createGeometry.js +22 -24
- package/Build/Workers/createGroundPolylineGeometry.js +23 -25
- package/Build/Workers/createPlaneGeometry.js +14 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
- package/Build/Workers/createPolygonGeometry.js +32 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
- package/Build/Workers/createPolylineGeometry.js +23 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
- package/Build/Workers/createRectangleGeometry.js +27 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
- package/Build/Workers/createSimplePolylineGeometry.js +21 -23
- package/Build/Workers/createSphereGeometry.js +17 -19
- package/Build/Workers/createSphereOutlineGeometry.js +16 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
- package/Build/Workers/createVectorTileGeometries.js +22 -24
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -16
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
- package/Build/Workers/createVerticesFromHeightmap.js +23 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
- package/Build/Workers/createWallGeometry.js +22 -24
- package/Build/Workers/createWallOutlineGeometry.js +21 -23
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/Build/Workers/decodeI3S.js +10 -11
- package/Build/Workers/transcodeKTX2.js +44 -80
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Math.js +0 -5
- package/Source/Core/PixelFormat.js +1 -0
- package/Source/Core/Rectangle.js +89 -0
- package/Source/Core/TaskProcessor.js +19 -3
- package/Source/Core/sampleTerrain.js +3 -3
- package/Source/DataSources/DataSourceDisplay.js +5 -0
- package/Source/Renderer/ShaderBuilder.js +6 -3
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -5
- package/Source/Scene/Cesium3DTile.js +65 -0
- package/Source/Scene/Cesium3DTileset.js +48 -1
- package/Source/Scene/ClippingPolygon.js +212 -0
- package/Source/Scene/ClippingPolygonCollection.js +968 -0
- package/Source/Scene/Globe.js +14 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
- package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
- package/Source/Scene/GltfLoader.js +458 -435
- package/Source/Scene/GltfLoaderUtil.js +3 -12
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
- package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
- package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
- package/Source/Scene/Model/LightingPipelineStage.js +2 -4
- package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
- package/Source/Scene/Model/Model.js +91 -3
- package/Source/Scene/Model/Model3DTileContent.js +21 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
- package/Source/Scene/Model/ModelSceneGraph.js +5 -0
- package/Source/Scene/Model/ModelUtility.js +3 -0
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
- package/Source/Scene/ModelComponents.js +169 -1
- package/Source/Scene/PickDepth.js +23 -15
- package/Source/Scene/ResourceCache.js +41 -50
- package/Source/Scene/ResourceCacheKey.js +41 -53
- package/Source/Scene/Terrain.js +2 -2
- package/Source/Shaders/Builtin/CzmBuiltins.js +6 -8
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
- package/Source/Shaders/GlobeFS.glsl +13 -1
- package/Source/Shaders/GlobeFS.js +13 -1
- package/Source/Shaders/GlobeVS.glsl +32 -0
- package/Source/Shaders/GlobeVS.js +32 -0
- package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageVS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
- package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
- package/Source/Shaders/Model/LightingStageFS.js +113 -48
- package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
- package/Source/Shaders/Model/MaterialStageFS.js +399 -137
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
- package/Source/Shaders/Model/ModelFS.glsl +6 -0
- package/Source/Shaders/Model/ModelFS.js +7 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -0
- package/Source/Shaders/Model/ModelVS.js +4 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
- package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/index.d.ts +230 -4
- package/index.js +234 -229
- package/package.json +1 -1
- package/Build/Workers/chunk-2KACWKS4.js +0 -501
- package/Build/Workers/chunk-2XPLH3JY.js +0 -2977
- package/Build/Workers/chunk-X6XOMPWL.js +0 -73
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
|
@@ -16,211 +16,473 @@ vec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)
|
|
|
16
16
|
return vec2(textureTransform * vec3(texCoord, 1.0));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
#ifdef
|
|
20
|
-
|
|
19
|
+
#ifdef HAS_NORMAL_TEXTURE
|
|
20
|
+
vec2 getNormalTexCoords()
|
|
21
21
|
{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
vec2 texCoord = TEXCOORD_NORMAL;
|
|
23
|
+
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
|
|
24
|
+
texCoord = vec2(u_normalTextureTransform * vec3(texCoord, 1.0));
|
|
25
|
+
#endif
|
|
26
|
+
return texCoord;
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
#if defined(HAS_NORMAL_TEXTURE) || defined(HAS_CLEARCOAT_NORMAL_TEXTURE)
|
|
31
|
+
vec3 computeTangent(in vec3 position, in vec2 normalTexCoords)
|
|
32
|
+
{
|
|
33
|
+
vec2 tex_dx = dFdx(normalTexCoords);
|
|
34
|
+
vec2 tex_dy = dFdy(normalTexCoords);
|
|
35
|
+
float determinant = tex_dx.x * tex_dy.y - tex_dy.x * tex_dx.y;
|
|
36
|
+
vec3 tangent = tex_dy.t * dFdx(position) - tex_dx.t * dFdy(position);
|
|
37
|
+
return tangent / determinant;
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
vec3
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
#ifdef USE_ANISOTROPY
|
|
42
|
+
struct NormalInfo {
|
|
43
|
+
vec3 tangent;
|
|
44
|
+
vec3 bitangent;
|
|
45
|
+
vec3 normal;
|
|
46
|
+
vec3 geometryNormal;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
NormalInfo getNormalInfo(ProcessedAttributes attributes)
|
|
50
|
+
{
|
|
51
|
+
vec3 geometryNormal = attributes.normalEC;
|
|
52
|
+
#ifdef HAS_NORMAL_TEXTURE
|
|
53
|
+
vec2 normalTexCoords = getNormalTexCoords();
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#ifdef HAS_BITANGENTS
|
|
57
|
+
vec3 tangent = attributes.tangentEC;
|
|
58
|
+
vec3 bitangent = attributes.bitangentEC;
|
|
59
|
+
#else // Assume HAS_NORMAL_TEXTURE
|
|
60
|
+
vec3 tangent = computeTangent(attributes.positionEC, normalTexCoords);
|
|
61
|
+
tangent = normalize(tangent - geometryNormal * dot(geometryNormal, tangent));
|
|
62
|
+
vec3 bitangent = normalize(cross(geometryNormal, tangent));
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
#ifdef HAS_NORMAL_TEXTURE
|
|
66
|
+
mat3 tbn = mat3(tangent, bitangent, geometryNormal);
|
|
67
|
+
vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
|
|
68
|
+
vec3 normal = normalize(tbn * (2.0 * normalSample - 1.0));
|
|
69
|
+
#else
|
|
70
|
+
vec3 normal = geometryNormal;
|
|
53
71
|
#endif
|
|
54
72
|
|
|
55
73
|
#ifdef HAS_DOUBLE_SIDED_MATERIAL
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
if (czm_backFacing()) {
|
|
75
|
+
tangent *= -1.0;
|
|
76
|
+
bitangent *= -1.0;
|
|
77
|
+
normal *= -1.0;
|
|
78
|
+
geometryNormal *= -1.0;
|
|
79
|
+
}
|
|
59
80
|
#endif
|
|
60
81
|
|
|
61
|
-
|
|
82
|
+
NormalInfo normalInfo;
|
|
83
|
+
normalInfo.tangent = tangent;
|
|
84
|
+
normalInfo.bitangent = bitangent;
|
|
85
|
+
normalInfo.normal = normal;
|
|
86
|
+
normalInfo.geometryNormal = geometryNormal;
|
|
87
|
+
|
|
88
|
+
return normalInfo;
|
|
62
89
|
}
|
|
63
90
|
#endif
|
|
64
91
|
|
|
65
|
-
|
|
92
|
+
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
|
|
93
|
+
vec3 getNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
|
|
66
94
|
{
|
|
67
|
-
|
|
68
|
-
|
|
95
|
+
vec2 normalTexCoords = getNormalTexCoords();
|
|
96
|
+
|
|
97
|
+
// If HAS_BITANGENTS is set, then HAS_TANGENTS is also set
|
|
98
|
+
#ifdef HAS_BITANGENTS
|
|
99
|
+
vec3 t = attributes.tangentEC;
|
|
100
|
+
vec3 b = attributes.bitangentEC;
|
|
101
|
+
#else
|
|
102
|
+
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
|
|
103
|
+
t = normalize(t - geometryNormal * dot(geometryNormal, t));
|
|
104
|
+
vec3 b = normalize(cross(geometryNormal, t));
|
|
69
105
|
#endif
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
|
|
107
|
+
mat3 tbn = mat3(t, b, geometryNormal);
|
|
108
|
+
vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
|
|
109
|
+
vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));
|
|
75
110
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
111
|
+
return textureNormal;
|
|
112
|
+
}
|
|
113
|
+
#endif
|
|
79
114
|
|
|
80
|
-
|
|
115
|
+
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
|
|
116
|
+
vec3 getClearcoatNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
|
|
117
|
+
{
|
|
118
|
+
vec2 normalTexCoords = TEXCOORD_CLEARCOAT_NORMAL;
|
|
119
|
+
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_TRANSFORM
|
|
120
|
+
normalTexCoords = vec2(u_clearcoatNormalTextureTransform * vec3(normalTexCoords, 1.0));
|
|
121
|
+
#endif
|
|
81
122
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
123
|
+
// If HAS_BITANGENTS is set, then HAS_TANGENTS is also set
|
|
124
|
+
#ifdef HAS_BITANGENTS
|
|
125
|
+
vec3 t = attributes.tangentEC;
|
|
126
|
+
vec3 b = attributes.bitangentEC;
|
|
127
|
+
#else
|
|
128
|
+
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
|
|
129
|
+
t = normalize(t - geometryNormal * dot(geometryNormal, t));
|
|
130
|
+
vec3 b = normalize(cross(geometryNormal, t));
|
|
87
131
|
#endif
|
|
88
132
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
133
|
+
mat3 tbn = mat3(t, b, geometryNormal);
|
|
134
|
+
vec3 n = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;
|
|
135
|
+
vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));
|
|
136
|
+
|
|
137
|
+
return textureNormal;
|
|
138
|
+
}
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
#ifdef HAS_NORMALS
|
|
142
|
+
vec3 computeNormal(ProcessedAttributes attributes)
|
|
143
|
+
{
|
|
144
|
+
// Geometry normal. This is already normalized
|
|
145
|
+
vec3 normal = attributes.normalEC;
|
|
146
|
+
|
|
147
|
+
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
|
|
148
|
+
normal = getNormalFromTexture(attributes, normal);
|
|
98
149
|
#endif
|
|
99
150
|
|
|
100
|
-
|
|
101
|
-
|
|
151
|
+
#ifdef HAS_DOUBLE_SIDED_MATERIAL
|
|
152
|
+
if (czm_backFacing()) {
|
|
153
|
+
normal = -normal;
|
|
154
|
+
}
|
|
155
|
+
#endif
|
|
102
156
|
|
|
103
|
-
|
|
104
|
-
|
|
157
|
+
return normal;
|
|
158
|
+
}
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
#ifdef HAS_BASE_COLOR_TEXTURE
|
|
162
|
+
vec4 getBaseColorFromTexture()
|
|
163
|
+
{
|
|
164
|
+
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
|
|
165
|
+
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
|
|
166
|
+
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
|
|
105
167
|
#endif
|
|
106
168
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#endif
|
|
112
|
-
material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;
|
|
169
|
+
vec4 baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));
|
|
170
|
+
|
|
171
|
+
#ifdef HAS_BASE_COLOR_FACTOR
|
|
172
|
+
baseColorWithAlpha *= u_baseColorFactor;
|
|
113
173
|
#endif
|
|
114
174
|
|
|
115
|
-
|
|
175
|
+
return baseColorWithAlpha;
|
|
176
|
+
}
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
#ifdef HAS_EMISSIVE_TEXTURE
|
|
180
|
+
vec3 getEmissiveFromTexture()
|
|
181
|
+
{
|
|
116
182
|
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
|
|
117
|
-
|
|
183
|
+
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
|
|
118
184
|
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
|
|
119
|
-
|
|
185
|
+
#endif
|
|
120
186
|
|
|
121
187
|
vec3 emissive = czm_srgbToLinear(texture(u_emissiveTexture, emissiveTexCoords).rgb);
|
|
122
|
-
|
|
188
|
+
#ifdef HAS_EMISSIVE_FACTOR
|
|
123
189
|
emissive *= u_emissiveFactor;
|
|
124
|
-
#endif
|
|
125
|
-
material.emissive = emissive;
|
|
126
|
-
#elif defined(HAS_EMISSIVE_FACTOR)
|
|
127
|
-
material.emissive = u_emissiveFactor;
|
|
128
190
|
#endif
|
|
129
191
|
|
|
130
|
-
|
|
131
|
-
|
|
192
|
+
return emissive;
|
|
193
|
+
}
|
|
194
|
+
#endif
|
|
195
|
+
|
|
196
|
+
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
|
|
197
|
+
void setSpecularGlossiness(inout czm_modelMaterial material)
|
|
198
|
+
{
|
|
199
|
+
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE
|
|
132
200
|
vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
201
|
+
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM
|
|
202
|
+
specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);
|
|
203
|
+
#endif
|
|
136
204
|
|
|
137
205
|
vec4 specularGlossiness = czm_srgbToLinear(texture(u_specularGlossinessTexture, specularGlossinessTexCoords));
|
|
138
206
|
vec3 specular = specularGlossiness.rgb;
|
|
139
207
|
float glossiness = specularGlossiness.a;
|
|
140
|
-
|
|
141
|
-
specular *=
|
|
142
|
-
|
|
208
|
+
#ifdef HAS_LEGACY_SPECULAR_FACTOR
|
|
209
|
+
specular *= u_legacySpecularFactor;
|
|
210
|
+
#endif
|
|
143
211
|
|
|
144
|
-
|
|
212
|
+
#ifdef HAS_GLOSSINESS_FACTOR
|
|
145
213
|
glossiness *= u_glossinessFactor;
|
|
146
|
-
|
|
214
|
+
#endif
|
|
215
|
+
#else
|
|
216
|
+
#ifdef HAS_LEGACY_SPECULAR_FACTOR
|
|
217
|
+
vec3 specular = clamp(u_legacySpecularFactor, vec3(0.0), vec3(1.0));
|
|
147
218
|
#else
|
|
148
|
-
#ifdef HAS_SPECULAR_FACTOR
|
|
149
|
-
vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));
|
|
150
|
-
#else
|
|
151
219
|
vec3 specular = vec3(1.0);
|
|
152
|
-
|
|
220
|
+
#endif
|
|
153
221
|
|
|
154
|
-
|
|
222
|
+
#ifdef HAS_GLOSSINESS_FACTOR
|
|
155
223
|
float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
|
|
156
|
-
|
|
224
|
+
#else
|
|
157
225
|
float glossiness = 1.0;
|
|
158
|
-
#endif
|
|
159
226
|
#endif
|
|
227
|
+
#endif
|
|
160
228
|
|
|
161
|
-
|
|
229
|
+
#ifdef HAS_DIFFUSE_TEXTURE
|
|
162
230
|
vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;
|
|
163
|
-
|
|
231
|
+
#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM
|
|
164
232
|
diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);
|
|
165
|
-
|
|
233
|
+
#endif
|
|
166
234
|
|
|
167
235
|
vec4 diffuse = czm_srgbToLinear(texture(u_diffuseTexture, diffuseTexCoords));
|
|
168
|
-
|
|
236
|
+
#ifdef HAS_DIFFUSE_FACTOR
|
|
169
237
|
diffuse *= u_diffuseFactor;
|
|
170
|
-
|
|
171
|
-
|
|
238
|
+
#endif
|
|
239
|
+
#elif defined(HAS_DIFFUSE_FACTOR)
|
|
172
240
|
vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
|
|
173
|
-
|
|
241
|
+
#else
|
|
174
242
|
vec4 diffuse = vec4(1.0);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
specular,
|
|
179
|
-
glossiness
|
|
180
|
-
);
|
|
181
|
-
material.diffuse = parameters.diffuseColor;
|
|
243
|
+
#endif
|
|
244
|
+
|
|
245
|
+
material.diffuse = diffuse.rgb * (1.0 - czm_maximumComponent(specular));
|
|
182
246
|
// the specular glossiness extension's alpha overrides anything set
|
|
183
247
|
// by the base material.
|
|
184
248
|
material.alpha = diffuse.a;
|
|
185
|
-
|
|
186
|
-
material.
|
|
187
|
-
|
|
188
|
-
|
|
249
|
+
|
|
250
|
+
material.specular = specular;
|
|
251
|
+
|
|
252
|
+
// glossiness is the opposite of roughness, but easier for artists to use.
|
|
253
|
+
float roughness = 1.0 - glossiness;
|
|
254
|
+
material.roughness = roughness * roughness;
|
|
255
|
+
}
|
|
256
|
+
#elif defined(LIGHTING_PBR)
|
|
257
|
+
float setMetallicRoughness(inout czm_modelMaterial material)
|
|
258
|
+
{
|
|
259
|
+
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
|
|
189
260
|
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
|
|
190
|
-
|
|
261
|
+
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
|
|
191
262
|
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
|
|
192
|
-
|
|
263
|
+
#endif
|
|
193
264
|
|
|
194
265
|
vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
|
|
195
266
|
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
|
|
196
267
|
float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
|
|
197
|
-
|
|
198
|
-
metalness
|
|
199
|
-
|
|
268
|
+
#ifdef HAS_METALLIC_FACTOR
|
|
269
|
+
metalness = clamp(metalness * u_metallicFactor, 0.0, 1.0);
|
|
270
|
+
#endif
|
|
200
271
|
|
|
201
|
-
|
|
202
|
-
roughness
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
272
|
+
#ifdef HAS_ROUGHNESS_FACTOR
|
|
273
|
+
roughness = clamp(roughness * u_roughnessFactor, 0.0, 1.0);
|
|
274
|
+
#endif
|
|
275
|
+
#else
|
|
276
|
+
#ifdef HAS_METALLIC_FACTOR
|
|
206
277
|
float metalness = clamp(u_metallicFactor, 0.0, 1.0);
|
|
207
|
-
|
|
278
|
+
#else
|
|
208
279
|
float metalness = 1.0;
|
|
209
|
-
|
|
280
|
+
#endif
|
|
210
281
|
|
|
211
|
-
|
|
282
|
+
#ifdef HAS_ROUGHNESS_FACTOR
|
|
212
283
|
float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
|
|
213
|
-
|
|
284
|
+
#else
|
|
214
285
|
float roughness = 1.0;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
material.
|
|
223
|
-
|
|
224
|
-
|
|
286
|
+
#endif
|
|
287
|
+
#endif
|
|
288
|
+
|
|
289
|
+
// dielectrics use f0 = 0.04, metals use albedo as f0
|
|
290
|
+
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
|
|
291
|
+
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.diffuse, metalness);
|
|
292
|
+
|
|
293
|
+
material.specular = f0;
|
|
294
|
+
|
|
295
|
+
// diffuse only applies to dielectrics.
|
|
296
|
+
material.diffuse = material.diffuse * (1.0 - f0) * (1.0 - metalness);
|
|
297
|
+
|
|
298
|
+
// roughness is authored as perceptual roughness
|
|
299
|
+
// square it to get material roughness
|
|
300
|
+
material.roughness = roughness * roughness;
|
|
301
|
+
|
|
302
|
+
return metalness;
|
|
303
|
+
}
|
|
304
|
+
#ifdef USE_SPECULAR
|
|
305
|
+
void setSpecular(inout czm_modelMaterial material, in float metalness)
|
|
306
|
+
{
|
|
307
|
+
#ifdef HAS_SPECULAR_TEXTURE
|
|
308
|
+
vec2 specularTexCoords = TEXCOORD_SPECULAR;
|
|
309
|
+
#ifdef HAS_SPECULAR_TEXTURE_TRANSFORM
|
|
310
|
+
specularTexCoords = computeTextureTransform(specularTexCoords, u_specularTextureTransform);
|
|
311
|
+
#endif
|
|
312
|
+
float specularWeight = texture(u_specularTexture, specularTexCoords).a;
|
|
313
|
+
#ifdef HAS_SPECULAR_FACTOR
|
|
314
|
+
specularWeight *= u_specularFactor;
|
|
315
|
+
#endif
|
|
316
|
+
#else
|
|
317
|
+
#ifdef HAS_SPECULAR_FACTOR
|
|
318
|
+
float specularWeight = u_specularFactor;
|
|
319
|
+
#else
|
|
320
|
+
float specularWeight = 1.0;
|
|
321
|
+
#endif
|
|
322
|
+
#endif
|
|
323
|
+
|
|
324
|
+
#ifdef HAS_SPECULAR_COLOR_TEXTURE
|
|
325
|
+
vec2 specularColorTexCoords = TEXCOORD_SPECULAR_COLOR;
|
|
326
|
+
#ifdef HAS_SPECULAR_COLOR_TEXTURE_TRANSFORM
|
|
327
|
+
specularColorTexCoords = computeTextureTransform(specularColorTexCoords, u_specularColorTextureTransform);
|
|
328
|
+
#endif
|
|
329
|
+
vec3 specularColorSample = texture(u_specularColorTexture, specularColorTexCoords).rgb;
|
|
330
|
+
vec3 specularColorFactor = czm_srgbToLinear(specularColorSample);
|
|
331
|
+
#ifdef HAS_SPECULAR_COLOR_FACTOR
|
|
332
|
+
specularColorFactor *= u_specularColorFactor;
|
|
333
|
+
#endif
|
|
334
|
+
#else
|
|
335
|
+
#ifdef HAS_SPECULAR_COLOR_FACTOR
|
|
336
|
+
vec3 specularColorFactor = u_specularColorFactor;
|
|
337
|
+
#else
|
|
338
|
+
vec3 specularColorFactor = vec3(1.0);
|
|
339
|
+
#endif
|
|
340
|
+
#endif
|
|
341
|
+
material.specularWeight = specularWeight;
|
|
342
|
+
vec3 f0 = material.specular;
|
|
343
|
+
vec3 dielectricSpecularF0 = min(f0 * specularColorFactor, vec3(1.0));
|
|
344
|
+
material.specular = mix(dielectricSpecularF0, material.diffuse, metalness);
|
|
345
|
+
}
|
|
346
|
+
#endif
|
|
347
|
+
#ifdef USE_ANISOTROPY
|
|
348
|
+
void setAnisotropy(inout czm_modelMaterial material, in NormalInfo normalInfo)
|
|
349
|
+
{
|
|
350
|
+
mat2 rotation = mat2(u_anisotropy.xy, -u_anisotropy.y, u_anisotropy.x);
|
|
351
|
+
float anisotropyStrength = u_anisotropy.z;
|
|
352
|
+
|
|
353
|
+
vec2 direction = vec2(1.0, 0.0);
|
|
354
|
+
#ifdef HAS_ANISOTROPY_TEXTURE
|
|
355
|
+
vec2 anisotropyTexCoords = TEXCOORD_ANISOTROPY;
|
|
356
|
+
#ifdef HAS_ANISOTROPY_TEXTURE_TRANSFORM
|
|
357
|
+
anisotropyTexCoords = computeTextureTransform(anisotropyTexCoords, u_anisotropyTextureTransform);
|
|
358
|
+
#endif
|
|
359
|
+
vec3 anisotropySample = texture(u_anisotropyTexture, anisotropyTexCoords).rgb;
|
|
360
|
+
direction = anisotropySample.rg * 2.0 - vec2(1.0);
|
|
361
|
+
anisotropyStrength *= anisotropySample.b;
|
|
362
|
+
#endif
|
|
363
|
+
|
|
364
|
+
direction = rotation * direction;
|
|
365
|
+
mat3 tbn = mat3(normalInfo.tangent, normalInfo.bitangent, normalInfo.normal);
|
|
366
|
+
vec3 anisotropicT = tbn * normalize(vec3(direction, 0.0));
|
|
367
|
+
vec3 anisotropicB = cross(normalInfo.geometryNormal, anisotropicT);
|
|
368
|
+
|
|
369
|
+
material.anisotropicT = anisotropicT;
|
|
370
|
+
material.anisotropicB = anisotropicB;
|
|
371
|
+
material.anisotropyStrength = anisotropyStrength;
|
|
372
|
+
}
|
|
373
|
+
#endif
|
|
374
|
+
#ifdef USE_CLEARCOAT
|
|
375
|
+
void setClearcoat(inout czm_modelMaterial material, in ProcessedAttributes attributes)
|
|
376
|
+
{
|
|
377
|
+
#ifdef HAS_CLEARCOAT_TEXTURE
|
|
378
|
+
vec2 clearcoatTexCoords = TEXCOORD_CLEARCOAT;
|
|
379
|
+
#ifdef HAS_CLEARCOAT_TEXTURE_TRANSFORM
|
|
380
|
+
clearcoatTexCoords = computeTextureTransform(clearcoatTexCoords, u_clearcoatTextureTransform);
|
|
381
|
+
#endif
|
|
382
|
+
float clearcoatFactor = texture(u_clearcoatTexture, clearcoatTexCoords).r;
|
|
383
|
+
#ifdef HAS_CLEARCOAT_FACTOR
|
|
384
|
+
clearcoatFactor *= u_clearcoatFactor;
|
|
385
|
+
#endif
|
|
386
|
+
#else
|
|
387
|
+
#ifdef HAS_CLEARCOAT_FACTOR
|
|
388
|
+
float clearcoatFactor = u_clearcoatFactor;
|
|
389
|
+
#else
|
|
390
|
+
// PERFORMANCE_IDEA: this case should turn the whole extension off
|
|
391
|
+
float clearcoatFactor = 0.0;
|
|
392
|
+
#endif
|
|
393
|
+
#endif
|
|
394
|
+
|
|
395
|
+
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE
|
|
396
|
+
vec2 clearcoatRoughnessTexCoords = TEXCOORD_CLEARCOAT_ROUGHNESS;
|
|
397
|
+
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE_TRANSFORM
|
|
398
|
+
clearcoatRoughnessTexCoords = computeTextureTransform(clearcoatRoughnessTexCoords, u_clearcoatRoughnessTextureTransform);
|
|
399
|
+
#endif
|
|
400
|
+
float clearcoatRoughness = texture(u_clearcoatRoughnessTexture, clearcoatRoughnessTexCoords).g;
|
|
401
|
+
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
|
|
402
|
+
clearcoatRoughness *= u_clearcoatRoughnessFactor;
|
|
403
|
+
#endif
|
|
404
|
+
#else
|
|
405
|
+
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
|
|
406
|
+
float clearcoatRoughness = u_clearcoatRoughnessFactor;
|
|
407
|
+
#else
|
|
408
|
+
float clearcoatRoughness = 0.0;
|
|
409
|
+
#endif
|
|
410
|
+
#endif
|
|
411
|
+
|
|
412
|
+
material.clearcoatFactor = clearcoatFactor;
|
|
413
|
+
// roughness is authored as perceptual roughness
|
|
414
|
+
// square it to get material roughness
|
|
415
|
+
material.clearcoatRoughness = clearcoatRoughness * clearcoatRoughness;
|
|
416
|
+
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
|
|
417
|
+
material.clearcoatNormal = getClearcoatNormalFromTexture(attributes, attributes.normalEC);
|
|
418
|
+
#else
|
|
419
|
+
material.clearcoatNormal = attributes.normalEC;
|
|
420
|
+
#endif
|
|
421
|
+
}
|
|
422
|
+
#endif
|
|
423
|
+
#endif
|
|
424
|
+
|
|
425
|
+
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
|
|
426
|
+
{
|
|
427
|
+
#ifdef USE_ANISOTROPY
|
|
428
|
+
NormalInfo normalInfo = getNormalInfo(attributes);
|
|
429
|
+
material.normalEC = normalInfo.normal;
|
|
430
|
+
#elif defined(HAS_NORMALS)
|
|
431
|
+
material.normalEC = computeNormal(attributes);
|
|
432
|
+
#endif
|
|
433
|
+
|
|
434
|
+
vec4 baseColorWithAlpha = vec4(1.0);
|
|
435
|
+
// Regardless of whether we use PBR, set a base color
|
|
436
|
+
#ifdef HAS_BASE_COLOR_TEXTURE
|
|
437
|
+
baseColorWithAlpha = getBaseColorFromTexture();
|
|
438
|
+
#elif defined(HAS_BASE_COLOR_FACTOR)
|
|
439
|
+
baseColorWithAlpha = u_baseColorFactor;
|
|
440
|
+
#endif
|
|
441
|
+
|
|
442
|
+
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
443
|
+
baseColorWithAlpha = v_pointCloudColor;
|
|
444
|
+
#elif defined(HAS_COLOR_0)
|
|
445
|
+
vec4 color = attributes.color_0;
|
|
446
|
+
// .pnts files store colors in the sRGB color space
|
|
447
|
+
#ifdef HAS_SRGB_COLOR
|
|
448
|
+
color = czm_srgbToLinear(color);
|
|
449
|
+
#endif
|
|
450
|
+
baseColorWithAlpha *= color;
|
|
451
|
+
#endif
|
|
452
|
+
|
|
453
|
+
material.diffuse = baseColorWithAlpha.rgb;
|
|
454
|
+
material.alpha = baseColorWithAlpha.a;
|
|
455
|
+
|
|
456
|
+
#ifdef USE_CPU_STYLING
|
|
457
|
+
material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
|
|
458
|
+
#endif
|
|
459
|
+
|
|
460
|
+
#ifdef HAS_OCCLUSION_TEXTURE
|
|
461
|
+
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
|
|
462
|
+
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
|
|
463
|
+
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
|
|
464
|
+
#endif
|
|
465
|
+
material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;
|
|
466
|
+
#endif
|
|
467
|
+
|
|
468
|
+
#ifdef HAS_EMISSIVE_TEXTURE
|
|
469
|
+
material.emissive = getEmissiveFromTexture();
|
|
470
|
+
#elif defined(HAS_EMISSIVE_FACTOR)
|
|
471
|
+
material.emissive = u_emissiveFactor;
|
|
472
|
+
#endif
|
|
473
|
+
|
|
474
|
+
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
|
|
475
|
+
setSpecularGlossiness(material);
|
|
476
|
+
#elif defined(LIGHTING_PBR)
|
|
477
|
+
float metalness = setMetallicRoughness(material);
|
|
478
|
+
#ifdef USE_SPECULAR
|
|
479
|
+
setSpecular(material, metalness);
|
|
480
|
+
#endif
|
|
481
|
+
#ifdef USE_ANISOTROPY
|
|
482
|
+
setAnisotropy(material, normalInfo);
|
|
483
|
+
#endif
|
|
484
|
+
#ifdef USE_CLEARCOAT
|
|
485
|
+
setClearcoat(material, attributes);
|
|
486
|
+
#endif
|
|
225
487
|
#endif
|
|
226
488
|
}
|