Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Properties | List of all members
PQS Class Reference
Inheritance diagram for PQS:

Classes

struct  GnomonicUV
 
class  VertexBuildData
 

Public Types

enum  EdgeState {
  EdgeState.Reset = -1, EdgeState.NoLerps = 0, EdgeState.NorthLerp = 1, EdgeState.SouthLerp = 2,
  EdgeState.EastLerp = 4, EdgeState.WestLerp = 8
}
 
enum  ModiferRequirements {
  ModiferRequirements.Default = 0, ModiferRequirements.UniqueMaterialInstances = 1, ModiferRequirements.VertexMapCoords = 2, ModiferRequirements.VertexGnomonicMapCoords = 4,
  ModiferRequirements.UVSphereCoords = 8, ModiferRequirements.UVQuadCoords = 16, ModiferRequirements.MeshColorChannel = 32, ModiferRequirements.MeshCustomNormals = 64,
  ModiferRequirements.MeshBuildTangents = 128, ModiferRequirements.MeshUV2 = 256, ModiferRequirements.MeshUV3 = 512, ModiferRequirements.MeshUV4 = 1024,
  ModiferRequirements.MeshAssignTangents = 2048
}
 
enum  QuadChild {
  QuadChild.SouthWest = 0, QuadChild.SouthEast = 1, QuadChild.NorthWest = 2, QuadChild.NorthEast = 3,
  QuadChild.Null = -1
}
 
enum  QuadEdge {
  QuadEdge.North = 0, QuadEdge.South = 1, QuadEdge.East = 2, QuadEdge.West = 3,
  QuadEdge.Null = -1
}
 
enum  QuadPlane {
  QuadPlane.XP, QuadPlane.XN, QuadPlane.YP, QuadPlane.YN,
  QuadPlane.ZP, QuadPlane.ZN
}
 

Public Member Functions

void ActivateSphere ()
 
virtual void ApplyTerrainShaderSettings ()
 Apply the terrain shader settings. More...
 
PQ AssignQuad (int subdiv)
 
Color BilinearInterpColorMap (Texture2D texture)
 
Color BilinearInterpColorMap (Vector3 planetPos, Texture2D texture)
 
double BilinearInterpFloatMap (Texture2D texture)
 
double BilinearInterpFloatMap (Vector3 planetPos, Texture2D texture)
 
bool BuildQuad (PQ quad)
 
void ClearCache ()
 
void CloseExternalRender ()
 
Texture2D[] CreateMaps (int width, double maxHeight, bool hasOcean, double oceanHeight, Color oceanColor)
 
void DeactivateSphere ()
 
void DestroyQuad (PQ quad)
 
void DisableSphere ()
 
void EnableSphere ()
 
void ForceStart ()
 
double GetAltitude (Vector3d worldPosition)
 
double GetClampedWorldAltitude (Vector3 worldPosition)
 
double GetClampedWorldSurfaceHeight (Vector3 worldPosition)
 
double GetRelativeAltitude (Vector3 worldPosition)
 
Vector3d GetRelativeDirection (Vector3d worldDirection)
 
double GetRelativeDistance (Vector3 worldPosition)
 
double GetRelativeDistanceSqr (Vector3 worldDirection)
 
Vector3d GetRelativePosition (Vector3d worldPosition)
 
Vector3 GetRightmostCornerNormal (PQ caller, PQ nextQuad)
 Gets the normal to the right of the side facing the next quad from the quad diagonally opposite the corner. More...
 
double GetSurfaceHeight (Vector3d radialVector)
 
Vector3d GetWorldPosition (Vector3d localPosition)
 
void QuadCreated (PQ quad)
 
bool RayIntersection (Vector3 worldStart, Vector3 worldDirection, out double intersectionDistance)
 
bool RayIntersection (Vector3 worldStart, Vector3 worldDirection, out Vector3d intersection)
 
void RebuildSphere ()
 
void ResetAndWait ()
 
void ResetSphere ()
 
void SetCache ()
 
void SetSecondaryTarget (Transform secondaryTarget)
 
void SetTarget (Transform target)
 
void SetupExternalRender ()
 
void StartUpSphere ()
 

Static Public Member Functions

static void BuildNormals (PQ quad)
 
static void BuildNormalsNoClear (PQ quad)
 
static void CreateCache ()
 
static QuadEdge GetEdgeRotatedClockwise (QuadEdge edge)
 Rotates the direction clockwise. More...
 
