Skip to main content

khora_data/render/
grid.rs

1// Copyright 2025 eraflo
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Editor grid overlay configuration.
16//!
17//! The infinite ground grid is a debug / editor overlay. Like
18//! [`GizmoFrame`](super::GizmoFrame), only the contract type lives in
19//! `khora-data` — the GPU work is the engine-side `GridLane`'s job.
20//!
21//! A host application opts into the grid by enabling this config
22//! (shared as an `Arc<Mutex<GridConfig>>` runtime resource). The
23//! sandbox leaves it disabled — no grid; the editor enables it.
24
25/// Editor grid overlay state.
26#[derive(Debug, Clone, Default)]
27pub struct GridConfig {
28    /// Whether `GridLane` should render the infinite ground grid.
29    pub enabled: bool,
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn disabled_by_default() {
38        assert!(!GridConfig::default().enabled);
39    }
40}