JCPalmer Posted January 13, 2015 Share Posted January 13, 2015 babylon.2.0.d.ts does not have the new BABYLON.Mesh constructor signature for mesh factory code I am generating from Tower of Babel 2.0 . I am also wondering if source argument should have a default of null, instead of being optional (?) The prelim code below has the class Arial.A instanced 2 different ways. When not being cloned, Arial.A still needs to pass the source arg in the call to super. What gets passed?module Arial{ var meshLib = new Array<BABYLON.Mesh>(56); var meshCount = [0,0,0, . . . ,0]; export function meshFactory(scene : BABYLON.Scene, meshName : string, materialsRootDir : string = "./") : BABYLON.Mesh { if (typeof BABYLON.Engine.Version === "undefined" || Number(BABYLON.Engine.Version.substr(0, 4)) < 2.0) throw "Babylon version too old"; var ret:BABYLON.Mesh = null; var src:BABYLON.Mesh; switch (meshName){ case "A": src = meshLib[55]; if (src === null){ ret = new A("A", scene, materialsRootDir); meshLib[55] = ret; }else ret = new A("A", scene, materialsRootDir, src); meshCount[55] += 1; break; . . . } if (ret === null) BABYLON.Tools.Error("Mesh not found: " + meshName); return ret; } export class A extends DIALOG.Letter { constructor(name: string, scene: BABYLON.Scene, materialsRootDir: string = "./", source? : Arial.A) { super(name, scene, null, source, true); Arial.defineMaterials(scene, materialsRootDir); //embedded version check BABYLON.Tools.Log('defining mesh: ' + this.name); this.setMaterialByID("font.signMaterial"); this.id = this.name; this.billboardMode = 0; this.position.x = 0; this.position.y = 0; this.position.z = 0; this.rotation.x = 0; this.rotation.y = 0; this.rotation.z = 0; this.scaling.x = 1; this.scaling.y = 1; this.scaling.z = 1; this.isVisible = true; this.checkCollisions = false; this.receiveShadows = false; this.setVerticesData(BABYLON.VertexBuffer.PositionKind, [ 0,0,0,0.362,0.686,0,0.293,0.686,0,0.326,0.536,0,0.667,0,0,0.224,0.289,0,0.436,0.289,0,0.186,0.201,0,0.476,0.201,0,0.1,0,0,0.567,0,0 ], false); this.setVerticesData(BABYLON.VertexBuffer.NormalKind, [ 0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1 ], false); this.setIndices([ 0,1,2,0,3,1,3,4,1,0,5,3,6,4,3,0,7,5,7,6,5,7,8,6,8,4,6,0,9,7,10,4,8 ]); this.subMeshes = []; new BABYLON.SubMesh(0, 0, 11, 0, 33, this); this.computeWorldMatrix(true); } }} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 14, 2015 Share Posted January 14, 2015 File updated! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 15, 2015 Author Share Posted January 15, 2015 David: Did not get a look at the file till now. Line 3021 does not have the extra parameters for constructor cloning. Date is 12 days old. Do not think it made to repository.https://github.com/BabylonJS/Babylon.js/blob/master/babylon.2.0.d.ts Jeff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 15, 2015 Author Share Posted January 15, 2015 Working around actually compiling for now, still need to limit the constructor to not set geometry, except skeletons, when a source arg is passed. Should this also apply to?:subMeshesphysics imposterscheckCollisionsreceiveShadowsscene.createOrUpdateSelectionOctree Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 15, 2015 Share Posted January 15, 2015 I updated the repo with the right definition file Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.