idTech4.Renderer.idRenderView.Copy C# (CSharp) Method

Copy() public method

Creates a shallow copy of this instance.
public Copy ( ) : idRenderView
return idRenderView
		public idRenderView Copy()
		{
			idRenderView view = new idRenderView();
			view.ViewID = this.ViewID;
			view.X = this.X;
			view.Y = this.Y;
			view.Width = this.Width;
			view.Height = this.Height;
			view.FovX = this.FovX;
			view.FovY = this.FovY;

			view.ViewOrigin = this.ViewOrigin;
			view.ViewAxis = this.ViewAxis;

			view.CramZNear = this.CramZNear;
			view.ForceUpdate = this.ForceUpdate;
			view.Time = this.Time;

			view.MaterialParameters = this.MaterialParameters;
			view.GlobalMaterial = this.GlobalMaterial;

			return view;
		}
	}

Usage Example

示例#1
0
		private void SingleView(idUserInterface hud, idRenderView renderView)
		{
			// normal rendering
			if(renderView == null)
			{
				return;
			}

			// place the sound origin for the player
			// TODO: gameSoundWorld->PlaceListener( view->vieworg, view->viewaxis, player->entityNumber + 1, gameLocal.time, hud ? hud->State().GetString( "location" ) : "Undefined" );

			// if the objective system is up, don't do normal drawing
			// TODO: objectives
			/*if ( player->objectiveSystemOpen ) {
				player->objectiveSystem->Redraw( gameLocal.time );
				return;
			}
			*/

			// hack the shake in at the very last moment, so it can't cause any consistency problems
			idRenderView hackedView = renderView.Copy();
			// TODO: hackedView.viewaxis = hackedView.viewaxis * ShakeAxis();

			idR.Game.CurrentRenderWorld.RenderScene(hackedView);

			if(_player.IsSpectating == true)
			{
				return;
			}

			// draw screen blobs
			if((idR.CvarSystem.GetBool("pm_thirdPerson") == false) && (idR.CvarSystem.GetBool("g_skipViewEffects") == false))
			{
				idConsole.Warning("TODO: screen blobs");

				/*for ( int i = 0 ; i < MAX_SCREEN_BLOBS ; i++ ) {
					screenBlob_t	*blob = &screenBlobs[i];
					if ( blob->finishTime <= gameLocal.time ) {
						continue;
					}
			
					blob->y += blob->driftAmount;

					float	fade = (float)( blob->finishTime - gameLocal.time ) / ( blob->finishTime - blob->startFadeTime );
					if ( fade > 1.0f ) {
						fade = 1.0f;
					}
					if ( fade ) {
						renderSystem->SetColor4( 1,1,1,fade );
						renderSystem->DrawStretchPic( blob->x, blob->y, blob->w, blob->h,blob->s1, blob->t1, blob->s2, blob->t2, blob->material );
					}
				}
				player->DrawHUD( hud );

				// armor impulse feedback
				float	armorPulse = ( gameLocal.time - player->lastArmorPulse ) / 250.0f;

				if ( armorPulse > 0.0f && armorPulse < 1.0f ) {
					renderSystem->SetColor4( 1, 1, 1, 1.0 - armorPulse );
					renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, armorMaterial );
				}


				// tunnel vision
				float	health = 0.0f;
				if ( g_testHealthVision.GetFloat() != 0.0f ) {
					health = g_testHealthVision.GetFloat();
				} else {
					health = player->health;
				}
				float alpha = health / 100.0f;
				if ( alpha < 0.0f ) {
					alpha = 0.0f;
				}
				if ( alpha > 1.0f ) {
					alpha = 1.0f;
				}

				if ( alpha < 1.0f  ) {
					renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha );
					renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial );
				}

				if ( player->PowerUpActive(BERSERK) ) {
					int berserkTime = player->inventory.powerupEndTime[ BERSERK ] - gameLocal.time;
					if ( berserkTime > 0 ) {
						// start fading if within 10 seconds of going away
						alpha = (berserkTime < 10000) ? (float)berserkTime / 10000 : 1.0f;
						renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, alpha );
						renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, berserkMaterial );
					}
				}

				if ( bfgVision ) {
					renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
					renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial );
				}*/
		
			}

			// test a single material drawn over everything
			if(idR.CvarSystem.GetString("g_testPostProcess") != string.Empty)
			{
				idMaterial material = idR.DeclManager.FindMaterial(idR.CvarSystem.GetString("g_testPostProcess"), false);

				if(material == null)
				{
					idConsole.Warning("Material not found.");
					idR.CvarSystem.SetString("g_testPostProcess", string.Empty);
				}
				else
				{
					idR.RenderSystem.Color = new Vector4(1, 1, 1, 1);
					idR.RenderSystem.DrawStretchPicture(0, 0, idE.VirtualScreenWidth, idE.VirtualScreenHeight, 0, 0, 1, 1, material);
				}
			}
		}
All Usage Examples Of idTech4.Renderer.idRenderView::Copy