muhuk / yer

A terrain generation toolkit
GNU General Public License v3.0
0 stars 0 forks source link

Add basic layer type: constant layer #16

Open muhuk opened 1 week ago

muhuk commented 1 week ago

A layer that evaluates to a constant value.

This will be part of the new project template.

0 is a good defaut value but it should be possible to use other values. Both as a default elevation and also to be mixed in with masks.

Main Purpose of a Layer is Calculating Heights

trait Sample2D {
    fn sample(&self, point: Vec2, height: f32) -> f32
}

Different Layer Types as Different Components or a Single Enum Component

The relationship between an entity and a component is 1-to-1 (zero or one). So it is not possible to add multiple instances of the same component to the same entity. But if we make a component for each different layer type a layer entity can potentially have multiple of these components on it and this would create an ambiguity.

Instead if we model it as a single enum component each entity can have at most one type of layer at most.

UI