|
From: <ma...@us...> - 2011-12-16 22:44:09
|
Revision: 581
http://openautomation.svn.sourceforge.net/openautomation/?rev=581&view=rev
Author: mayerch
Date: 2011-12-16 22:44:03 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Lighting and finally add the faces in the wall holes
Modified Paths:
--------------
JSFloorPlan/trunk/index.html
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/index.html
===================================================================
--- JSFloorPlan/trunk/index.html 2011-12-16 22:43:35 UTC (rev 580)
+++ JSFloorPlan/trunk/index.html 2011-12-16 22:44:03 UTC (rev 581)
@@ -39,7 +39,24 @@
</td>
<td>
Entfernung</td><td><div style="width:150px;" height="100" id="distSlider"></div>
- </td></tr>
+ </td>
+ <td>
+ </td>
+ </tr>
+ <tr style="border: 1px black;">
+ <td>
+ Licht Richtung</td><td><div style="width:150px;" height="100" id="lightDirectionSlider"></div>
+ </td>
+ <td>
+ Licht Höhe</td><td><div style="width:150px;" height="100" id="lightHeightSlider"></div>
+ </td>
+ <td>
+ Licht Stärke</td><td><div style="width:150px;" height="100" id="lightStrengthSlider"></div>
+ </td>
+ <td>
+ Licht Entfernung</td><td><div style="width:150px;" height="100" id="lightDistanceSlider"></div>
+ </td>
+ </tr>
</table>
<hr />
<h2>Status Infos:</h2>
@@ -90,6 +107,7 @@
</td><td>
Zeige Wireframe: <input type="checkbox" name="showWireframe" />
</td><td>
+ Licht-Sicht: <input type="checkbox" name="showLightView" />
</td><td>
</td><td>
</td>
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-16 22:43:35 UTC (rev 580)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-16 22:44:03 UTC (rev 581)
@@ -313,8 +313,8 @@
var wallLength = calcLength2D( sm, em );
var fLeft = holes[h].distance / wallLength;
var fRight = (holes[h].distance + holes[h].width) / wallLength;
- if( fLeft < 0.0 ) fLeft = 0.01; //// FIXME
- if( fRight > 1.0 ) fRight = 0.99; //// FIXME
+ if( fLeft <= 0.0 ) fLeft = 0.001; //// FIXME - actually the config file is bad. Leave at least 1mm wall
+ if( fRight >= 1.0 ) fRight = 0.999; //// FIXME - actually the config file is bad. Leave at least 1mm wall
var lintel = (sh - holes[h].lintel) / sh;
var paparet = holes[h].paparet / sh;
if( 1 == lintel )
@@ -323,12 +323,9 @@
if( paparet == 0 ) continue; // FIXME: Assume paparet != 0 - otherwise it should be two walls...
- console.log( sourrounding );
sourrounding.splice( -2, 0, new poly2tri.Point(fLeft,1), new poly2tri.Point(fLeft,paparet), new poly2tri.Point(fRight,paparet), new poly2tri.Point(fRight,1) );
- console.log( sourrounding );
continue;
}
- //if( 0 == paparet ) paparet = 0.01; //// FIXME
if( 0 == paparet )
{
// not a hole, the sourrounding goes to the groud...
@@ -342,7 +339,7 @@
holesToAdd.push( [new poly2tri.Point(fLeft,paparet), new poly2tri.Point(fRight,paparet), new poly2tri.Point(fRight,lintel), new poly2tri.Point(fLeft,lintel)] );
}
} // if( floorWalls[j].holes.length )
- var swctx = new poly2tri.SweepContext( sourrounding );
+ var swctx = new poly2tri.SweepContext( sourrounding.slice(0) ); // pass a copy of sourrounding
for( var htA = 0; htA < holesToAdd.length; htA++ )
swctx.AddHole( holesToAdd[htA] );
@@ -416,10 +413,28 @@
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround )));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround+eh)));
geometry.faces.push(new THREE.Face3(s1id, s2id, mId+1) );
- geometry.faces.push(new THREE.Face3(s2id, s1id, e1id ) );
- geometry.faces.push(new THREE.Face3(e2id, s2id, e1id ) );
geometry.faces.push(new THREE.Face3(e2id, e1id, mId+3) );
- //console.log(geometry, cubeMaterial);
+
+ for( var e = 0; e < sourrounding.length; e++ )
+ {
+ var id1 = sourrounding[e ].id;
+ var id2 = sourrounding[(e+1)%sourrounding.length].id;
+ geometry.faces.push(new THREE.Face3( id1, id2 , id1 + wall1verticesLength) );
+ geometry.faces.push(new THREE.Face3( id2, id2 + wall1verticesLength, id1 + wall1verticesLength) );
+ }
+
+ // hole sides
+ for( var hta = 0; hta < holesToAdd.length; hta++ )
+ {
+ for( var e = 0; e < holesToAdd[hta].length; e++ )
+ {
+ var id1 = holesToAdd[hta][e ].id;
+ var id2 = holesToAdd[hta][(e+1)%sourrounding.length].id;
+ geometry.faces.push(new THREE.Face3( id1, id2 , id1 + wall1verticesLength) );
+ geometry.faces.push(new THREE.Face3( id2, id2 + wall1verticesLength, id1 + wall1verticesLength) );
+ }
+ }
+
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, cubeMaterial);
mesh.castShadow = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|