Created
January 19, 2016 16:35
-
-
Save Colmea/8b6c47c46f8b4d3462a1 to your computer and use it in GitHub Desktop.
Cannot read property 'materials' of undefined
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
/// <amd-dependency path="lib/babylon" /> | |
declare var require:(moduleId:string) => any; | |
var BABYLON = require('lib/babylon'); | |
import Timber = require('app/object/Timber'); | |
class Timber3D extends BABYLON.Mesh { | |
/** | |
* 3D object instance | |
*/ | |
object: BABYLON.Mesh; | |
/** | |
* Object instance from project | |
*/ | |
objectData: Timber; | |
constructor(timber: Timber, scene: BABYLON.Scene) { | |
super(timber.id, scene); | |
this.objectData = timber; | |
var object = BABYLON.VertexData.CreateBox( | |
{ | |
width: timber.width, | |
height: timber.height, | |
depth: timber.depth, | |
} | |
); | |
object.applyToMesh(this, false); | |
this.material = new BABYLON.StandardMaterial("texture1", this.scene); | |
this.material.diffuseTexture = new BABYLON.Texture("images/textures/lamelle.jpg", this.scene); | |
this.material.specularColor = BABYLON.Color3.Black(); | |
this.material.emissiveColor = BABYLON.Color3.White(); | |
this.position = new BABYLON.Vector3(timber.position.x, timber.position.y, timber.position.z); | |
} | |
} | |
export = Timber3D; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment