From a73a726de20d40f63a2d4b6ff898741994cd36e1 Mon Sep 17 00:00:00 2001 From: matthiascy Date: Thu, 30 Nov 2023 14:24:22 +0100 Subject: [PATCH] update default material params --- pypkg/bk7084/app.py | 5 +++-- pyproject.toml | 2 +- src/core/material.rs | 2 +- src/render/rpass/blph.wgsl | 9 ++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pypkg/bk7084/app.py b/pypkg/bk7084/app.py index 3619ee8..8abf8b6 100644 --- a/pypkg/bk7084/app.py +++ b/pypkg/bk7084/app.py @@ -56,7 +56,7 @@ def add_point_light(self, pos: Vec3, color: Color, show_light: bool = False): color (Color): Color of the light. show_light (bool, optional): Whether to show the light object. Defaults to False. """ - entity = super().add_point_light_py(pos, color) + light = super().add_point_light_py(pos, color) if show_light: mat = Material() mat.diffuse = color @@ -66,7 +66,8 @@ def add_point_light(self, pos: Vec3, color: Color, show_light: bool = False): sphere = self.add_mesh(mesh) sphere.set_visible(True) sphere.set_transform(Mat4.from_translation(pos)) - return entity + return light, sphere + return light def run(self, builder: Window): """Starts the main loop.""" diff --git a/pyproject.toml b/pyproject.toml index c7a12ba..4c7371a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bk7084" -version = '0.3.9' +version = '0.3.10' description = "Python framework for BK7084 Computational Simulations" license = { file = "LICENSE" } keywords = ["bk7084", "computational", "simulations", "python", "graphics"] diff --git a/src/core/material.rs b/src/core/material.rs index 539bb5a..7cbbd96 100644 --- a/src/core/material.rs +++ b/src/core/material.rs @@ -177,7 +177,7 @@ impl Default for Material { Self { name: SmlString::from("material_default"), ambient: Some([1.0, 1.0, 1.0]), - diffuse: Some([0.9, 0.4, 0.3]), + diffuse: Some([0.7, 0.7, 0.7]), specular: Some([0.5, 0.5, 0.5]), shininess: Some(10.0), refractive_index: Some(1.0), diff --git a/src/render/rpass/blph.wgsl b/src/render/rpass/blph.wgsl index 3ac6b17..ac9ea35 100644 --- a/src/render/rpass/blph.wgsl +++ b/src/render/rpass/blph.wgsl @@ -257,6 +257,9 @@ fn fs_main(vout : VSOutput) -> @location(0) vec4 { // Ambient on. if (material.illum != 0u) { var ka = material.ka.rgb; + if (material.map_ka != INVALID_INDEX) { + ka = textureSample(textures[material.map_ka], samplers[texture_sampler_ids[material.map_ka]], vout.uv).rgb; + } var ia = vec3(0.0, 0.0, 0.0); for (var i : u32 = 0u; i < directional_lights.len; i++) { @@ -265,11 +268,7 @@ fn fs_main(vout : VSOutput) -> @location(0) vec4 { for (var i : u32 = 0u; i < point_lights.len; i++) { ia += point_lights.data[i].color; } - ia = 0.04 * ia / f32(directional_lights.len + point_lights.len); - - if (material.map_ka != INVALID_INDEX) { - ka = textureSample(textures[material.map_ka], samplers[texture_sampler_ids[material.map_ka]], vout.uv).rgb; - } + ia = 0.08 * ia / f32(directional_lights.len + point_lights.len); color += ka * ia * kd; }