|
@@ -203,15 +203,9 @@ export class DirectionalLight extends ShadowLight {
|
|
var xOffset = this._orthoRight - this._orthoLeft;
|
|
var xOffset = this._orthoRight - this._orthoLeft;
|
|
var yOffset = this._orthoTop - this._orthoBottom;
|
|
var yOffset = this._orthoTop - this._orthoBottom;
|
|
|
|
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- Matrix.OrthoOffCenterRHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale,
|
|
|
|
- this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale,
|
|
|
|
- this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);
|
|
|
|
- } else {
|
|
|
|
- Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale,
|
|
|
|
- this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale,
|
|
|
|
- this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);
|
|
|
|
- }
|
|
|
|
|
|
+ Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale,
|
|
|
|
+ this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale,
|
|
|
|
+ this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);
|
|
}
|
|
}
|
|
|
|
|
|
protected _buildUniformLayout(): void {
|
|
protected _buildUniformLayout(): void {
|
|
@@ -231,37 +225,20 @@ export class DirectionalLight extends ShadowLight {
|
|
*/
|
|
*/
|
|
public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {
|
|
public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {
|
|
if (this.computeTransformedInformation()) {
|
|
if (this.computeTransformedInformation()) {
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- this._uniformBuffer.updateFloat4("vLightData", -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z, 1, lightIndex);
|
|
|
|
- } else {
|
|
|
|
- this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);
|
|
|
|
- }
|
|
|
|
|
|
+ this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- this._uniformBuffer.updateFloat4("vLightData", -this.direction.x, -this.direction.y, -this.direction.z, 1, lightIndex);
|
|
|
|
- } else {
|
|
|
|
- this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light {
|
|
public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light {
|
|
if (this.computeTransformedInformation()) {
|
|
if (this.computeTransformedInformation()) {
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- effect.setFloat3(lightDataUniformName, -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z);
|
|
|
|
- } else {
|
|
|
|
- effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);
|
|
|
|
- }
|
|
|
|
|
|
+ effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- effect.setFloat3(lightDataUniformName, -this.direction.x, -this.direction.y, -this.direction.z);
|
|
|
|
- } else {
|
|
|
|
- effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|