From a3589788df19ed31245605b36b0afd978bc0fd90 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 30 May 2015 18:33:35 -0700 Subject: [PATCH] allow edit.js to change between cubic and marching-cubes surface extractor on polyvox entity-items. --- examples/html/entityProperties.html | 12 ++++++++++++ examples/libraries/entityPropertyDialogBox.js | 7 ++++--- .../src/RenderablePolyVoxEntityItem.cpp | 1 + libraries/entities/src/PolyVoxEntityItem.h | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 6b1fc113d4..21e2e83136 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -358,6 +358,7 @@ var elVoxelVolumeSizeX = document.getElementById("property-voxel-volume-size-x"); var elVoxelVolumeSizeY = document.getElementById("property-voxel-volume-size-y"); var elVoxelVolumeSizeZ = document.getElementById("property-voxel-volume-size-z"); + var elVoxelSurfaceStyle = document.getElementById("property-voxel-surface-style"); if (window.EventBridge !== undefined) { @@ -597,6 +598,7 @@ elVoxelVolumeSizeX.value = properties.voxelVolumeSize.x.toFixed(2); elVoxelVolumeSizeY.value = properties.voxelVolumeSize.y.toFixed(2); elVoxelVolumeSizeZ.value = properties.voxelVolumeSize.z.toFixed(2); + elVoxelSurfaceStyle.value = properties.voxelSurfaceStyle; } if (selected) { @@ -846,6 +848,7 @@ elVoxelVolumeSizeX.addEventListener('change', voxelVolumeSizeChangeFunction); elVoxelVolumeSizeY.addEventListener('change', voxelVolumeSizeChangeFunction); elVoxelVolumeSizeZ.addEventListener('change', voxelVolumeSizeChangeFunction); + elVoxelSurfaceStyle.addEventListener('change', createEmitTextPropertyUpdateFunction('voxelSurfaceStyle')); elMoveSelectionToGrid.addEventListener("click", function() { @@ -994,6 +997,15 @@
X
Y
Z
+ + +
Surface Extractor
+
+
diff --git a/examples/libraries/entityPropertyDialogBox.js b/examples/libraries/entityPropertyDialogBox.js index 567b6e3024..1b1a6a9c12 100644 --- a/examples/libraries/entityPropertyDialogBox.js +++ b/examples/libraries/entityPropertyDialogBox.js @@ -99,9 +99,6 @@ EntityPropertyDialogBox = (function () { } if (properties.type == "PolyVox") { - array.push({ label: "Shape Type:", value: properties.shapeType }); - index++; - array.push({ label: "Voxel Space Size:", type: "header" }); index++; @@ -111,6 +108,9 @@ EntityPropertyDialogBox = (function () { index++; array.push({ label: "Z:", value: properties.voxelVolumeSize.z.toFixed(decimals) }); index++; + + array.push({ label: "Surface Extractor", value: properties.voxelSurfaceStyle }); + index++; } array.push({ label: "Position:", type: "header" }); @@ -355,6 +355,7 @@ EntityPropertyDialogBox = (function () { properties.voxelVolumeSize.x = array[index++].value; properties.voxelVolumeSize.y = array[index++].value; properties.voxelVolumeSize.z = array[index++].value; + properties.voxelSurfaceStyle = array[index++].value; } index++; // skip header diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index 389a5eac4f..97484f246f 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -188,6 +188,7 @@ void RenderablePolyVoxEntityItem::getModel() { surfaceExtractor.execute(); break; } + case PolyVoxEntityItem::SURFACE_EDGED_CUBIC: case PolyVoxEntityItem::SURFACE_CUBIC: { PolyVox::CubicSurfaceExtractorWithNormals> surfaceExtractor (_volData, _volData->getEnclosingRegion(), &polyVoxMesh); diff --git a/libraries/entities/src/PolyVoxEntityItem.h b/libraries/entities/src/PolyVoxEntityItem.h index 467d41f3e1..530f073237 100644 --- a/libraries/entities/src/PolyVoxEntityItem.h +++ b/libraries/entities/src/PolyVoxEntityItem.h @@ -57,7 +57,8 @@ class PolyVoxEntityItem : public EntityItem { enum PolyVoxSurfaceStyle { SURFACE_MARCHING_CUBES, - SURFACE_CUBIC + SURFACE_CUBIC, + SURFACE_EDGED_CUBIC }; virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) { _voxelSurfaceStyle = voxelSurfaceStyle; }