|
@@ -12864,6 +12864,71 @@ var BABYLON;
|
|
AbstractMesh.prototype.getVerticesData = function (kind) {
|
|
AbstractMesh.prototype.getVerticesData = function (kind) {
|
|
return null;
|
|
return null;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Sets the vertex data of the mesh geometry for the requested `kind`.
|
|
|
|
+ * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
|
|
|
|
+ * The `data` are either a numeric array either a Float32Array.
|
|
|
|
+ * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
|
|
|
|
+ * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
|
|
|
|
+ * Note that a new underlying VertexBuffer object is created each call.
|
|
|
|
+ * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
|
|
|
|
+ *
|
|
|
|
+ * Possible `kind` values :
|
|
|
|
+ * - BABYLON.VertexBuffer.PositionKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UVKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV2Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV3Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV4Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV5Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV6Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.ColorKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
|
|
+ *
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ AbstractMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Updates the existing vertex data of the mesh geometry for the requested `kind`.
|
|
|
|
+ * If the mesh has no geometry, it is simply returned as it is.
|
|
|
|
+ * The `data` are either a numeric array either a Float32Array.
|
|
|
|
+ * No new underlying VertexBuffer object is created.
|
|
|
|
+ * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
|
|
|
|
+ * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
|
|
|
|
+ *
|
|
|
|
+ * Possible `kind` values :
|
|
|
|
+ * - BABYLON.VertexBuffer.PositionKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UVKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV2Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV3Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV4Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV5Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV6Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.ColorKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
|
|
+ *
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ AbstractMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Sets the mesh indices.
|
|
|
|
+ * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
|
|
|
|
+ * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
|
|
|
|
+ * This method creates a new index buffer each call.
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ AbstractMesh.prototype.setIndices = function (indices, totalVertices) {
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
/** Returns false by default, used by the class Mesh.
|
|
/** Returns false by default, used by the class Mesh.
|
|
* Returns a boolean
|
|
* Returns a boolean
|
|
*/
|
|
*/
|
|
@@ -14215,6 +14280,23 @@ var BABYLON;
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Creates new normals data for the mesh.
|
|
|
|
+ * @param updatable.
|
|
|
|
+ */
|
|
|
|
+ AbstractMesh.prototype.createNormals = function (updatable) {
|
|
|
|
+ var positions = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
|
|
+ var indices = this.getIndices();
|
|
|
|
+ var normals;
|
|
|
|
+ if (this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
|
|
+ normals = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ normals = [];
|
|
|
|
+ }
|
|
|
|
+ BABYLON.VertexData.ComputeNormals(positions, indices, normals);
|
|
|
|
+ this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
|
|
|
|
+ };
|
|
return AbstractMesh;
|
|
return AbstractMesh;
|
|
}(BABYLON.Node));
|
|
}(BABYLON.Node));
|
|
// Statics
|
|
// Statics
|
|
@@ -23857,6 +23939,80 @@ var BABYLON;
|
|
return this._sourceMesh.getVerticesData(kind, copyWhenShared);
|
|
return this._sourceMesh.getVerticesData(kind, copyWhenShared);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Sets the vertex data of the mesh geometry for the requested `kind`.
|
|
|
|
+ * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
|
|
|
|
+ * The `data` are either a numeric array either a Float32Array.
|
|
|
|
+ * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
|
|
|
|
+ * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
|
|
|
|
+ * Note that a new underlying VertexBuffer object is created each call.
|
|
|
|
+ * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
|
|
|
|
+ *
|
|
|
|
+ * Possible `kind` values :
|
|
|
|
+ * - BABYLON.VertexBuffer.PositionKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UVKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV2Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV3Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV4Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV5Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV6Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.ColorKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
|
|
+ *
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ InstancedMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {
|
|
|
|
+ if (this.sourceMesh) {
|
|
|
|
+ this.sourceMesh.setVerticesData(kind, data, updatable, stride);
|
|
|
|
+ }
|
|
|
|
+ return this.sourceMesh;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Updates the existing vertex data of the mesh geometry for the requested `kind`.
|
|
|
|
+ * If the mesh has no geometry, it is simply returned as it is.
|
|
|
|
+ * The `data` are either a numeric array either a Float32Array.
|
|
|
|
+ * No new underlying VertexBuffer object is created.
|
|
|
|
+ * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
|
|
|
|
+ * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
|
|
|
|
+ *
|
|
|
|
+ * Possible `kind` values :
|
|
|
|
+ * - BABYLON.VertexBuffer.PositionKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UVKind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV2Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV3Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV4Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV5Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.UV6Kind
|
|
|
|
+ * - BABYLON.VertexBuffer.ColorKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
|
|
+ * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
|
|
+ *
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ InstancedMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
|
|
|
|
+ if (this.sourceMesh) {
|
|
|
|
+ this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);
|
|
|
|
+ }
|
|
|
|
+ return this.sourceMesh;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Sets the mesh indices.
|
|
|
|
+ * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
|
|
|
|
+ * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
|
|
|
|
+ * This method creates a new index buffer each call.
|
|
|
|
+ * Returns the Mesh.
|
|
|
|
+ */
|
|
|
|
+ InstancedMesh.prototype.setIndices = function (indices, totalVertices) {
|
|
|
|
+ if (this.sourceMesh) {
|
|
|
|
+ this.sourceMesh.setIndices(indices, totalVertices);
|
|
|
|
+ }
|
|
|
|
+ return this.sourceMesh;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Boolean : True if the mesh owns the requested kind of data.
|
|
* Boolean : True if the mesh owns the requested kind of data.
|
|
*/
|
|
*/
|
|
InstancedMesh.prototype.isVerticesDataPresent = function (kind) {
|
|
InstancedMesh.prototype.isVerticesDataPresent = function (kind) {
|
|
@@ -24726,19 +24882,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
- Mesh.prototype.createNormals = function (updatable) {
|
|
|
|
- var positions = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
|
|
- var indices = this.getIndices();
|
|
|
|
- var normals;
|
|
|
|
- if (this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
|
|
- normals = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- normals = [];
|
|
|
|
- }
|
|
|
|
- BABYLON.VertexData.ComputeNormals(positions, indices, normals);
|
|
|
|
- this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
|
|
|
|
- };
|
|
|
|
/**
|
|
/**
|
|
* Creates a un-shared specific occurence of the geometry for the mesh.
|
|
* Creates a un-shared specific occurence of the geometry for the mesh.
|
|
* Returns the Mesh.
|
|
* Returns the Mesh.
|
|
@@ -26777,7 +26920,14 @@ var BABYLON;
|
|
var rootMaterial = this._renderingMesh.material;
|
|
var rootMaterial = this._renderingMesh.material;
|
|
if (rootMaterial && rootMaterial instanceof BABYLON.MultiMaterial) {
|
|
if (rootMaterial && rootMaterial instanceof BABYLON.MultiMaterial) {
|
|
var multiMaterial = rootMaterial;
|
|
var multiMaterial = rootMaterial;
|
|
- return multiMaterial.getSubMaterial(this.materialIndex);
|
|
|
|
|
|
+ var effectiveMaterial = multiMaterial.getSubMaterial(this.materialIndex);
|
|
|
|
+ if (this._currentMaterial !== effectiveMaterial) {
|
|
|
|
+ this._currentMaterial = effectiveMaterial;
|
|
|
|
+ if (this._materialDefines) {
|
|
|
|
+ this._materialDefines.markAllAsDirty();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return effectiveMaterial;
|
|
}
|
|
}
|
|
if (!rootMaterial) {
|
|
if (!rootMaterial) {
|
|
return this._mesh.getScene().defaultMaterial;
|
|
return this._mesh.getScene().defaultMaterial;
|
|
@@ -31035,6 +31185,14 @@ var BABYLON;
|
|
MaterialDefines.prototype.markAsUnprocessed = function () {
|
|
MaterialDefines.prototype.markAsUnprocessed = function () {
|
|
this._isDirty = true;
|
|
this._isDirty = true;
|
|
};
|
|
};
|
|
|
|
+ MaterialDefines.prototype.markAllAsDirty = function () {
|
|
|
|
+ this._areTexturesDirty = true;
|
|
|
|
+ this._areAttributesDirty = true;
|
|
|
|
+ this._areLightsDirty = true;
|
|
|
|
+ this._areFresnelDirty = true;
|
|
|
|
+ this._areMiscDirty = true;
|
|
|
|
+ this._isDirty = true;
|
|
|
|
+ };
|
|
MaterialDefines.prototype.markAsLightDirty = function () {
|
|
MaterialDefines.prototype.markAsLightDirty = function () {
|
|
this._areLightsDirty = true;
|
|
this._areLightsDirty = true;
|
|
this._isDirty = true;
|
|
this._isDirty = true;
|
|
@@ -60054,7 +60212,7 @@ var BABYLON;
|
|
* Debug Control allowing to overload the reflectivity color.
|
|
* Debug Control allowing to overload the reflectivity color.
|
|
* This as to be use with the overloadedReflectivityIntensity parameter.
|
|
* This as to be use with the overloadedReflectivityIntensity parameter.
|
|
*/
|
|
*/
|
|
- _this.overloadedReflectivity = new BABYLON.Color3(0.3, 0.3, 0.3);
|
|
|
|
|
|
+ _this.overloadedReflectivity = new BABYLON.Color3(0.0, 0.0, 0.0);
|
|
/**
|
|
/**
|
|
* Debug Control indicating how much the overloaded reflectivity color is used against the default one.
|
|
* Debug Control indicating how much the overloaded reflectivity color is used against the default one.
|
|
*/
|
|
*/
|
|
@@ -60101,7 +60259,7 @@ var BABYLON;
|
|
* AKA Specular Color in other nomenclature.
|
|
* AKA Specular Color in other nomenclature.
|
|
*/
|
|
*/
|
|
_this.reflectivityColor = new BABYLON.Color3(1, 1, 1);
|
|
_this.reflectivityColor = new BABYLON.Color3(1, 1, 1);
|
|
- _this.reflectionColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
|
|
|
|
|
+ _this.reflectionColor = new BABYLON.Color3(0.0, 0.0, 0.0);
|
|
_this.emissiveColor = new BABYLON.Color3(0, 0, 0);
|
|
_this.emissiveColor = new BABYLON.Color3(0, 0, 0);
|
|
/**
|
|
/**
|
|
* AKA Glossiness in other nomenclature.
|
|
* AKA Glossiness in other nomenclature.
|
|
@@ -60318,11 +60476,10 @@ var BABYLON;
|
|
}
|
|
}
|
|
var scene = this.getScene();
|
|
var scene = this.getScene();
|
|
var engine = scene.getEngine();
|
|
var engine = scene.getEngine();
|
|
- var needNormals = false;
|
|
|
|
var needUVs = false;
|
|
var needUVs = false;
|
|
this._defines.reset();
|
|
this._defines.reset();
|
|
if (scene.lightsEnabled && !this.disableLighting) {
|
|
if (scene.lightsEnabled && !this.disableLighting) {
|
|
- needNormals = BABYLON.MaterialHelper.PrepareDefinesForLights(scene, mesh, this._defines, true, this.maxSimultaneousLights) || needNormals;
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForLights(scene, mesh, this._defines, true, this.maxSimultaneousLights);
|
|
}
|
|
}
|
|
if (!this.checkReadyOnEveryCall) {
|
|
if (!this.checkReadyOnEveryCall) {
|
|
if (this._renderId === scene.getRenderId()) {
|
|
if (this._renderId === scene.getRenderId()) {
|
|
@@ -60363,7 +60520,6 @@ var BABYLON;
|
|
if (!this.reflectionTexture.isReady()) {
|
|
if (!this.reflectionTexture.isReady()) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- needNormals = true;
|
|
|
|
this._defines.REFLECTION = true;
|
|
this._defines.REFLECTION = true;
|
|
if (this.reflectionTexture.coordinatesMode === BABYLON.Texture.INVCUBIC_MODE) {
|
|
if (this.reflectionTexture.coordinatesMode === BABYLON.Texture.INVCUBIC_MODE) {
|
|
this._defines.INVERTCUBICMAP = true;
|
|
this._defines.INVERTCUBICMAP = true;
|
|
@@ -60401,7 +60557,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
if (this.reflectionTexture instanceof BABYLON.HDRCubeTexture && this.reflectionTexture) {
|
|
if (this.reflectionTexture instanceof BABYLON.HDRCubeTexture && this.reflectionTexture) {
|
|
this._defines.USESPHERICALFROMREFLECTIONMAP = true;
|
|
this._defines.USESPHERICALFROMREFLECTIONMAP = true;
|
|
- needNormals = true;
|
|
|
|
if (this.reflectionTexture.isPMREM) {
|
|
if (this.reflectionTexture.isPMREM) {
|
|
this._defines.USEPMREMREFLECTION = true;
|
|
this._defines.USEPMREMREFLECTION = true;
|
|
}
|
|
}
|
|
@@ -60560,7 +60715,6 @@ var BABYLON;
|
|
if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
|
|
this._defines.EMISSIVEFRESNEL = true;
|
|
this._defines.EMISSIVEFRESNEL = true;
|
|
}
|
|
}
|
|
- needNormals = true;
|
|
|
|
this._defines.FRESNEL = true;
|
|
this._defines.FRESNEL = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -60578,7 +60732,11 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Attribs
|
|
// Attribs
|
|
if (mesh) {
|
|
if (mesh) {
|
|
- if (needNormals && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
|
|
|
|
+ if (!mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
|
|
+ mesh.createNormals(true);
|
|
|
|
+ BABYLON.Tools.Warn("PBRMaterial: Normals have been created for the mesh: " + mesh.name);
|
|
|
|
+ }
|
|
|
|
+ if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
this._defines.NORMAL = true;
|
|
this._defines.NORMAL = true;
|
|
if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
|
|
if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
|
|
this._defines.TANGENT = true;
|
|
this._defines.TANGENT = true;
|