This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Capture the first pointer down | |
// And if we start on the potato we block camera control | |
var potatoHasControl; | |
scene.onPointerDown = (evt, pickResult) => { | |
if (!pickResult.hit) { | |
return; | |
} | |
if (pickResult.pickedMesh !== potato) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Capture the first pointer down | |
// And if we start on the potato we block camera control | |
var potatoHasControl; | |
scene.onPointerDown = (evt, pickResult) => { | |
if (!pickResult.hit) { | |
return; | |
} | |
if (pickResult.pickedMesh !== potato) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an heightmap | |
var heightmap = new BABYLON.DynamicTexture("heightmap", {width:1024, height:1024}, scene); | |
heightmap.update(); | |
var context = heightmap.getContext(); | |
// Plug the heightmap in the node material | |
var textureBlocks = matCap.getTextureBlocks().filter(b => b.name === "HeightMap"); | |
if (textureBlocks && textureBlocks.length) { | |
textureBlocks[0].texture = heightmap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createScene = async function () { | |
var scene = new BABYLON.Scene(engine); | |
// Let's create our potato | |
var potato = BABYLON.MeshBuilder.CreateSphere("potato", | |
{ diameterX: 0.8, diameterY: 0.9, diameterZ: 0.8 }, | |
scene); | |
// Create a potato(ish) material | |
var matCap = await BABYLON.NodeMaterial.ParseFromSnippetAsync("WSJ3VZ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createScene = function () { | |
var scene = new BABYLON.Scene(engine); | |
// Let's create our potato | |
var potato = BABYLON.MeshBuilder.CreateSphere("potato", | |
{ diameterX: 0.8, diameterY: 0.9, diameterZ: 0.8 }, | |
scene); | |
// Environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Particle { | |
private _alpha: number | undefined; | |
private _beta: number | undefined; | |
public get alpha(): number { | |
if (this._alpha === undefined) { | |
this._alpha = Math.random() > 0.5 ? 2 : 3; | |
} | |
return this._alpha; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Particle { | |
public alpha: number; | |
public beta: number; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the material | |
var nodeMaterial = new BABYLON.NodeMaterial("node", scene, { emitComments: true }); | |
// Vertex | |
// First we need the position of the vertex | |
var positionInput = new BABYLON.InputBlock("position"); | |
positionInput.setAsAttribute("position"); | |
// Then we need to compute the world version of it using the World matrix | |
var worldInput = new BABYLON.InputBlock("world"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +deltakosh is my blockchain ID. https://onename.com/deltakosh |