mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-18 13:54:01 +08:00
try to fix problem of 3d preview
This commit is contained in:
parent
537fe6a5bf
commit
88ecd13c24
@ -2,7 +2,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-01-21 13:56:40
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-03-05 18:41:09
|
||||
* @Last Modified time: 2016-03-05 20:36:43
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -51,11 +51,11 @@ function handleFiles(files, type) {
|
||||
var run = false, stop = false;
|
||||
$("[title='Movements']").click(function(){
|
||||
stop = !stop;
|
||||
MSP.stopPlay(stop);
|
||||
speed = stop ? 0 : 1;
|
||||
});
|
||||
$("[title='Running']").click(function(){
|
||||
run = !run;
|
||||
MSP.playQuickly(run);
|
||||
speed = run ? 4 : 1;
|
||||
});
|
||||
|
||||
$('#model-alex').on('change', function() {
|
||||
|
@ -48,9 +48,9 @@ scene = new THREE.Scene();
|
||||
|
||||
// Skin Part
|
||||
canvas = document.createElement('canvas');;
|
||||
canvas.width = 64;
|
||||
canvas.height = 64;
|
||||
var context = canvas.getContext("2d");
|
||||
canvas.width = 64;
|
||||
canvas.height = 64;
|
||||
var context = canvas.getContext("2d");
|
||||
|
||||
var skinTexture = new THREE.Texture(canvas);
|
||||
skinTexture.magFilter = THREE.NearestFilter;
|
||||
@ -878,7 +878,7 @@ function RenderSkin() {
|
||||
container = document.getElementById('skinpreview');
|
||||
|
||||
renderer = new THREE.WebGLRenderer({alpha: true});
|
||||
onWindowResize();
|
||||
renderer.setSize(600, 350);
|
||||
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
|
||||
@ -898,20 +898,30 @@ function RenderSkin() {
|
||||
isMouseDown = false;
|
||||
}, false);
|
||||
|
||||
container.appendChild(renderer.domElement);
|
||||
var canvas3d = renderer.domElement;
|
||||
canvas3d.setAttribute('id', 'canvas3d');
|
||||
canvas3d.style = '';
|
||||
container.appendChild(canvas3d);
|
||||
onWindowResize();
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
camera.aspect = (window.innerWidth - sidebarWidth) / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
if (window.innerWidth > 768) {
|
||||
renderer.setSize(container.clientWidth, container.clientWidth/1.8);
|
||||
} else {
|
||||
renderer.setSize(container.clientWidth/1.5, container.clientWidth/1.8);
|
||||
}
|
||||
var canvas3d = document.getElementById('canvas3d');
|
||||
canvas3d.width = 600;
|
||||
canvas3d.height = 350;
|
||||
|
||||
canvas3d.setSize(container.clientWidth, container.clientWidth/12*7);
|
||||
}
|
||||
|
||||
Element.prototype.setSize = function (w, h) {
|
||||
this.style.width = w + "px";
|
||||
this.style.height = h + "px";
|
||||
return this;
|
||||
};
|
||||
|
||||
function Animate() {
|
||||
scene.getObjectByName("cape", false).visible = capeLoaded;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user