/// <summary> /// The constructor. Dimensions of the viewport are expressed as a pecentage between /// 0 and 100. This allows the dimensions to apply irrespective of /// changes in the target's size: e.g. to fill the whole area, /// values of 0,0,100,100 are appropriate. /// </summary> /// <param name="camera">Reference to the camera to be the source for the image.</param> /// <param name="target">Reference to the render target to be the destination for the rendering.</param> /// <param name="left">Left</param> /// <param name="top">Top</param> /// <param name="width">Width</param> /// <param name="height">Height</param> /// <param name="zOrder">Relative Z-order on the target. Lower = further to the front.</param> public Viewport(Camera camera, RenderTarget target, float left, float top, float width, float height, int zOrder) { Debug.Assert(camera != null, "Cannot use a null Camera to create a viewport."); Debug.Assert(target != null, "Cannor use a null RenderTarget to create a viewport."); LogManager.Instance.Write("Creating viewport rendering from camera '{0}', relative dimensions L:{1},T:{2},W:{3},H:{4}, Z-Order:{5}", camera.Name, left, top, width, height, zOrder); this.camera = camera; this.target = target; this.zOrder = zOrder; relativeLeft = left; relativeTop = top; relativeWidth = width; relativeHeight = height; backColor = ColorEx.Black; clearEveryFrame = true; clearBuffers = FrameBuffer.Color | FrameBuffer.Depth; // Calculate actual dimensions UpdateDimensions(); isUpdated = true; showOverlays = true; showSkies = true; showShadows = true; materialSchemeName = MaterialManager.DefaultSchemeName; // notify camera camera.NotifyViewport(this); }
/// <summary> /// The constructor. Dimensions of the viewport are expressed as a pecentage between /// 0 and 100. This allows the dimensions to apply irrespective of /// changes in the target's size: e.g. to fill the whole area, /// values of 0,0,100,100 are appropriate. /// </summary> /// <param name="camera">Reference to the camera to be the source for the image.</param> /// <param name="target">Reference to the render target to be the destination for the rendering.</param> /// <param name="left">Left</param> /// <param name="top">Top</param> /// <param name="width">Width</param> /// <param name="height">Height</param> /// <param name="zOrder">Relative Z-order on the target. Lower = further to the front.</param> public Viewport(Camera camera, RenderTarget target, float left, float top, float width, float height, int zOrder) : base() { LogManager.Instance.Write( "Creating viewport rendering from camera '{0}', relative dimensions L:{1},T:{2},W:{3},H:{4}, Z-Order:{5}", camera.Name, left, top, width, height, zOrder); Camera = camera; Target = target; Left = left; Top = top; Width = width; Height = height; ZOrder = zOrder; BackgroundColor = ColorEx.Black; ClearDepth = 1.0; ClearEveryFrame = true; ClearBuffers = FrameBufferType.Color | FrameBufferType.Depth; IsUpdated = false; ShowOverlays = true; ShowSkies = true; ShowShadows = true; VisibilityMask = 0xFFFFFFFFu; IsAutoUpdated = true; OrientationMode = DefaultOrientationMode; // MaterialScheme = MaterialManager.DefaultSchemeName; MaterialScheme = Root.Instance.RenderSystem.DefaultViewportMaterialScheme; // Calculate actual dimensions UpdateDimensions(); // notify camera if (camera != null) { camera.NotifyViewport(this); } }
/// <summary> /// The constructor. Dimensions of the viewport are expressed as a pecentage between /// 0 and 100. This allows the dimensions to apply irrespective of /// changes in the target's size: e.g. to fill the whole area, /// values of 0,0,100,100 are appropriate. /// </summary> /// <param name="camera">Reference to the camera to be the source for the image.</param> /// <param name="target">Reference to the render target to be the destination for the rendering.</param> /// <param name="left">Left</param> /// <param name="top">Top</param> /// <param name="width">Width</param> /// <param name="height">Height</param> /// <param name="zOrder">Relative Z-order on the target. Lower = further to the front.</param> public Viewport( Camera camera, RenderTarget target, float left, float top, float width, float height, int zOrder ) : base() { LogManager.Instance.Write( "Creating viewport rendering from camera '{0}', relative dimensions L:{1},T:{2},W:{3},H:{4}, Z-Order:{5}", camera.Name, left, top, width, height, zOrder ); Camera = camera; Target = target; Left = left; Top = top; Width = width; Height = height; ZOrder = zOrder; BackgroundColor = ColorEx.Black; ClearDepth = 1.0; ClearEveryFrame = true; ClearBuffers = FrameBufferType.Color | FrameBufferType.Depth; IsUpdated = false; ShowOverlays = true; ShowSkies = true; ShowShadows = true; VisibilityMask = 0xFFFFFFFFu; IsAutoUpdated = true; OrientationMode = DefaultOrientationMode; // MaterialScheme = MaterialManager.DefaultSchemeName; MaterialScheme = Root.Instance.RenderSystem.DefaultViewportMaterialScheme; // Calculate actual dimensions UpdateDimensions(); // notify camera if ( camera != null ) { camera.NotifyViewport( this ); } }