MCPcopy Create free account
hub / github.com/crownengine/crown / set_texture

Method set_texture

src/world/material.cpp:100–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void Material::set_texture(StringId32 sampler_name, ResourceId texture_resource)
101{
102 const TextureResource *tr = (TextureResource *)_resource_manager->get(RESOURCE_TYPE_TEXTURE, texture_resource);
103 TextureData *td = material_resource::texture_data_array(_resource);
104 u32 idx = material_resource::texture_data_index(_resource, td, sampler_name);
105 TextureHandle *th = (TextureHandle *)material_resource::texture_handle(td, idx, _data);
106 th->texture_handle = tr->handle.idx;
107#if CROWN_CAN_RELOAD
108 u32 index = material_resource::texture_data_index(_resource, td, sampler_name);
109 _texture_resources[index] = (TextureResource *)tr;
110#endif
111}
112
113void Material::reload_textures(const TextureResource *old_resource, const TextureResource *new_resource)
114{

Callers 2

renderMethod · 0.80
load_apiFunction · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected