Skip to content

Commit

Permalink
Merge pull request #183 from alex-lancer/master
Browse files Browse the repository at this point in the history
Fix RTC_CENTER for pnts model
  • Loading branch information
gkjohnson authored Jun 1, 2021
2 parents ba3549a + 58de2ed commit bf629b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/three/PNTSLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ export class PNTSLoader extends PNTSLoaderBase {
result.scene = object;
result.scene.featureTable = featureTable;

const rtcCenter = featureTable.getData( 'RTC_CENTER' );

if ( rtcCenter ) {

result.scene.position.x += rtcCenter[ 0 ];
result.scene.position.y += rtcCenter[ 1 ];
result.scene.position.z += rtcCenter[ 2 ];

}

return result;

}
Expand Down
8 changes: 7 additions & 1 deletion src/three/TilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,13 @@ export class TilesRenderer extends TilesRendererBase {
// any transformations applied to it can be assumed to be applied after load
// (such as applying RTC_CENTER) meaning they should happen _after_ the z-up
// rotation fix which is why "multiply" happens here.
scene.matrix.multiply( tempMat ).premultiply( cachedTransform );
if ( extension !== 'pnts' ) {

scene.matrix.multiply( tempMat );

}

scene.matrix.premultiply( cachedTransform );
scene.matrix.decompose( scene.position, scene.quaternion, scene.scale );
scene.traverse( c => {

Expand Down

0 comments on commit bf629b1

Please sign in to comment.