未验证 提交 33f1f8f6 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #19939 from fernandojsg/handpath

[WebXR Hand input] Add setPath on the XRHandModelFactory
......@@ -42,12 +42,23 @@ XRHandModel.prototype = Object.assign( Object.create( Object3D.prototype ), {
var XRHandModelFactory = ( function () {
function XRHandModelFactory() {}
function XRHandModelFactory() {
this.path = '';
}
XRHandModelFactory.prototype = {
constructor: XRHandModelFactory,
setPath: function ( path ) {
this.path = path;
return this;
},
createHandModel: function ( controller, profile, options ) {
const handModel = new XRHandModel( controller );
......@@ -65,15 +76,15 @@ var XRHandModelFactory = ( function () {
// @todo Detect profile if not provided
if ( profile === undefined || profile === "spheres" ) {
handModel.motionController = new XRHandPrimitiveModel( handModel, controller, xrInputSource.handedness, { primitive: "sphere" } );
handModel.motionController = new XRHandPrimitiveModel( handModel, controller, this.path, xrInputSource.handedness, { primitive: "sphere" } );
} else if ( profile === "boxes" ) {
handModel.motionController = new XRHandPrimitiveModel( handModel, controller, xrInputSource.handedness, { primitive: "box" } );
handModel.motionController = new XRHandPrimitiveModel( handModel, controller, this.path, xrInputSource.handedness, { primitive: "box" } );
} else if ( profile === "oculus" ) {
handModel.motionController = new XRHandOculusMeshModel( handModel, controller, xrInputSource.handedness, options );
handModel.motionController = new XRHandOculusMeshModel( handModel, controller, this.path, xrInputSource.handedness, options );
}
......
......@@ -2,7 +2,7 @@ import { FBXLoader } from "../loaders/FBXLoader.js";
class XRHandOculusMeshModel {
constructor( handModel, controller, handedness, options ) {
constructor( handModel, controller, path, handedness, options ) {
this.controller = controller;
this.handModel = handModel;
......@@ -11,7 +11,8 @@ class XRHandOculusMeshModel {
var loader = new FBXLoader();
const low = options && options.model === "lowpoly" ? "_low" : "";
loader.load( `../../models/fbx/OculusHand_${handedness === "right" ? "R" : "L"}${low}.fbx`, object => {
loader.setPath( path );
loader.load( `fbx/OculusHand_${handedness === "right" ? "R" : "L"}${low}.fbx`, object => {
this.handModel.add( object );
// Hack because of the scale of the skinnedmesh
......
......@@ -8,7 +8,7 @@ import {
class XRHandPrimitiveModel {
constructor( handModel, controller, handedness, options ) {
constructor( handModel, controller, path, handedness, options ) {
this.controller = controller;
this.handModel = handModel;
......
......@@ -101,7 +101,7 @@
scene.add( controller2 );
var controllerModelFactory = new XRControllerModelFactory();
var handModelFactory = new XRHandModelFactory();
var handModelFactory = new XRHandModelFactory().setPath( "./models/" );
// Hand 1
controllerGrip1 = renderer.xr.getControllerGrip( 0 );
......
......@@ -103,7 +103,7 @@
scene.add( controller2 );
var controllerModelFactory = new XRControllerModelFactory();
var handModelFactory = new XRHandModelFactory();
var handModelFactory = new XRHandModelFactory().setPath( "./models/" );
// Hand 1
......
......@@ -91,7 +91,7 @@
scene.add( controller2 );
var controllerModelFactory = new XRControllerModelFactory();
var handModelFactory = new XRHandModelFactory();
var handModelFactory = new XRHandModelFactory().setPath( "./models/" );
// Hand 1
controllerGrip1 = renderer.xr.getControllerGrip( 0 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册