static QuadEdge GetEdgeRotatedCounterclockwise (QuadEdge edge)
 Rotates the direction counter clockwise. More...
 
static bool LineSphereIntersection (Vector3d relPos, Vector3d relVel, double radius, out Vector3d relIntersection)
 
static void LoadCacheSettings (ConfigNode node)
 
static int ti (int x, int z)
 
static int vi (int x, int z)
 

Public Attributes

bool buildTangents
 
bool cancelUpdate
 can cancel the update from PreUpdate More...
 
double circumference
 
double collapseAltitudeMax
 
double collapseAltitudeValue
 
double collapseDelta
 
double collapseSeaLevelValue
 
double collapseThreshold
 
double[] collapseThresholds
 
bool DEBUG_ShowGUI
 
bool DEBUG_ShowGUIRebuild
 
bool DEBUG_UseSharedMaterial = false
 
bool defaultInspector
 
double detailAltitudeMax
 
double detailAltitudeQuads
 
double detailDelta
 
double detailRad
 
double detailSeaLevelQuads
 
Material fallbackMaterial
 
float frameTimeDelta
 
double halfChord
 
Material highQualitySurfaceMaterial
 High quality terrain material. More...
 
double horizonAngle
 
double horizonDistance
 
bool isActive
 can turn off the pqs More...
 
bool isAlive
 used for the pqs's master startup and shutdown. not to be meddled with More...
 
bool isBuildingMaps
 is building the maps More...
 
bool isDisabled
 
bool isFakeBuild
 
bool isStarted
 can turn off the pqs More...
 
bool isSubdivisionEnabled
 
bool isThinking
 failsafe restart check in case it crashes... blush :p More...
 
GameObject LocalSpacePQStorage
 
Material lowQualitySurfaceMaterial
 Low quality terrain material. More...
 
string mapFilename
 
int mapFilesize
 
double mapMaxHeight
 
bool mapOcean
 
Color mapOceanColor
 
double mapOceanHeight
 
List< Material > materialsForUpdates = new List<Material>()
 
double maxDetailDistance
 
float maxFrameEnd
 
float maxFrameTime
 
int maxLevel
 
int maxLevelAtCurrentTgtSpeed
 
float maxQuadLenghtsPerFrame = 0.03f
 
Material mediumQualitySurfaceMaterial
 Medium quality terrain material. More...
 
bool meshCastShadows
 
bool meshRecieveShadows
 
double meshVertMax
 maximum known vertex height - updates as subdivision occurs, dont assume this is a fixed value More...
 
double meshVertMin
 minimum known vertex height - updates as subdivision occurs, dont assume this is a fixed value More...
 
double minDetailDistance
 
int minLevel
 
List< PQnormalUpdateList
 
PQS parentSphere
 
PQSMod_CelestialBodyTransform PQSModCBTransform
 
bool quadAllowBuild
 
int quadCount
 
int[] quadCounts
 
PQ[] quads
 
double radius
 
double radiusDelta
 
double radiusMax
 
double radiusMin
 
double radiusSquared
 
Vector3d relativeSecondaryTargetPosition
 
Vector3d relativeTargetPosition
 
Vector3d relativeTargetPositionNormalized
 
bool reqAssignTangents
 
bool reqBuildTangents
 
bool reqColorChannel
 
bool reqCustomNormals
 
bool reqGnomonicCoords
 
bool reqSphereUV
 
bool reqUV2
 
bool reqUV3
 
bool reqUV4
 
bool reqUVQuad
 
bool reqVertexMapCoods
 
Transform secondaryTarget
 
int seed
 
double subdivisionThreshold
 
double[] subdivisionThresholds
 
Material surfaceMaterial
 Selected terrain material. More...
 
bool surfaceRelativeQuads
 
double sy
 
Transform target
 
double targetAltitude
 
double targetHeight
 
double targetSecondaryAltitude
 
double targetSpeed
 
Vector3d targetVelocity
 
Vector3d transformPosition
 
QuaternionD transformRotation
 
Material ultraQualitySurfaceMaterial
 Ultra High quality terrain material. More...
 
bool useSharedMaterial
 
double visibleAltitude
 
double visibleRadius
 
double visRad
 
double visRadAltitudeMax
 
double visRadAltitudeValue
 
double visRadDelta
 
double visRadSeaLevelValue
 

Static Public Attributes

static Color[] cacheColors
 
static int[][] cacheIndices
 index caches More...
 
static Mesh cacheMesh
 cached mesh More...
 
