diff --git a/8ia8dlk7l5.js b/8ia8dlk7l5.js index 5f16280..8bf4423 100644 --- a/8ia8dlk7l5.js +++ b/8ia8dlk7l5.js @@ -1485,22 +1485,29 @@ GameLib.CustomCode.prototype.clearGrid = function() { GameLib.CustomCode.prototype.createTile = function(tileName, imageName, displace) { - var material = { - materialType : GameLib.D3.API.Material.MATERIAL_TYPE_PHONG, - componentType : GameLib.D3.API.Material.GetComponentType(GameLib.D3.API.Material.MATERIAL_TYPE_PHONG) - } - + var material = null; + var apiMaterial = {}; + if (imageName) { - material.diffuseMap = { - image : this[imageName] - }; - } - + + apiMaterial.diffuseMap = new GameLib.D3.Texture.Image( + this.graphics, + { + image : this[imageName] + } + ); + }; + if (displace) { - material.displacementMap = this.textureDisplacement; - } + apiMaterial.displacementMap = this.textureDisplacement; + } + + material = new GameLib.D3.Material.Phong( + this.graphics, + apiMaterial + ) - this[tileName] = new GameLib.D3.Mesh( + this[tileName] = new GameLib.D3.Mesh( this.graphics, { geometry : { @@ -1510,7 +1517,7 @@ GameLib.CustomCode.prototype.createTile = function(tileName, imageName, displace widthSegments : 10, heightSegments : 10 }, - scene : this.scene, + parentScene : this.scene, materials : [material] } )