Skip to content

Commit

Permalink
Update Sandcastle, minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed May 9, 2024
1 parent 3913e71 commit 90b3043
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
33 changes: 12 additions & 21 deletions Apps/Sandcastle/gallery/development/glTF PBR Specular.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<input
type="range"
min="0.0"
max="2.0"
max="10.0"
step="0.01"
data-bind="value: luminanceAtZenith, valueUpdate: 'input'"
/>
Expand Down Expand Up @@ -315,32 +315,23 @@
}
);

const modelOptions = [
{
text: "Specular Test",
onselect: function () {
loadModel(
"../../SampleData/models/SpecularTest/glTF-Binary/SpecularTest.glb"
);
},
},
{
text: "Water Bottle",
onselect: function () {
loadModel(
"../../SampleData/models/SpecGlossVsMetalRough/glTF-Binary/SpecGlossVsMetalRough.glb"
);
},
},
];
Sandcastle.addToolbarMenu(modelOptions);
let model;
loadModel(
"../../SampleData/models/SpecularTest/glTF-Binary/SpecularTest.glb"
);

Sandcastle.addToggleButton(
"Enable KHR_materials_specular",
true,
function (checked) {
Cesium.ModelUtility.supportedExtensions.KHR_materials_specular = checked;
model.resetDrawCommands();
}
);

async function loadModel(modelURL) {
try {
const model = await Cesium.Model.fromGltfAsync({
model = await Cesium.Model.fromGltfAsync({
url: modelURL,
modelMatrix: modelMatrix,
//minimumPixelSize: 128,
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/GltfLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function GltfLoader(options) {
const {
gltfResource,
typedArray,
releaseGltfJson,
releaseGltfJson = false,
asynchronous = true,
incrementallyLoadTextures = true,
upAxis = Axis.Y,
Expand Down
6 changes: 5 additions & 1 deletion packages/engine/Source/Scene/Model/MaterialPipelineStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const {
* to render a primitive. This handles the following material types:
* <ul>
* <li>Basic glTF materials (PBR metallic roughness model)</li>
* <li>The `KHR_materials_specular` glTF extension</li>
* <li>The `KHR_materials_pbrSpecularGlossiness` glTF extension</li>
* <li>The `KHR_materials_unlit` glTF extension</li>
* </ul>
Expand Down Expand Up @@ -96,7 +97,10 @@ MaterialPipelineStage.process = function (
disableTextures
);
} else {
if (defined(material.specular)) {
if (
defined(material.specular) &&
ModelUtility.supportedExtensions.KHR_materials_specular === true
) {
processSpecularUniforms(
material,
uniformMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ vec3 textureIBL(
) {
vec3 v = -positionEC;
vec3 n = normalEC;
vec3 l = normalize(lightDirectionEC);
vec3 l = normalize(lightDirectionEC);
vec3 h = normalize(v + l);

float NdotV = abs(dot(n, v)) + 0.001;
Expand Down

0 comments on commit 90b3043

Please sign in to comment.