-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
117 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* global describe, it */ | ||
import assert from 'assert'; | ||
import { _testing } from '../src/Provider/PointCloudProvider'; | ||
|
||
|
||
describe('PointCloudProvider', function () { | ||
it('should correctly parse normal information in metadata', function () { | ||
const layer = { | ||
material: { defines: {} } | ||
}; | ||
|
||
// no normals | ||
const metadata = { | ||
boundingBox: { | ||
lx: 0, | ||
ly: 1, | ||
ux: 2, | ||
uy: 3, | ||
}, | ||
scale: 1.0, | ||
pointAttributes: ['POSITION', 'RGB'], | ||
}; | ||
|
||
let result = _testing.parseMetadata(layer, metadata); | ||
const normalDefined = layer.material.defines['NORMAL'] || layer.material.defines['NORMAL_SPHEREMAPPED'] || layer.material.defines['NORMAL_OCT16']; | ||
assert.ok(!normalDefined); | ||
|
||
// normals as vector | ||
layer.material = { defines: {} }; | ||
metadata.pointAttributes = ['POSITION', 'NORMAL', 'CLASSIFICATION']; | ||
result = _testing.parseMetadata(layer, metadata); | ||
assert.ok(layer.material.defines['NORMAL']); | ||
assert.ok(!layer.material.defines['NORMAL_SPHEREMAPPED']); | ||
assert.ok(!layer.material.defines['NORMAL_OCT16']); | ||
|
||
// spheremapped normals | ||
layer.material = { defines: {} }; | ||
metadata.pointAttributes = ['POSITION', 'COLOR_PACKED', 'NORMAL_SPHEREMAPPED']; | ||
result = _testing.parseMetadata(layer, metadata); | ||
assert.ok(!layer.material.defines['NORMAL']); | ||
assert.ok(layer.material.defines['NORMAL_SPHEREMAPPED']); | ||
assert.ok(!layer.material.defines['NORMAL_OCT16']); | ||
|
||
// oct16 normals | ||
layer.material = { defines: {} }; | ||
metadata.pointAttributes = ['POSITION', 'COLOR_PACKED', 'CLASSIFICATION', 'NORMAL_OCT16']; | ||
result = _testing.parseMetadata(layer, metadata); | ||
assert.ok(!layer.material.defines['NORMAL']); | ||
assert.ok(!layer.material.defines['NORMAL_SPHEREMAPPED']); | ||
assert.ok(layer.material.defines['NORMAL_OCT16']); | ||
}); | ||
}); | ||
|