コード例 #1
0
ファイル: RenderObject.cpp プロジェクト: alex-games/games2015
bool RenderObject::setTexture(const std::string &n)
{
	std::string name = n;
	stringToLowerUserData(name);

	if (name.empty())
		return false;

	if(texture && name == texture->name)
		return true; // no texture change

	TextureLoadResult res = TEX_FAILED;
	CountedPtr<Texture> tex = core->addTexture(name, &res);
	setTexturePointer(tex);
	return !!tex && res != TEX_FAILED;
}
コード例 #2
0
void RenderObject::setTexture(const std::string &n)
{
	std::string name = n;
	stringToLowerUserData(name);

	if (name.empty())
        return;

    if(texture && texture->name == core->getInternalTextureName(name))
        return; // no texture change

    Texture *oldtex = texture;
	Texture *t = core->addTexture(name);
	setTexturePointer(t, NO_ADD_REF);

    if (oldtex)
        oldtex->removeRef();
}