예제 #1
0
void MainWindow::setupTextures()
{
	//renderer->addNormalMap("../Resources/AssetGroups/Ogre/ogre_normalmap.png", "ogreNormal");
	//renderer->addDiffuseMap("../Resources/AssetGroups/Ogre/diffuse.png", "ogreDiffuse");
	//renderer->addAmbientOcclusionMap("../Resources/AssetGroups/Ogre/ao_ears.png", "ogreAO");

	renderer->addNormalMap("../Resources/AssetGroups/Cauldron/cauldronNormal.png", "cauldronNormal");
	renderer->addDiffuseMap("../Resources/AssetGroups/Cauldron/cauldronDiffuse.png", "cauldronDiffuse");
	renderer->addNormalMap("../Resources/AssetGroups/Cauldron/liquidBurnNormal.png", "liquidBurnNormal");
	renderer->addNormalMap("../Resources/AssetGroups/Cauldron/liquidNormal.png", "liquidNormal");
	renderer->addDiffuseMap("../Resources/AssetGroups/Cauldron/liquidBurnDiffuse.png", "liquidBurnDiffuse");
	renderer->addDiffuseMap("../Resources/AssetGroups/Cauldron/liquidDiffuse.png", "liquidDiffuse");
	renderer->addDiffuseMap("../Resources/Textures/alchemyRoomTexture.png", "alchRoomTexture");
	renderer->addDiffuseMap("../Resources/Textures/alchemyRoomOuterTexture.png", "alchRoomOuterTexture");
	renderer->addDiffuseMap("../Resources/Textures/alchemyTableTexture.png", "alchTableTexture");
	renderer->addDiffuseMap("../Resources/Textures/glassTexture.png", "alchTableGlassTexture");
	renderer->addDiffuseMap("../Resources/Textures/metalBitsTexture.png", "alchTableMetalTexture");
	renderer->addDiffuseMap("../Resources/Textures/liquidsTexture.png", "alchTableLiquidsTexture");
	renderer->addDiffuseMap("../Resources/Textures/potionLargeTexture1.png", "potLTexture1");
	renderer->addDiffuseMap("../Resources/Textures/potionSmallTexture1.png", "potSTexture1");
	renderer->addDiffuseMap("../Resources/Textures/potionThinTexture1.png", "potTTexture1");
	renderer->addDiffuseMap("../Resources/Textures/potionWideTexture1.png", "potWTexture1");
	renderer->addDiffuseMap("../Resources/Textures/potionSkoomaTexture1.png", "potVTexture1");

	uchar* data = createNoiseTexture();
	noiseMap = renderer->addAlphaMap(data, noiseWidth, noiseHeight, "noiseTexture");
	dMenu->addFloatSlider("tab", &octaveIndex, 0,3,"Octave");
	data = createNoiseTexture();
	renderer->addAmbientOcclusionMap(data, noiseWidth, noiseHeight, "burnNoise");
}
예제 #2
0
void LLPostProcess::initialize(unsigned int width, unsigned int height)
{
	destroyGL();
	mScreenWidth = width;
	mScreenHeight = height;

	createScreenTextures();
	createNoiseTexture();

	//Setup our VBO.
	{
		mVBO = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1,3);
		mVBO->allocateBuffer(4,0,TRUE);

		LLStrider<LLVector3> v;
		LLStrider<LLVector2> uv1;
		LLStrider<LLVector2> uv2;

		mVBO->getVertexStrider(v);
		mVBO->getTexCoord0Strider(uv1);
		mVBO->getTexCoord1Strider(uv2);
	
		v[0] = LLVector3( uv2[0] = uv1[0] = LLVector2(0, 0) );
		v[1] = LLVector3( uv2[1] = uv1[1] = LLVector2(0, mScreenHeight) );
		v[2] = LLVector3( uv2[2] = uv1[2] = LLVector2(mScreenWidth, 0) );
		v[3] = LLVector3( uv2[3] = uv1[3] = LLVector2(mScreenWidth, mScreenHeight) );

		mVBO->flush();
	}
	stop_glerror();
}
void LLPostProcess::createNightVisionShader(void)
{
	/// Define uniform names
	nightVisionUniforms["RenderTexture"] = 0;
	nightVisionUniforms["NoiseTexture"] = 0;
	nightVisionUniforms["brightMult"] = 0;	
	nightVisionUniforms["noiseStrength"] = 0;
	nightVisionUniforms["lumWeights"] = 0;	

	createNoiseTexture(mNoiseTexture);
}
int TextureManager::init(char *errorString)
{
	// Free everything if there was something before.
	releaseAll();

	int retVal = initializeDefaultSensor(errorString);
	if (retVal != 0) return retVal;

	// create small and large rendertarget texture
	createRenderTargetTexture(errorString, X_OFFSCREEN, Y_OFFSCREEN, TM_OFFSCREEN_NAME);
	createRenderTargetTexture(errorString, X_HIGHLIGHT, Y_HIGHLIGHT, TM_HIGHLIGHT_NAME);
	createNoiseTexture(errorString, TM_NOISE_NAME);
	createNoiseTexture3D(errorString, TM_NOISE3D_NAME);

	// Create texture for depth sensor (kinect)
	CreateSensorTexture(errorString, TM_DEPTH_SENSOR_NAME);

	// Go throught the textures directory and load all textures.
	HANDLE hFind = INVALID_HANDLE_VALUE;
	WIN32_FIND_DATA ffd;

	// Go to first file in textures directory
	char *dirname = TM_DIRECTORY TM_SHADER_WILDCARD;
	hFind = FindFirstFile(TM_DIRECTORY TM_SHADER_WILDCARD, &ffd);
	if (hFind == INVALID_HANDLE_VALUE)
	{
		sprintf_s(errorString, MAX_ERROR_LENGTH,
				  "IO Error\nThere are no textures in " TM_DIRECTORY);
		return -1;
	}

	// Load all the textures in the directory
	do
	{		
		// Note that the number of textures is increased automatically
		int retVal = loadTGA(ffd.cFileName, errorString);
		if (retVal) return retVal;
	} while (FindNextFile(hFind, &ffd));

	return 0;
}
예제 #5
0
void
ParticleSystem::_initialize(int numParticles, bool bUseGL)
{
    assert(!m_bInitialized);

    //    initCuda(bUseGL);
    createNoiseTexture(64, 64, 64);

    m_numParticles = numParticles;

    // allocate GPU arrays
    m_pos.alloc(m_numParticles, m_bUseVBO, true);    // create as VBO
    m_vel.alloc(m_numParticles, m_bUseVBO, true);

    m_sortKeys.alloc(m_numParticles);
    m_indices.alloc(m_numParticles, m_bUseVBO, false, true); // create as index buffer

    sdkCreateTimer(&m_timer);
    setParameters(&m_params);

    m_bInitialized = true;
}