Example #1
0
void ResourceManager::load(StringId64 type, StringId64 name)
{
	ResourcePair id = { type, name };
	ResourceEntry& entry = sort_map::get(_rm, id, ResourceEntry::NOT_FOUND);

	if (entry == ResourceEntry::NOT_FOUND)
	{
		TempAllocator64 ta;
		DynamicString type_str(ta);
		DynamicString name_str(ta);
		type.to_string(type_str);
		name.to_string(name_str);

		CE_ASSERT(_loader->can_load(type, name)
			, "Can't load resource #ID(%s-%s)"
			, type_str.c_str()
			, name_str.c_str()
			);
		CE_UNUSED(type_str);
		CE_UNUSED(name_str);

		ResourceRequest rr;
		rr.type = type;
		rr.name = name;
		rr.load_function = sort_map::get(_type_data, type, ResourceTypeData()).load;
		rr.allocator = &_resource_heap;
		rr.data = NULL;

		_loader->add_request(rr);
		return;
	}

	entry.references++;
}
Example #2
0
void ResourceManager::on_offline(StringId64 type, StringId64 name)
{
	OfflineFunction func = sort_map::get(_type_data, type, ResourceTypeData()).offline;

	if (func)
		func(name, *this);
}
Example #3
0
void ResourceManager::on_unload(StringId64 type, void* data)
{
	sort_map::get(_type_data, type, ResourceTypeData()).unload(_resource_heap, data);
}
Example #4
0
u32 BundleCompiler::version(StringId64 type)
{
	CE_ASSERT(sort_map::has(_compilers, type), "Compiler not found");

	return sort_map::get(_compilers, type, ResourceTypeData()).version;
}
Example #5
0
void BundleCompiler::compile(StringId64 type, const char* path, CompileOptions& opts)
{
	CE_ASSERT(sort_map::has(_compilers, type), "Compiler not found");

	sort_map::get(_compilers, type, ResourceTypeData()).compiler(path, opts);
}