/// <summary> /// Modifies this camera so it always renders from the reflection of itself through the /// plane specified. /// </summary> /// <remarks> /// This is obviously useful for rendering planar reflections. /// </remarks> /// <param name="plane"></param> public virtual void EnableReflection( Plane plane ) { this.isReflected = true; this._reflectionPlane = plane; this.linkedReflectionPlane = null; this._reflectionMatrix = Utility.BuildReflectionMatrix( plane ); InvalidateView(); }
/// <summary> /// Links the frustum to a custom near clip plane, which can be used /// to clip geometry in a custom manner without using user clip planes. /// </summary> /// <remarks> /// <p> /// There are several applications for clipping a scene arbitrarily by /// a single plane; the most common is when rendering a reflection to /// a texture, and you only want to render geometry that is above the /// water plane (to do otherwise results in artefacts). Whilst it is /// possible to use user clip planes, they are not supported on all /// cards, and sometimes are not hardware accelerated when they are /// available. Instead, where a single clip plane is involved, this /// technique uses a 'fudging' of the near clip plane, which is /// available and fast on all hardware, to perform as the arbitrary /// clip plane. This does change the shape of the frustum, leading /// to some depth buffer loss of precision, but for many of the uses of /// this technique that is not an issue.</p> /// <p> /// This version of the method links to a plane, rather than requiring /// a by-value plane definition, and therefore you can /// make changes to the plane (e.g. by moving / rotating the node it is /// attached to) and they will automatically affect this object. /// </p> /// <p>This technique only works for perspective projection.</p> /// </remarks> /// <param name="plane">The plane to link to to perform the clipping.</param> public virtual void EnableCustomNearClipPlane( Plane plane ) { this.useObliqueDepthProjection = true; this.linkedObliqueProjPlane = null; this.obliqueProjPlane = plane; InvalidateFrustum(); }
/// <summary> /// Links the frustum to a custom near clip plane, which can be used /// to clip geometry in a custom manner without using user clip planes. /// </summary> /// <remarks> /// <p> /// There are several applications for clipping a scene arbitrarily by /// a single plane; the most common is when rendering a reflection to /// a texture, and you only want to render geometry that is above the /// water plane (to do otherwise results in artefacts). Whilst it is /// possible to use user clip planes, they are not supported on all /// cards, and sometimes are not hardware accelerated when they are /// available. Instead, where a single clip plane is involved, this /// technique uses a 'fudging' of the near clip plane, which is /// available and fast on all hardware, to perform as the arbitrary /// clip plane. This does change the shape of the frustum, leading /// to some depth buffer loss of precision, but for many of the uses of /// this technique that is not an issue.</p> /// <p> /// This version of the method links to a plane, rather than requiring /// a by-value plane definition, and therefore you can /// make changes to the plane (e.g. by moving / rotating the node it is /// attached to) and they will automatically affect this object. /// </p> /// <p>This technique only works for perspective projection.</p> /// </remarks> /// <param name="plane">The plane to link to to perform the clipping.</param> public virtual void EnableCustomNearClipPlane( IDerivedPlaneProvider plane ) { this.useObliqueDepthProjection = true; this.linkedObliqueProjPlane = plane; this.obliqueProjPlane = plane.DerivedPlane; InvalidateFrustum(); }
/// <summary> /// Disables any custom near clip plane. /// </summary> public virtual void DisableCustomNearClipPlane() { this.useObliqueDepthProjection = false; this.linkedObliqueProjPlane = null; InvalidateFrustum(); }
/// <summary> /// Modifies this frustum so it always renders from the reflection of itself through the /// plane specified. Note that this version of the method links to a plane /// so that changes to it are picked up automatically. /// </summary> /// <remarks>This is obviously useful for performing planar reflections.</remarks> /// <param name="plane"></param> public virtual void EnableReflection( IDerivedPlaneProvider plane ) { this.isReflected = true; this.linkedReflectionPlane = plane; this._reflectionPlane = this.linkedReflectionPlane.DerivedPlane; this._reflectionMatrix = Utility.BuildReflectionMatrix( this._reflectionPlane ); this.lastLinkedReflectionPlane = this._reflectionPlane; InvalidateView(); }
/// <summary> /// Modifies this frustum so it always renders from the reflection of itself through the /// plane specified. Note that this version of the method links to a plane /// so that changes to it are picked up automatically. /// </summary> /// <remarks>This is obviously useful for performing planar reflections.</remarks> /// <param name="plane"></param> public virtual void EnableReflection( IDerivedPlaneProvider plane ) { isReflected = true; linkedReflectionPlane = plane; _reflectionPlane = linkedReflectionPlane.DerivedPlane; _reflectionMatrix = Utility.BuildReflectionMatrix( _reflectionPlane ); lastLinkedReflectionPlane = _reflectionPlane; InvalidateView(); }