Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
郭贵成 committed Mar 9, 2018
1 parent b45e437 commit 54688e7
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions build/mxreality.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var VR=function (scene,renderer,container,cameraPara,cameraPosition) {
this.defaultVolume=0.3;
this.sliceSegment=0;
this._controlTarget={x:0.0001,y:0,z:0};
this.recType={"video":"video","box":"box","slice":"slice"};
this.resType={"video":"video","box":"box","slice":"slice"};
this.asteroidConfig={enable:false,assteroidFPS:36,assteroidFov:135,asteroidForwardTime:2000,asteroidWaitTime:1000,asteroidDepressionRate:0.5,asteroidTop:1,cubeResolution:2048};
this.VRhint="请取消屏幕翻转锁定后装入VR盒子中";
this.camera=new THREE.PerspectiveCamera(this.cameraPara.fov,this.cameraPara.aspect , this.cameraPara.near, this.cameraPara.far);
Expand Down Expand Up @@ -75,10 +75,10 @@ VR.prototype.init=function () {
AVR.bindOrientationEnevt(that,that._controlTarget);
}, false);
};
VR.prototype.playPanorama=function (recUrl,recType,objName) {
VR.prototype.playPanorama=function (recUrl,resType,objName) {
objName=objName||"__panoContainer";
var that = this;
that._containerRadius=(that.recType.box == recType|| that.recType.slice==recType) ? (that.vrbox.width / 2.1) : that.vrbox.radius;
that._containerRadius=(that.resType.box == resType|| that.resType.slice==resType) ? (that.vrbox.width / 2.1) : that.vrbox.radius;

that.autoHideLeftTime = that.defaultAutoHideLeftTime;
that.voiceHideLeftTime = that.defaultVoiceHideLeftTime;
Expand Down Expand Up @@ -212,7 +212,7 @@ VR.prototype.playPanorama=function (recUrl,recType,objName) {
that.videoToolBar.btn.style.borderBottom = "0.6rem solid transparent";
}

if (that.recType.box == recType) {
if (that.resType.box == resType) {
var textures = [];
var materials = [];

Expand Down Expand Up @@ -241,7 +241,7 @@ VR.prototype.playPanorama=function (recUrl,recType,objName) {
that.loadProgressManager.onLoad();
}
imgPanoToolBar();
}else if(that.recType.slice==recType){
}else if(that.resType.slice==resType){
var cubeGeometry = new THREE.CubeGeometry(that.vrbox.width, that.vrbox.height, that.vrbox.depth, that.sliceSegment, that.sliceSegment, that.sliceSegment);
//cubeGeometry.scale(-1, 1, 1)
var textureLoader = new THREE.TextureLoader(that.loadProgressManager);
Expand Down Expand Up @@ -289,7 +289,7 @@ VR.prototype.playPanorama=function (recUrl,recType,objName) {
var phiStart = AVR.isMobileDevice()?Math.PI/2:-Math.PI/2;
var geometry = geometry = new THREE.SphereBufferGeometry(this.vrbox.radius, this.vrbox.widthSegments, this.vrbox.heightSegments, phiStart);
geometry.scale(-1, 1, 1); //x取反(面朝里)
if (that.recType.video == recType) {
if (that.resType.video == resType) {

var video = AVR.createTag('video', {
'webkit-playsinline': true,
Expand Down
6 changes: 3 additions & 3 deletions docs/VRAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

播放器类别指定

vr.recType={"video":"video","box":"box","slice":"slice"};
//全景视频则是vr.recType.video 正六面体为vr.recType.box 切片并补天播放器类别为vr.recType.slice
vr.resType={"video":"video","box":"box","slice":"slice"};
//全景视频则是vr.resType.video 正六面体为vr.resType.box 切片并补天播放器类别为vr.resType.slice

初始化全景容器参数,如果全景图为正六面体则指定width、height、depth 3个参数,适用于box和slice类别;
如果为球体则设置radius、widthSegments、heightSegments ,适用于video和默认类别
Expand Down Expand Up @@ -69,7 +69,7 @@

/**
* resource 全景资源地址
* resourceType 全景资源类别vr.recType.[box/video/slice]
* resourceType 全景资源类别vr.resType.[box/video/slice]
* objName 播放器对象name值 默认为 __panoContainer
**/
vr.playPanorama(resource,resourceType,objName);
Expand Down
2 changes: 1 addition & 1 deletion examples/asteroid_view1.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
//AVR.useGyroscope=false;
vr.init();

vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.recType.video);
vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.resType.video);
vr.video.setAttribute("loop","loop");
vr.video.crossOrigin="Anonymous";
vr.video.autoplay=true;
Expand Down
2 changes: 1 addition & 1 deletion examples/auto_convert.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
vr.init();
vr.sphere2BoxPano("textures/puydesancy.jpg",1024,1024,function (img) {
//document.getElementById("test").src=img;
vr.playPanorama(img,vr.recType.box);
vr.playPanorama(img,vr.resType.box);
});

//
Expand Down
2 changes: 1 addition & 1 deletion examples/cubic_projection.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

}
vr.sphere2BoxPano("textures/puydesancy.jpg",1024,1024,function (sliceArray) {
vr.playPanorama(sliceArray, vr.recType.slice);
vr.playPanorama(sliceArray, vr.resType.slice);
});
//vr.playPanorama("http://ov4hj29xx.bkt.clouddn.com/puydesancy.jpg");

Expand Down
4 changes: 2 additions & 2 deletions examples/vr_cube.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
vr.VRObject.getObjectByName("__panoContainer").visible = true;
}
vr.init();
vr.playPanorama("textures/sun_temple_stripe.jpg",vr.recType.box);
//vr.playPanorama("textures/aaa.png",vr.recType.box);
vr.playPanorama("textures/sun_temple_stripe.jpg",vr.resType.box);
//vr.playPanorama("textures/aaa.png",vr.resType.box);

}
init();
Expand Down
2 changes: 1 addition & 1 deletion examples/vr_slice_pano.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
vr.VRObject.getObjectByName("__panoContainer").visible = true;
}
vr.sphere2BoxPano("http://ov4hj29xx.bkt.clouddn.com/puydesancy.jpg",1024,1024,function (sliceArray) {
vr.playPanorama(sliceArray, vr.recType.slice);
vr.playPanorama(sliceArray, vr.resType.slice);
});
}
init();
Expand Down
4 changes: 2 additions & 2 deletions examples/vr_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
//AVR.useGyroscope=false;
vr.init();

vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.recType.video);
//vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/panovideo/960p.mp4',vr.recType.video);
vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.resType.video);
//vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/panovideo/960p.mp4',vr.resType.video);
vr.video.setAttribute("loop","loop");
vr.video.crossOrigin="Anonymous";
vr.loadProgressManager.onLoad=function () {
Expand Down
2 changes: 1 addition & 1 deletion examples/vr_video1.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
//AVR.useGyroscope=false;
vr.init();

vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.recType.video);
vr.playPanorama('http://ov4hj29xx.bkt.clouddn.com/360.mp4',vr.resType.video);
vr.video.setAttribute("loop","loop");
vr.video.crossOrigin="Anonymous";
vr.loadProgressManager.onLoad=function () {
Expand Down

0 comments on commit 54688e7

Please sign in to comment.