|
@@ -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;
|
|
|
|
|
|
}
|