mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-14 04:59:58 +01:00
vk: read alpha for material base_color, fixes #308
This commit is contained in:
parent
139807a559
commit
51318fc77f
@ -16,7 +16,7 @@ static const xvk_material_t k_default_material = {
|
||||
|
||||
.metalness = 0.f,
|
||||
.roughness = 1.f,
|
||||
.base_color = { 1.f, 1.f, 1.f },
|
||||
.base_color = { 1.f, 1.f, 1.f, 1.f },
|
||||
|
||||
.set = false,
|
||||
};
|
||||
@ -58,12 +58,7 @@ static void loadMaterialsFromFile( const char *filename, int depth ) {
|
||||
const char *path_end = Q_strrchr(filename, '/');
|
||||
byte *data = gEngine.fsapi->LoadFile( filename, 0, false );
|
||||
char *pos = (char*)data;
|
||||
xvk_material_t current_material = {
|
||||
.base_color = -1,
|
||||
.metalness = tglob.blackTexture,
|
||||
.roughness = tglob.whiteTexture,
|
||||
.tex_normalmap = 0,
|
||||
};
|
||||
xvk_material_t current_material = k_default_material;
|
||||
int current_material_index = -1;
|
||||
qboolean force_reload = false;
|
||||
qboolean create = false;
|
||||
@ -150,7 +145,7 @@ static void loadMaterialsFromFile( const char *filename, int depth ) {
|
||||
} else if (Q_stricmp(key, "metalness") == 0) {
|
||||
sscanf(value, "%f", ¤t_material.metalness);
|
||||
} else if (Q_stricmp(key, "base_color") == 0) {
|
||||
sscanf(value, "%f %f %f", ¤t_material.base_color[0], ¤t_material.base_color[1], ¤t_material.base_color[2]);
|
||||
sscanf(value, "%f %f %f %f", ¤t_material.base_color[0], ¤t_material.base_color[1], ¤t_material.base_color[2], ¤t_material.base_color[3]);
|
||||
} else {
|
||||
gEngine.Con_Printf(S_ERROR "Unknown material key %s\n", key);
|
||||
continue;
|
||||
|
@ -8,7 +8,7 @@ typedef struct {
|
||||
int tex_metalness;
|
||||
int tex_normalmap;
|
||||
|
||||
vec3_t base_color;
|
||||
vec4_t base_color;
|
||||
float roughness;
|
||||
float metalness;
|
||||
|
||||
|
@ -194,7 +194,7 @@ static void applyMaterialToKusok(vk_kusok_data_t* kusok, const vk_render_geometr
|
||||
gcolor[0] = color[0] * mat->base_color[0];
|
||||
gcolor[1] = color[1] * mat->base_color[1];
|
||||
gcolor[2] = color[2] * mat->base_color[2];
|
||||
gcolor[3] = color[3];
|
||||
gcolor[3] = color[3] * mat->base_color[3];
|
||||
Vector4Copy(gcolor, kusok->color);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user