Ejemplo n.º 1
0
int SceneObject::findOrCreateSkybox(const char* pictureFiles[6])
{
	string name;
	for(int i = 0; i < 6; i++)
	{
		name += pictureFiles[i];
		name += ";";
	}

	Str2Idx::iterator it = m_textures.find(name);
	if(m_textures.end() != it)
	{
		return it->second;
	}

	USES_CONVERSION;

	PURESOFTIMGBUFF32 image;
	PuresoftDefaultPictureLoader picLoader;
	picLoader.loadFromFile(CA2W(pictureFiles[0]), &image);
	image.pixels = NULL;
	int tex = m_pipeline.createTexture(&image, 5);
	m_pipeline.getTexture(tex, &image, PuresoftFBO::LAYER_XPOS);
	picLoader.retrievePixel(&image);
	picLoader.close();
	for(int i = 1; i < 6; i++)
	{
		picLoader.loadFromFile(CA2W(pictureFiles[i]), &image);
		m_pipeline.getTexture(tex, &image, (PuresoftFBO::LAYER)i);
		picLoader.retrievePixel(&image);
		picLoader.close();
	}

	return m_textures[name] = tex;
}
Ejemplo n.º 2
0
int SceneObject::findOrCreateTexture(const char* pictureFile)
{
	Str2Idx::iterator it = m_textures.find(pictureFile);
	if(m_textures.end() != it)
	{
		return it->second;
	}

	USES_CONVERSION;

	PURESOFTIMGBUFF32 image;
	PuresoftDefaultPictureLoader picLoader;
	picLoader.loadFromFile(CA2W(pictureFile), &image);
	int tex = m_pipeline.createTexture(&image, 0, PuresoftFBO::WRAP);
	m_pipeline.getTexture(tex, &image);
	picLoader.retrievePixel(&image);
	picLoader.close();
	return m_textures[pictureFile] = tex;
}
Ejemplo n.º 3
0
static int findOrCreateTexture(const string& pictureFile, PuresoftPipeline* pipeline)
{
	static MapStrToIndex textures;

	MapStrToIndex::iterator it = textures.find(pictureFile);
	if(textures.end() != it)
	{
		return it->second;
	}

	USES_CONVERSION;

	PURESOFTIMGBUFF32 image;
	PuresoftDefaultPictureLoader picLoader;
	picLoader.loadFromFile(CA2W(pictureFile.c_str()), &image);
	int tex = pipeline->createTexture(&image);
	pipeline->getTexture(tex, &image);
	picLoader.retrievePixel(&image);
	picLoader.close();
	return textures[pictureFile] = tex;
}