khora_core/asset/materials/
mod.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//! Defines the core traits and material types for the rendering system.
16
17mod alpha_mode;
18mod emissive;
19mod standard;
20mod unlit;
21mod wireframe;
22
23pub use alpha_mode::*;
24pub use emissive::*;
25pub use standard::*;
26pub use unlit::*;
27pub use wireframe::*;
28
29use super::Asset;
30
31/// A trait for types that can be used as a material.
32///
33/// A material defines the surface properties of an object being rendered,
34/// influencing how it interacts with light and determining which shader
35// (`RenderPipeline`) is used to draw it.
36pub trait Material: Asset {}
37
38/// This is the key to our type-erased material handle system.
39/// We explicitly tell the compiler that a boxed, dynamic Material trait
40/// object can itself be treated as a valid Asset. This allows it to be
41/// stored inside an AssetHandle.
42impl Asset for Box<dyn Material> {}