Skip to content

Commit

Permalink
Add support for format .drc, Google's Draco 3D Data Compression (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit authored Dec 13, 2024
1 parent e2f1a1c commit e99257d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,13 @@ export class FileTypeParser {
};
}

if (this.checkString('DRACO')) {
return {
ext: 'drc',
mime: 'application/vnd.google.draco', // Invented by us
};
}

// -- 6-byte signatures --

if (this.check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {
Expand Down
Binary file added fixture/fixture-cube_pc.drc
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@
"fbx",
"vsdx",
"vtt",
"apk"
"apk",
"drc"
],
"dependencies": {
"strtok3": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file
- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document
- [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression
- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
- [`dwg`](https://en.wikipedia.org/wiki/.dwg) - Autodesk CAD file
- [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export const extensions = [
'vsdx',
'vtt',
'apk',
'drc',
];

export const mimeTypes = [
Expand Down Expand Up @@ -307,4 +308,5 @@ export const mimeTypes = [
'application/x.autodesk.fbx', // Invented by us
'application/vnd.visio',
'application/vnd.android.package-archive',
'application/vnd.google.draco', // Invented by us
];
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const names = {
dng: [
'fixture-Leica-M10',
],
drc: [
'fixture-cube_pc',
],
epub: [
'fixture',
'fixture-crlf',
Expand Down

0 comments on commit e99257d

Please sign in to comment.