v0.3.0 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
22class Material;
23
25struct Ground {
26
27 // [Public Types]
28
30 struct Procedural {
31
32 // [Public Types]
33
36
37 // [Public Member Variables]
38
40 float spacing {1.0f};
41 float lineWidthPixels {1.0f};
42 float reliefStrength {0.0f};
43 };
44
46 struct Grid {
47
48 // [Public Member Variables]
49
51 std::optional<GridComponent> minor {};
52 std::optional<GridComponent> major {};
54 0.15f};
56 32.0f};
57 };
58
60 using Content = std::variant<Grid>;
61
62 // [Public Member Variables]
63
65 };
66
68 using Fill = std::variant<Procedural, std::shared_ptr<Material>>;
69
71 struct RadialFade {
72
73 // [Public Member Variables]
74
76 math::vec2 center {0.0f, 0.0f};
77 float startDistance {10.0f};
78 float endDistance {100.0f};
79 };
80
82 struct HorizonHaze {
83
84 // [Public Member Variables]
85
88 math::radians(3.0f)};
89 };
90
91 // [Public Member Variables]
92
94 std::optional<RadialFade> radialFade {};
95 std::optional<HorizonHaze> horizonHaze {};
96};
97
98} // namespace a3d
99
100#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:82
float angularWidth
Angular extent from the horizon, in radians; must be in (0, pi/2].
Definition: Ground.h:87
Color color
Horizon-haze color.
Definition: Ground.h:86
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:42
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:41
Configures a procedural grid with optional minor and major line components.
Definition: Ground.h:46
Color color
Base ground color between grid lines.
Definition: Ground.h:50
std::optional< GridComponent > major
Optional major grid lines.
Definition: Ground.h:52
std::optional< GridComponent > minor
Optional minor grid lines.
Definition: Ground.h:51
float specularExponent
Phong specular exponent; must be greater than zero; higher values produce narrower highlights.
Definition: Ground.h:55
float specularIntensity
Phong specular intensity coefficient; must be non-negative; zero disables specular highlights.
Definition: Ground.h:53
Configures a procedurally rendered ground fill.
Definition: Ground.h:30
std::variant< Grid > Content
Supported procedural ground content.
Definition: Ground.h:60
Content content
Procedural content to render.
Definition: Ground.h:64
Configures a radial transition from the ground fill toward a color.
Definition: Ground.h:71
float startDistance
Distance from the center where fading begins; must be non-negative.
Definition: Ground.h:77
math::vec2 center
Center of the radial fade on the ground surface.
Definition: Ground.h:76
float endDistance
Distance where fading completes; must be greater than startDistance.
Definition: Ground.h:78
Color color
Color approached beyond the fade range.
Definition: Ground.h:75
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:68
Fill fill
Ground fill to render.
Definition: Ground.h:93
std::optional< RadialFade > radialFade
Optional radial fade applied to the ground.
Definition: Ground.h:94
std::optional< HorizonHaze > horizonHaze
Optional haze applied around the ground horizon.
Definition: Ground.h:95