Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.LevelGridVolume


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
/**
 * Copyright 1998-2011 Epic Games, Inc. All Rights Reserved.
 */
class LevelGridVolume extends Volume
	native
	dependson(KMeshProps)
	hidecategories(Advanced,Attachment,Collision,Volume,Physics,Location)
	autoexpandcategories(LevelGridVolume)
	placeable;



/** Structure contains coordinates for a single grid cell */
struct native LevelGridCellCoordinate
{
	/** Cell X coordinate */
	var int X;

	/** Cell Y coordinate */
	var int Y;

	/** Cell Z coordinate */
	var int Z;

	structcpptext
	{
		/** Constructor */
		FLevelGridCellCoordinate()
			: X( 0 ), Y( 0 ), Z( 0 )
		{
		}

		/** Equality operator */
		UBOOL operator==( const FLevelGridCellCoordinate& RHS ) const
		{
			return ( RHS.X == X && RHS.Y == Y && RHS.Z == Z );
		}
	}
};



/** Possible shapes for grid cells */
enum LevelGridCellShape
{
	/** Axis-aligned boxes */
	LGCS_Box,

	/** Hexagonal prism */
	LGCS_Hex
};


/** Name of this level grid volume, which is also the prefix for level names created for volume.  If empty, the level grid volume actor's name will be used instead.  You should set this name before placing any actors into the level, and never change it afterwards! */
var() const string LevelGridVolumeName;

/** Shape of the cells this grid is composed of */
var() const LevelGridCellShape CellShape;

/** The number of streaming volumes should the grid be subdivided into along each axis.  Be careful when changing this after actors have been added to the level grid volume! */
var() const int Subdivisions[ 3 ];

/*
* Width of each grid cell (X axis size.)  Be careful when changing this after actors have been added to the level grid volume! /
var() const int CellWidth;

* Depth of each grid cell (Y axis size.)  Be careful when changing this after actors have been added to the level grid volume! /
var() const int CellDepth;

* Height of each grid cell (Z axis size.)  Be careful when changing this after actors have been added to the level grid volume! /
var() const int CellHeight;

* Location offset for all grid cells in the map.  Be careful when changing this after actors have been added to the level grid volume! /
var() const vector GridOffset;
*/


/** Minimum distance between a grid cell and the viewer before a cell's level will be queued to stream in */
var() const float LoadingDistance;

/** Extra distance before the LoadingDistance which levels should stay loaded.  This can be used to prevent a level from continuously being loaded and unloaded as the viewer's distance to the cell crosses the LoadingDistance threshold. */
var() const float KeepLoadedRange;

/** Grid cell convex shape, used for fast distance tests */
var const transient KConvexElem CellConvexElem;



