Hersir Posted October 5, 2018 Share Posted October 5, 2018 Hi, I use TransformNode as parent for my meshes and would like to add all children to ShadowGenerator, like this `addShadowCaster(node, true)` but it accepts just AbstractMesh as input there, what about changing type to TransformNode ? Like this: public addShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap) { return this; } if (!this._shadowMap.renderList) { this._shadowMap.renderList = []; } // Need to check if is real mesh if (mesh instanceof AbstractMesh) { this._shadowMap.renderList.push(mesh); } if (includeDescendants) { this._shadowMap.renderList.push(...mesh.getChildMeshes()); } return this; } for `removeShadowCaster` similar public removeShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap || !this._shadowMap.renderList) { return this; } // check if real mesh if (mesh instanceof AbstractMesh) { var index = this._shadowMap.renderList.indexOf(mesh); if (index !== -1) { this._shadowMap.renderList.splice(index, 1); } } if (includeDescendants) { // use getChildMeshes instead of getChildren to support nested TransformNodes for (var child of mesh.getChildMeshes(true)) { this.removeShadowCaster(<any>child); } } return this; } Any objections on this ? I haven't tested / profiled change impact so its just an idea now Would like to hear feedback, as maybe I am missing something here Quote Link to comment Share on other sites More sharing options...
Guest Posted October 5, 2018 Share Posted October 5, 2018 I have an objection If you only add a transformNode it will not cast anything. Hersir 1 Quote Link to comment Share on other sites More sharing options...
Hersir Posted October 8, 2018 Author Share Posted October 8, 2018 ? true 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.