Skip to content

Commit

Permalink
Simplify fixture gen: no presets and panels but hierarchical select opts
Browse files Browse the repository at this point in the history
app.js
- set opacity fixed to 100
- headerbytes from 5 to 4
- also show black pixels

LedModFixture
- headerbytes from 5 to 4

LedModFixtureGen
- ledSize default to 5
- remove opacity
- rename cloud to cloud4516
- rename fixtureGen to fixtureVar
- fixtureVar: 3 level recursive options tree
- remove panels checkbox (default fixTbl)
- fixtureVarChFun: call ui->findOptionsText
- pnlTbl ->fixTbl, pnlFirst->fixFirst
- remove fixPreset (move to options and fixtureVarChFun)
- getPanels->getFixtures
- compare on option texts instead of option values
  • Loading branch information
ewoudwijma committed May 9, 2024
1 parent 444d314 commit 1c4cb3b
Show file tree
Hide file tree
Showing 5 changed files with 1,585 additions and 1,658 deletions.
20 changes: 11 additions & 9 deletions data/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ function preview3D(canvasNode, buffer) {
led.push(0);
if (led.length <= 2) //1D and 2D: maak 3D
led.push(0);
let geometry;
// ppf("size and shape", jsonValues.pview.ledSize, jsonValues.pview.shape, jsonValues.pview.opacity);
if (!jsonValues.pview.ledSize) jsonValues.pview.ledSize = 7;
if (!jsonValues.pview.opacity) jsonValues.pview.opacity = 100;

// ppf("size and shape", jsonValues.pview.ledSize, jsonValues.pview.shape);
if (!jsonValues.pview.ledSize) jsonValues.pview.ledSize = 7;

let geometry;
if (jsonValues.pview.shape == 1)
geometry = new THREE.TetrahedronGeometry(jsonValues.pview.ledSize / 30); //was 1/factor
else // default
geometry = new THREE.SphereGeometry(jsonValues.pview.ledSize / 30); //was 1/factor
const material = new THREE.MeshBasicMaterial({transparent: true, opacity: jsonValues.pview.opacity / 100});
const material = new THREE.MeshBasicMaterial({transparent: true, opacity: 1.0});
// material.color = new THREE.Color(`${x/mW}`, `${y/mH}`, `${z/mD}`);
const mesh = new THREE.Mesh( geometry, material );
mesh.position.set(offset_x + d*led[0]/factor, -offset_y - d*led[1]/factor, - offset_z - d*led[2]/factor);
Expand Down Expand Up @@ -268,17 +268,19 @@ function preview3D(canvasNode, buffer) {
}

//light up the cube
let firstLed = 5;
let headerBytes = 4;
var i = 0;
if (jsonValues.pview.outputs) {
// console.log("preview3D jsonValues", jsonValues.pview);
for (var output of jsonValues.pview.outputs) {
if (output.leds) {
for (var led of output.leds) {
if (i < scene.children.length) {
scene.children[i].visible = buffer[i*3 + firstLed] + buffer[i*3 + firstLed + 1] + buffer[i*3 + firstLed+2] > 10; //do not show blacks
if (scene.children[i].visible)
scene.children[i].material.color = new THREE.Color(`${buffer[i*3 + firstLed]/255}`, `${buffer[i*3 + firstLed + 1]/255}`, `${buffer[i*3 + firstLed + 2]/255}`);
// scene.children[i].visible = buffer[headerBytes + i*3] + buffer[headerBytes + i*3 + 1] + buffer[headerBytes + i*3 + 2] > 10; //do not show blacks
// if (scene.children[i].visible) {
scene.children[i].material.color = new THREE.Color(`${buffer[headerBytes + i*3]/255}`, `${buffer[headerBytes + i*3 + 1]/255}`, `${buffer[headerBytes + i*3 + 2]/255}`);
// scene.children[i].geometry.setAtttribute("radius", buffer[4] / 30);
// }
}
i++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/App/LedFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void Fixture::projectAndMap() {
}
}); //starJson.lookFor("leds" (create the right type, otherwise crash)

if (starJson.deserialize(false)) { //this will call above function parameter for each led
if (starJson.deserialize()) { //this will call above function parameter for each led

//after processing each led
stackUnsigned8 rowNr = 0;
Expand Down
19 changes: 11 additions & 8 deletions src/App/LedModFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ class LedModFixture:public SysModule {

buffer = wsBuf->get();

// send leds preview to clients
for (size_t i = 0; i < eff->fixture.nrOfLeds; i++)
{
buffer[i*3+5] = eff->fixture.ledsP[i].red;
buffer[i*3+5+1] = eff->fixture.ledsP[i].green;
buffer[i*3+5+2] = eff->fixture.ledsP[i].blue;
}
#define headerBytes 4

//new values
buffer[0] = 1; //userFun id
//rotations
Expand All @@ -98,7 +93,15 @@ class LedModFixture:public SysModule {
buffer[3] = eff->fixture.head.z;
}

}, eff->fixture.nrOfLeds * 3 + 5, true);
// send leds preview to clients
for (size_t i = 0; i < eff->fixture.nrOfLeds; i++)
{
buffer[headerBytes + i*3] = eff->fixture.ledsP[i].red;
buffer[headerBytes + i*3+1] = eff->fixture.ledsP[i].green;
buffer[headerBytes + i*3+2] = eff->fixture.ledsP[i].blue;
}

}, headerBytes + eff->fixture.nrOfLeds * 3, true);
return true;
}
default: return false;
Expand Down
Loading

0 comments on commit 1c4cb3b

Please sign in to comment.