var reverseFontMap = []; var reverseWeightMap = []; // 数据整理 // ["helvetiker","optimer","gentilis","droid/droid_sans","droid/droid_serif"] for (var i in fontMap) reverseFontMap[fontMap[i]] = i; //["regular","bold"] for (var i in weightMap) reverseWeightMap[weightMap[i]] = i;
var targetRotation = 0; var targetRotationOnMouseDown = 0;
var mouseX = 0; var mouseXOnMouseDown = 0;
var windowHalfX = window.innerWidth / 2; var windowHalfY = window.innerHeight / 2;
camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); camera.position.set(0, 400, 700);
cameraTarget = new THREE.Vector3(0, 150, 0);
controls = new THREE.OrbitControls(camera)
// SCENE scene = new THREE.Scene(); // black bg scene.background = new THREE.Color(0x000000); scene.fog = new THREE.Fog(0x000000, 250, 1400);
// AxesHelper var axesHelper = new THREE.AxesHelper(500); // scene.add(axesHelper);
// LIGHTS // var dirLight = new THREE.DirectionalLight(0xffffff, 0.125); // dirLight.position.set(0, 0, 0).normalize(); // scene.add(dirLight);
// var helper = new THREE.DirectionalLightHelper(dirLight, 150); // scene.add(helper);
// 点光源 强度 颜色 pointLight = new THREE.PointLight(0xffffff, 1.5); pointLight.position.set(0, 100, 90); scene.add(pointLight); var pointLightHelper = new THREE.PointLightHelper(pointLight, 10); // scene.add(pointLightHelper);
// Get text from hash
var hash = document.location.hash.substr(1);
if (hash.length !== 0) {
var colorhash = hash.substring(0, 6); var fonthash = hash.substring(6, 7); var weighthash = hash.substring(7, 8); var bevelhash = hash.substring(8, 9); var texthash = hash.substring(10);
// "fix" side normals by removing z-component of normals for side faces // (this doesn't work well for beveled geometry as then we lose nice curvature around z-axis)
if (!bevelEnabled) {
var triangleAreaHeuristics = 0.1 * (height * size);
for (var i = 0; i < textGeo.faces.length; i++) {
var face = textGeo.faces[i];
if (face.materialIndex == 1) {
for (var j = 0; j < face.vertexNormals.length; j++) {