taisei/src/resource/material.h
Andrei Alexeyev 78266ace3f
pbr: refactor material management and shader
Introduced a new PBRMaterial resource type. Materials are now fully
described with .material files instead of being hardcoded. Added some
functions to abstract away and simplify set up of PBR shaders.
2021-09-01 00:21:50 +03:00

33 lines
830 B
C

/*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#pragma once
#include "taisei.h"
#include "resource.h"
#include "texture.h"
typedef struct PBRMaterial {
Texture *diffuse_map;
Texture *normal_map;
Texture *ambient_map;
Texture *roughness_map;
vec3 diffuse_color;
vec3 ambient_color;
float roughness_value;
float metallic_value;
} PBRMaterial;
extern ResourceHandler material_res_handler;
#define MATERIAL_PATH_PREFIX "res/gfx/"
#define MATERIAL_EXTENSION ".material"
DEFINE_RESOURCE_GETTER(PBRMaterial, res_material, RES_MATERIAL)
DEFINE_OPTIONAL_RESOURCE_GETTER(PBRMaterial, res_material_optional, RES_MATERIAL)