Skip to content

Commit

Permalink
Update 4.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
nimadez committed Sep 26, 2024
1 parent 01562d6 commit ff8851d
Show file tree
Hide file tree
Showing 14 changed files with 552 additions and 569 deletions.
Binary file modified media/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voxel-builder",
"version": "4.4.8",
"version": "4.4.9",
"description": "Voxel-based 3D modeling application",
"main": "electron.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ws-connect.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#
# Websockets Server
# This script can be used to connect with or train machine learning models
#
# $ python3 ws-connect.py


Expand Down
Binary file added src/assets/overcast_soil_puresky_1k.hdr
Binary file not shown.
Binary file removed src/assets/snow_field_2_puresky_1k.hdr
Binary file not shown.
2 changes: 1 addition & 1 deletion src/assets/tex_checker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/examples/model_menger.json

Large diffs are not rendered by default.

233 changes: 132 additions & 101 deletions src/index.html

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/modules/babylon.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ export function Vector3Distance(min, max) {
return BABYLON.Vector3.Distance(min, max);
}

export function Vector3Minimize(left, right) {
return BABYLON.Vector3.Minimize(left, right);
}

export function Vector3Maximize(left, right) {
return BABYLON.Vector3.Maximize(left, right);
}

export function Vector3TransformCoordinates(p, m) {
return BABYLON.Vector3.TransformCoordinates(p, m);
}
Expand Down Expand Up @@ -118,6 +126,10 @@ export function CreatePlane(name, size, side, scene) {
return BABYLON.MeshBuilder.CreatePlane(name, { size: size, sideOrientation: side, updatable: false }, scene);
}

export function CreateDisc(name, radius, tessellation, side, scene) {
return BABYLON.MeshBuilder.CreateDisc(name, { radius: radius, tessellation: tessellation, sideOrientation: side }, scene);
}

export function CreateSphere(name, diameter, segments, side, scene) {
return BABYLON.MeshBuilder.CreateSphere(name, { diameter: diameter, segments: segments, sideOrientation: side }, scene);
}
Expand Down
825 changes: 382 additions & 443 deletions src/modules/core.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/modules/generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SimplexNoise } from '../../libs/addons/SimplexNoise.js';
import { Vector3 } from '../babylon.js';

