|
@@ -315,32 +315,39 @@
|
|
|
/**
|
|
|
* Inserts the submesh in its correct queue depending on its material.
|
|
|
* @param subMesh The submesh to dispatch
|
|
|
+ * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.
|
|
|
+ * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.
|
|
|
*/
|
|
|
- public dispatch(subMesh: SubMesh): void {
|
|
|
- var material = subMesh.getMaterial();
|
|
|
- var mesh = subMesh.getMesh();
|
|
|
+ public dispatch(subMesh: SubMesh, mesh?: AbstractMesh, material?: Nullable<Material>): void {
|
|
|
+ // Get mesh and materials if not provided
|
|
|
+ if (mesh === undefined) {
|
|
|
+ mesh = subMesh.getMesh();
|
|
|
+ }
|
|
|
+ if (material === undefined) {
|
|
|
+ material = subMesh.getMaterial();
|
|
|
+ }
|
|
|
|
|
|
- if (!material) {
|
|
|
+ if (material === null || material === undefined) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (material.needAlphaBlendingForMesh(mesh)) { // Transparent
|
|
|
this._transparentSubMeshes.push(subMesh);
|
|
|
} else if (material.needAlphaTesting()) { // Alpha test
|
|
|
- if (material.needDepthPrePass) {
|
|
|
+ if (material.needDepthPrePass === true) {
|
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
|
}
|
|
|
|
|
|
this._alphaTestSubMeshes.push(subMesh);
|
|
|
} else {
|
|
|
- if (material.needDepthPrePass) {
|
|
|
+ if (material.needDepthPrePass === true) {
|
|
|
this._depthOnlySubMeshes.push(subMesh);
|
|
|
}
|
|
|
|
|
|
this._opaqueSubMeshes.push(subMesh); // Opaque
|
|
|
}
|
|
|
|
|
|
- if (mesh._edgesRenderer) {
|
|
|
+ if (mesh._edgesRenderer !== null && mesh._edgesRenderer !== undefined) {
|
|
|
this._edgesRenderers.push(mesh._edgesRenderer);
|
|
|
}
|
|
|
}
|