-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
3,945 additions
and
273 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<!-- | ||
Author: Kovacs Viktor | ||
Homepage: http://www.kovacsv.hu | ||
--> | ||
|
||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
"http://www.w3.org/TR/html4/strict.dtd"> | ||
|
||
<html> | ||
|
||
<head> | ||
|
||
<meta http-equiv="content-type" content="text/html;charset=utf-8"> | ||
<script type="text/javascript" src="../src/core/jsm.js"></script> | ||
<script type="text/javascript" src="../src/geometry/determinant.js"></script> | ||
<script type="text/javascript" src="../src/geometry/matrix.js"></script> | ||
<script type="text/javascript" src="../src/geometry/coord.js"></script> | ||
<script type="text/javascript" src="../src/geometry/coordutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/coordsystem.js"></script> | ||
<script type="text/javascript" src="../src/geometry/coordsystemutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/sector.js"></script> | ||
<script type="text/javascript" src="../src/geometry/sectorutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/line.js"></script> | ||
<script type="text/javascript" src="../src/geometry/lineutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/transformation.js"></script> | ||
<script type="text/javascript" src="../src/geometry/transformationutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/polygon.js"></script> | ||
<script type="text/javascript" src="../src/geometry/polygonutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/plane.js"></script> | ||
<script type="text/javascript" src="../src/geometry/planeutils.js"></script> | ||
<script type="text/javascript" src="../src/geometry/projection.js"></script> | ||
<script type="text/javascript" src="../src/geometry/convexhull.js"></script> | ||
<script type="text/javascript" src="../src/modeler/camera.js"></script> | ||
<script type="text/javascript" src="../src/modeler/body.js"></script> | ||
<script type="text/javascript" src="../src/modeler/bodyutils.js"></script> | ||
<script type="text/javascript" src="../src/modeler/adjacencylist.js"></script> | ||
<script type="text/javascript" src="../src/modeler/cututils.js"></script> | ||
<script type="text/javascript" src="../src/modeler/textureutils.js"></script> | ||
<script type="text/javascript" src="../src/modeler/model.js"></script> | ||
<script type="text/javascript" src="../src/modeler/material.js"></script> | ||
<script type="text/javascript" src="../src/modeler/generator.js"></script> | ||
<script type="text/javascript" src="../src/modeler/solidgenerator.js"></script> | ||
<script type="text/javascript" src="../src/modeler/svgtomodel.js"></script> | ||
<script type="text/javascript" src="../src/modeler/exporter.js"></script> | ||
<script type="text/javascript" src="../build/three.min.js"></script> | ||
<script type="text/javascript" src="../src/viewer/converter.js"></script> | ||
<script type="text/javascript" src="../src/viewer/mouse.js"></script> | ||
<script type="text/javascript" src="../src/viewer/touch.js"></script> | ||
<script type="text/javascript" src="../src/viewer/viewer.js"></script> | ||
<title>Example</title> | ||
|
||
<script type="text/javascript"> | ||
var viewer = null; | ||
|
||
function GenerateChart () | ||
{ | ||
function GetMaximumCount (chart) | ||
{ | ||
var max = 0; | ||
var i, j, current; | ||
for (i = 0; i < chart.values.length; i++) { | ||
current = chart.values[i]; | ||
if (current.length > max) { | ||
max = current.length; | ||
} | ||
} | ||
return max; | ||
} | ||
|
||
function GenerateBoundingBody (model, materials, chart) | ||
{ | ||
var rowCount = GetMaximumCount (chart); | ||
var columnCount = chart.values.length; | ||
var xSize = rowCount * chart.itemSize + (rowCount - 1) * chart.itemOffsetX + 2 * chart.itemSize; | ||
var ySize = columnCount * chart.itemSize + (columnCount - 1) * chart.itemOffsetY + 2 * chart.itemSize; | ||
var offsetX = xSize / 2.0 - 3.0 * chart.itemSize / 2.0; | ||
var offsetY = ySize / 2.0 - 3.0 * chart.itemSize / 2.0; | ||
var bottom = JSM.GenerateRectangle (xSize, ySize); | ||
bottom.Transform (new JSM.TranslationTransformation (new JSM.Vector (offsetX, offsetY, 0.0))); | ||
bottom.SetPolygonsMaterialIndex (0); | ||
model.AddBody (bottom); | ||
} | ||
|
||
function GenerateOneValueBody (model, materials, chart, i, j) | ||
{ | ||
var height = chart.values[i][j]; | ||
var offsetX = j * (chart.itemSize + chart.itemOffsetX); | ||
var offsetY = i * (chart.itemSize + chart.itemOffsetY); | ||
var body = JSM.GenerateCuboidSides (chart.itemSize, chart.itemSize, height, [1, 1, 1, 1, 0, 1]); | ||
body.Transform (new JSM.TranslationTransformation (new JSM.Vector (offsetX, offsetY, height / 2.0))); | ||
var material = 1 + (i % (materials.Count () - 1)); | ||
body.SetPolygonsMaterialIndex (material); | ||
model.AddBody (body); | ||
} | ||
|
||
function GenerateValueBodies (model, materials, chart) | ||
{ | ||
var i, j; | ||
for (i = 0; i < chart.values.length; i++) { | ||
for (j = 0; j < chart.values[i].length; j++) { | ||
GenerateOneValueBody (model, materials, chart, i, j); | ||
} | ||
} | ||
} | ||
|
||
var chart = { | ||
values : [ | ||
[2, 4, 3, 5, 1, 4, 2], | ||
[1, 5, 3, 4], | ||
[3, 1, 2, 5, 1, 3] | ||
], | ||
itemSize : 1.0, | ||
itemOffsetX : 0.5, | ||
itemOffsetY : 0.5, | ||
}; | ||
|
||
var model = new JSM.Model (); | ||
var materials = new JSM.Materials (); | ||
materials.AddMaterial (new JSM.Material (0xf0f0f0, 0xf0f0f0)); | ||
materials.AddMaterial (new JSM.Material (0x008ab8, 0x008ab8)); | ||
materials.AddMaterial (new JSM.Material (0x279b61, 0x279b61)); | ||
materials.AddMaterial (new JSM.Material (0x993333, 0x993333)); | ||
materials.AddMaterial (new JSM.Material (0xffcc33, 0xffcc33)); | ||
materials.AddMaterial (new JSM.Material (0x95cae4, 0x95cae4)); | ||
materials.AddMaterial (new JSM.Material (0xa3e496, 0xa3e496)); | ||
materials.AddMaterial (new JSM.Material (0xcc3333, 0xcc3333)); | ||
materials.AddMaterial (new JSM.Material (0xffff7a, 0xffff7a)); | ||
|
||
GenerateBoundingBody (model, materials, chart); | ||
GenerateValueBodies (model, materials, chart); | ||
|
||
return [model, materials]; | ||
} | ||
|
||
function Load () | ||
{ | ||
var TextureLoaded = function () { | ||
viewer.Draw (); | ||
}; | ||
|
||
var viewerSettings = { | ||
cameraEyePosition : [3.0, -2.0, 1.0], | ||
cameraCenterPosition : [0.0, 0.0, 0.0], | ||
cameraUpVector : [0, 0, 1], | ||
cameraDisableZoom : true | ||
}; | ||
|
||
viewer = new JSM.Viewer (); | ||
viewer.Start ('example', viewerSettings); | ||
|
||
var model = GenerateChart (); | ||
var conversionData = new JSM.ConversionData (null, true, true); | ||
var meshes = JSM.ConvertModelToThreeMeshes (model[0], model[1], conversionData); | ||
for (var i = 0; i < meshes.length; i++) { | ||
viewer.AddMesh (meshes[i]); | ||
} | ||
|
||
viewer.FitInWindow (); | ||
viewer.Draw (); | ||
} | ||
|
||
window.onload = function () | ||
{ | ||
Load (); | ||
} | ||
</script> | ||
|
||
</head> | ||
|
||
<body> | ||
<canvas id="example" width="1000" height="500"></canvas> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.