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

Adds EXT_geopose extension #1980

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
02788c2
Feature metadata draft
lilleyse Feb 19, 2021
8ff6036
New draft for version 1.0.0
lilleyse Feb 21, 2021
06c786d
Add examples section
lilleyse Feb 22, 2021
4e9f198
Updates from review
lilleyse Feb 22, 2021
2356b8a
Fix min/max schema
lilleyse Feb 22, 2021
8579414
Peer review edits
lilleyse Feb 22, 2021
1843828
Resolve TODOs
lilleyse Feb 23, 2021
efceb1c
Wording
lilleyse Feb 23, 2021
3f4c417
Insert Wetzel output
ptrgags Feb 23, 2021
d03e0f7
Wetzel output revisions
lilleyse Feb 23, 2021
3ae81a5
Add last figure
lilleyse Feb 24, 2021
7177150
Addressed review feedback
lilleyse Feb 24, 2021
d0dcbbb
Fix schema TOC indentation
lilleyse Feb 24, 2021
c2b8dfd
Don't make class required in case the model does not have metadata
lilleyse Feb 24, 2021
3e710a9
Schema wording tweaks
lilleyse Feb 24, 2021
ca09ad2
Change bufferView type back to integer
lilleyse Feb 24, 2021
99d4841
Update extensions/2.0/Vendor/EXT_feature_metadata/1.0.0/schema/featur…
lilleyse Feb 24, 2021
d4bafc6
Merge pull request #3 from CesiumGS/feature-metadata
ptrgags Feb 24, 2021
7533ef8
Update links to Cesium 3D Metadata spec
lilleyse Feb 24, 2021
7b98a75
Update date
lilleyse Feb 24, 2021
d7fc766
Minor updates
lilleyse Feb 24, 2021
cfdce9b
Update links to EXT_mesh_gpu_instancing
lilleyse Feb 24, 2021
d818407
Reorder classes/enums
lilleyse Feb 25, 2021
815cb67
Wording
lilleyse Feb 25, 2021
8193046
Tweaks
lilleyse Feb 25, 2021
26272c1
Update README.md
lilleyse Apr 27, 2021
60579f9
Adds initial draft of CESIUM_geopose v0.0.0
sanjeetsuhag May 5, 2021
f7a132c
Fixes typo
sanjeetsuhag May 5, 2021
89b0322
Adds table of contents
sanjeetsuhag May 5, 2021
a75c782
Adds note of OGC GeoPose extension being a draft
sanjeetsuhag May 5, 2021
7273123
Rename to EXT_geopose
sanjeetsuhag May 5, 2021
c43578d
Improves top README
sanjeetsuhag May 5, 2021
46e242d
Fix extension name
sanjeetsuhag May 5, 2021
0476fdf
Fix extension name in 0.0.0
sanjeetsuhag May 5, 2021
09960b0
Fix schema name
sanjeetsuhag May 5, 2021
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
682 changes: 682 additions & 0 deletions extensions/2.0/Vendor/EXT_feature_metadata/0.0.0/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Texture Metadata Example: Microcosm

This glTF example is a mesh that represents a lot of different types of
terrain in one small tile

This example simulates using per-texel metadata for land cover
classification as well as the Normalized Difference Vegetation Index (NDVI)
values.

The data here is hand-made until we can get more realistic data.

### Script to generate metadata

To generate the metadata buffer, run `node microcosm-metadata.js`. This
will overwrite `microcosm.bin` and print out JSON to add to the bufferViews
of the glTF.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
'use strict';

const fs = require('fs');

/**
* Need to know these lengths:
* - total buffer length
*
* - LULC Name bufferView length and offsets
* - LULC Name offsets bufferView length and offsets
* - LULC Color bufferView length and offsets
*/

// This is how I mapped the color values in GIMP. Kinda haphazard admittedly.
const landCoverValues = {
0: {
name: "Grassland",
color: [118, 163, 11]
},
32: {
name: "Rocky Ground",
color: [110, 110, 110]
},
64: {
name: "Desert",
color: [212, 209, 182]
},
128: {
name: "River",
color: [82, 173, 204]
},
208: {
name: "Forest",
color: [50, 84, 51]
},
255: {
name: "Building",
color: [194, 194, 194]
}
};

const unusedLandCover = {
name: "Unused",
color: [0, 0, 0]
};

const numberOfLandCoverFeatures = 256;
const sizeOfColor = 3;

function makeLandCoverColors() {
const bufferLength = numberOfLandCoverFeatures * sizeOfColor;
const buffer = Buffer.alloc(bufferLength);
for (let i = 0; i < numberOfLandCoverFeatures; i++) {
const feature = landCoverValues[i];
if (feature !== undefined) {
const [r, g, b] = feature.color;
buffer[3 * i] = r;
buffer[3 * i + 1] = g;
buffer[3 * i + 2] = b;
}

// Otherwise the default color of 0, 0, 0 is used,
// but the buffer is allocated with all 0s so no work is needed here.
}
return buffer;
}

function makeLandCoverNames() {
const offsets = new Uint32Array(numberOfLandCoverFeatures + 1);
let nameText = '';
let currentOffset = 0;
for (let i = 0; i < numberOfLandCoverFeatures; i++) {
let feature = landCoverValues[i];
if (feature === undefined) {
feature = unusedLandCover;
}

const name = feature.name;
const nameLength = Buffer.byteLength(name, 'utf8');

offsets[i] = currentOffset;
currentOffset += nameLength;

nameText += name;
}
offsets[numberOfLandCoverFeatures] = currentOffset;

const namesBuffer = Buffer.from(nameText, 'utf8');

// Convert from Uint32Array -> Buffer (which is a Uint8Array)
const offsetsBuffer = Buffer.from(offsets.buffer);
return [namesBuffer, offsetsBuffer];
}

function makeBufferViews() {
const [landCoverNames, landCoverOffsets] = makeLandCoverNames();
const landCoverColor = makeLandCoverColors();

return [
{
name: "LULC Name",
bufferView: landCoverNames
},
{
name: "LULC Name Offsets",
bufferView: landCoverOffsets,
},
{
name: "LULC Color",
bufferView: landCoverColor
}
]
}

function makeBinFile() {
const bufferViewInfos = makeBufferViews();
const bufferViews = [];
const stats = [];
let offset = 0;
for (const bufferViewInfo of bufferViewInfos) {
if (offset % 8 != 0) {
const paddingBytes = 8 - (offset % 8);
console.log(`Offset not aligned, adding ${paddingBytes} of padding`);
const padding = Buffer.alloc(paddingBytes);
bufferViews.push(padding);
offset += paddingBytes;
}

const bufferView = bufferViewInfo.bufferView;
const byteLength = bufferView.byteLength;
stats.push({
name: bufferViewInfo.name,
buffer: 1,
byteLength: byteLength,
byteOffset: offset
});
offset += byteLength;

bufferViews.push(bufferView);
}

const buffer = Buffer.concat(bufferViews);
fs.writeFileSync('microcosm-metadata.bin', buffer, 'utf8');

console.log(JSON.stringify(stats, undefined, 4));
console.log('totalLength:', buffer.byteLength);
}

makeBinFile();
Binary file not shown.
Loading