提交 38c5643d 编写于 作者: Z zz85

managed to get only a slight glimpse of preview working in gui

上级 45d87064
......@@ -30,10 +30,11 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
geometry.gui.parameters.depth,
geometry.gui.parameters.segmentsWidth,
geometry.gui.parameters.segmentsHeight,
geometry.gui.parameters.segmentsDepth,
geometry.gui.parameters.materials,
geometry.gui.parameters.flipped,
geometry.gui.parameters.sides
geometry.gui.parameters.segmentsDepth
// ,
// geometry.gui.parameters.materials,
// geometry.gui.parameters.flipped,
// geometry.gui.parameters.sides
].join( ', ' ) + ' )';
......
......@@ -28,8 +28,6 @@ var Code = function () {
temp = temp.firstChild.nodeValue;
temp = temp.replace("js/Three.js", "../build/Three.js");
console.log('test', temp);
var opener = window.open('','myconsole',
'width=800,height=400'
+',menubar=1'
......@@ -69,6 +67,7 @@ var Code = function () {
var _codegen = function (html) {
var string = '';
console.log(_list);
string += [
'var camera, scene, renderer;',
......@@ -118,8 +117,12 @@ var Code = function () {
if ( html ) {
string = '<!doctype html>\n<html>\n\t<body>\n\t\t<script src=\"js/Three.js\"></script>\n\t\t<script>\n' + ( '\n' + string ).replace( /\n/gi, '\n\t\t\t' ) + '\n\n\t\t</script>\n\t</body>\n</html>';
string = '<!doctype html>\n<html>\n\t<body>\
\n\t\t<style> body {background-color: #f0f0f0;} </style>\
\n\t\t<script src=\"js/Three.js\"></script>\
\n\t\t<script>\n'
+ ( '\n' + string ).replace( /\n/gi, '\n\t\t\t' ) +
'\n\n\t\t</script>\n\t</body>\n</html>';
}
return string;
......@@ -131,6 +134,16 @@ var Code = function () {
}
var _strfor = function(str) {
for (var i=1; i<arguments.length; i++) {
if (arguments[i].toFixed) {
arguments[i] = arguments[i].toFixed(2);
}
str = str.replace('{'+(i-1)+'}', arguments[i]);
}
return str;
}
// signals
signals.updated.add( function ( scene ) {
......@@ -143,7 +156,16 @@ var Code = function () {
if ( object.geometry == undefined || object.geometry.gui == undefined ) {
_list.push( 'TODO' );
if (object instanceof THREE.Camera) {
var string = '';
string += _strfor( '\n\tcamera.position.set({0},{1},{2});', object.position.x, object.position.y, object.position.z);
string += _strfor( '\n\tcamera.rotation.set({0},{1},{2});', object.rotation.x, object.rotation.y, object.rotation.z);
_list.push( string );
} else {
_list.push( 'TODO' );
}
continue;
}
......
......@@ -41,6 +41,8 @@ UI.Viewport = function () {
var _scene = new THREE.Scene();
_scene.add(_camera);
/*
var light = new THREE.AmbientLight( 0x404040 );
_scene.add( light );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册