I do this:
import * as BABYLON from 'babylonjs';
import 'babylonjs-procedural-textures';
var woodTexture = new BABYLON.WoodProceduralTexture(name + "text", 1024, scene);
And receive this: Uncaught (in promise) TypeError: babylonjs__WEBPACK_IMPORTED_MODULE_0__.WoodProceduralTexture is not a constructor
;
Why?
Try:
import * from 'babylonjs-procedural-textures';
and:
var woodTexture = new WoodProceduralTexture(name + "text", 1024, scene);
.
Not exactly, but this helped:
import { WoodProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, FireProceduralTexture, BrickProceduralTexture, RoadProceduralTexture, CloudProceduralTexture } from 'babylonjs-procedural-textures';
var woodTexture = new WoodProceduralTexture(name + "text", 1024, scene);
// other ProceduralTexture's go here
But CustomProceduralTexture
still should be used with BABYLON.
prefix and should NOT be imported from babylonjs-procedural-textures
:
var customProcText = new BABYLON.CustomProceduralTexture("customtext", "../../assets/proceduralTextures/asphalt", 1024, scene);
CustomProceduralTexture
is in the core library and not in babylonjs-procedural-textures
, that’s why in your sample you must access it through BABYLON.