|
@@ -93,7 +93,7 @@ module BABYLON.GLTF1 {
|
|
|
var parseObject = (parsedObjects: any, runtimeProperty: string, gltfRuntime: IGLTFRuntime) => {
|
|
|
for (var object in parsedObjects) {
|
|
|
var parsedObject = parsedObjects[object];
|
|
|
- gltfRuntime[runtimeProperty][object] = parsedObject;
|
|
|
+ (<any>gltfRuntime)[runtimeProperty][object] = parsedObject;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -608,10 +608,10 @@ module BABYLON.GLTF1 {
|
|
|
var vertexData = new VertexData();
|
|
|
var geometry = new Geometry(id, gltfRuntime.scene, vertexData, false, newMesh);
|
|
|
|
|
|
- var verticesStarts = [];
|
|
|
- var verticesCounts = [];
|
|
|
- var indexStarts = [];
|
|
|
- var indexCounts = [];
|
|
|
+ var verticesStarts = new Array<number>();
|
|
|
+ var verticesCounts = new Array<number>();
|
|
|
+ var indexStarts = new Array<number>();
|
|
|
+ var indexCounts = new Array<number>();
|
|
|
|
|
|
for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
|
|
var meshID = meshes[meshIndex];
|
|
@@ -828,7 +828,7 @@ module BABYLON.GLTF1 {
|
|
|
|
|
|
if (light) {
|
|
|
if (light.type === "ambient") {
|
|
|
- var ambienLight: IGLTFAmbienLight = light[light.type];
|
|
|
+ var ambienLight: IGLTFAmbienLight = (<any>light)[light.type];
|
|
|
var hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);
|
|
|
hemiLight.name = node.name;
|
|
|
|
|
@@ -839,7 +839,7 @@ module BABYLON.GLTF1 {
|
|
|
lastNode = hemiLight;
|
|
|
}
|
|
|
else if (light.type === "directional") {
|
|
|
- var directionalLight: IGLTFDirectionalLight = light[light.type];
|
|
|
+ var directionalLight: IGLTFDirectionalLight = (<any>light)[light.type];
|
|
|
var dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);
|
|
|
dirLight.name = node.name;
|
|
|
|
|
@@ -850,7 +850,7 @@ module BABYLON.GLTF1 {
|
|
|
lastNode = dirLight;
|
|
|
}
|
|
|
else if (light.type === "point") {
|
|
|
- var pointLight: IGLTFPointLight = light[light.type];
|
|
|
+ var pointLight: IGLTFPointLight = (<any>light)[light.type];
|
|
|
var ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);
|
|
|
ptLight.name = node.name;
|
|
|
|
|
@@ -861,7 +861,7 @@ module BABYLON.GLTF1 {
|
|
|
lastNode = ptLight;
|
|
|
}
|
|
|
else if (light.type === "spot") {
|
|
|
- var spotLight: IGLTFSpotLight = light[light.type];
|
|
|
+ var spotLight: IGLTFSpotLight = (<any>light)[light.type];
|
|
|
var spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);
|
|
|
spLight.name = node.name;
|
|
|
|
|
@@ -887,7 +887,7 @@ module BABYLON.GLTF1 {
|
|
|
|
|
|
if (camera) {
|
|
|
if (camera.type === "orthographic") {
|
|
|
- var orthographicCamera: IGLTFCameraOrthographic = camera[camera.type];
|
|
|
+ var orthographicCamera: IGLTFCameraOrthographic = (<any>camera)[camera.type];
|
|
|
var orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene);
|
|
|
|
|
|
orthoCamera.name = node.name;
|
|
@@ -897,7 +897,7 @@ module BABYLON.GLTF1 {
|
|
|
lastNode = orthoCamera;
|
|
|
}
|
|
|
else if (camera.type === "perspective") {
|
|
|
- var perspectiveCamera: IGLTFCameraPerspective = camera[camera.type];
|
|
|
+ var perspectiveCamera: IGLTFCameraPerspective = (<any>camera)[camera.type];
|
|
|
var persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene);
|
|
|
|
|
|
persCamera.name = node.name;
|
|
@@ -1016,7 +1016,7 @@ module BABYLON.GLTF1 {
|
|
|
/**
|
|
|
* onBind shaderrs callback to set uniforms and matrices
|
|
|
*/
|
|
|
- var onBindShaderMaterial = (mesh: Mesh, gltfRuntime: IGLTFRuntime, unTreatedUniforms: Object, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, onSuccess: (shaderMaterial: ShaderMaterial) => void) => {
|
|
|
+ var onBindShaderMaterial = (mesh: Mesh, gltfRuntime: IGLTFRuntime, unTreatedUniforms: {[key: string]: IGLTFTechniqueParameter}, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, onSuccess: (shaderMaterial: ShaderMaterial) => void) => {
|
|
|
var materialValues = material.values || technique.parameters;
|
|
|
|
|
|
for (var unif in unTreatedUniforms) {
|
|
@@ -1040,7 +1040,7 @@ module BABYLON.GLTF1 {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- var value = materialValues[technique.uniforms[unif]];
|
|
|
+ var value = (<any>materialValues)[technique.uniforms[unif]];
|
|
|
if (!value) {
|
|
|
continue;
|
|
|
}
|
|
@@ -1067,7 +1067,7 @@ module BABYLON.GLTF1 {
|
|
|
* Prepare uniforms to send the only one time
|
|
|
* Loads the appropriate textures
|
|
|
*/
|
|
|
- var prepareShaderMaterialUniforms = (gltfRuntime: IGLTFRuntime, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, unTreatedUniforms: Object) => {
|
|
|
+ var prepareShaderMaterialUniforms = (gltfRuntime: IGLTFRuntime, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, unTreatedUniforms: {[key: string]: IGLTFTechniqueParameter}) => {
|
|
|
var materialValues = material.values || technique.parameters;
|
|
|
var techniqueUniforms = technique.uniforms;
|
|
|
|
|
@@ -1077,7 +1077,7 @@ module BABYLON.GLTF1 {
|
|
|
for (var unif in unTreatedUniforms) {
|
|
|
var uniform: IGLTFTechniqueParameter = unTreatedUniforms[unif];
|
|
|
var type = uniform.type;
|
|
|
- var value = materialValues[techniqueUniforms[unif]];
|
|
|
+ var value = (<any>materialValues)[techniqueUniforms[unif]];
|
|
|
|
|
|
if (value === undefined) {
|
|
|
// In case the value is the same for all materials
|
|
@@ -1125,7 +1125,7 @@ module BABYLON.GLTF1 {
|
|
|
/**
|
|
|
* Shader compilation success
|
|
|
*/
|
|
|
- var onShaderCompileSuccess = (gltfRuntime: IGLTFRuntime, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, unTreatedUniforms: Object, onSuccess: (shaderMaterial: ShaderMaterial) => void) => {
|
|
|
+ var onShaderCompileSuccess = (gltfRuntime: IGLTFRuntime, shaderMaterial: ShaderMaterial, technique: IGLTFTechnique, material: IGLTFMaterial, unTreatedUniforms: {[key: string]: IGLTFTechniqueParameter}, onSuccess: (shaderMaterial: ShaderMaterial) => void) => {
|
|
|
return (_: Effect) => {
|
|
|
prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);
|
|
|
|
|
@@ -1138,7 +1138,7 @@ module BABYLON.GLTF1 {
|
|
|
/**
|
|
|
* Returns the appropriate uniform if already handled by babylon
|
|
|
*/
|
|
|
- var parseShaderUniforms = (tokenizer: Tokenizer, technique: IGLTFTechnique, unTreatedUniforms: Object): string => {
|
|
|
+ var parseShaderUniforms = (tokenizer: Tokenizer, technique: IGLTFTechnique, unTreatedUniforms: {[key: string]: IGLTFTechniqueParameter}): string => {
|
|
|
for (var unif in technique.uniforms) {
|
|
|
var uniform = technique.uniforms[unif];
|
|
|
var uniformParameter: IGLTFTechniqueParameter = technique.parameters[uniform];
|
|
@@ -1399,7 +1399,7 @@ module BABYLON.GLTF1 {
|
|
|
var vertexTokenizer = new Tokenizer(vertexShader);
|
|
|
var pixelTokenizer = new Tokenizer(pixelShader);
|
|
|
|
|
|
- var unTreatedUniforms: Object = {};
|
|
|
+ var unTreatedUniforms: {[key: string]: IGLTFTechniqueParameter} = {};
|
|
|
var uniforms = [];
|
|
|
var attributes = [];
|
|
|
var samplers = [];
|
|
@@ -1569,8 +1569,8 @@ module BABYLON.GLTF1 {
|
|
|
// Create nodes
|
|
|
this._createNodes(gltfRuntime);
|
|
|
|
|
|
- var meshes = [];
|
|
|
- var skeletons = [];
|
|
|
+ var meshes = new Array<AbstractMesh>();
|
|
|
+ var skeletons = new Array<Skeleton>();
|
|
|
|
|
|
// Fill arrays of meshes and skeletons
|
|
|
for (var nde in gltfRuntime.nodes) {
|