|
From: <ma...@us...> - 2011-12-10 10:03:17
|
Revision: 564
http://openautomation.svn.sourceforge.net/openautomation/?rev=564&view=rev
Author: mayerch
Date: 2011-12-10 10:03:11 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
Enable switching between floors
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 22:48:33 UTC (rev 563)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-10 10:03:11 UTC (rev 564)
@@ -502,6 +502,7 @@
// Init after the scene was set up
selectChange( 'showNodes' );
selectChange( 'showWallLines' );
+ selectChange( 'showFloor' );
}
function show3D( rotation, tilt )
@@ -512,9 +513,10 @@
var cx = -Math.cos(rotation) * Math.cos(tilt);
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
+ var heightOfGround = buildingProperties.floor[ showStates.showFloor ].heightOfGround;
camera.up = new THREE.Vector3( Math.cos(rotation) * Math.sin(tilt), -Math.sin(rotation) * Math.sin(tilt), Math.cos(tilt) );
- camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz );
- camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, 0) );
+ camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz + heightOfGround);
+ camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, heightOfGround) );
pointLight.position = camera.position;
// update opacity
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 22:48:33 UTC (rev 563)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-10 10:03:11 UTC (rev 564)
@@ -209,6 +209,7 @@
});
$('select').change(function(e){
showStates[ e.target.name ] = e.target.value;
+ selectChange( e.target.name );
show3D( roll, tilt );
}).each(function(){
showStates[ this.name ] = this.value; // init
@@ -237,6 +238,14 @@
});
});
break;
+
+ case 'showFloor':
+ $( buildingProperties.floor ).each( function( number ){
+ THREE.SceneUtils.traverseHierarchy( this.wallGroup, function( object ) {
+ object.visible = ( showStates['showFloor'] == number );
+ });
+ });
+ break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|