static float cacheMeshSize = 1f
 
static Vector3[] cacheNormals
 
static float cacheQuadSize = 1f
 
static float cacheQuadSizeDiv2 = cacheQuadSize / 2f
 
static int cacheRes
 side vert count - 1 More...
 
static int cacheResDiv2
 cacheRes / 2 More...
 
static int cacheResDiv2Plus1
 (cacheRes / 2) + 1 More...
 
static int cacheSideVertCount = 15
 must be odd More...
 
static Vector4[] cacheTangents
 
static int cacheTriCount
 triangle count (triIndexCount / 3) More...
 
static int cacheTriIndexCount
 total indices in plane mesh More...
 
static Vector2[] cacheUV2s
 
static Vector2[] cacheUV3s
 
static Vector2[] cacheUV4s
 
static Vector2d[] cacheUVQuad
 
static Vector2[] cacheUVs
 
static int cacheVertCount
 total verts in plane mesh More...
 
static double cacheVertCountReciprocal = 1d / (cacheSideVertCount * cacheSideVertCount)
 
static Vector3[] cacheVerts
 
static PQS_GameBindings GameBindings = new PQS_GameBindings()
 
static bool Global_AllowScatter = true
 
static bool Global_ForceShaderModel = true
 
static double Global_ScatterFactor = 1.0d
 
static Vector3[] tan1
 
static Vector3[] tan2
 
static Vector3d[] verts
 

Static Protected Member Functions

static void BuildTangents (PQ quad)
 

Properties

PQS[] ChildSpheres [get]
 
EventData< PQSOnReady [get]
 
Vector3d PrecisePosition [get, set]
 

Member Enumeration Documentation

Enumerator
Reset 
NoLerps 
NorthLerp 
SouthLerp 
EastLerp 
WestLerp 
Enumerator
Default 
UniqueMaterialInstances 
VertexMapCoords 
VertexGnomonicMapCoords 
UVSphereCoords 
UVQuadCoords 
MeshColorChannel 
MeshCustomNormals 
MeshBuildTangents 
MeshUV2 
MeshUV3 
MeshUV4 
MeshAssignTangents 
Enumerator
SouthWest 
SouthEast 
NorthWest 
NorthEast 
Null 
Enumerator
North 
South 
East 
West 
Null 
Enumerator
XP 
XN 
YP 
YN 
ZP 
ZN 

Member Function Documentation

void PQS.ActivateSphere ( )
inline
virtual void PQS.ApplyTerrainShaderSettings ( )
inlinevirtual

Apply the terrain shader settings.

PQ PQS.AssignQuad ( int  subdiv)
inline
Color PQS.BilinearInterpColorMap ( Texture2D  texture)
inline
Color PQS.BilinearInterpColorMap ( Vector3  planetPos,
Texture2D  texture 
)
inline
double PQS.BilinearInterpFloatMap ( Texture2D  texture)
inline
double PQS.BilinearInterpFloatMap ( Vector3  planetPos,
Texture2D  texture 
)
inline
static void PQS.BuildNormals ( PQ  quad)
inlinestatic
static void PQS.BuildNormalsNoClear ( PQ  quad)
inlinestatic
bool PQS.BuildQuad ( PQ  quad)
inline

< do any mods

< add mesh stuff to quad

static void PQS.BuildTangents ( PQ  quad)
inlinestaticprotected

< Gram-Schmidt orthogonalize

< Calculate handedness

void PQS.ClearCache ( )
inline
void PQS.CloseExternalRender ( )
inline
static void PQS.CreateCache ( )
inlinestatic

< work out few bits we'll need for vert spamming

< create verts

< create tangents

< Gram-Schmidt orthogonalize

< Calculate handedness

< some other temp arrays we'll be needing

Texture2D [] PQS.CreateMaps ( int  width,
double  maxHeight,
bool  hasOcean,
double  oceanHeight,
Color  oceanColor 
)
inline
void PQS.DeactivateSphere ( )
inline
void PQS.DestroyQuad ( PQ  quad)
inline
void PQS.DisableSphere ( )
inline
void PQS.EnableSphere ( )
inline
void PQS.ForceStart ( )
inline
double PQS.GetAltitude ( Vector3d  worldPosition)
inline
double PQS.GetClampedWorldAltitude ( Vector3  worldPosition)
inline
double PQS.GetClampedWorldSurfaceHeight ( Vector3  worldPosition)
inline
static QuadEdge PQS.GetEdgeRotatedClockwise ( QuadEdge  edge)
inlinestatic

