コード例 #1
0
ファイル: Vis.c プロジェクト: 5432935/genesis3d
// FIXME:  Put the fog in Fog.c
//=====================================================================================
//	VisFog
//=====================================================================================
static void VisFog(geEngine *Engine, geWorld *World, const geCamera *Camera, Frustum_Info *Fi, int32 Area)
{
	GBSP_BSPData	*BSPData;
	GFX_Leaf		*GFXLeafs;
	geFog			*Fog;
	World_BSP		*CBSP;
	Frustum_Info	WorldSpaceFrustum;
	//geVec3d			*Pos;

	assert(World);
	assert(Camera);
	assert(Fi);

	World->NumVisibleFog = 0;

	if (!World->FogList)
		return;				// Don't waste time

	//return;

	// Make the frustum go to world space
	Frustum_TransformToWorldSpace(Fi, Camera, &WorldSpaceFrustum);

	CBSP = World->CurrentBSP;
	
	BSPData = &CBSP->BSPData;

	GFXLeafs = BSPData->GFXLeafs;
	
	for (Fog = World->FogList; Fog; Fog = Fog->Next)
	{
		geWorld_FogData	*FogData;

		if (World->NumVisibleFog >= MAX_VISIBLE_FOG)
			return;		// Oh well...
		
		FogData = (geWorld_FogData*)geFog_GetUserData(Fog);

		if (CBSP->LeafData[FogData->Leaf].VisFrame != World->CurFrameStatic)
			continue;		// might not be visible

		if (Area != GFXLeafs[FogData->Leaf].Area)
			continue;		// Fog only effects it's own area

		// If not in the view frustum, then tottaly ignore...
		if (!Frustum_PointInFrustum(&WorldSpaceFrustum, &Fog->Pos, Fog->VolumeRadius-1.0f))
			continue;
		
		FogData->VisFrame = World->CurFrameDynamic;

		// Add it to the list
		World->VisibleFog[World->NumVisibleFog++] = Fog;
		
		// For debugging...
		Engine->DebugInfo.NumFog++;
	}
}
コード例 #2
0
ファイル: User.c プロジェクト: RealityFactory/Genesis3D
//=====================================================================================
//	User_SetCameraInfo
//=====================================================================================
geBoolean User_SetCameraInfo(geEngine *Engine, geWorld *World, geCamera *Camera, Frustum_Info *Fi)
{
	assert(Engine != NULL);
	assert(World != NULL);
	assert(World->UserInfo != NULL);
	assert(Camera != NULL);
	assert(Fi != NULL);

	gWorld = World;
	gEngine = Engine;
	gCamera = Camera;
	gBSP = World->CurrentBSP;
	gGFXLeafs = World->CurrentBSP->BSPData.GFXLeafs;
	gGFXModels = World->CurrentBSP->BSPData.GFXModels;

	// Make the frustum go to World/Model space
	Frustum_TransformToWorldSpace(Fi, Camera, &gWorldSpaceFrustum);

	return GE_TRUE;	
}