Add ShadowMap (#6778)

* Temporary modification that skyBox does not node

* add default Node for model

* revert
This commit is contained in:
troublemaker52025
2020-05-29 15:15:47 +08:00
committed by GitHub
parent 50ee04c797
commit 539efdee2e
@@ -337,6 +337,11 @@ export class ForwardPipeline extends RenderPipeline {
*/
private cullLightPerModel (model: Model) {
_tempLightIndex.length = 0;
if(model.node) {
model.node.getWorldPosition(_tempVec3);
}else {
_tempVec3.set(0.0, 0.0, 0.0);
}
for (let i = 0; i < this._validLights.length; i++) {
let isCulled = false;
switch (this._validLights[i].type) {
@@ -355,7 +360,7 @@ export class ForwardPipeline extends RenderPipeline {
if (this._validLights[i].type === LightType.DIRECTIONAL) {
_tempLightDist[i] = 0;
} else {
_tempLightDist[i] = Vec3.distance((this._validLights[i] as SphereLight | SpotLight).position, model.node.getWorldPosition(_tempVec3));
_tempLightDist[i] = Vec3.distance((this._validLights[i] as SphereLight | SpotLight).position, _tempVec3);
}
}
}