Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/draco import #23

Merged
merged 24 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0b0be1e
Initialize Draco decoder module
jim-ec Nov 11, 2020
93f6096
Use 'draco_decoder_gltf.js' instead of 'draco_decoder.js'
jim-ec Nov 11, 2020
5b2ba46
added draco extension parsing
UX3D-hohenester Nov 12, 2020
5b0309f
draco position decoding wip
UX3D-hohenester Nov 12, 2020
03f2604
store decoded draco position data into accessor
jim-ec Nov 12, 2020
35bfca0
first working version (models look exploded)
UX3D-hohenester Nov 12, 2020
df79708
getting correct values from draco now works
UX3D-hohenester Nov 13, 2020
3b07962
added code for parsing data into sample viewer from draco
UX3D-hohenester Nov 17, 2020
ade78f3
added target to new primitive buffer views
UX3D-hohenester Nov 17, 2020
2453313
fixed component type; fixed array length properties; fixed position b…
UX3D-hohenester Nov 17, 2020
3378eaa
allow draco sample assets
UX3D-hohenester Nov 17, 2020
b21f9be
refactored code (removed unncessary code and cleanup)
UX3D-hohenester Nov 18, 2020
3964d82
made decoder more robust towards draco parameter handling
UX3D-hohenester Nov 18, 2020
89f1856
added color handling; small fix
UX3D-hohenester Nov 18, 2020
cf1b872
added handling for all standard primitive attributes and related refa…
UX3D-hohenester Nov 18, 2020
3bb15fa
fix
UX3D-hohenester Nov 19, 2020
54fb08d
added component type handling
UX3D-hohenester Nov 19, 2020
a77b323
fixed rigging and component type import
UX3D-hohenester Nov 20, 2020
c103d62
fix for vertex count and refactor
UX3D-hohenester Nov 20, 2020
41d23dd
fix
UX3D-hohenester Nov 20, 2020
d74400c
updated models subrepository
UX3D-hohenester Nov 20, 2020
17e131b
code cleanup/ simplification
UX3D-hohenester Nov 23, 2020
cba3f8a
Merge branch 'develop' into feature/dracoImport
UX3D-hohenester Nov 25, 2020
ac70046
formatting and removed confusing comment
UX3D-becher Nov 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<script src="libs/dat.gui.min.js"></script>
<script src="libs/stats.min.js"></script>

<script src="https://www.gstatic.com/draco/v1/decoders/draco_decoder_gltf.js"></script>
<script src="dist/gltf-sample-viewer.umd.js"></script>
</head>
<script>
Expand Down
23 changes: 23 additions & 0 deletions src/draco.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

class DracoDecoder {

constructor() {
this.module = null;

this.initializingPromise = new Promise(resolve => {
let dracoDecoderType = {};
dracoDecoderType['onModuleLoaded'] = dracoDecoderModule => {
this.module = dracoDecoderModule;
resolve();
};
DracoDecoderModule(dracoDecoderType);
});
}

async ready() {
return this.initializingPromise;
}

}

export { DracoDecoder };
8 changes: 6 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { gltfViewer } from './viewer.js';
import { gltfInput } from './input.js';
import { WebGl } from './webgl.js';
import { DracoDecoder } from './draco.js';

function gltfSampleViewer(
async function gltfSampleViewer(
canvasId,
index,
envMap = "Courtyard of the Doge's palace",
Expand All @@ -28,7 +29,10 @@ function gltfSampleViewer(
input.setupGlobalInputBindings(document);
input.setupCanvasInputBindings(canvas);

new gltfViewer(canvas, index, input, onRendererReady, basePath, initialModel, envMap);
const dracoDecoder = new DracoDecoder();
await dracoDecoder.ready();

new gltfViewer(canvas, index, input, onRendererReady, basePath, initialModel, envMap, dracoDecoder);
}

function getWebGlContext(canvas)
Expand Down
2 changes: 1 addition & 1 deletion src/model_path_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {

class gltfModelPathProvider
{
constructor(modelIndexerPath, ignoredVariants = ["glTF-Draco", "glTF-Embedded"])
constructor(modelIndexerPath, ignoredVariants = ["glTF-Embedded"])
{
this.modelIndexerPath = modelIndexerPath;
this.ignoredVariants = ignoredVariants;
Expand Down
Loading