Convert to unlit rendering and fix connection update error
Lighting changes: - Disabled HemisphericLight in customEnvironment - Changed all materials from diffuse to emissive colors - Added disableLighting=true to all StandardMaterials - Updated toolbox colors, diagram entities, and spinner Bug fix: - Fixed "Cannot read properties of undefined (reading 'pickedMesh')" error - Added defensive check in DiagramObject.updateConnection() - Now validates hit array has at least 2 elements before accessing Materials now render at full brightness with unlit/flat shading. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
cf0f359921
commit
6d2049e1f6
@ -323,6 +323,9 @@ export class DiagramObject {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!hit || hit.length < 2) {
|
||||
return; // No valid intersection found, skip update
|
||||
}
|
||||
if (hit[0].pickedMesh.id === this._to) {
|
||||
hit.reverse();
|
||||
}
|
||||
|
||||
@ -192,7 +192,9 @@ export function buildMissingMaterial(name: string, scene: Scene, color: string):
|
||||
}
|
||||
const newMaterial = new StandardMaterial(name, scene);
|
||||
newMaterial.id = name;
|
||||
newMaterial.diffuseColor = Color3.FromHexString(color);
|
||||
newMaterial.emissiveColor = Color3.FromHexString(color);
|
||||
newMaterial.disableLighting = true;
|
||||
// newMaterial.diffuseColor = Color3.FromHexString(color);
|
||||
newMaterial.alpha = 1;
|
||||
return newMaterial;
|
||||
}
|
||||
@ -53,8 +53,11 @@ export class Spinner {
|
||||
const text = new DynamicTexture("spinner", {width: 1024, height: 1024}, this._scene, false);
|
||||
text.drawText("Please Wait", 250, 500, "bold 150px Segoe UI", "white", "transparent", true, true);
|
||||
spinner.rotation.z = Math.PI;
|
||||
material.diffuseTexture = text;
|
||||
material.diffuseColor.set(.5, .5, 0);
|
||||
material.emissiveTexture = text;
|
||||
material.emissiveColor.set(.5, .5, 0);
|
||||
material.disableLighting = true;
|
||||
// material.diffuseTexture = text;
|
||||
// material.diffuseColor.set(.5, .5, 0);
|
||||
const rotate = new Animation("rotate", "rotation.y", 10,
|
||||
Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);
|
||||
const keys = [];
|
||||
|
||||
@ -16,8 +16,11 @@ export async function buildColor(color: Color3, scene: Scene, parent: TransformN
|
||||
const width = .1;
|
||||
const height = .1;
|
||||
const material = new StandardMaterial("material-" + color.toHexString(), scene);
|
||||
material.emissiveColor = color;
|
||||
material.diffuseColor = color;
|
||||
material.ambientColor = color;
|
||||
material.disableLighting = true;
|
||||
// material.diffuseColor = color;
|
||||
// material.ambientColor = color;
|
||||
//material.roughness = 1;
|
||||
material.specularPower = 64;
|
||||
// material.ambientColor = color;
|
||||
|
||||
@ -33,10 +33,11 @@ export class CustomEnvironment {
|
||||
this.name = name;
|
||||
|
||||
this.scene.ambientColor = new Color3(.1, .1, .1);
|
||||
const light = new HemisphericLight("light1", new Vector3(.5, 1, 1).normalize(), this.scene);
|
||||
light.groundColor = new Color3(0, 0, 0);
|
||||
light.diffuse = new Color3(1, 1, 1);
|
||||
light.intensity = .8;
|
||||
// Light disabled for unlit rendering
|
||||
// const light = new HemisphericLight("light1", new Vector3(.5, 1, 1).normalize(), this.scene);
|
||||
// light.groundColor = new Color3(0, 0, 0);
|
||||
// light.diffuse = new Color3(1, 1, 1);
|
||||
// light.intensity = .8;
|
||||
const physics = new CustomPhysics(this.scene);
|
||||
physics
|
||||
.initializeAsync()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user