当前位置: 首页>>代码示例>>C++>>正文


C++ idBounds函数代码示例

本文整理汇总了C++中idBounds函数的典型用法代码示例。如果您正苦于以下问题:C++ idBounds函数的具体用法?C++ idBounds怎么用?C++ idBounds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了idBounds函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: idBounds

/*
============
idClip::DrawClipModels
============
*/
void idClip::DrawClipModels( const idVec3& eye, const float radius, const idEntity* passEntity )
{
	int				i, num;
	idBounds		bounds;
	idClipModel*		clipModelList[MAX_GENTITIES];
	idClipModel*		clipModel;
	
	bounds = idBounds( eye ).Expand( radius );
	
	num = idClip::ClipModelsTouchingBounds( bounds, -1, clipModelList, MAX_GENTITIES );
	
	for( i = 0; i < num; i++ )
	{
		clipModel = clipModelList[i];
		if( clipModel->GetEntity() == passEntity )
		{
			continue;
		}
		if( clipModel->renderModelHandle != -1 )
		{
			gameRenderWorld->DebugBounds( colorCyan, clipModel->GetAbsBounds() );
		}
		else
		{
			collisionModelManager->DrawModel( clipModel->Handle(), clipModel->GetOrigin(), clipModel->GetAxis(), eye, radius );
		}
	}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:33,代码来源:Clip.cpp

示例2: idBounds

/*
============
idAASSettings::idAASSettings
============
*/
idAASSettings::idAASSettings( void )
{
    numBoundingBoxes = 1;
    boundingBoxes[0] = idBounds( idVec3( -16, -16, 0 ), idVec3( 16, 16, 72 ) );
    usePatches = false;
    writeBrushMap = false;
    playerFlood = false;
    noOptimize = false;
    allowSwimReachabilities = false;
    allowFlyReachabilities = false;
    fileExtension = "aas48";
    // physics settings
    gravity = idVec3( 0, 0, -1066 );
    gravityDir = gravity;
    gravityValue = gravityDir.Normalize();
    invGravityDir = -gravityDir;
    maxStepHeight = 14.0f;
    maxBarrierHeight = 32.0f;
    maxWaterJumpHeight = 20.0f;
    maxFallHeight = 64.0f;
    minFloorCos = 0.7f;
    // fixed travel times
    tt_barrierJump = 100;
    tt_startCrouching = 100;
    tt_waterJump = 100;
    tt_startWalkOffLedge = 100;
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:32,代码来源:AASFile.cpp

示例3: memset

/*
===============
idClip::Init
===============
*/
void idClip::Init( void ) {
	cmHandle_t h;
	idVec3 size, maxSector = vec3_origin;

	// clear clip sectors
	clipSectors = new clipSector_t[MAX_SECTORS];
	memset( clipSectors, 0, MAX_SECTORS * sizeof( clipSector_t ) );
	numClipSectors = 0;
	touchCount = -1;
	// get world map bounds
	h = collisionModelManager->LoadModel( "worldMap", false );
	collisionModelManager->GetModelBounds( h, worldBounds );
	// create world sectors
	CreateClipSectors_r( 0, worldBounds, maxSector );

	size = worldBounds[1] - worldBounds[0];
	gameLocal.Printf( "map bounds are (%1.1f, %1.1f, %1.1f)\n", size[0], size[1], size[2] );
	gameLocal.Printf( "max clip sector is (%1.1f, %1.1f, %1.1f)\n", maxSector[0], maxSector[1], maxSector[2] );

	// initialize a default clip model
	defaultClipModel.LoadModel( idTraceModel( idBounds( idVec3( 0, 0, 0 ) ).Expand( 8 ) ) );

	// set counters to zero
	numRotations = numTranslations = numMotions = numRenderModelTraces = numContents = numContacts = 0;
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:30,代码来源:Clip.cpp

示例4: idClipModel

/*
================
idMoveableItem::Spawn
================
*/
void idMoveableItem::Spawn( void ) {
	idTraceModel trm;
	float density, friction, bouncyness, tsize;
	idStr clipModelName;
	idBounds bounds;

	// create a trigger for item pickup
	spawnArgs.GetFloat( "triggersize", "16.0", tsize );
	trigger = new idClipModel( idTraceModel( idBounds( vec3_origin ).Expand( tsize ) ) );
	trigger->Link( gameLocal.clip, this, 0, GetPhysics()->GetOrigin(), GetPhysics()->GetAxis() );
	trigger->SetContents( CONTENTS_TRIGGER );

	// check if a clip model is set
	spawnArgs.GetString( "clipmodel", "", clipModelName );
	if ( !clipModelName[0] ) {
		clipModelName = spawnArgs.GetString( "model" );		// use the visual model
	}

	// load the trace model
	if ( !collisionModelManager->TrmFromModel( clipModelName, trm ) ) {
		gameLocal.Error( "idMoveableItem '%s': cannot load collision model %s", name.c_str(), clipModelName.c_str() );
		return;
	}

	// if the model should be shrinked
	if ( spawnArgs.GetBool( "clipshrink" ) ) {
		trm.Shrink( CM_CLIP_EPSILON );
	}

	// get rigid body properties
	spawnArgs.GetFloat( "density", "0.5", density );
	density = idMath::ClampFloat( 0.001f, 1000.0f, density );
	spawnArgs.GetFloat( "friction", "0.05", friction );
	friction = idMath::ClampFloat( 0.0f, 1.0f, friction );
	spawnArgs.GetFloat( "bouncyness", "0.6", bouncyness );
	bouncyness = idMath::ClampFloat( 0.0f, 1.0f, bouncyness );

	// setup the physics
	physicsObj.SetSelf( this );
	physicsObj.SetClipModel( new idClipModel( trm ), density );
	physicsObj.SetOrigin( GetPhysics()->GetOrigin() );
	physicsObj.SetAxis( GetPhysics()->GetAxis() );
	physicsObj.SetBouncyness( bouncyness );
	physicsObj.SetFriction( 0.6f, 0.6f, friction );
	physicsObj.SetGravity( gameLocal.GetGravity() );
	physicsObj.SetContents( CONTENTS_RENDERMODEL );
	physicsObj.SetClipMask( MASK_SOLID | CONTENTS_MOVEABLECLIP );
	SetPhysics( &physicsObj );

	smoke = NULL;
	smokeTime = 0;
	const char *smokeName = spawnArgs.GetString( "smoke_trail" );
	if ( *smokeName != '\0' ) {
		smoke = static_cast<const idDeclParticle *>( declManager->FindType( DECL_PARTICLE, smokeName ) );
		smokeTime = gameLocal.time;
		BecomeActive( TH_UPDATEPARTICLES );
	}
}
开发者ID:angjminer,项目名称:deamos,代码行数:63,代码来源:Item.cpp

示例5: GetFileName

/*
================
idDeclParticle::Parse
================
*/
bool idDeclParticle::Parse( const char *text, const int textLength ) {
	idLexer src;
	idToken	token;

	src.LoadMemory( text, textLength, GetFileName(), GetLineNum() );
	src.SetFlags( DECL_LEXER_FLAGS );
	src.SkipUntilString( "{" );

	depthHack = 0.0f;

	while (1) {
		if ( !src.ReadToken( &token ) ) {
			break;
		}

		if ( !token.Icmp( "}" ) ) {
			break;
		}

		if ( !token.Icmp( "{" ) ) {
			idParticleStage *stage = ParseParticleStage( src );
			if ( !stage ) {
				src.Warning( "Particle stage parse failed" );
				MakeDefault();
				return false;
			}
			stages.Append( stage );
			continue;
		}

		if ( !token.Icmp( "depthHack" ) ) {
			depthHack = src.ParseFloat();
			continue;
		}

		src.Warning( "bad token %s", token.c_str() );
		MakeDefault();
		return false;
	}

	//
	// calculate the bounds
	//
	bounds.Clear();
	for( int i = 0; i < stages.Num(); i++ ) {
		GetStageBounds( stages[i] );
		bounds.AddBounds( stages[i]->bounds );
	}

	if ( bounds.GetVolume() <= 0.1f ) {
		bounds = idBounds( vec3_origin ).Expand( 8.0f );
	}

	return true;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:60,代码来源:DeclParticle.cpp

示例6: TraceModelForClipModel

/*
============
idClip::Contacts
============
*/
int idClip::Contacts( contactInfo_t *contacts, const int maxContacts, const idVec3 &start, const idVec6 &dir, const float depth,
					  const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity ) {
	int i, j, num, n, numContacts;
	idClipModel *touch, *clipModelList[MAX_GENTITIES];
	idBounds traceBounds;
	const idTraceModel *trm;
	trm = TraceModelForClipModel( mdl );
	if( !passEntity || passEntity->entityNumber != ENTITYNUM_WORLD ) {
		// test world
		idClip::numContacts++;
		numContacts = collisionModelManager->Contacts( contacts, maxContacts, start, dir, depth, trm, trmAxis, contentMask, 0, vec3_origin, mat3_default );
	} else {
		numContacts = 0;
	}
	for( i = 0; i < numContacts; i++ ) {
		contacts[i].entityNum = ENTITYNUM_WORLD;
		contacts[i].id = 0;
	}
	if( numContacts >= maxContacts ) {
		return numContacts;
	}
	if( !trm ) {
		traceBounds = idBounds( start ).Expand( depth );
	} else {
		traceBounds.FromTransformedBounds( trm->bounds, start, trmAxis );
		traceBounds.ExpandSelf( depth );
	}
	num = GetTraceClipModels( traceBounds, contentMask, passEntity, clipModelList );
	for( i = 0; i < num; i++ ) {
		touch = clipModelList[i];
		if( !touch ) {
			continue;
		}
		// no contacts with render models
		if( touch->renderModelHandle != -1 ) {
			continue;
		}
		idClip::numContacts++;
		n = collisionModelManager->Contacts( contacts + numContacts, maxContacts - numContacts,
											 start, dir, depth, trm, trmAxis, contentMask,
											 touch->Handle(), touch->origin, touch->axis );
		for( j = 0; j < n; j++ ) {
			contacts[numContacts].entityNum = touch->entity->entityNumber;
			contacts[numContacts].id = touch->id;
			numContacts++;
		}
		if( numContacts >= maxContacts ) {
			break;
		}
	}
	return numContacts;
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:57,代码来源:Clip.cpp

示例7: clipBounds

/*
================
hhCameraInterpolator::hhCameraInterpolator
================
*/
hhCameraInterpolator::hhCameraInterpolator() : 
	clipBounds( idBounds(idVec3(-1, -1, 10), idVec3(1, 1, 12)) ) {

	ClearFuncList();
	RegisterFunc( NoInterpEvaluate, IT_None );
	RegisterFunc( VariableMidPointSinusoidalEvaluate, IT_VariableMidPointSinusoidal );
	RegisterFunc( LinearEvaluate, IT_Linear );
	RegisterFunc( InverseEvaluate, IT_Inverse );

	SetSelf( NULL );
	Setup( 0.0f, IT_None );
	Reset( vec3_origin, mat3_identity[2], 0.0f );
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:18,代码来源:prey_camerainterpolator.cpp

示例8: PostEventMS

/*
================
idItem::Spawn
================
*/
void idItem::Spawn(void)
{
	idStr		giveTo;
	idEntity 	*ent;
	float		tsize;

	if (spawnArgs.GetBool("dropToFloor")) {
		PostEventMS(&EV_DropToFloor, 0);
	}

	if (spawnArgs.GetFloat("triggersize", "0", tsize)) {
		GetPhysics()->GetClipModel()->LoadModel(idTraceModel(idBounds(vec3_origin).Expand(tsize)));
		GetPhysics()->GetClipModel()->Link(gameLocal.clip);
	}

	if (spawnArgs.GetBool("start_off")) {
		GetPhysics()->SetContents(0);
		Hide();
	} else {
		GetPhysics()->SetContents(CONTENTS_TRIGGER);
	}

	giveTo = spawnArgs.GetString("owner");

	if (giveTo.Length()) {
		ent = gameLocal.FindEntity(giveTo);

		if (!ent) {
			gameLocal.Error("Item couldn't find owner '%s'", giveTo.c_str());
		}

		PostEventMS(&EV_Touch, 0, ent, 0);
	}

	if (spawnArgs.GetBool("spin") || gameLocal.isMultiplayer) {
		spin = true;
		BecomeActive(TH_THINK);
	}

	//pulse = !spawnArgs.GetBool( "nopulse" );
	//temp hack for tim
	pulse = false;
	orgOrigin = GetPhysics()->GetOrigin();

	canPickUp = !(spawnArgs.GetBool("triggerFirst") || spawnArgs.GetBool("no_touch"));

	inViewTime = -1000;
	lastCycle = -1;
	itemShellHandle = -1;
	shellMaterial = declManager->FindMaterial("itemHighlightShell");
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:56,代码来源:Item.cpp

示例9: PointReachableAreaNum

/*
============
idAASLocal::ShowWallEdges
============
*/
void idAASLocal::ShowWallEdges( const idVec3 &origin ) const {
	int i, areaNum, numEdges, edges[1024];
	idVec3 start, end;
	idPlayer *player;
	player = gameLocal.GetLocalPlayer();
	if( !player ) {
		return;
	}
	areaNum = PointReachableAreaNum( origin, DefaultSearchBounds(), ( AREA_REACHABLE_WALK | AREA_REACHABLE_FLY ) );
	numEdges = GetWallEdges( areaNum, idBounds( origin ).Expand( 256.0f ), TFL_WALK, edges, 1024 );
	for( i = 0; i < numEdges; i++ ) {
		GetEdge( edges[i], start, end );
		gameRenderWorld->DebugLine( colorRed, start, end );
		gameRenderWorld->DrawText( va( "%d", edges[i] ), ( start + end ) * 0.5f, 0.1f, colorWhite, player->viewAxis );
	}
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:21,代码来源:AAS_debug.cpp

示例10: SetShaderParm

//--------------------------------
// hhProxDoor::Spawn
//--------------------------------
void hhProxDoor::Spawn() {
	proxState = PROXSTATE_Inactive;
	doorSndState = PDOORSND_Closed;

	spawnArgs.GetBool( "startlocked", "0", doorLocked );
	SetShaderParm( SHADERPARM_MODE, GetDoorShaderParm( doorLocked, true ) );	// 2=locked, 1=unlocked, 0=never locked

	if( !spawnArgs.GetFloat("trigger_distance", "0.0", maxDistance) ) {
		common->Warning( "No 'trigger_distance' specified for entityDef '%s'", this->GetEntityDefName() );
	}
	if( !spawnArgs.GetFloat("movement_distance", "0.0", movementDistance) ) {
		common->Warning( "No 'movement_distance' specified for entityDef '%s'", this->GetEntityDefName() );
	}
	lastDistance = movementDistance + 1.0f; // Safe default -mdl

	if( !spawnArgs.GetFloat("stop_distance", "0.0", stopDistance) ) {
		common->Warning( "No 'stop_distance' specificed for entityDef '%s'", this->GetEntityDefName() );
	}

	spawnArgs.GetBool( "openForMonsters", "1", openForMonsters );
	spawnArgs.GetFloat( "damage", "1", damage );

	//Find any portal boundary we are on
	areaPortal = gameRenderWorld->FindPortal( GetPhysics()->GetAbsBounds() );

	if (gameLocal.isMultiplayer) {
		fl.networkSync = true;

		if (gameLocal.isClient) {
			doorTrigger = new idClipModel( idTraceModel(idBounds(vec3_origin).Expand(maxDistance)) );
			doorTrigger->Link( gameLocal.clip, this, 255, GetOrigin(), GetAxis() );
			doorTrigger->SetContents( CONTENTS_TRIGGER );

			SetAASAreaState( doorLocked );			//close the area state if we are locked...
			SetDoorState( PROXSTATE_Inactive );
		}
		else {
			PostEventMS( &EV_PostSpawn, 50 ); //rww - this must be delayed or it will happen on the first server frame and we DON'T want that.
		}
	}
	else { //just call it now. some sp maps might target a door piece in the spawn function of an entity or something crazy like that.
		Event_PostSpawn();
	}
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:47,代码来源:game_proxdoor.cpp

示例11: GetEntityDefName

//--------------------------------
// hhProxDoor::Event_PostSpawn
//--------------------------------
void hhProxDoor::Event_PostSpawn( void ) {
	int numSubObjs;
	int i;
	const char* objDef;

//Parse and spawn our door sections
	numSubObjs = spawnArgs.GetInt( "num_doorobjs", "0" );
	for( i = 0; i < numSubObjs; i++ ) {
		if( !spawnArgs.GetString( va("doorobject%i", i+1), "", &objDef ) ) {
			common->Warning( "failed to find doorobject%i", i+1 );
		}
		else {
			//Set our default rotation/origin.
			idDict args;
			args.SetVector( "origin", this->GetOrigin() );
			args.SetMatrix( "rotation", this->GetAxis() );
			hhProxDoorSection* ent = static_cast<hhProxDoorSection*> ( gameLocal.SpawnObject(objDef, &args) );
			if( !ent ) {
				common->Warning( "failed to spawn doorobject%i for entityDef '%s'", i+1, GetEntityDefName() );
			}
			else {
				ent->proxyParent = this;
				doorPieces.Append( ent );
			}
		}
	} 
//Spawn our trigger and link it up
//	if( doorLocked && !spawnArgs.GetBool("locktrigger") ) {
		//we would never be able to open the door, so don't spawn a trigger
//	}
//	else {
		doorTrigger = new idClipModel( idTraceModel(idBounds(vec3_origin).Expand(maxDistance)) );
		doorTrigger->Link( gameLocal.clip, this, 255, GetOrigin(), GetAxis() );
		doorTrigger->SetContents( CONTENTS_TRIGGER );
//	}

	SpawnSoundTrigger();

	SetAASAreaState( doorLocked );			//close the area state if we are locked...
	SetDoorState( PROXSTATE_Inactive );
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:44,代码来源:game_proxdoor.cpp

示例12: ResetIndices

/*
================
rvCTF_AssaultPoint::InitializeLinks
================
*/
void rvCTF_AssaultPoint::Event_InitializeLinks( void ) {
	if( linked ) {
		return;
	}
	
	// pull in our targets
	toStrogg = gameLocal.FindEntity( spawnArgs.GetString( "targetStroggAP" ) );	
	toMarine = gameLocal.FindEntity( spawnArgs.GetString( "targetMarineAP" ) );

	ResetIndices();

	trigger = new idClipModel( idTraceModel( idBounds( vec3_origin ).Expand( 16.0f ) ) );
// RAVEN BEGIN
// ddynerman: multiple clip worlds
	trigger->Link( this, 0, GetPhysics()->GetOrigin(), GetPhysics()->GetAxis() );
// RAVEN END
	trigger->SetContents ( CONTENTS_TRIGGER );

	GetPhysics()->SetClipModel( NULL, 1.0f );

	linked = true;
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:27,代码来源:CTF.cpp

示例13: switch

/*
=============
idEditEntities::DisplayEntities
=============
*/
void idEditEntities::DisplayEntities( void ) {
	idEntity *ent;

	if ( !gameLocal.GetLocalPlayer() ) {
		return;
	}

	selectableEntityClasses.Clear();
	selectedTypeInfo_t sit;

	switch( g_editEntityMode.GetInteger() ) {
		case 1:
			sit.typeInfo = &idLight::Type;
			sit.textKey = "texture";
			selectableEntityClasses.Append( sit );
			break;
		case 2:
			sit.typeInfo = &idSound::Type;
			sit.textKey = "s_shader";
			selectableEntityClasses.Append( sit );
			sit.typeInfo = &idLight::Type;
			sit.textKey = "texture";
			selectableEntityClasses.Append( sit );
			break;
		case 3:
			sit.typeInfo = &idAFEntity_Base::Type;
			sit.textKey = "articulatedFigure";
			selectableEntityClasses.Append( sit );
			break;
		case 4:
			sit.typeInfo = &idFuncEmitter::Type;
			sit.textKey = "model";
			selectableEntityClasses.Append( sit );
			break;
		case 5:
			sit.typeInfo = &idAI::Type;
			sit.textKey = "name";
			selectableEntityClasses.Append( sit );
			break;
		case 6:
			sit.typeInfo = &idEntity::Type;
			sit.textKey = "name";
			selectableEntityClasses.Append( sit );
			break;
		case 7:
			sit.typeInfo = &idEntity::Type;
			sit.textKey = "model";
			selectableEntityClasses.Append( sit );
			break;
		default:
			return;
	}

	idBounds viewBounds( gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin() );
	idBounds viewTextBounds( gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin() );
	idMat3 axis = gameLocal.GetLocalPlayer()->viewAngles.ToMat3();

	viewBounds.ExpandSelf( 512 );
	viewTextBounds.ExpandSelf( 128 );

	idStr textKey;

	for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {

		idVec4 color;

		textKey = "";
		if ( !EntityIsSelectable( ent, &color, &textKey ) ) {
			continue;
		}

		bool drawArrows = false;
		if ( ent->GetType() == &idAFEntity_Base::Type ) {
			if ( !static_cast<idAFEntity_Base *>(ent)->IsActiveAF() ) {
				continue;
			}
		} else if ( ent->GetType() == &idSound::Type ) {
			if ( ent->fl.selected ) {
				drawArrows = true;
			}
			const idSoundShader * ss = declManager->FindSound( ent->spawnArgs.GetString( textKey ) );
			if ( ss->HasDefaultSound() || ss->base->GetState() == DS_DEFAULTED ) {
				color.Set( 1.0f, 0.0f, 1.0f, 1.0f );
			}
		} else if ( ent->GetType() == &idFuncEmitter::Type ) {
			if ( ent->fl.selected ) {
				drawArrows = true;
			}
		}

		if ( !viewBounds.ContainsPoint( ent->GetPhysics()->GetOrigin() ) ) {
			continue;
		}

		gameRenderWorld->DebugBounds( color, idBounds( ent->GetPhysics()->GetOrigin() ).Expand( 8 ) );
//.........这里部分代码省略.........
开发者ID:Salamek,项目名称:Shadow-of-Dust,代码行数:101,代码来源:GameEdit.cpp

示例14: assert


//.........这里部分代码省略.........

	// skip any frames where camera cuts occur
	realFrame = frame;
	cut = 0;
	for( i = 0; i < cameraCuts.Num(); i++ ) {
		if ( frame < cameraCuts[ i ] ) {
			break;
		}
		frame++;
		cut++;
	}

	if ( g_debugCinematic.GetBool() ) {
		int prevFrameTime	= ( gameLocal.time - starttime - gameLocal.msec ) * frameRate;
		int prevFrame		= prevFrameTime / 1000;
		int prevCut;

		prevCut = 0;
		for( i = 0; i < cameraCuts.Num(); i++ ) {
			if ( prevFrame < cameraCuts[ i ] ) {
				break;
			}
			prevFrame++;
			prevCut++;
		}

		if ( prevCut != cut ) {
			gameLocal.Printf( "%d: '%s' cut %d\n", gameLocal.framenum, GetName(), cut );
		}
	}

	// clamp to the first frame.  also check if this is a one frame anim.  one frame anims would end immediately,
	// but since they're mainly used for static cams anyway, just stay on it infinitely.
	if ( ( frame < 0 ) || ( camera.Num() < 2 ) ) {
		view->viewaxis = camera[ 0 ].q.ToQuat().ToMat3();
		view->vieworg = camera[ 0 ].t + offset;
		view->fov_x = camera[ 0 ].fov;
	} else if ( frame > camera.Num() - 2 ) {
		if ( cycle > 0 ) {
			cycle--;
		}

		if ( cycle != 0 ) {
			// advance start time so that we loop
			starttime += ( ( camera.Num() - cameraCuts.Num() ) * 1000 ) / frameRate;
			GetViewParms( view );
			return;
		}

		Stop();
		if ( gameLocal.GetCamera() != NULL ) {
			// we activated another camera when we stopped, so get it's viewparms instead
			gameLocal.GetCamera()->GetViewParms( view );
			return;
		} else {
			// just use our last frame
			camFrame = &camera[ camera.Num() - 1 ];
			view->viewaxis = camFrame->q.ToQuat().ToMat3();
			view->vieworg = camFrame->t + offset;
			view->fov_x = camFrame->fov;
		}
	} else if ( lerp == 0.0f ) {
		camFrame = &camera[ frame ];
		view->viewaxis = camFrame[ 0 ].q.ToMat3();
		view->vieworg = camFrame[ 0 ].t + offset;
		view->fov_x = camFrame[ 0 ].fov;
	} else {
		camFrame = &camera[ frame ];
		invlerp = 1.0f - lerp;
		q1 = camFrame[ 0 ].q.ToQuat();
		q2 = camFrame[ 1 ].q.ToQuat();
		q3.Slerp( q1, q2, lerp );
		view->viewaxis = q3.ToMat3();
		view->vieworg = camFrame[ 0 ].t * invlerp + camFrame[ 1 ].t * lerp + offset;
		view->fov_x = camFrame[ 0 ].fov * invlerp + camFrame[ 1 ].fov * lerp;
	}

	gameLocal.CalcFov( view->fov_x, view->fov_x, view->fov_y );

	// setup the pvs for this frame
	UpdatePVSAreas( view->vieworg );
	
#if 0
	static int lastFrame = 0;
	static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f );
	if ( gameLocal.time != lastFrame ) {
		gameRenderWorld->DebugBounds( colorCyan, idBounds( view->vieworg ).Expand( 16.0f ), vec3_origin, gameLocal.msec );
		gameRenderWorld->DebugLine( colorRed, view->vieworg, view->vieworg + idVec3( 0.0f, 0.0f, 2.0f ), 10000, false );
		gameRenderWorld->DebugLine( colorCyan, lastFrameVec, view->vieworg, 10000, false );
		gameRenderWorld->DebugLine( colorYellow, view->vieworg + view->viewaxis[ 0 ] * 64.0f, view->vieworg + view->viewaxis[ 0 ] * 66.0f, 10000, false );
		gameRenderWorld->DebugLine( colorOrange, view->vieworg + view->viewaxis[ 0 ] * 64.0f, view->vieworg + view->viewaxis[ 0 ] * 64.0f + idVec3( 0.0f, 0.0f, 2.0f ), 10000, false );
		lastFrameVec = view->vieworg;
		lastFrame = gameLocal.time;
	}
#endif

	if ( g_showcamerainfo.GetBool() ) {
		gameLocal.Printf( "^5Frame: ^7%d/%d\n\n\n", realFrame + 1, camera.Num() - cameraCuts.Num() );
	}
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:101,代码来源:Camera.cpp

示例15: GetName

/*
================
idDeclParticle::Parse
================
*/
bool idDeclParticle::Parse( const char* text, const int textLength, bool allowBinaryVersion )
{

	if( cvarSystem->GetCVarBool( "fs_buildresources" ) )
	{
		fileSystem->AddParticlePreload( GetName() );
	}
	
	idLexer src;
	idToken	token;
	
	unsigned int sourceChecksum = 0;
	idStrStatic< MAX_OSPATH > generatedFileName;
	if( allowBinaryVersion )
	{
		// Try to load the generated version of it
		// If successful,
		// - Create an MD5 of the hash of the source
		// - Load the MD5 of the generated, if they differ, create a new generated
		generatedFileName = "generated/particles/";
		generatedFileName.AppendPath( GetName() );
		generatedFileName.SetFileExtension( ".bprt" );
		
		idFileLocal file( fileSystem->OpenFileReadMemory( generatedFileName ) );
		sourceChecksum = MD5_BlockChecksum( text, textLength );
		
		if( binaryLoadParticles.GetBool() && LoadBinary( file, sourceChecksum ) )
		{
			return true;
		}
	}
	
	src.LoadMemory( text, textLength, GetFileName(), GetLineNum() );
	src.SetFlags( DECL_LEXER_FLAGS );
	src.SkipUntilString( "{" );
	
	depthHack = 0.0f;
	
	while( 1 )
	{
		if( !src.ReadToken( &token ) )
		{
			break;
		}
		
		if( !token.Icmp( "}" ) )
		{
			break;
		}
		
		if( !token.Icmp( "{" ) )
		{
			if( stages.Num() >= MAX_PARTICLE_STAGES )
			{
				src.Error( "Too many particle stages" );
				MakeDefault();
				return false;
			}
			idParticleStage* stage = ParseParticleStage( src );
			if( !stage )
			{
				src.Warning( "Particle stage parse failed" );
				MakeDefault();
				return false;
			}
			stages.Append( stage );
			continue;
		}
		
		if( !token.Icmp( "depthHack" ) )
		{
			depthHack = src.ParseFloat();
			continue;
		}
		
		src.Warning( "bad token %s", token.c_str() );
		MakeDefault();
		return false;
	}
	
	// don't calculate bounds or write binary files for defaulted ( non-existent ) particles in resource builds
	if( fileSystem->UsingResourceFiles() )
	{
		bounds = idBounds( vec3_origin ).Expand( 8.0f );
		return true;
	}
	//
	// calculate the bounds
	//
	bounds.Clear();
	for( int i = 0; i < stages.Num(); i++ )
	{
		GetStageBounds( stages[i] );
		bounds.AddBounds( stages[i]->bounds );
	}
//.........这里部分代码省略.........
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:DeclParticle.cpp


注:本文中的idBounds函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。