Esempio n. 1
0
bool SpriteResource_CheckCreated(SpriteResource* resource)
{
	if (resource->state != ResourceState_CreationInProgress)
		return resource->state == ResourceState_Created;

	for (std::map<std::string, SpriteResource::Animation>::iterator it = resource->animations.begin(); it != resource->animations.end(); ++it)
		for (std::vector<SpriteResource::Frame>::iterator it2 = it->second.frames.begin(); it2 != it->second.frames.end(); ++it2)
		{
			const Resource* texture = (const Resource*) Texture_Get(it2->texture);
			if (texture->state == ResourceState_CreationInProgress)
				return false;
			else if (texture->state == ResourceState_FailedToCreate)
			{
				resource->state = ResourceState_FailedToCreate;
				Log::Error(string_format("SpriteObj resource %s failed to load (asynchronously)", resource->name.c_str()));
				return false;
			}
		}

	resource->state = ResourceState_Created;
	resource->width = resource->defaultAnimation->frames[0].texture.GetWidth();
	resource->height = resource->defaultAnimation->frames[0].texture.GetHeight();
	Assert(resource->width && resource->height);
	return true;
}
Esempio n. 2
0
bool operator != (Texture& texture, const TextureObj* obj)
{
	return Texture_Get(texture) != obj;
}
Esempio n. 3
0
void Material::SetTextureParameter(const std::string& name, Texture& value, const Sampler& sampler) { if (obj) Material_SetTextureParameter(obj, name, Texture_Get(value), sampler); }
Esempio n. 4
0
void Material::SetTextureParameter(int index, Texture& value, const Sampler& sampler) { if (obj) Material_SetTextureParameter(obj, index, Texture_Get(value), sampler); }