Table of Contents

Class RainCoverData

Namespace
DFA.Puddlecraft

Saved rain cover for one scene: a top-down grid of the highest surface over each spot. A point lower than that surface is under cover (a roof, an awning, a bridge) and gets no rain. Baked in the editor with ray tracing against render meshes.

[Icon("Packages/com.dfa.puddlecraft/editor/icons/puddlecraft.png")]
public sealed class RainCoverData : ScriptableObject
Inheritance
RainCoverData

Fields

NoCover

Cover heights at or below this mean no geometry was found.

public const float NoCover = -100000

Field Value

float

Properties

cellSize

Side of one grid cell, in metres.

public float cellSize { get; }

Property Value

float

heights

The cover heights, one RFloat texel per cell. Readable on the CPU.

public Texture2D heights { get; }

Property Value

Texture2D

isValid

True when the map holds baked data.

public bool isValid { get; }

Property Value

bool

origin

World XZ of the grid's corner.

public Vector2 origin { get; }

Property Value

Vector2

resolutionX

Number of cells along world X.

public int resolutionX { get; }

Property Value

int

resolutionZ

Number of cells along world Z.

public int resolutionZ { get; }

Property Value

int

size

Size of the grid in metres, along world X and Z.

public Vector2 size { get; }

Property Value

Vector2

Methods

CoverHeight(Vector3)

Height of the highest surface over a world position, or NoCover outside the grid.

public float CoverHeight(Vector3 position)

Parameters

position Vector3

Returns

float

IsExposed(Vector3, float)

True when rain reaches a world position: nothing in the grid sits more than tolerance metres above it.

public bool IsExposed(Vector3 position, float tolerance = 0.1)

Parameters

position Vector3
tolerance float

Returns

bool