Skip to content

Instantly share code, notes, and snippets.

@Colmea
Created January 21, 2016 08:20
Show Gist options
  • Save Colmea/c842a89c34ffed1a8288 to your computer and use it in GitHub Desktop.
Save Colmea/c842a89c34ffed1a8288 to your computer and use it in GitHub Desktop.
/// <reference path="../../../../typings/babylonjs/babylon.d.ts" />
/// <amd-dependency path="app/../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);
console.log('babylon timber', BABYLON);
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", scene);
this.material.diffuseTexture = new BABYLON.Texture("images/textures/lamelle.jpg", 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