فهرست منبع

USDZExporter: fix default plane anchoring orientation and add precision specifiers (#25012)

Fixes #25011
hybridherbst 2 سال پیش
والد
کامیت
15bec5bd19
1فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 9 9
      examples/jsm/exporters/USDZExporter.js

+ 9 - 9
examples/jsm/exporters/USDZExporter.js

@@ -6,7 +6,7 @@ import * as fflate from '../libs/fflate.module.js';
 
 
 class USDZExporter {
 class USDZExporter {
 
 
-	async parse( scene, options = { ar: { anchoring: { type: 'plane' }, planeAnchoring: { alignment: 'vertical' } } } ) {
+	async parse( scene, options = { ar: { anchoring: { type: 'plane' }, planeAnchoring: { alignment: 'horizontal' } } } ) {
 
 
 		const files = {};
 		const files = {};
 		const modelFileName = 'model.usda';
 		const modelFileName = 'model.usda';
@@ -618,9 +618,9 @@ function buildCamera( camera ) {
 			matrix4d xformOp:transform = ${ transform }
 			matrix4d xformOp:transform = ${ transform }
 			uniform token[] xformOpOrder = ["xformOp:transform"]
 			uniform token[] xformOpOrder = ["xformOp:transform"]
 	
 	
-			float2 clippingRange = (${camera.near}, ${camera.far})
-			float horizontalAperture = ${( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10}
-			float verticalAperture = ${( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10}
+			float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
+			float horizontalAperture = ${ ( ( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10 ).toPrecision( PRECISION ) }
+			float verticalAperture = ${ ( ( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10 ).toPrecision( PRECISION ) }
 			token projection = "orthographic"
 			token projection = "orthographic"
 		}
 		}
 	
 	
@@ -633,12 +633,12 @@ function buildCamera( camera ) {
 			matrix4d xformOp:transform = ${ transform }
 			matrix4d xformOp:transform = ${ transform }
 			uniform token[] xformOpOrder = ["xformOp:transform"]
 			uniform token[] xformOpOrder = ["xformOp:transform"]
 	
 	
-			float2 clippingRange = (${camera.near}, ${camera.far})
-			float focalLength = ${camera.getFocalLength()}
-			float focusDistance = ${camera.focus}
-			float horizontalAperture = ${camera.getFilmWidth()}
+			float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
+			float focalLength = ${ camera.getFocalLength().toPrecision( PRECISION ) }
+			float focusDistance = ${ camera.focus.toPrecision( PRECISION ) }
+			float horizontalAperture = ${ camera.getFilmWidth().toPrecision( PRECISION ) }
 			token projection = "perspective"
 			token projection = "perspective"
-			float verticalAperture = ${camera.getFilmHeight()}
+			float verticalAperture = ${ camera.getFilmHeight().toPrecision( PRECISION ) }
 		}
 		}
 	
 	
 	`;
 	`;