Skip to content

Commit

Permalink
refs #7 fix:sample cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
adrs2002 committed Dec 1, 2017
1 parent d54a703 commit 453894f
Show file tree
Hide file tree
Showing 9 changed files with 5,762 additions and 566,765 deletions.
111,699 changes: 0 additions & 111,699 deletions sample/2monwolv.x

This file was deleted.

94,183 changes: 0 additions & 94,183 deletions sample/2refor.x

This file was deleted.

60,392 changes: 0 additions & 60,392 deletions sample/content/SSR06_Born2.x

This file was deleted.

53,694 changes: 0 additions & 53,694 deletions sample/content/SSR06_Born3.x

This file was deleted.

52,374 changes: 0 additions & 52,374 deletions sample/content/_SSR06_model.x

This file was deleted.

Binary file added sample/content/texture/ene_grp1_uv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5,594 changes: 5,594 additions & 0 deletions sample/content/track.x

Large diffs are not rendered by default.

194,423 changes: 0 additions & 194,423 deletions sample/monster.x

This file was deleted.

168 changes: 168 additions & 0 deletions sample/xFileLoad_mqx.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>three.js webgl - X-File loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

<style>
body { font-family: Monospace; background-color: #000; color: #fff; margin: 0px; overflow: hidden; }

#info { color: #fff; position: absolute; top: 10px; width: 100%; text-align: center; z-index: 100; display: block; }

#info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer; }
</style>

</head>

<body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - X-File Loader test<br />
</div>
<div id="canvase3d"></div>

<!-- <script src="three.min.js"></script> -->
<script src="../three.js"></script>
<script src="lib/OrbitControls.js"></script>

<script src="../XLoader.js"></script>

<script src="lib/Detector.js"></script>
<script src="lib/stats.min.js"></script>
<!-- <script src='../../examples/js/libs/dat.gui.min.js'></script> -->
<script src='lib/dat.gui.min.js'></script>
<script>

if (!Detector.webgl) Detector.addGetWebGLMessage();
var container, stats, controls;
var camera, scene, renderer;
var clock = new THREE.Clock();
var gui = new dat.GUI();
var mixers = [];
var manager = null;
var Texloader = null;

var skeletonHelper = null;

var Models = [];

var d = new Date();
var LastDateTime = null;

var animates = [];
var actions = [];
init();

function init() {

LastDateTime = Date.now();

container = document.createElement('div');
document.body.appendChild(container);
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000);
scene = new THREE.Scene();
scene.add(new THREE.AmbientLight(0x999999));
// grid
var gridHelper = new THREE.GridHelper(14, 1, 0x303030, 0x303030);
gridHelper.position.set(0, -0.04, 0);
scene.add(gridHelper);
// stats
stats = new Stats();
container.appendChild(stats.dom);

renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x666666);
container.appendChild(renderer.domElement);

controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.target.set(0, 2, 0);
camera.position.set(2, 7, 28);
camera.up.set(0, 1, 0);

var light = new THREE.DirectionalLight(0xeeeeff, 2);
light.position.set(10, 100, 1).normalize();
scene.add(light);

light = new THREE.DirectionalLight(0xaa5555);
light.position.set(-1, -1, -1).normalize();
scene.add(light);

controls.update();
window.addEventListener('resize', onWindowResize, false);
animate();

// model load
manager = new THREE.LoadingManager();
manager.onProgress = function (item, loaded, total) {
console.log(item, loaded, total);
};
var onProgress = function (xhr) {
if (xhr.lengthComputable) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log(Math.round(percentComplete, 2) + '% downloaded');
}
};
var onError = function (xhr) {
};

Texloader = new THREE.TextureLoader();
var loader = new THREE.XLoader(manager, Texloader);

//download Model file
loader.load(['content/track.x', { zflag : false } ], function (object) {
for (var i = 0; i < object.models.length; i++) {
Models.push(object.models[i]);
Models[i].scale.x = 0.1;
Models[i].scale.y = 0.1;
Models[i].scale.z = 0.1;
scene.add(Models[i]);
if (Models[0] instanceof THREE.SkinnedMesh) {
skeletonHelper = new THREE.SkeletonHelper(Models[0]);
scene.add(skeletonHelper);
}
}
object = null;
}, onProgress, onError);

}

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
//
function animate() {

requestAnimationFrame(animate);
var nowTime = Date.now();
var dulTime = nowTime - LastDateTime;
LastDateTime = nowTime;

if (animates != null && animates.length > 0) {
for (var i = 0; i < animates.length; i++) {
animates[i].update(dulTime);
}
}

if (Models != null && Models.length > 0) {
if (skeletonHelper != null) { skeletonHelper.update(); }

}

stats.update();
render();
}
function render() {
//renderer.setFaceCulling(THREE.CullFaceFront, THREE.FrontFaceDirectionCW);
renderer.render(scene, camera);
}

</script>

</body>

</html>

0 comments on commit 453894f

Please sign in to comment.