Skip to content

Commit

Permalink
gltf-compressor with geometry compression
Browse files Browse the repository at this point in the history
  • Loading branch information
vineek committed Jan 17, 2024
1 parent 467484f commit af160e0
Show file tree
Hide file tree
Showing 40 changed files with 2,819 additions and 219 deletions.
188 changes: 117 additions & 71 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,77 +100,106 @@ GltfState containing a state for visualization in GltfView

**Kind**: global class

* [GltfState](#GltfState)
* [new GltfState(view)](#new_GltfState_new)
* _instance_
* [.gltf](#GltfState+gltf)
* [.environment](#GltfState+environment)
* [.userCamera](#GltfState+userCamera)
* [.sceneIndex](#GltfState+sceneIndex)
* [.cameraIndex](#GltfState+cameraIndex)
* [.animationIndices](#GltfState+animationIndices)
* [.animationTimer](#GltfState+animationTimer)
* [.variant](#GltfState+variant)
* [.renderingParameters](#GltfState+renderingParameters)
* [.morphing](#GltfState+renderingParameters.morphing)
* [.skinning](#GltfState+renderingParameters.skinning)
* [.clearColor](#GltfState+renderingParameters.clearColor)
* [.exposure](#GltfState+renderingParameters.exposure)
* [.usePunctual](#GltfState+renderingParameters.usePunctual)
* [.useIBL](#GltfState+renderingParameters.useIBL)
* [.iblIntensity](#GltfState+renderingParameters.iblIntensity)
* [.renderEnvironmentMap](#GltfState+renderingParameters.renderEnvironmentMap)
* [.blurEnvironmentMap](#GltfState+renderingParameters.blurEnvironmentMap)
* [.toneMap](#GltfState+renderingParameters.toneMap)
* [.debugOutput](#GltfState+renderingParameters.debugOutput)
* [.environmentRotation](#GltfState+renderingParameters.environmentRotation)
* [.useDirectionalLightsWithDisabledIBL](#GltfState+renderingParameters.useDirectionalLightsWithDisabledIBL)
* [.internalMSAA](#GltfState+renderingParameters.internalMSAA)
* _static_
* [.ToneMaps](#GltfState.ToneMaps)
* [.NONE](#GltfState.ToneMaps.NONE)
* [.ACES_HILL_EXPOSURE_BOOST](#GltfState.ToneMaps.ACES_HILL_EXPOSURE_BOOST)
* [.ACES_NARKOWICZ](#GltfState.ToneMaps.ACES_NARKOWICZ)
* [.ACES_HILL](#GltfState.ToneMaps.ACES_HILL)
* [.DebugOutput](#GltfState.DebugOutput)
* [.NONE](#GltfState.DebugOutput.NONE)
* [.generic](#GltfState.DebugOutput.generic)
* [.UV_COORDS_0](#GltfState.DebugOutput.generic.UV_COORDS_0)
* [.UV_COORDS_1](#GltfState.DebugOutput.generic.UV_COORDS_1)
* [.NORMAL](#GltfState.DebugOutput.generic.NORMAL)
* [.GEOMETRYNORMAL](#GltfState.DebugOutput.generic.GEOMETRYNORMAL)
* [.TANGENT](#GltfState.DebugOutput.generic.TANGENT)
* [.BITANGENT](#GltfState.DebugOutput.generic.BITANGENT)
* [.WORLDSPACENORMAL](#GltfState.DebugOutput.generic.WORLDSPACENORMAL)
* [.ALPHA](#GltfState.DebugOutput.generic.ALPHA)
* [.OCCLUSION](#GltfState.DebugOutput.generic.OCCLUSION)
* [.EMISSIVE](#GltfState.DebugOutput.generic.EMISSIVE)
* [.mr](#GltfState.DebugOutput.mr)
* [.METALLIC_ROUGHNESS](#GltfState.DebugOutput.mr.METALLIC_ROUGHNESS)
* [.BASECOLOR](#GltfState.DebugOutput.mr.BASECOLOR)
* [.METALLIC](#GltfState.DebugOutput.mr.METALLIC)
* [.ROUGHNESS](#GltfState.DebugOutput.mr.ROUGHNESS)
* [.clearcoat](#GltfState.DebugOutput.clearcoat)
* [.CLEARCOAT](#GltfState.DebugOutput.clearcoat.CLEARCOAT)
* [.CLEARCOAT_FACTOR](#GltfState.DebugOutput.clearcoat.CLEARCOAT_FACTOR)
* [.CLEARCOAT_ROUGHNESS](#GltfState.DebugOutput.clearcoat.CLEARCOAT_ROUGHNESS)
* [.CLEARCOAT_NORMAL](#GltfState.DebugOutput.clearcoat.CLEARCOAT_NORMAL)
* [.sheen](#GltfState.DebugOutput.sheen)
* [.SHEEN](#GltfState.DebugOutput.sheen.SHEEN)
* [.SHEEN_COLOR](#GltfState.DebugOutput.sheen.SHEEN_COLOR)
* [.SHEEN_ROUGHNESS](#GltfState.DebugOutput.sheen.SHEEN_ROUGHNESS)
* [.specular](#GltfState.DebugOutput.specular)
* [.SPECULAR](#GltfState.DebugOutput.specular.SPECULAR)
* [.SPECULAR_FACTOR](#GltfState.DebugOutput.specular.SPECULAR_FACTOR)
* [.SPECULAR_COLOR](#GltfState.DebugOutput.specular.SPECULAR_COLOR)
* [.transmission](#GltfState.DebugOutput.transmission)
* [.TRANSMISSION_VOLUME](#GltfState.DebugOutput.transmission.TRANSMISSION_VOLUME)
* [.TRANSMISSION_FACTOR](#GltfState.DebugOutput.transmission.TRANSMISSION_FACTOR)
* [.VOLUME_THICKNESS](#GltfState.DebugOutput.transmission.VOLUME_THICKNESS)
* [.iridescence](#GltfState.DebugOutput.iridescence)
* [.IRIDESCENCE](#GltfState.DebugOutput.iridescence.IRIDESCENCE)
* [.IRIDESCENCE_FACTOR](#GltfState.DebugOutput.iridescence.IRIDESCENCE_FACTOR)
* [.IRIDESCENCE_THICKNESS](#GltfState.DebugOutput.iridescence.IRIDESCENCE_THICKNESS)
- [Classes](#classes)
- [GltfView](#gltfview)
- [new GltfView(context)](#new-gltfviewcontext)
- [gltfView.createState() ⇒ GltfState](#gltfviewcreatestate--gltfstate)
- [gltfView.createResourceLoader(\[externalDracoLib\], \[externalKtxLib\]) ⇒ ResourceLoader](#gltfviewcreateresourceloaderexternaldracolib-externalktxlib--resourceloader)
- [gltfView.renderFrame(state, width, height)](#gltfviewrenderframestate-width-height)
- [gltfView.gatherStatistics(state) ⇒ Object](#gltfviewgatherstatisticsstate--object)
- [GltfState](#gltfstate)
- [new GltfState(view)](#new-gltfstateview)
- [gltfState.gltf](#gltfstategltf)
- [gltfState.environment](#gltfstateenvironment)
- [gltfState.userCamera](#gltfstateusercamera)
- [gltfState.sceneIndex](#gltfstatesceneindex)
- [gltfState.cameraIndex](#gltfstatecameraindex)
- [gltfState.animationIndices](#gltfstateanimationindices)
- [gltfState.animationTimer](#gltfstateanimationtimer)
- [gltfState.variant](#gltfstatevariant)
- [gltfState.renderingParameters](#gltfstaterenderingparameters)
- [renderingParameters.morphing](#renderingparametersmorphing)
- [renderingParameters.skinning](#renderingparametersskinning)
- [renderingParameters.clearColor](#renderingparametersclearcolor)
- [renderingParameters.exposure](#renderingparametersexposure)
- [renderingParameters.usePunctual](#renderingparametersusepunctual)
- [renderingParameters.useIBL](#renderingparametersuseibl)
- [renderingParameters.iblIntensity](#renderingparametersiblintensity)
- [renderingParameters.renderEnvironmentMap](#renderingparametersrenderenvironmentmap)
- [renderingParameters.blurEnvironmentMap](#renderingparametersblurenvironmentmap)
- [renderingParameters.toneMap](#renderingparameterstonemap)
- [renderingParameters.debugOutput](#renderingparametersdebugoutput)
- [renderingParameters.environmentRotation](#renderingparametersenvironmentrotation)
- [renderingParameters.useDirectionalLightsWithDisabledIBL](#renderingparametersusedirectionallightswithdisabledibl)
- [renderingParameters.internalMSAA](#renderingparametersinternalmsaa)
- [GltfState.ToneMaps](#gltfstatetonemaps)
- [ToneMaps.NONE](#tonemapsnone)
- [ToneMaps.ACES\_HILL\_EXPOSURE\_BOOST](#tonemapsaces_hill_exposure_boost)
- [ToneMaps.ACES\_NARKOWICZ](#tonemapsaces_narkowicz)
- [ToneMaps.ACES\_HILL](#tonemapsaces_hill)
- [GltfState.DebugOutput](#gltfstatedebugoutput)
- [DebugOutput.NONE](#debugoutputnone)
- [DebugOutput.generic](#debugoutputgeneric)
- [generic.UV\_COORDS\_0](#genericuv_coords_0)
- [generic.UV\_COORDS\_1](#genericuv_coords_1)
- [generic.NORMAL](#genericnormal)
- [generic.GEOMETRYNORMAL](#genericgeometrynormal)
- [generic.TANGENT](#generictangent)
- [generic.BITANGENT](#genericbitangent)
- [generic.WORLDSPACENORMAL](#genericworldspacenormal)
- [generic.ALPHA](#genericalpha)
- [generic.OCCLUSION](#genericocclusion)
- [generic.EMISSIVE](#genericemissive)
- [DebugOutput.mr](#debugoutputmr)
- [mr.METALLIC\_ROUGHNESS](#mrmetallic_roughness)
- [mr.BASECOLOR](#mrbasecolor)
- [mr.METALLIC](#mrmetallic)
- [mr.ROUGHNESS](#mrroughness)
- [DebugOutput.clearcoat](#debugoutputclearcoat)
- [clearcoat.CLEARCOAT](#clearcoatclearcoat)
- [clearcoat.CLEARCOAT\_FACTOR](#clearcoatclearcoat_factor)
- [clearcoat.CLEARCOAT\_ROUGHNESS](#clearcoatclearcoat_roughness)
- [clearcoat.CLEARCOAT\_NORMAL](#clearcoatclearcoat_normal)
- [DebugOutput.sheen](#debugoutputsheen)
- [sheen.SHEEN](#sheensheen)
- [sheen.SHEEN\_COLOR](#sheensheen_color)
- [sheen.SHEEN\_ROUGHNESS](#sheensheen_roughness)
- [DebugOutput.specular](#debugoutputspecular)
- [specular.SPECULAR](#specularspecular)
- [specular.SPECULAR\_FACTOR](#specularspecular_factor)
- [specular.SPECULAR\_COLOR](#specularspecular_color)
- [DebugOutput.transmission](#debugoutputtransmission)
- [transmission.TRANSMISSION\_VOLUME](#transmissiontransmission_volume)
- [transmission.TRANSMISSION\_FACTOR](#transmissiontransmission_factor)
- [transmission.VOLUME\_THICKNESS](#transmissionvolume_thickness)
- [DebugOutput.iridescence](#debugoutputiridescence)
- [iridescence.IRIDESCENCE](#iridescenceiridescence)
- [iridescence.IRIDESCENCE\_FACTOR](#iridescenceiridescence_factor)
- [iridescence.IRIDESCENCE\_THICKNESS](#iridescenceiridescence_thickness)
- [anisotropy.ANISOTROPIC\_STRENGTH](#anisotropyanisotropic_strength)
- [anisotropy.ANISOTROPIC\_DIRECTION](#anisotropyanisotropic_direction)
- [ResourceLoader](#resourceloader)
- [new ResourceLoader(view)](#new-resourceloaderview)
- [resourceLoader.loadGltf(gltfFile, \[externalFiles\]) ⇒ Promise](#resourceloaderloadgltfgltffile-externalfiles--promise)
- [resourceLoader.loadEnvironment(environmentFile, \[lutFiles\]) ⇒ Promise](#resourceloaderloadenvironmentenvironmentfile-lutfiles--promise)
- [resourceLoader.initKtxLib(\[externalKtxLib\])](#resourceloaderinitktxlibexternalktxlib)
- [resourceLoader.initDracoLib(\[externalDracoLib\])](#resourceloaderinitdracolibexternaldracolib)
- [UserCamera](#usercamera)
- [new UserCamera()](#new-usercamera)
- [userCamera.setVerticalFoV(yfov)](#usercamerasetverticalfovyfov)
- [userCamera.getPosition()](#usercameragetposition)
- [userCamera.getRotation()](#usercameragetrotation)
- [userCamera.getLookDirection()](#usercameragetlookdirection)
- [userCamera.getTarget()](#usercameragettarget)
- [userCamera.lookAt(from, to)](#usercameralookatfrom-to)
- [userCamera.setPosition(position)](#usercamerasetpositionposition)
- [userCamera.setTarget(target)](#usercamerasettargettarget)
- [userCamera.setRotation(yaw, pitch)](#usercamerasetrotationyaw-pitch)
- [userCamera.setDistanceFromTarget(distance, target)](#usercamerasetdistancefromtargetdistance-target)
- [userCamera.zoomBy(value)](#usercamerazoombyvalue)
- [userCamera.orbit(x, y)](#usercameraorbitx-y)
- [userCamera.pan(x, y)](#usercamerapanx-y)
- [userCamera.fitViewToScene(gltf, sceneIndex)](#usercamerafitviewtoscenegltf-sceneindex)

<a name="new_GltfState_new"></a>

Expand Down Expand Up @@ -429,6 +458,9 @@ such as "NORMAL"
* [.IRIDESCENCE](#GltfState.DebugOutput.iridescence.IRIDESCENCE)
* [.IRIDESCENCE_FACTOR](#GltfState.DebugOutput.iridescence.IRIDESCENCE_FACTOR)
* [.IRIDESCENCE_THICKNESS](#GltfState.DebugOutput.iridescence.IRIDESCENCE_THICKNESS)
* [.anisotropy](#GltfState.DebugOutput.anisotropy)
* [.ANISOTROPIC_STRENGTH](#GltfState.DebugOutput.anisotropy.ANISOTROPIC_STRENGTH)
* [.ANISOTROPIC_DIRECTION](#GltfState.DebugOutput.anisotropy.ANISOTROPIC_DIRECTION)

<a name="GltfState.DebugOutput.NONE"></a>

Expand Down Expand Up @@ -711,6 +743,20 @@ output the iridescence thickness
**Kind**: static property of [<code>iridescence</code>](#GltfState.DebugOutput.iridescence)
<a name="ResourceLoader"></a>

<a name="GltfState.DebugOutput.anisotropy.IRIDESCENCE"></a>

##### anisotropy.ANISOTROPIC\_STRENGTH
output the anisotropy strength

**Kind**: static property of [<code>anisotropy</code>](#GltfState.DebugOutput.anisotropy)
<a name="GltfState.DebugOutput.anisotropy.ANISOTROPIC_STRENGTH"></a>

##### anisotropy.ANISOTROPIC\_DIRECTION
output the final anisotropic direction as defined by the anisotropicTexture and anisotropic rotation

**Kind**: static property of [<code>anisotropy</code>](#GltfState.DebugOutput.anisotropy)
<a name="ResourceLoader"></a>

## ResourceLoader
ResourceLoader can be used to load resources for the GltfState
that are then used to display the loaded data with GltfView
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct ([https://www.khronos.org/developers/code-of-conduct](https://www.khronos.org/developers/code-of-conduct)), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil.
A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Files in this repository fall under one of these licenses:

* SPDX license identifier: "`Apache-2.0`"
* Apache License 2.0
* Apache License 2.0
* For files copied from other Apache-2.0 projects (gltf-sampler-viewer)

* SPDX license identifier: "`CC0-1.0`"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ glTF-Compressor

[![](assets/images/ToyCar.jpg)](https://phasmatic3d.github.io/glTF-Sample-Viewer-KTX-demo/)

This is the official [Khronos glTF 2.0](https://www.khronos.org/gltf/) image compression project using [WebGL](https://www.khronos.org/webgl/): [glTF-Compressor](https://github.khronos.org/glTF-Compressor-Release/)
This is the official [Khronos glTF 2.0](https://www.khronos.org/gltf/) image compression project using [WebGL](https://www.khronos.org/webgl/): [glTF-Compressor](https://phasmatic3d.github.io/glTF-Sample-Viewer-KTX-demo/)



Expand Down Expand Up @@ -54,7 +54,7 @@ For local usage and debugging, please follow these instructions:
Web App
-------

You can find an example application for the glTF-Compressor in the [app_web subdirectory of the glTF-Compressor repository](app_web). A live demo can be found at [https://github.khronos.org/glTF-Compressor-Release/](https://github.khronos.org/glTF-Compressor-Release/).
You can find an example application for the glTF-Compressor in the [app_web subdirectory of the glTF-Compressor repository](app_web). A live demo can be found at [https://phasmatic3d.github.io/glTF-Sample-Viewer-KTX-demo/](https://phasmatic3d.github.io/glTF-Sample-Viewer-KTX-demo/).

**Running a local version**

Expand Down
11 changes: 11 additions & 0 deletions assets/ui/Compressor 30X30.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/ui/Compressor 50X50.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"url": "git+https://github.com/KhronosGroup/glTF-Sample-Viewer.git"
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"build": "echo 'Please run `npm run build` from the `app_web` or `app_headless` directory.'",
"dev": "echo 'Please run `npm run dev` from the `app_web` or `app_headless` directory.'",
"prepublishOnly": "npm run build && npm run build_docs",
"build_docs": "rm API.md; ./node_modules/.bin/jsdoc2md source/gltf-sample-viewer.js source/GltfView/gltf_view.js source/GltfState/gltf_state.js source/ResourceLoader/resource_loader.js source/gltf/user_camera.js > API.md",
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -35,6 +35,7 @@
"rollup": "^2.79.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-glslify": "^1.3.1",
"@rollup/plugin-wasm": "^6.1.3",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"concurrently": "^7.4.0",
Expand All @@ -46,4 +47,4 @@
"url": "https://github.com/KhronosGroup/glTF-Sample-Viewer/issues"
},
"homepage": "https://github.com/KhronosGroup/glTF-Sample-Viewer/#readme"
}
}
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import commonjs from '@rollup/plugin-commonjs';
import glslify from 'rollup-plugin-glslify';
import resolve from '@rollup/plugin-node-resolve';
import copy from "rollup-plugin-copy";
import {wasm} from "@rollup/plugin-wasm";


export default {
Expand All @@ -19,9 +20,10 @@ export default {
}
],
plugins: [
wasm(),
glslify(),
resolve({
browser: true,
browser: false,
preferBuiltins: false,
dedupe: ['gl-matrix', 'axios', 'jpeg-js', 'fast-png']
}),
Expand Down
Loading

0 comments on commit af160e0

Please sign in to comment.