Skip to content

Commit

Permalink
Rename EXT_blend -> KHR_blend
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Jul 11, 2018
1 parent 0a8988e commit 3068102
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Content pipeline tools for optimizing [glTF](https://www.khronos.org/gltf) asset
Supports common operations including:
* Converting glTF to glb (and reverse)
* Saving buffers/textures as embedded or separate files
* Converting glTF 1.0 models to glTF 2.0 (using the [KHR_techniques_webgl](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl) and [EXT_blend](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_blend) extensions)
* Converting glTF 1.0 models to glTF 2.0 (using the [KHR_techniques_webgl](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl) and [KHR_blend](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_blend) extensions)

`gltf-pipeline` can be used as a command-line tool or Node.js module.

Expand Down
6 changes: 3 additions & 3 deletions lib/moveTechniqueRenderStates.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function getSupportedBlendFactors(value, defaultValue) {
}

/**
* Move glTF 1.0 technique render states to glTF 2.0 materials properties and EXT_blend extension.
* Move glTF 1.0 technique render states to glTF 2.0 materials properties and KHR_blend extension.
*
* @param {Object} gltf A javascript object containing a glTF asset.
* @returns {Object} The updated glTF asset.
Expand Down Expand Up @@ -108,7 +108,7 @@ function moveTechniqueRenderStates(gltf) {
gltf.extensions = {};
}

addExtensionsUsed(gltf, 'EXT_blend');
addExtensionsUsed(gltf, 'KHR_blend');
}

ForEach.material(gltf, function (material) {
Expand All @@ -124,7 +124,7 @@ function moveTechniqueRenderStates(gltf) {
material.extensions = {};
}

material.extensions.EXT_blend = blending;
material.extensions.KHR_blend = blending;
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/updateVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ function glTF10to20(gltf) {
underscoreApplicationSpecificSemantics(gltf);
// Clamp camera parameters
clampCameraParameters(gltf);
// Move legacy technique render states to material properties and add EXT_blend extension blending functions
// Move legacy technique render states to material properties and add KHR_blend extension blending functions
moveTechniqueRenderStates(gltf);
// Add material techniques to KHR_techniques_webgl extension, removing shaders, programs, and techniques
moveTechniquesToExtension(gltf);
Expand Down
14 changes: 7 additions & 7 deletions specs/lib/moveTechniqueRenderStatesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('moveTechniqueRenderStates', function() {
expect(material.doubleSided).toBe(true);
});

it('sets alphaMode and moves technique render state blending functions to material EXT_blend extension', function() {
it('sets alphaMode and moves technique render state blending functions to material KHR_blend extension', function() {
var gltfWithBlendFunctions = JSON.parse(JSON.stringify(gltf));

gltfWithBlendFunctions.techniques.technique0.states = {
Expand All @@ -88,13 +88,13 @@ describe('moveTechniqueRenderStates', function() {
};

var gltfWithBlendExtension = moveTechniqueRenderStates(gltfWithBlendFunctions);
expect(gltfWithBlendExtension.extensionsUsed.indexOf('EXT_blend')).toBeGreaterThan(-1);
expect(gltfWithBlendExtension.extensionsUsed.indexOf('KHR_blend')).toBeGreaterThan(-1);
expect(gltfWithBlendExtension.extensionsRequired).toBeUndefined();

var material = gltfWithBlendExtension.materials[0];
expect(material.alphaMode).toBe('BLEND');
expect(material.extensions).toBeDefined();
var materialBlending = material.extensions.EXT_blend;
var materialBlending = material.extensions.KHR_blend;
expect(materialBlending).toBeDefined();
expect(materialBlending.blendEquation).toEqual([
WebGLConstants.FUNC_ADD,
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('moveTechniqueRenderStates', function() {
};

var gltfWithBlendExtension = moveTechniqueRenderStates(gltfWithBlendFunctions);
var materialBlending = gltfWithBlendExtension.materials[0].extensions.EXT_blend;
var materialBlending = gltfWithBlendExtension.materials[0].extensions.KHR_blend;
expect(materialBlending).toBeDefined();
expect(materialBlending.blendEquation).toEqual([
WebGLConstants.FUNC_ADD,
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('moveTechniqueRenderStates', function() {
};

gltfWithBlendExtension = moveTechniqueRenderStates(gltfWithBlendFunctions);
materialBlending = gltfWithBlendExtension.materials[0].extensions.EXT_blend;
materialBlending = gltfWithBlendExtension.materials[0].extensions.KHR_blend;
expect(materialBlending).toBeDefined();
expect(materialBlending.blendEquation).toEqual([
WebGLConstants.FUNC_ADD,
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('moveTechniqueRenderStates', function() {

var gltfWithBlendExtension = moveTechniqueRenderStates(gltfWithBlendFunctions);

var materialBlending = gltfWithBlendExtension.materials[0].extensions.EXT_blend;
var materialBlending = gltfWithBlendExtension.materials[0].extensions.KHR_blend;
expect(materialBlending).toBeDefined();
expect(materialBlending.blendFactors).toEqual([
WebGLConstants.ONE,
Expand All @@ -199,7 +199,7 @@ describe('moveTechniqueRenderStates', function() {
]);
});

it('does not set alphaMode or add EXT_blend if no blending is found in render states', function () {
it('does not set alphaMode or add KHR_blend if no blending is found in render states', function () {
var gltfWithoutBlending = JSON.parse(JSON.stringify(gltf));
gltfWithoutBlending.techniques.technique0.states.enable = [
WebGLConstants.DEPTH_TEST,
Expand Down
6 changes: 3 additions & 3 deletions specs/lib/updateVersionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ describe('updateVersion', function() {
'KHR_materials_common',
'WEB3D_quantized_attributes',
'UNKOWN_EXTENSION',
'EXT_blend',
'KHR_blend',
'KHR_techniques_webgl'
]);
var extensionsRequired = gltf.extensionsRequired;
Expand Down Expand Up @@ -599,8 +599,8 @@ describe('updateVersion', function() {
expect(material.doubleSided).toBeUndefined();
expect(material.alphaMode).toBe('BLEND');

// Expect technique blending to be moved to material EXT_blend extension
var materialBlending = material.extensions.EXT_blend;
// Expect technique blending to be moved to material KHR_blend extension
var materialBlending = material.extensions.KHR_blend;
expect(materialBlending).toBeDefined();
expect(materialBlending.blendEquation).toEqual([
WebGLConstants.FUNC_SUBTRACT,
Expand Down

0 comments on commit 3068102

Please sign in to comment.