allow edit.js to change between cubic and marching-cubes surface extractor on polyvox entity-items.

This commit is contained in:
Seth Alves 2015-05-30 18:33:35 -07:00
parent f955cb45b2
commit a3589788df
4 changed files with 19 additions and 4 deletions

View file

@ -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 @@
<div class="input-area">X <br><input class="coord" type='number' id="property-voxel-volume-size-x"></input></div>
<div class="input-area">Y <br><input class="coord" type='number' id="property-voxel-volume-size-y"></input></div>
<div class="input-area">Z <br><input class="coord" type='number' id="property-voxel-volume-size-z"></input></div>
</div>
<div class="label">Surface Extractor</div>
<div class="value">
<select name="SelectVoxelSurfaceStyle" id="property-voxel-surface-style">
<option value='0'>marching cubes</option>
<option value='1'>cubic</option>
<option value='2'>edged cubic</option>
</select>
</div>
</div>

View file

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

View file

@ -188,6 +188,7 @@ void RenderablePolyVoxEntityItem::getModel() {
surfaceExtractor.execute();
break;
}
case PolyVoxEntityItem::SURFACE_EDGED_CUBIC:
case PolyVoxEntityItem::SURFACE_CUBIC: {
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
(_volData, _volData->getEnclosingRegion(), &polyVoxMesh);

View file

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