cpptext
{
	/**
	 * Gets the "friendly" name of this grid volume
	 *
	 * @return	The name of this grid volume
	 */
	FString GetLevelGridVolumeName() const;


	/**
	 * UObject: Performs operations after the object is loaded
	 */
	virtual void PostLoad();


	/**
	 * UObject: Called when a property value has been changed in the editor.
	 *
	 * @param	PropertyThatChanged		The property that changed, or NULL
	 */
	virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);


	/**
	 * Computes the world space bounds of the entire grid
	 *
	 * @return	Bounds of the grid in world space
	 */
	FBox GetGridBounds() const;


	/**
	 * Computes the size of a grid subdivision (not necessarily the same as a grid cell's bounds!)
	 *
	 * @return	Size of a grid subdivision
	 */
	FVector GetGridCellSubdivisionSize() const;


	/**
	 * Computes the size of a single grid cell
	 *
	 * @return	Size of the cell
	 */
	FVector GetGridCellSize() const;



	/**
	 * Computes the world space bounds of a single grid cell
	 *
	 * @param	InCoords	Coordinate of cell to compute bounds for
	 *
	 * @return	Bounds of the cell in world space
	 */
	FBox GetGridCellBounds( const FLevelGridCellCoordinate& InCoords ) const;


	/**
	 * Updates the convex volume that represents the shape of a single cell within this volume.
	 * Important: The convex volume is centered about the origin and not relative to any volume or cell!
	 */
	void UpdateConvexCellVolume();


	/**
	 * Computes the center point of a grid cell
	 *
	 * @param	InCoords	Coordinate of cell to compute bounds for
	 *
	 * @return	Center point of the cell in world space
	 */
	FVector GetGridCellCenterPoint( const FLevelGridCellCoordinate& InCoords ) const;


	/**
	 * Computes the 2D shape of a hex cell for this volume
	 *
	 * @param	OutHexPoints	Array that will be filled in with the 6 hexagonal points
	 */
	void ComputeHexCellShape( FVector2D* OutHexPoints ) const;


	/**
	 * Gets all levels associated with this level grid volume (not including the P level)
	 *
	 * @param	OutLevels	List of levels (out)
	 */
	void GetLevelsForAllCells( TArray< class ULevelStreaming* >& OutLevels ) const;


	/**
	 * Finds the level for the specified cell coordinates
	 *
	 * @param	InCoords	Grid cell coordinates
	 *
	 * @return	Level streaming record for level at the specified coordinates, or NULL if not found
	 */
	class ULevelStreaming* FindLevelForGridCell( const FLevelGridCellCoordinate& InCoords ) const;


	/**
	 * Returns true if the specified actor belongs in this grid network
	 *
	 * @param	InActor		The actor to check
	 *
	 * @return	True if the actor belongs in this grid network
	 */
	UBOOL IsActorMemberOfGrid( AActor* InActor ) const;


	/**
	 * Returns true if the specified cell is 'usable'.  That is, the bounds of the cell overlaps the actual
	 * level grid volume's brush
	 *
	 * @return	True if the specified cell is 'usable'
	 */
	UBOOL IsGridCellUsable( const FLevelGridCellCoordinate& InCellCoord ) const;


	/**
	 * Computes the grid cell that a box should be associated with based on the cell that it most
	 * overlaps.  If the box doesn't overlap any cells but bMustOverlap is false, then the function
	 * will choose the cell that's closest to the box.
	 *
	 * @param	InBox			The box to test
	 * @param	bMustOverlap	True if the box must overlap a cell for the function to succeed
	 * @param	OutBestCell		(Out) The best cell for the box
	 *
	 * @return	True if a cell was found for the box.  If bMustOverlap is false, the function will always return true.
	 */
	UBOOL FindBestGridCellForBox( const FBox& InBox, const UBOOL bMustOverlap, FLevelGridCellCoordinate& OutBestCell ) const;


	/**
	 * Checks to see if an AABB overlaps the specified grid cell
	 *
	 * @param	InCellCoord		The grid cell coordinate to test against
	 * @param	InBox			The world space AABB to test
	 *
	 * @return	True if the box overlaps the grid cell
	 */
	UBOOL TestWhetherCellOverlapsBox( const FLevelGridCellCoordinate& InCellCoord, const FBox& InBox ) const;


	/**
	 * Computes the minimum distance between the specified point and grid cell in world space
	 *
	 * @param	InCellCoord		The grid cell coordinate to test against
	 * @param	InPoint			The world space location to test
	 *
	 * @return	Squared distance to the cell
	 */
	FLOAT ComputeSquaredDistanceToCell( const FLevelGridCellCoordinate& InCellCoord, const FVector& InPoint ) const;


	/**
	 * Determines whether or not the level associated with the specified grid cell should be loaded based on
	 * distance to the viewer's position
	 *
	 * @param	InCellCoord			The grid cell coordinate associated with the level we're testing
	 * @param	InViewLocation		The viewer's location
	 * @param	bIsAlreadyLoaded	Pass true if the associated level is already loaded, otherwise false.  This is used to determine whether we should keep an already-loaded level in memory based on a configured distance threshold.
	 *
	 * @return	True if level should be loaded (or for already-loaded levels, should stay loaded)
	 */
	UBOOL ShouldLevelBeLoaded( const FLevelGridCellCoordinate& InCellCoord, const FVector& InViewLocation, const UBOOL bIsAlreadyLoaded ) const;


	/**
	 * AActor: Checks this actor for errors.  Called during the map check phase in the editor.
	 */
#if WITH_EDITOR
	virtual void CheckForErrors();
#endif
}


defaultproperties
{
	Begin Object Name=BrushComponent0
		CollideActors=False
		BlockActors=False
		BlockZeroExtent=False
		BlockNonZeroExtent=False
		BlockRigidBody=False
	End Object

	Begin Object Class=LevelGridVolumeRenderingComponent Name=LevelGridVolumeRenderer
	End Object
	Components.Add(LevelGridVolumeRenderer)

	bColored=true

	// Grey brush
	BrushColor=(R=80,G=80,B=80,A=255)

	bCollideActors=False
	bBlockActors=False
	bProjTarget=False
	SupportedEvents.Empty

	CellShape=LGCS_Box
	Subdivisions[0]=1
	Subdivisions[1]=1
	Subdivisions[2]=1

	LoadingDistance=20480
	KeepLoadedRange=2048
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: to 6-1-2011 07:10:42.000 - Creation time: ti 22-3-2011 19:57:07.553 - Created with UnCodeX