实验目的是实现混合纹理以及用键盘控制纹理切换
运行效果:
代码:
<!--
Project Name: 实验6-???-???
Author: ???
Student ID: ???
Description: 实验6的WebGL版
Date: 2017.12.09
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>实验6</title>
<script src="js/three.min.js"></script>
<script src="js/OBJLoader.js"></script>
<script src="js/DDSLoader.js"></script>
<script src="js/MTLLoader.js"></script>
<script src="js/OBJMTLLoader.js"></script>
<script src="js/Detector.js"></script>
<script src="js/stats.min.js"></script>
<style type="text/css">
div#canvas-frame {
border: none;
cursor: pointer;
width: 100%;
height: 600px;
background-color: #EEEEEE;
}
</style>
<script>
var renderer;
var mouseX=0,mouseY=0;
var windowHalfX=window.innerWidth/2;
var windowHalfY=window.innerHeight/2;
var isTextureChanged=false;//是否改变桌面纹理
var legDist=45;//桌腿之间的距离
//初始化Three绘制canvas
function initThree(){
width=document.getElementById('canvas-frame').clientWidth;
height=document.getElementById('canvas-frame