Rotates the direction clockwise.

Parameters
edgeEdge direction which we want to rotate.
Returns
The edge rotated clockwise.
static QuadEdge PQS.GetEdgeRotatedCounterclockwise ( QuadEdge  edge)
inlinestatic

Rotates the direction counter clockwise.

Parameters
edgeEdge direction which we want to rotate.
Returns
The edge rotated counter clockwise.
double PQS.GetRelativeAltitude ( Vector3  worldPosition)
inline
Vector3d PQS.GetRelativeDirection ( Vector3d  worldDirection)
inline
double PQS.GetRelativeDistance ( Vector3  worldPosition)
inline
double PQS.GetRelativeDistanceSqr ( Vector3  worldDirection)
inline
Vector3d PQS.GetRelativePosition ( Vector3d  worldPosition)
inline
Vector3 PQS.GetRightmostCornerNormal ( PQ  caller,
PQ  nextQuad 
)
inline

Gets the normal to the right of the side facing the next quad from the quad diagonally opposite the corner.

Parameters
callerPQ for which we want to get a corner normal for interpolation.
nextQuadPQ to help us decide the sampling direction.
Returns
The normal from the PQ diagonally opposite the calling quad.
double PQS.GetSurfaceHeight ( Vector3d  radialVector)
inline
Vector3d PQS.GetWorldPosition ( Vector3d  localPosition)
inline
static bool PQS.LineSphereIntersection ( Vector3d  relPos,
Vector3d  relVel,
double  radius,
out Vector3d  relIntersection 
)
inlinestatic
static void PQS.LoadCacheSettings ( ConfigNode  node)
inlinestatic
void PQS.QuadCreated ( PQ  quad)
inline
bool PQS.RayIntersection ( Vector3  worldStart,
Vector3  worldDirection,
out double  intersectionDistance 
)
inline
bool PQS.RayIntersection ( Vector3  worldStart,
Vector3  worldDirection,
out Vector3d  intersection 
)
inline
void PQS.RebuildSphere ( )
inline
void PQS.ResetAndWait ( )
inline
void PQS.ResetSphere ( )
inline
void PQS.SetCache ( )
inline
void PQS.SetSecondaryTarget ( Transform  secondaryTarget)
inline
void PQS.SetTarget ( Transform  target)
inline
void PQS.SetupExternalRender ( )
inline
void PQS.StartUpSphere ( )
inline
static int PQS.ti ( int  x,
int  z 
)
inlinestatic
static int PQS.vi ( int  x,
int  z 
)
inlinestatic

Member Data Documentation

bool PQS.buildTangents
Color [] PQS.cacheColors
static
int [][] PQS.cacheIndices
static

index caches

Mesh PQS.cacheMesh
static

cached mesh

float PQS.cacheMeshSize = 1f
static
Vector3 [] PQS.cacheNormals
static
float PQS.cacheQuadSize = 1f
static
float PQS.cacheQuadSizeDiv2 = cacheQuadSize / 2f
static
int PQS.cacheRes
static

side vert count - 1

int PQS.cacheResDiv2
static

cacheRes / 2

int PQS.cacheResDiv2Plus1
static

(cacheRes / 2) + 1

int PQS.cacheSideVertCount = 15
static

must be odd

Vector4 [] PQS.cacheTangents
static
int PQS.cacheTriCount
static

triangle count (triIndexCount / 3)

int PQS.cacheTriIndexCount
static

total indices in plane mesh

Vector2 [] PQS.cacheUV2s
static
Vector2 [] PQS.cacheUV3s
static
Vector2 [] PQS.cacheUV4s
static
Vector2d [] PQS.cacheUVQuad
static
Vector2 [] PQS.cacheUVs
static
int PQS.cacheVertCount
static

total verts in plane mesh

double PQS.cacheVertCountReciprocal = 1d / (cacheSideVertCount * cacheSideVertCount)
static
Vector3 [] PQS.cacheVerts
static
bool PQS.cancelUpdate

can cancel the update from PreUpdate