import {
ui, builder, xformer, project,
ui, builder, xformer, project, memory,
hexToRgbFloat, rgbFloatToHex,
COL_ICE
} from '../core.js';
Expand All @@ -35,7 +35,7 @@ class Generator {
if (str.length == 3 && parseInt(str[0]) !== NaN && parseInt(str[1]) !== NaN && parseInt(str[2]) !== NaN) {
builder.add(Vector3(parseInt(str[0]), parseInt(str[1]), parseInt(str[2])), currentColor, true);
builder.create();
builder.update();
memory.record();
} else {
ui.notification("invalid coord (e.g. 20,20,20)");
}
Expand Down Expand Up @@ -82,7 +82,7 @@ class Generator {
}

if (isNewScene) {
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
} else {
xformer.beginNewObject(data);
Expand Down Expand Up @@ -111,7 +111,7 @@ class Generator {
}

if (isNewScene) {
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
} else {
xformer.beginNewObject(data);
Expand Down Expand Up @@ -158,7 +158,7 @@ class Generator {
}

if (isNewScene) {
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
} else {
xformer.beginNewObject(data);
Expand Down Expand Up @@ -204,7 +204,7 @@ class Generator {
}

if (isNewScene) {
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
} else {
xformer.beginNewObject(data, (isHeightGrad) ? true : false);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/raycaster/voxelizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Voxelizer {
pool.normalizeMesh(mesh, scale);

const data = rcv.mesh_voxel(mesh, COL_ICE);
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
ui.showProgress(0);
}
Expand All @@ -45,7 +45,7 @@ class Voxelizer {
const data = rcv.mesh_bake(pool.selected);

ui.setMode(0); // important: after data
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
ui.showProgress(0);
} else {
Expand All @@ -64,7 +64,7 @@ class Voxelizer {
mesh.dispose();

ui.setMode(0);
builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
project.clearScene();
ui.showProgress(0);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ class Voxelizer {
}
}

builder.setDataFromArray(data);
builder.createVoxelsFromArray(data);
builder.normalizeVoxelPositions(false);
project.clearScene();
ui.showProgress(0);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/sandbox/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ui, camera, hdri, light, builder } from '../core.js';
const TILE = 1;
const DPR_FAST = 0.6;
const CAM_FAR = 1000;
const TEX_CHECKER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAArBJREFUeF7t3UGKwkAUhOEXBMHoQlBw5f0P5UpBBHEpCoLM0Imjzhnq8wavbTr1V1Un3fF4/Cm/2BXoDofDz/1+j12ANnjXdZHzz+fzGjbA8/ms1WoVtQht5tvtNsy8Xq9rOp1Gzb/b7coGsAGcAE4AjwCPABqABiACiUAUkIQBKAAGwkA+ACOIEcQJ5ASyglnBsgBZgDAoiQILBsJAGAgDYSAMhIEwEAbCQBgIA2EgDExaAaVQpVCtYLVwtXD3AtwLcDHExRA3g9wMcjXM1bAkCiwYCANhIAyEgTAQBsJAGAgDYSAMhIEwMGgFtIK1grWCtYK1grWCtYK1grW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YCANhIAyEgTAQBsJAGAgDYSAMhIEwMOgEpIKlgqWCpYInqeD1eh10AY6lThsgrfjD4fC9AZ7PZ1kul2lnEF3v/X4vq9Vq/HawBsjrhX8NUMtPw8Ba8/V6Hf75ruviOuByuXwfAbX63W4XdQj11ps2wHw+j6r/dDppAA3woQA3QFfcAB4BHgFJJ0AD0ABE4G8iiAagAWAgDDQHSNJA5gAGQQZBBkEGQX9egEGQQVCSBCg0AA1AA9AANAANUBNBJoEmgSaBJoEmgUkYgAJQAApAASgABaCAMRZuFGwUnKQBjYJlAmUCZQJlAr+rYTQADUADJJ0ADUAD0AA0AA0wvCCCHWwQxA5mB7ODk0QwO5gdzA5mB7OD2cEogB0MA+UBvCaOGcQMSqJAgRBmEDOIGcQMYgYxgz4viyYCiUAiMOkEiEAikAgkAolAIpAIFAmzG+iTMZZDfTPIN4OSKLDAQBgIA2EgDISBMBAGwkAYCANhYDgGRjHgp9iKgvWXlgWoNdfa2ykFJDZAes2z2az8AHQh6tsoo9tQAAAAAElFTkSuQmCC";


class Sandbox {
Expand Down Expand Up @@ -287,7 +287,7 @@ class Sandbox {
if (ui.domRenderHdriBackground.checked) {
this.scene.background = this.scene.environment;
this.scene.background.mapping = THREE.EquirectangularReflectionMapping;
this.scene.backgroundIntensity = 1.0;
this.scene.backgroundIntensity = 0.8;
this.scene.backgroundBlurriness = ui.domRenderHdriBlur.value;
} else {
this.scene.background = null;
Expand Down Expand Up @@ -415,8 +415,8 @@ class Sandbox {
ui.domMenuInScreenRender.children[0].firstChild.innerHTML = 'stop';
} else {
renderer.setClearColor(0x000000, 0);
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
//renderer.toneMapping = THREE.ACESFilmicToneMapping;
//renderer.toneMappingExposure = 0.8;
renderer.shadowMap.type = THREE.PCFShadowMap;
renderer.domElement.style.pointerEvents = 'unset';

Expand Down
15 changes: 8 additions & 7 deletions src/modules/websockets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MODE, preferences, ui, builder } from '../core.js';

class WebsocketClient {
constructor() {
this.domConnect = document.getElementById('ws_connect');
this.ws = undefined;
this.retryDelay = 2000;
this.maxRetry = 10;
Expand All @@ -33,8 +34,8 @@ class WebsocketClient {

this.ws.onopen = () => {
clearInterval(this.interval);
ui.domWebSocketStatus.innerHTML = 'Connected';
ui.domWebSocketStatus.style.color = 'limegreen';
this.domConnect.innerHTML = 'Connected';
this.domConnect.style.color = 'limegreen';
this.retry = 0;
this.sendMessage('Initialized.', 'init');
};
Expand All @@ -56,7 +57,7 @@ class WebsocketClient {
}

if (this.parsed.is_clear) {
builder.setDataFromArray(this.data);
builder.createVoxelsFromArray(this.data);
} else {
builder.add(
this.data[0].position,
Expand All @@ -82,8 +83,8 @@ class WebsocketClient {
this.interval = setInterval(() => {
if (this.retry < this.maxRetry) {
this.retry++;
ui.domWebSocketStatus.innerHTML = `Retry ${this.retry}/${this.maxRetry} ...`;
ui.domWebSocketStatus.style.color = 'slategray';
this.domConnect.innerHTML = `Retry ${this.retry}/${this.maxRetry} ...`;
this.domConnect.style.color = 'slategray';
this.connect();
} else {
this.disconnect();
Expand All @@ -103,8 +104,8 @@ class WebsocketClient {
if (this.ws && this.ws.readyState === WebSocket.OPEN)
this.ws.close();
this.ws = undefined;
ui.domWebSocketStatus.innerHTML = 'Disconnect';
ui.domWebSocketStatus.style.color = 'indianred';
this.domConnect.innerHTML = 'Connect';
this.domConnect.style.color = 'indianred';
}
}

Expand Down

0 comments on commit ff8851d

Please sign in to comment.