improvements
This commit is contained in:
parent
e5ca283fdd
commit
19b7aefa02
BIN
libtacoma.so
BIN
libtacoma.so
Binary file not shown.
@ -25,3 +25,30 @@ VK_KHR_acceleration_structure
|
||||
VK_KHR_ray_query
|
||||
|
||||
BLAS Compaction: 2.6MB -> 0.9MB (1.7MB saved, 66.1% smaller)
|
||||
_______________
|
||||
Vulkan Version:
|
||||
- available: 1.4.309
|
||||
- requesting: 1.3.0
|
||||
______________________
|
||||
Used Instance Layers :
|
||||
VK_LAYER_KHRONOS_validation
|
||||
|
||||
Used Instance Extensions :
|
||||
____________________
|
||||
Devices : 1
|
||||
0: AMD Radeon RX 6950 XT
|
||||
- Compatible
|
||||
Compatible physical devices found : 1
|
||||
Using Device:
|
||||
- Device Name : AMD Radeon RX 6950 XT
|
||||
- Vendor : AMD
|
||||
- Driver Version : 2.0.341
|
||||
- API Version : 1.4.308
|
||||
- Device Type : Discrete GPU
|
||||
________________________
|
||||
Used Device Extensions :
|
||||
VK_KHR_deferred_host_operations
|
||||
VK_KHR_acceleration_structure
|
||||
VK_KHR_ray_query
|
||||
|
||||
BLAS Compaction: 2.6MB -> 0.9MB (1.7MB saved, 66.1% smaller)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
master_volume 0.642776
|
||||
music_volume 0.522385
|
||||
sfx_volume 1
|
||||
fullscreen 1
|
||||
fullscreen 0
|
||||
|
||||
@ -304,7 +304,6 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) {
|
||||
bottom := area.y + area.h;
|
||||
sliders_h := ui_h(18, 0);
|
||||
|
||||
// Toggle: Palette | Color Picker
|
||||
r.h = row_h;
|
||||
half := r.w / 2;
|
||||
r.w = half;
|
||||
@ -322,7 +321,6 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) {
|
||||
if use_color_picker {
|
||||
GR.color_picker(r, *current_color, *theme.color_picker_theme);
|
||||
} else {
|
||||
// Palette file selector
|
||||
if g_palettes.count > 1 {
|
||||
r.h = row_h;
|
||||
pal_w := r.w / cast(float)g_palettes.count;
|
||||
@ -350,7 +348,6 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) {
|
||||
}
|
||||
r.y += top_h;
|
||||
|
||||
// Trile material picker
|
||||
unique_mats : [..]Material;
|
||||
unique_mats.allocator = temp;
|
||||
for x: 0..15 for y: 0..15 for z: 0..15 {
|
||||
@ -374,11 +371,11 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) {
|
||||
array_add(*as_entries, e);
|
||||
}
|
||||
|
||||
r.h = bot_h;
|
||||
r.h = bot_h * 0.75;
|
||||
region2, inside2 := GR.begin_scrollable_region(r, *theme.scrollable_region_theme);
|
||||
end_y2 := draw_swatches(as_entries, inside2, block, *trile_palette_scroll, 10000, theme);
|
||||
GR.end_scrollable_region(region2, inside2.x + inside2.w, end_y2, *trile_palette_scroll);
|
||||
r.y += bot_h;
|
||||
r.y += bot_h * 0.75;
|
||||
|
||||
r.h = ui_h(3, 2);
|
||||
GR.label(r, "Roughness", *t_label_left(theme));
|
||||
@ -391,7 +388,7 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) {
|
||||
r.y += r.h;
|
||||
GR.label(r, "Emittance", *t_label_left(theme));
|
||||
r.y += r.h;
|
||||
GR.slider(r, *emittance, 0, 2, 1, *theme.slider_theme);
|
||||
GR.slider(r, *emittance, 0, 127, 1, *theme.slider_theme);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -490,10 +490,17 @@ void main() {
|
||||
|
||||
vec3 albedo = trixel_material.xyz;
|
||||
int packedMaterial = int(round(trixel_material.w * 255.0));
|
||||
float emittance = float((packedMaterial >> 1) & 0x3) / 3.0;
|
||||
int roughnessInt = (packedMaterial >> 5) & 0x7;
|
||||
float roughness = max(float(roughnessInt) / 7.0, 0.05);
|
||||
float metallic = float((packedMaterial >> 3) & 0x3) / 3.0;
|
||||
float emittance = 0.0;
|
||||
int roughnessInt = 0;
|
||||
float roughness = 0.05;
|
||||
float metallic = 0.0;
|
||||
if ((packedMaterial & 0x1) != 0) {
|
||||
emittance = float((packedMaterial >> 1) & 0x7F) / 127.0;
|
||||
} else {
|
||||
roughnessInt = (packedMaterial >> 5) & 0x7;
|
||||
roughness = max(float(roughnessInt) / 7.0, 0.05);
|
||||
metallic = float((packedMaterial >> 3) & 0x3) / 3.0;
|
||||
}
|
||||
|
||||
// Snap normal to nearest axis to avoid interpolation noise
|
||||
vec3 absN = abs(fnormal.xyz);
|
||||
|
||||
@ -100,10 +100,17 @@ void main() {
|
||||
// Get the material info.
|
||||
vec3 albedo = color.xyz;
|
||||
int packedMaterial = int(round(color.w*255.0));
|
||||
float emittance = float((packedMaterial >> 1) & 0x3) / 3.0;
|
||||
int roughnessInt = (packedMaterial >> 5) & 0x7;
|
||||
float roughness = max(float(roughnessInt) / 7.0, 0.05);
|
||||
float metallic = float((packedMaterial >> 3) & 0x3) / 3.0;
|
||||
float emittance = 0.0;
|
||||
int roughnessInt = 0;
|
||||
float roughness = 0.05;
|
||||
float metallic = 0.0;
|
||||
if ((packedMaterial & 0x1) != 0) {
|
||||
emittance = float((packedMaterial >> 1) & 0x7F) / 127.0;
|
||||
} else {
|
||||
roughnessInt = (packedMaterial >> 5) & 0x7;
|
||||
roughness = max(float(roughnessInt) / 7.0, 0.05);
|
||||
metallic = float((packedMaterial >> 3) & 0x3) / 3.0;
|
||||
}
|
||||
|
||||
// Ambient light.
|
||||
vec3 light = 0.3 * albedo;
|
||||
|
||||
@ -136,10 +136,9 @@ ltriles :: () {
|
||||
} @Command
|
||||
|
||||
Material :: struct {
|
||||
addRoughness : u8 = 0;
|
||||
roughness : u8 = 4;
|
||||
metallic : u8 = 0;
|
||||
emittance : u8 = 0;
|
||||
emittance : u8 = 0; // 0 = not emissive; 1-127 = emissive (replaces roughness/metallic in encoding)
|
||||
color : Vector3 = .{1.0, 0.0, 1.0};
|
||||
}
|
||||
|
||||
@ -174,12 +173,14 @@ TrixelSerialize :: [5]u8;
|
||||
|
||||
TrileSerialize :: struct {
|
||||
name : string = "test";
|
||||
version : int = 0;
|
||||
trixels : [16][16][16] TrixelSerialize;
|
||||
};
|
||||
|
||||
trile_to_serialize_form :: (t: Trile) -> TrileSerialize {
|
||||
ts := TrileSerialize.{
|
||||
name = t.name,
|
||||
name = t.name,
|
||||
version = 1,
|
||||
};
|
||||
for i: 0..15 {
|
||||
for j: 0..15 {
|
||||
@ -193,16 +194,27 @@ trile_to_serialize_form :: (t: Trile) -> TrileSerialize {
|
||||
}
|
||||
|
||||
trile_from_serialize_form :: (ts: TrileSerialize) -> Trile {
|
||||
t := Trile.{
|
||||
name = sprint("%",ts.name)
|
||||
};
|
||||
t := Trile.{ name = sprint("%", ts.name) };
|
||||
for i: 0..15 {
|
||||
for j: 0..15 {
|
||||
for k: 0..15 {
|
||||
matinfo := ts.trixels[i][j][k];
|
||||
mat := material_from_rgba(matinfo[1], matinfo[2], matinfo[3], matinfo[4]);
|
||||
mat : Material;
|
||||
if ts.version == 0 {
|
||||
// Old format: bit 0=addRoughness(unused), bits 1-2=emittance(0-3), bits 3-4=metallic, bits 5-7=roughness
|
||||
packed := matinfo[4];
|
||||
old_emittance := (packed >> 1) & 0x3;
|
||||
mat.metallic = (packed >> 3) & 0x3;
|
||||
mat.roughness = (packed >> 5) & 0x7;
|
||||
mat.emittance = old_emittance * 42; // scale 0-3 → 0,42,84,126
|
||||
mat.color.x = cast(float) matinfo[1] / 255.0;
|
||||
mat.color.y = cast(float) matinfo[2] / 255.0;
|
||||
mat.color.z = cast(float) matinfo[3] / 255.0;
|
||||
} else {
|
||||
mat = material_from_rgba(matinfo[1], matinfo[2], matinfo[3], matinfo[4]);
|
||||
}
|
||||
t.trixels[i][j][k].material = mat;
|
||||
t.trixels[i][j][k].empty = matinfo[0] == 0;
|
||||
t.trixels[i][j][k].empty = matinfo[0] == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,8 +222,12 @@ trile_from_serialize_form :: (ts: TrileSerialize) -> Trile {
|
||||
}
|
||||
|
||||
material_encode_to_char :: (mat: Material) -> u8 {
|
||||
return (mat.addRoughness & 0x1) | ((mat.emittance & 0x3) << 1) |
|
||||
((mat.metallic & 0x3) << 3) | ((mat.roughness & 0x7) << 5);
|
||||
if mat.emittance > 0 {
|
||||
// Emissive mode: bit 0 = 1, bits 1-7 = emittance (0-127)
|
||||
return 0x1 | ((mat.emittance & 0x7F) << 1);
|
||||
}
|
||||
// Material mode: bit 0 = 0, bits 3-4 = metallic, bits 5-7 = roughness
|
||||
return ((mat.metallic & 0x3) << 3) | ((mat.roughness & 0x7) << 5);
|
||||
}
|
||||
|
||||
material_encode_to_float :: (mat: Material) -> float {
|
||||
@ -220,9 +236,12 @@ material_encode_to_float :: (mat: Material) -> float {
|
||||
|
||||
material_decode_from_char :: (packedMaterial: u8) -> Material {
|
||||
mat : Material;
|
||||
mat.emittance = (packedMaterial >> 1) & 3;
|
||||
mat.roughness = (packedMaterial >> 5) & 7;
|
||||
mat.metallic = (packedMaterial >> 3) & 3;
|
||||
if packedMaterial & 0x1 {
|
||||
mat.emittance = (packedMaterial >> 1) & 0x7F;
|
||||
} else {
|
||||
mat.roughness = (packedMaterial >> 5) & 7;
|
||||
mat.metallic = (packedMaterial >> 3) & 3;
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user