reformatted tool arrangement. Added diffusetexture to label. Added exportable to object parents.

This commit is contained in:
Michael Mainguy 2024-06-17 14:17:45 -05:00
parent e0d85a6a3d
commit 4c300dc73b
4 changed files with 13 additions and 9 deletions

View File

@ -181,6 +181,7 @@ export class DiagramObject {
}
if (!this._baseTransform) {
this._baseTransform = new TransformNode("base-" + this._mesh.id, this._scene);
this._baseTransform.metadata = {exportable: true};
}
if (this._from && this._to) {
if (!this._meshRemovedObserver) {

View File

@ -1,4 +1,4 @@
import {AbstractMesh, Color3, DynamicTexture, Material, MeshBuilder, StandardMaterial} from "@babylonjs/core";
import {AbstractMesh, DynamicTexture, Material, MeshBuilder, StandardMaterial} from "@babylonjs/core";
import {DefaultScene} from "../../defaultScene";
function calculateDynamicTextureDimensions(text: string, font: string): {
@ -20,27 +20,31 @@ function calculateDynamicTextureDimensions(text: string, font: string): {
}
function createDynamicTexture(text: string, font: string, DTWidth: number, DTHeight: number): DynamicTexture {
const dynamicTexture = new DynamicTexture("DynamicTexture", {
const dynamicTexture = new DynamicTexture("text-text", {
width: DTWidth,
height: DTHeight
}, DefaultScene.Scene, false);
dynamicTexture.drawText(text, null, null, font, "#ffffff", "#000000", true);
dynamicTexture.metadata = {exportable: true};
return dynamicTexture;
}
function createMaterial(dynamicTexture: DynamicTexture): Material {
const mat = new StandardMaterial("mat", DefaultScene.Scene);
mat.diffuseColor = Color3.Black();
mat.disableLighting = true;
const mat = new StandardMaterial("text-mat", DefaultScene.Scene);
//mat.diffuseColor = Color3.Black();
mat.disableLighting = false;
mat.backFaceCulling = false;
mat.emissiveTexture = dynamicTexture;
mat.freeze();
mat.diffuseTexture = dynamicTexture;
mat.metadata = {exportable: true};
//mat.freeze();
return mat;
}
function createPlane(text: string, material: Material, planeWidth: number, height: number): AbstractMesh {
const plane = MeshBuilder.CreatePlane("text" + text, {width: planeWidth, height: height}, DefaultScene.Scene);
plane.material = material;
plane.metadata = {exportable: true};
return plane;
}

View File

@ -51,8 +51,7 @@ export async function buildColor(color: Color3, scene: Scene, parent: TransformN
}
const GRID_SIZE = 5;
const GRID_SIZE = 6;
function calculatePosition(i: number) {
return (i / GRID_SIZE) - .5 - (1 / GRID_SIZE / 2);

View File

@ -47,7 +47,7 @@ export class CustomEnvironment {
.then(() => {
const ground = this.createGround();
new PhysicsAggregate(ground, PhysicsShapeType.BOX, {mass: 0}, this.scene);
createPoints(20, 20);
//createPoints(20, 20);
this.createBackgroundAudio();
this._groundMeshObservable.notifyObservers(ground);
this.createWalls();