Example #1
0
void collectDefines(const CommonVertexShaderParams& shaderParams, ShaderDefines& shaderDefines ) {

	shaderDefines.clear();

	if( shaderParams.skinning ) {	
			shaderDefines.addDefine("USE_SKINNING");
			shaderDefines.addDefine("NUM_BONES", shaderParams.bones + 1);
	}

	if( shaderParams.instancing ) {	
			shaderDefines.addDefine("USE_INSTANSING");
	}	
	
}
Example #2
0
void collectDefines(const CommonFragmentShaderParams& shaderParams, ShaderDefines& shaderDefines) {

	shaderDefines.clear();

	if( shaderParams.diffuseMap ) {
			shaderDefines.addDefine("USE_DIFFUSE_MAP");
	}
	if( shaderParams.detailMap ) {
			shaderDefines.addDefine("USE_DETAIL_MAP");
	}	
	if( shaderParams.normalMap ) {
			shaderDefines.addDefine("USE_NORMAL_MAP");
	}
	if( shaderParams.specularMap ) {
			shaderDefines.addDefine("USE_SPECULAR_MAP");
	}	
	if( shaderParams.emissionMap ) {
			shaderDefines.addDefine("USE_EMISSION_MAP");
	}	
	if( shaderParams.alphaTest ) {
			shaderDefines.addDefine("USE_ALPHA_TEST");
	}

}
Example #3
0
void RenderTest1()
{

	RenderParticleTest();

	/*
	SharedPtr<File> file = CreateFile();
	file->open( String("D:\\test.txt"), FILE_MODE_READ, FILE_TEXT);
	char buffer[1024];
	size_t size = file->read( 5, &buffer[0] );
	file->close();	
	*/

	SharedPtr<Foo111> foo = new Foo111;
	SharedPtr<Asset> asset;


	//asset->addListe
	asset = new TextureAsset("Content/tree_foliage.dds");
	asset->load();
	asset = new TextureAsset("Content/lizard_diff.dds");
	asset->load();
	//asset = new TextureAsset("Content/lizard_norm.dds");
	asset = new TextureAsset("Content/TerrainDiffuseArray.dds");
	asset->load();
	asset = new TextureAsset("Content/TerrainNormalArray.dds");

	//asset = new TextureAsset("Content/Terrain.dds");
	//asset = new TextureAsset("Content/Wood.dds");

	asset->addListener(foo);

	asset->load();

	asset->removeListener(foo);


	AssetName a1("DisciplesIII");
	SharedPtr<Skeleton> skeleton = CreateTestSkeleton();

	unsigned numBones = skeleton->getNumBones();

	TextureInfo info;
	gTextureManager = CreateTextureManager();
	SharedPtr<Texture> texture1 = gTextureManager->createTexture(info);
	SharedPtr<Texture> texture2 = gTextureManager->createTexture(AssetName("textures/fire.dds"));

	MaterialInfo materialInfo;
	SharedPtr<Material> material = GetMaterialManager()->createMaterial(materialInfo);

	material->setTexture(texture1, MATERIAL_TEXTURE_DEFFUSE);


	texture1 = NULL;
	texture2 = NULL;

	

	

	SharedPtr<Geometry> geometry = new Geometry;
	geometry->addItem(GeometryItem(3,0));
	geometry->addItem(GeometryItem(3,3));
	geometry->addItem(GeometryItem(3,6));

	geometry->addItem(GeometryItem(0,6,3,4,5));

	//geometry->set



	


	

	size_t s = sizeof(RenderProfile);
	Map map;
	for (int i = 0; i < 10000000; i++) {
		RenderProfile rf;
		rf.field = rand();
		rf.surface.skinning = 2;
		rf.postProcess.msaa = 4;
		rf.postProcess.dof = 2;
		//map.insert(Map::value_type(rf, NULL));
	}

	printf("Passed...\n");

	SharedPtr<Logger> logger = CreateLogger();
	logger->start("MyLog.log");
	logger->error("Render", "Hello!");	

	ShaderDefines  shaderDefines;
	shaderDefines.addDefine("USE_EMISSION_MAP");
	shaderDefines.addDefine("USE_DIFFUSE_MAP");
	shaderDefines.addDefine("USE_SPECULAR_MAP");
	shaderDefines.addDefine("USE_NORMAL_MAP");
	shaderDefines.addDefine("USE_DETAIL_MAP");
	shaderDefines.addDefine("USE_FOG");
	shaderDefines.addDefine("USE_3DC");
	shaderDefines.addDefine("NUM_SAMPLES",8);
	  
	String string = shaderDefines.getString();
	String defines = shaderDefines.getDefines();

	logger->info("Render", string);
	logger->info("Render", defines);

	logger->stop();




	SharedPtr<MemoryBuffer> mb = CreateMemoryBuffer(0xFFFF0000);
	if( mb ) {
			int* intPtr = (int*)mb->lock();
			intPtr[0] = 0xFFFF;
			intPtr[0] = 0xDEAD;
			mb->unlock();
	}
	mb=NULL;
	
	ResourceName texture3( "textures/particles/fire.dds");
	
	
	SharedPtr<RenderScene> rs = CreateRenderScene();
	SharedPtr<LightRenderSceneObject> sunLight = new LightRenderSceneObject;
	SharedPtr<ParticleSystemRenderSceneObject> particleSystemRenderSceneObject = new ParticleSystemRenderSceneObject;
	SharedPtr<TerrainRenderSceneObject> ts = new TerrainRenderSceneObject;
	SharedPtr<TextRenderSceneObject> textSceneObject = new TextRenderSceneObject;
	SharedPtr<MeshRenderSceneObject> meshSceneObject = new MeshRenderSceneObject;
	
	SharedPtr<LightRenderSceneObject> omniLights1 = new LightRenderSceneObject;
	SharedPtr<LightRenderSceneObject> omniLights2 = new LightRenderSceneObject;
	SharedPtr<LightRenderSceneObject> omniLights3 = new LightRenderSceneObject;


	//rs->
	SharedPtr<ParticleSystemManager> particleSystemManager = CreateParticleSystemManager();
	SharedPtr<ParticleSystem> particleSystem1 = particleSystemManager->createParticleSystem();
	SharedPtr<ParticleSystem> particleSystem2 = particleSystemManager->createParticleSystem();

	particleSystem1->addStream( new ParticleStream );
	particleSystem1->addStream( new ParticleStream );
		
	particleSystemRenderSceneObject->setParticleSystem(particleSystem1);

	particleSystem1 = NULL;
	particleSystem2 = NULL;


	rs->addLight(sunLight);

	LightInfo omniLightInfo;
	omniLightInfo.type = LIGHT_OMNI;
	omniLights1->setInfo(omniLightInfo);
	omniLights2->setInfo(omniLightInfo);
	omniLights3->setInfo(omniLightInfo);

	omniLights1->setColor(Color::RED, LIGHT_COLOR_DIFFUSE);

	rs->addLight(omniLights1);
	rs->addLight(omniLights2);
	rs->addLight(omniLights3);

	DynamicArray<SharedPtr<LightRenderSceneObject>> lights;
	rs->getLights(lights);


	rs->addMesh(meshSceneObject);
	//rs->addSceneObject(ps);
	//rs->addSceneObject(textSceneObject);

	textSceneObject->setText("Hello,world!");

	particleSystemRenderSceneObject->setTransform(Transform());


	rs->removeMesh(meshSceneObject);



	sunLight->setTransform(Transform());
	//light->


	rs->removeLight(omniLights1);
	rs->removeLight(omniLights2);
	rs->removeLight(omniLights3);

	rs->removeLight(sunLight);
	//rs->removeSceneObject(ps);


	 /*
	HardwareTexture* htexture = NULL;

	SharedPtr<TextureSurface> surface[10];
	for(unsigned mipLevel =0; mipLevel < 10; mipLevel++) {
		htexture->update(mipLevel, surface[mipLevel] );		
	}


	SharedPtr<TextureVolume> volume[10];
	for (unsigned mipLevel = 0; mipLevel < 10; mipLevel++) {
		//htexture->update(mipLevel, surface[mipLevel]);
		htexture->update(mipLevel, volume[mipLevel]);
	}
	*/


}