Avara3D 0.2.0
C++ API reference
Ground.h
1//
2// Ground.h
3// avara3d
4//
5// Created by Morgan Davis on 8/9/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_VISUAL_GROUND_H
10#define AVARA3D_VISUAL_GROUND_H
11
12#include "a3d/Color.h"
13
14#include <memory>
15#include <optional>
16#include <variant>
17
18#include "a3d/Math.h"
19
20namespace a3d {
21
22 class Material;
23
25 struct Ground {
26
27 // [Public Types]
28
30 struct Procedural {
31
32 // [Public Types]
33
36
37 // [Public Member Variables]
38
40 float spacing {
41 1.0f};
42 float lineWidthPixels {1.0f};
43 float reliefStrength {0.0f};
44 };
45
47 struct Grid {
48
49 // [Public Member Variables]
50
52 std::optional<GridComponent> minor {};
53 std::optional<GridComponent> major {};
55 0.15f};
57 32.0f};
58 };
59
61 using Content = std::variant<Grid>;
62
63 // [Public Member Variables]
64
66 };
67
69 using Fill = std::variant<Procedural, std::shared_ptr<Material>>;
70
72 struct RadialFade {
73
74 // [Public Member Variables]
75
77 math::vec2 center {0.0f, 0.0f};
79 10.0f};
81 100.0f};
82 };
83
85 struct HorizonHaze {
86
87 // [Public Member Variables]
88
91 math::radians(3.0f)};
92 };
93
94 // [Public Member Variables]
95
97 std::optional<RadialFade> radialFade {};
98 std::optional<HorizonHaze> horizonHaze {};
99 };
100
101}
102
103#endif // AVARA3D_VISUAL_GROUND_H
Represents a normalized RGBA color.
Definition: Color.h:27
static Color Black()
Returns opaque black.
Configures haze concentrated around the ground horizon.
Definition: Ground.h:85
float angularWidth
Angular extent from the horizon, in radians; must be in (0, pi/2].
Definition: Ground.h:90
Color color
Horizon-haze color.
Definition: Ground.h:89
Configures one set of procedural grid lines.
Definition: Ground.h:35
Color color
Grid-line color.
Definition: Ground.h:39
float reliefStrength
Strength of procedural grid relief; zero disables relief.
Definition: Ground.h:43
float spacing
Distance between grid lines in scene units; must be greater than zero.
Definition: Ground.h:40
float lineWidthPixels
Grid-line width in pixels; must be greater than zero.
Definition: Ground.h:42
Configures a procedural grid with optional minor and major line components.
Definition: Ground.h:47
Color color
Base ground color between grid lines.
Definition: Ground.h:51
std::optional< GridComponent > major
Optional major grid lines.
Definition: Ground.h:53
std::optional< GridComponent > minor
Optional minor grid lines.
Definition: Ground.h:52
float specularExponent
Phong specular exponent; must be greater than zero; higher values produce narrower highlights.
Definition: Ground.h:56
float specularIntensity
Phong specular intensity coefficient; must be non-negative; zero disables specular highlights.
Definition: Ground.h:54
Configures a procedurally rendered ground fill.
Definition: Ground.h:30
std::variant< Grid > Content
Supported procedural ground content.
Definition: Ground.h:61
Content content
Procedural content to render.
Definition: Ground.h:65
Configures a radial transition from the ground fill toward a color.
Definition: Ground.h:72
float startDistance
Distance from the center where fading begins; must be non-negative.
Definition: Ground.h:78
math::vec2 center
Center of the radial fade on the ground surface.
Definition: Ground.h:77
float endDistance
Distance where fading completes; must be greater than startDistance.
Definition: Ground.h:80
Color color
Color approached beyond the fade range.
Definition: Ground.h:76
Configures ground rendering over a VisualWorld reference Surface.
Definition: Ground.h:25
std::variant< Procedural, std::shared_ptr< Material > > Fill
Procedural or material-backed ground fill.
Definition: Ground.h:69
Fill fill
Ground fill to render.
Definition: Ground.h:96
std::optional< RadialFade > radialFade
Optional radial fade applied to the ground.
Definition: Ground.h:97
std::optional< HorizonHaze > horizonHaze
Optional haze applied around the ground horizon.
Definition: Ground.h:98