How to use the babylonjs.Texture function in babylonjs

To help you get started, we’ve selected a few babylonjs examples, based on popular ways it is used in public projects.

github prateekbh / hopon / babylon / app.js View on Github external
const innerCSG = CSG.FromMesh(binInner);
const subCSG = outerCSG.subtract(innerCSG);
const mat0 = new StandardMaterial("mat0", scene);
const displayBin = subCSG.toMesh('displayBin', mat0, scene);

scene.removeMesh(bin);
scene.removeMesh(binInner);

const materialSphere1 = new StandardMaterial("texture1", scene);
const materialGround1 = new StandardMaterial("texture2", scene);
ground.receiveShadows = true;
shadowGenerator.getShadowMap().renderList.push(sphere);
shadowGenerator.getShadowMap().renderList.push(displayBin);
sphere.material = materialSphere1;
ground.material = materialGround1;
materialSphere1.diffuseTexture = new Texture("ball.png", scene);
materialGround1.diffuseTexture = new Texture("floor.jpg", scene);
materialGround1.diffuseTexture.uScale = 5.0;
materialGround1.diffuseTexture.vScale = 5.0;
sphere.position.y = 2.1;
displayBin.position.y =1;
displayBin.position.x = -0.3;
displayBin.position.z = -8;
scene.clearColor = new Color3(0.2, 0.2, 0.2);
scene.gravity = new Vector3(0, 0, 0);
scene.enablePhysics();
sphere.physicsImpostor = new PhysicsImpostor(sphere, PhysicsImpostor.SphereImpostor, { mass: 1, restitution: 0.9 }, scene);
ground.physicsImpostor = new PhysicsImpostor(ground, PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.9 }, scene);
displayBin.physicsImpostor = new PhysicsImpostor(displayBin, PhysicsImpostor.MeshImpostor, {mass: 0}, scene);
engine.runRenderLoop(function () {
	scene.render();
});
github BabylonJS / Editor / src / editor / scene / scene-icons.ts View on Github external
protected createTexture (url: string): Texture {
        const texture = new Texture(url, this.scene);
        texture.hasAlpha = true;

        this.scene.textures.pop();

        return texture;
    }
}
github prateekbh / hopon / babylon / app.js View on Github external
const subCSG = outerCSG.subtract(innerCSG);
const mat0 = new StandardMaterial("mat0", scene);
const displayBin = subCSG.toMesh('displayBin', mat0, scene);

scene.removeMesh(bin);
scene.removeMesh(binInner);

const materialSphere1 = new StandardMaterial("texture1", scene);
const materialGround1 = new StandardMaterial("texture2", scene);
ground.receiveShadows = true;
shadowGenerator.getShadowMap().renderList.push(sphere);
shadowGenerator.getShadowMap().renderList.push(displayBin);
sphere.material = materialSphere1;
ground.material = materialGround1;
materialSphere1.diffuseTexture = new Texture("ball.png", scene);
materialGround1.diffuseTexture = new Texture("floor.jpg", scene);
materialGround1.diffuseTexture.uScale = 5.0;
materialGround1.diffuseTexture.vScale = 5.0;
sphere.position.y = 2.1;
displayBin.position.y =1;
displayBin.position.x = -0.3;
displayBin.position.z = -8;
scene.clearColor = new Color3(0.2, 0.2, 0.2);
scene.gravity = new Vector3(0, 0, 0);
scene.enablePhysics();
sphere.physicsImpostor = new PhysicsImpostor(sphere, PhysicsImpostor.SphereImpostor, { mass: 1, restitution: 0.9 }, scene);
ground.physicsImpostor = new PhysicsImpostor(ground, PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.9 }, scene);
displayBin.physicsImpostor = new PhysicsImpostor(displayBin, PhysicsImpostor.MeshImpostor, {mass: 0}, scene);
engine.runRenderLoop(function () {
	scene.render();
});