double PQS.circumference
double PQS.collapseAltitudeMax
double PQS.collapseAltitudeValue
double PQS.collapseDelta
double PQS.collapseSeaLevelValue
double PQS.collapseThreshold
double [] PQS.collapseThresholds
bool PQS.DEBUG_ShowGUI
bool PQS.DEBUG_ShowGUIRebuild
bool PQS.DEBUG_UseSharedMaterial = false
bool PQS.defaultInspector
double PQS.detailAltitudeMax
double PQS.detailAltitudeQuads
double PQS.detailDelta
double PQS.detailRad
double PQS.detailSeaLevelQuads
Material PQS.fallbackMaterial
float PQS.frameTimeDelta
PQS_GameBindings PQS.GameBindings = new PQS_GameBindings()
static
bool PQS.Global_AllowScatter = true
static
bool PQS.Global_ForceShaderModel = true
static
double PQS.Global_ScatterFactor = 1.0d
static
double PQS.halfChord
Material PQS.highQualitySurfaceMaterial

High quality terrain material.

double PQS.horizonAngle
double PQS.horizonDistance
bool PQS.isActive

can turn off the pqs

bool PQS.isAlive

used for the pqs's master startup and shutdown. not to be meddled with

bool PQS.isBuildingMaps

is building the maps

bool PQS.isDisabled
bool PQS.isFakeBuild
bool PQS.isStarted

can turn off the pqs

bool PQS.isSubdivisionEnabled
bool PQS.isThinking

failsafe restart check in case it crashes... blush :p

GameObject PQS.LocalSpacePQStorage
Material PQS.lowQualitySurfaceMaterial

Low quality terrain material.

string PQS.mapFilename
int PQS.mapFilesize
double PQS.mapMaxHeight
bool PQS.mapOcean
Color PQS.mapOceanColor
double PQS.mapOceanHeight
List<Material> PQS.materialsForUpdates = new List<Material>()
double PQS.maxDetailDistance
float PQS.maxFrameEnd
float PQS.maxFrameTime
int PQS.maxLevel
int PQS.maxLevelAtCurrentTgtSpeed
float PQS.maxQuadLenghtsPerFrame = 0.03f
Material PQS.mediumQualitySurfaceMaterial

Medium quality terrain material.

bool PQS.meshCastShadows
bool PQS.meshRecieveShadows
double PQS.meshVertMax

maximum known vertex height - updates as subdivision occurs, dont assume this is a fixed value

double PQS.meshVertMin

minimum known vertex height - updates as subdivision occurs, dont assume this is a fixed value

double PQS.minDetailDistance
int PQS.minLevel
List<PQ> PQS.normalUpdateList
PQS PQS.parentSphere
PQSMod_CelestialBodyTransform PQS.PQSModCBTransform
bool PQS.quadAllowBuild
int PQS.quadCount
int [] PQS.quadCounts
PQ [] PQS.quads
double PQS.radius
double PQS.radiusDelta
double PQS.radiusMax
double PQS.radiusMin
double PQS.radiusSquared
Vector3d PQS.relativeSecondaryTargetPosition
Vector3d PQS.relativeTargetPosition
Vector3d PQS.relativeTargetPositionNormalized
bool PQS.reqAssignTangents
bool PQS.reqBuildTangents
bool PQS.reqColorChannel
bool PQS.reqCustomNormals
bool PQS.reqGnomonicCoords
bool PQS.reqSphereUV
bool PQS.reqUV2
bool PQS.reqUV3
bool PQS.reqUV4
bool PQS.reqUVQuad
bool PQS.reqVertexMapCoods
Transform PQS.secondaryTarget
int PQS.seed
double PQS.subdivisionThreshold
double [] PQS.subdivisionThresholds
Material PQS.surfaceMaterial

Selected terrain material.

bool PQS.surfaceRelativeQuads
double PQS.sy
Vector3 [] PQS.tan1
static
Vector3 [] PQS.tan2
static
Transform PQS.target
double PQS.targetAltitude
double PQS.targetHeight
double PQS.targetSecondaryAltitude
double PQS.targetSpeed
Vector3d PQS.targetVelocity
Vector3d PQS.transformPosition
QuaternionD PQS.transformRotation
Material PQS.ultraQualitySurfaceMaterial

Ultra High quality terrain material.

bool PQS.useSharedMaterial
Vector3d [] PQS.verts
static
double PQS.visibleAltitude
double PQS.visibleRadius
double PQS.visRad
double PQS.visRadAltitudeMax
double PQS.visRadAltitudeValue
double PQS.visRadDelta
double PQS.visRadSeaLevelValue

Property Documentation

PQS [] PQS.ChildSpheres
get
EventData<PQS> PQS.OnReady
get
Vector3d PQS.PrecisePosition
getset

The documentation for this class was generated from the following file: