void Material::use_depth(Graphics *graphics, ResourceCache *cache) { Texture *albedo = cache->get<Texture2D>(get_albedo_texture()); graphics->set_texture(0, albedo); Program *program = cache->get_program(m_depth_vert_shader, m_depth_frag_shader); update_program_depth(program); graphics->set_cull_mode(get_cull_mode()); }
void RasterizerState::init(const RasterizerDesc& desc) { desc_.cull = get_cull_mode(desc.cull); desc_.winding = get_winding_order(desc.order); GLboolean write_color = desc.color_write ? GL_TRUE : GL_FALSE; desc_.color_mask[0] = write_color; desc_.color_mask[1] = write_color; desc_.color_mask[2] = write_color; desc_.color_mask[3] = write_color; }
void Material::use(Graphics *graphics, ResourceCache *cache, DepthTexture *shadowmap) { Texture *albedo = cache->get<Texture2D>(get_albedo_texture()); Texture *normal = cache->get<Texture2D>(get_normal_texture()); Texture *roughness = cache->get<Texture2D>(get_roughness_texture()); Texture *metallic = cache->get<Texture2D>(get_metallic_texture()); Texture *env = cache->get<TextureCube>(get_env_texture()); graphics->set_texture(0, albedo); graphics->set_texture(1, normal); graphics->set_texture(2, roughness); graphics->set_texture(3, metallic); graphics->set_texture(4, g_env_brdf); graphics->set_texture(5, shadowmap); graphics->set_texture(6, env); Program *program = cache->get_program(m_vert_shader, m_frag_shader); update_program(program); graphics->set_cull_mode(get_cull_mode()); graphics->set_blend_enabled(is_blending_enabled()); }