summaryrefslogtreecommitdiff
path: root/engine/src/material.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/material.rs')
-rw-r--r--engine/src/material.rs40
1 files changed, 32 insertions, 8 deletions
diff --git a/engine/src/material.rs b/engine/src/material.rs
index 2b9a8ca..94ab24e 100644
--- a/engine/src/material.rs
+++ b/engine/src/material.rs
@@ -21,9 +21,9 @@ pub struct Material
impl Material
{
- pub fn builder() -> Builder
+ pub const fn builder() -> Builder
{
- Builder::default()
+ Builder::new()
}
}
@@ -51,7 +51,7 @@ pub struct Builder
impl Builder
{
#[must_use]
- pub fn new() -> Self
+ pub const fn new() -> Self
{
Self {
ambient: Color::WHITE_F32,
@@ -125,7 +125,7 @@ impl Builder
/// # Panics
/// Will panic if no ambient map, diffuse map or specular map is set.
#[must_use]
- pub fn build(self) -> Material
+ pub const fn build(self) -> Material
{
Material {
ambient: self.ambient,
@@ -149,8 +149,8 @@ impl Default for Builder
builder! {
/// Material flags.
-#[builder(name = FlagsBuilder, derives = (Debug, Default, Clone))]
-#[derive(Debug, Default, Clone, Component)]
+#[builder(name = FlagsBuilder, derives = (Debug, Clone))]
+#[derive(Debug, Clone, Component)]
#[non_exhaustive]
pub struct Flags
{
@@ -163,8 +163,32 @@ pub struct Flags
impl Flags
{
#[must_use]
- pub fn builder() -> FlagsBuilder
+ pub const fn builder() -> FlagsBuilder
{
- FlagsBuilder::default()
+ FlagsBuilder::new()
+ }
+}
+
+impl Default for Flags
+{
+ fn default() -> Self
+ {
+ Self::builder().build()
+ }
+}
+
+impl FlagsBuilder
+{
+ pub const fn new() -> Self
+ {
+ Self { use_ambient_color: false }
+ }
+}
+
+impl Default for FlagsBuilder
+{
+ fn default() -> Self
+ {
+ Self::new()
}
}