Renderer::Renderer(const Desc & desc)
	: RendererHelper<1>("PerlinNoiseOceanRenderer", "PerlinNoiseOceanWireFrameRenderer", Renderer::ERenderPass::Deferred_Pass)
	, mHeightMapCS(nullptr)
	, mCubeMapTexture(Engine::GetInstance()->GetTextureManager()->LoadTextureCubeMap(desc.mSkyboxCubeMapTextureFilename))
	, mOceanColorTexture(Engine::GetInstance()->GetTextureManager()->LoadTexture2D("medias/textures/OceanColor256.tif", GL_REPEAT, GL_REPEAT))
	//, mOceanColorTexture(Engine::GetInstance()->GetTextureManager()->GetDefaultTexture2D())
	, mHeightMapTextureSize(desc.mHeightMapTextureSize)
	, mMapSize(desc.mMapWidth, desc.mMapDepth)
	, mPatchCount(desc.mMapWidth / 64, desc.mMapDepth / 64)
	, mMapCount(0)
	, mDrawNormalShader("TerrainDrawNormals")
{
	PRINT_BEGIN_SECTION;
	PRINT_MESSAGE("Initialize PerlinNoiseOceanRenderer.....");

	const glm::vec3 vertices[] =
	{
		glm::vec3(0.0f,	0.0f, 0.0f),
		glm::vec3(1.0f,	0.0f, 0.0f),
		glm::vec3(0.0f,	0.0f, 1.0f),
		glm::vec3(1.0f,	0.0f, 1.0f)
	};
		

	//setup vao and vbo stuff
	CreateBuffers();

	glBindVertexArray(mVaoID);

	glBindBuffer(GL_ARRAY_BUFFER, mVboIDs[VertexArrayBufferIndex]);
	glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
	GL_CHECK_ERRORS;

	glEnableVertexAttribArray(Shader::POSITION_ATTRIBUTE);
	glVertexAttribPointer(Shader::POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), 0);
	GL_CHECK_ERRORS;

	glPatchParameteri(GL_PATCH_VERTICES, 4);

	glBindVertexArray(0);

	GL_CHECK_ERRORS;

	mMapCount = (GLint)desc.mMaps.size();

	PerMapData * modelMatrixBuffer = new PerMapData[mMapCount];
	for (int i = 0; i < mMapCount; ++i)
	{
		modelMatrixBuffer[i].mModelDQ = desc.mMaps[i].mModelDQ;
	}
	mModelMatrixBuffer.CreateResource(GL_STATIC_DRAW, GL_RGBA32F, (mMapCount * sizeof(PerMapData)), modelMatrixBuffer);

	LoadShaders(desc);

	mIsInitialized = true;

	PRINT_MESSAGE(".....PerlinNoiseOceanRenderer initialized!");
	PRINT_END_SECTION;
}
void Renderer::LoadHeightMapComputeShader(const Desc & desc)
{
	PRINT_MESSAGE("Initialize Perlin Noise Ocean Renderer (Height Map Compute) Shaders : .....");

	mHeightMapCS = new HeightMapCS();
	glm::vec2 scale = glm::vec2((GLfloat)mHeightMapTextureSize.x / (GLfloat)mMapSize.x, (GLfloat)mHeightMapTextureSize.y / (GLfloat)mMapSize.y);
	mHeightMapCS->LoadShader(desc.mWaveProps, mHeightMapTextureSize, scale);

	Engine::GetInstance()->AttachComputeShader(mHeightMapCS);

	PRINT_MESSAGE(".....done.");
}
void Renderer::LoadWireFrameShader(const Desc & /*desc*/)
{
	PRINT_MESSAGE("Initialize Perlin Noise Ocean Renderer (Wire Frame) Shaders : .....");

	const char * uniformNames[] =
	{
		"u_PatchCount",
		"u_MapSize",
		"u_HeightMapTextureSize",
		"u_MaxAmplitude",
		"u_HeightMapSampler",
		"u_PerMapDataSampler",
	};


	//setup shader
	mWireFrameShader.LoadFromFile(GL_VERTEX_SHADER, "shaders/HeightFieldOcean.vs.glsl");

	mWireFrameShader.LoadFromFile(GL_TESS_CONTROL_SHADER, "shaders/HeightFieldOcean.tcs.glsl");

	mWireFrameShader.LoadFromFile(GL_TESS_EVALUATION_SHADER, "shaders/PerlinNoiseOcean.tes.glsl");

	//mWireFrameShader.LoadFromFile(GL_GEOMETRY_SHADER, "shaders/HeightFieldOcean.gs.glsl");

	mWireFrameShader.LoadFromFile(GL_FRAGMENT_SHADER, "shaders/HeightFieldOcean.wireframe.fs.glsl");

	mWireFrameShader.CreateAndLinkProgram();
	mWireFrameShader.Use();

	mWireFrameShader.AddUniforms(uniformNames, 6);

	//pass values of constant uniforms at initialization
	glUniform2iv(mWireFrameShader.GetUniform(u_PatchCount), 1, glm::value_ptr(mPatchCount)); GL_CHECK_ERRORS;
	glUniform2iv(mWireFrameShader.GetUniform(u_MapSize), 1, glm::value_ptr(mMapSize)); GL_CHECK_ERRORS;
	glUniform2iv(mShader.GetUniform(u_HeightMapTextureSize), 1, glm::value_ptr(mHeightMapTextureSize)); GL_CHECK_ERRORS;
	glUniform1f(mShader.GetUniform(u_MaxAmplitude), mHeightMapCS->GetMaxAmplitude()); GL_CHECK_ERRORS;
	glUniform1i(mWireFrameShader.GetUniform(u_HeightMapSampler), 0); GL_CHECK_ERRORS;
	glUniform1i(mWireFrameShader.GetUniform(u_PerMapDataSampler), 1); GL_CHECK_ERRORS;

	//GetWavePropertyUniformIndex(mWireFrameShader, mWireFrameShaderWaveProps);

	mWireFrameShader.SetupFrameDataBlockBinding();
	mWireFrameShader.UnUse();

	GL_CHECK_ERRORS;

	PRINT_MESSAGE(".....done.");
}
예제 #4
0
void update_rotation(Db_Object db, int league_id){
	
	char query[DEFAULT_QUERY_LENGTH];
	const char* SELECT_CURRENT_STARTERS = "select t_rotation.team_id,position from t_rotation join t_team on t_rotation.team_id = t_team.team_id where next_starter = 1 AND league_id = %d and t_team.active = 1;";
	int query_len = sprintf(query,SELECT_CURRENT_STARTERS,league_id);
	native_result* result = db->execute_query_result(db->conn,query,query_len);
	native_row row;
	Array_List list = Array_List_create(sizeof(Key_Value));
	while(row = db->fetch_row(result)){
		int team_id = db->get_column_int(row,0);
		int position = db->get_column_int(row,1);
		PRINT_MESSAGE(1,"team_id: %d starter: %d\n",team_id,position);
		Key_Value starter = malloc(sizeof(struct key_value));
		starter->key = (void*)team_id;
		starter->value = (void*)position;
		PRINT_MESSAGE(1,"starter,key: %d, starter.value: %d\n",starter->key,starter->value);
		Array_List_add(list,starter);
	}
	if(list->length>8){
		exit(1);
	}
	db->free_result(result);
	const char* RESET_NEXT_STARTER = "Update t_rotation set next_starter = 0 where team_id = %d; update t_lineup set bat_order=0, position=0 where team_id=%d and position=1;";
	const char* SELECT_NEW_STARTER = "select player_id from t_rotation where team_id = %d and position = %d;";
	const char* UPDATE_ROTATION = "update t_rotation set next_starter = 1 where team_id = %d and position = %d; update t_lineup set position =1, bat_order=9 where player_id=%d;";
	int i;
	for(i=0;i<list->length;i++){
		int team_id = (int)((Key_Value)gget(list,i))->key;
		int position = (int)((Key_Value)gget(list,i))->value;
		position = (position%5) + 1;
		query_len = sprintf(query,RESET_NEXT_STARTER,team_id,team_id);
		db->execute_query(db->conn,query,query_len);
		int query_len = sprintf(query,SELECT_NEW_STARTER,team_id,position);
		result = db->execute_query_result(db->conn,query,query_len);
		row = db->fetch_row(result);
		int new_starter_id = db->get_column_int(row,0);
		db->free_result(result);
		query_len = sprintf(query,UPDATE_ROTATION,team_id,position,new_starter_id);
		db->execute_query(db->conn,query,query_len);		
	}
	Array_List_free(list,1);
}
예제 #5
0
void ContinuousBuild::OnFileSaved(wxCommandEvent& e)
{
	e.Skip();
	PRINT_MESSAGE(wxT("ContinuousBuild::OnFileSaved\n"));
	// Dont build while the main build is in progress
	if (m_buildInProgress) {
		PRINT_MESSAGE(wxT("Build already in progress, skipping\n"));
		return;
	}

	ContinousBuildConf conf;
	m_mgr->GetConfigTool()->ReadObject(wxT("ContinousBuildConf"), &conf);

	if (conf.GetEnabled()) {
		wxString *fileName = (wxString*) e.GetClientData();
		if(fileName)
			DoBuild(*fileName);
	} else {
		PRINT_MESSAGE(wxT("ContinuousBuild is disabled\n"));
	}
}
예제 #6
0
int main(int argc, char **argv){
	
	int seed = 0;
	int c;
	int option_index = 0;
	double HITTER_MODIFIER= 1.0;
	double PITCHER_MODIFIER= 1.0;
	double AB_EXPONENT = 1.0;
	static struct option long_options[] = 
	{
	{"seed",required_argument,0,'s'},
	LONG_OPTIONS_STRUCT,
	{0,0,0,0}
	};
		if(argc < 2){
		print_usage();
		exit(1);
	}
	int home_id = atoi(argv[1]);
	int away_id = atoi(argv[2]);
	while(1){
		c = getopt_long(argc,argv,"s:h:p:x:",long_options,&option_index);
		if(c == -1){
			break;
		}
		switch(c){
			LONG_OPTIONS_CASE
			case 's':
				seed = atoi(optarg);
				break;
			
			case '?':
				printf("????\n");
				break;
			default:
				printf("default\n");
				break;
		}
	}
	
	Db_Object db = db_connect(CONFIG_FILE);
	
	PRINT_MESSAGE(1,"home: %d away: %d hit: %lf pitch: %lf ab_exp: %lf\n",home_id,away_id,HITTER_MODIFIER,PITCHER_MODIFIER,AB_EXPONENT);
	sim_game(db,1,home_id,away_id,HITTER_MODIFIER,PITCHER_MODIFIER,AB_EXPONENT,NULL);
	db->close_connection(db->conn);
	free(db);
	return 0;
}
예제 #7
0
void TRendererError::printMessage() {
	std::string strCaption;
	PRINT_MESSAGE(m_message.c_str(), formatError(strCaption, m_code, m_severity));
}
void HeightMapCS::LoadShader(const WavePropertyList & waveProps, const glm::vec2 & textureSize, const glm::vec2 & scale)
{
	PRINT_MESSAGE("Initialize Deep Ocean Renderer (Height Map Compute) Shaders : .....");

	mTextureSize = textureSize;

	mWaveCount = (GLint)waveProps.size();
	assert(mWaveCount > 0);
	GLsizei wavePropsBufferItemCount = mWaveCount * __waveparams_count__;
	GLsizei wavePropsBufferSize = wavePropsBufferItemCount * sizeof(GLfloat);

	glBindBuffer(GL_SHADER_STORAGE_BUFFER, mBufferIds[WavePropsBufferIndex]);
	glBufferData(GL_SHADER_STORAGE_BUFFER, wavePropsBufferSize, nullptr, GL_STATIC_DRAW); GL_CHECK_ERRORS;
	{
		GLfloat * wavePropsBuffer = (GLfloat *)glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY);	GL_CHECK_ERRORS;
		for (int i = 0; i < mWaveCount; ++i)
		{
			const WaveProperty & src = waveProps[i];
			wavePropsBuffer[WaveParams_Amplitude] = src.mAmplitude;
			wavePropsBuffer[WaveParams_DirectionX] = src.mDirection.x;
			wavePropsBuffer[WaveParams_DirectionY] = src.mDirection.z;
			wavePropsBuffer[WaveParams_W] = src.GetFrequency();
			wavePropsBuffer[WaveParams_Phase] = src.GetPhase();
			wavePropsBuffer[WaveParams_Steepness] = src.mSteepness;
			wavePropsBuffer += __waveparams_count__;
		}
		glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); GL_CHECK_ERRORS;
	}

	glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);

	glGenTextures(1, &mHeightMapTextureId);
	glBindTexture(GL_TEXTURE_2D, mHeightMapTextureId);
	TextureManager::CreateTexStorage2D(GL_TEXTURE_2D, mTextureSize.x, mTextureSize.y, nullptr, false, GL_NEAREST, GL_NEAREST, GL_REPEAT, GL_REPEAT, mPrecomputeNormals ? GL_RGBA16F : GL_R16F, GL_RED, GL_FLOAT);
	glBindTexture(GL_TEXTURE_2D, 0);

	// ---------------------------------------


	std::vector<std::string> shaderSources;
	if (mPrecomputeNormals)
	{
		shaderSources.push_back("#define PRECOMPUTE_NORMAL\n");
	}

	std::string csSource;
	Shader::MergeFile(csSource, "shaders/DeepOcean.hmap.cs.glsl");
	shaderSources.push_back(csSource);
	mShader.LoadFromString(GL_COMPUTE_SHADER, shaderSources, Shader::EInclude::ComputeShadersCommon);

	mShader.CreateAndLinkProgram();
	mShader.Use();

	const char * uniformNames[__hmap_cs_uniforms_count__] =
	{
		"u_WaveCount",
		"u_TextureSize",
		"u_Scale",
		"u_Time",
	};

	mShader.AddUniforms(uniformNames, __hmap_cs_uniforms_count__);

	glUniform1i(mShader.GetUniform(u_WaveCount), mWaveCount); GL_CHECK_ERRORS;
	glUniform2iv(mShader.GetUniform(u_TextureSize), 1, glm::value_ptr(mTextureSize)); GL_CHECK_ERRORS;
	glUniform2fv(mShader.GetUniform(u_Scale), 1, glm::value_ptr(scale)); GL_CHECK_ERRORS;

	mShader.UnUse();

	PRINT_MESSAGE("Height map texture id : %li", mHeightMapTextureId);
	PRINT_MESSAGE("Wave props buffer id : %li", mBufferIds[WavePropsBufferIndex]);

	mIsInitialized = true;

	PRINT_MESSAGE(".....done.");
}
예제 #9
0
GridRenderer::GridRenderer(int width, int depth)
	: RendererHelper<1>("GridRenderer", "GridWireFrameRenderer", Forward_Pass)
{
	PRINT_BEGIN_SECTION;
	PRINT_MESSAGE("Initialize GridRenderer.....");

	const char * uniformNames[__uniforms_count__] =
	{
		"vGridSize"
	};

	//setup shader
	mShader.LoadFromFile(GL_VERTEX_SHADER, "shaders/grid.vs.glsl");
	mShader.LoadFromFile(GL_FRAGMENT_SHADER, "shaders/grid.forward.fs.glsl");
	mShader.CreateAndLinkProgram();
	mShader.Use();

		mShader.AddUniforms(uniformNames, __uniforms_count__);

		//pass values of constant uniforms at initialization
		glUniform2f(mShader.GetUniform(vGridSize), (float)width, (float)depth);

		mShader.SetupFrameDataBlockBinding();
	mShader.UnUse();

	GL_CHECK_ERRORS;

	m_vertexCount = ((width + 1) + (depth + 1)) * 2;
	glm::vec3* vertices = new glm::vec3[m_vertexCount];
	 
	int count = 0;
	int width_2 = width/2;
	int depth_2 = depth/2;
	int i=0 ;

	for (i = -width_2; i <= width_2; i++)
	{
		vertices[count++] = glm::vec3(i, -0.1f, -depth_2);
		vertices[count++] = glm::vec3(i, -0.1f, depth_2);
	}

	for (i = -depth_2; i <= depth_2; i++)
	{
		vertices[count++] = glm::vec3(-width_2, -0.1f, i);
		vertices[count++] = glm::vec3(width_2, -0.1f, i);
	}

	//setup vao and vbo stuff
	CreateBuffers();

	glBindVertexArray(mVaoID);

		glBindBuffer (GL_ARRAY_BUFFER, mVboIDs[0]);
		glBufferData(GL_ARRAY_BUFFER, ((width + 1) + (depth + 1)) * 2 * sizeof(glm::vec3), &vertices[0], GL_STATIC_DRAW);
		GL_CHECK_ERRORS;
		 
		glEnableVertexAttribArray(Shader::POSITION_ATTRIBUTE);
		glVertexAttribPointer(Shader::POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, 0);
		GL_CHECK_ERRORS;
		 
	glBindVertexArray(0);

	GL_CHECK_ERRORS;

	delete [] vertices;	 

	mIsInitialized = true;

	PRINT_MESSAGE(".....GridRenderer initialized!");
	PRINT_END_SECTION;
}
예제 #10
0
void SkyboxRenderer::Initialize()
{
	PRINT_BEGIN_SECTION;
	PRINT_MESSAGE("Initialize SkyboxRenderer.....");

	const char * uniformNames[__uniforms_count__] =
	{
		"u_SkyboxCubeMapSampler"
	};

	//setup shader
	mShader.LoadFromFile(GL_VERTEX_SHADER, "shaders/skybox.vs.glsl");
	mShader.LoadFromFile(GL_FRAGMENT_SHADER, "shaders/skybox.forward.fs.glsl");

	//std::vector<std::string> shaderFilenames(2);
	//shaderFilenames[0] = "shaders/DeferredShadingCommon.incl.glsl";
	//shaderFilenames[1] = "shaders/skybox.deferred.fs.glsl";
	//mShader.LoadFromFile(GL_FRAGMENT_SHADER, shaderFilenames);


	mShader.CreateAndLinkProgram();
	mShader.Use();
		mShader.AddUniforms(uniformNames, __uniforms_count__);

		glUniform1i(mShader.GetUniform(u_SkyboxCubeMapSampler), 0); GL_CHECK_ERRORS;

		mShader.SetupFrameDataBlockBinding();
	mShader.UnUse();

	GL_CHECK_ERRORS;

	//setup shader
	mWireFrameShader.LoadFromFile(GL_VERTEX_SHADER, "shaders/skybox.vs.glsl");
	mWireFrameShader.LoadFromFile(GL_FRAGMENT_SHADER, "shaders/skybox.wireframe.fs.glsl");
	mWireFrameShader.CreateAndLinkProgram();
	mWireFrameShader.Use();
	mWireFrameShader.SetupFrameDataBlockBinding();
	mWireFrameShader.UnUse();

	GL_CHECK_ERRORS;


	GLfloat skyboxVertices[] = 
	{
		// Positions          
		-1.0f,  1.0f, -1.0f,
		-1.0f, -1.0f, -1.0f,
		1.0f, -1.0f, -1.0f,
		1.0f, -1.0f, -1.0f,
		1.0f,  1.0f, -1.0f,
		-1.0f,  1.0f, -1.0f,

		-1.0f, -1.0f,  1.0f,
		-1.0f, -1.0f, -1.0f,
		-1.0f,  1.0f, -1.0f,
		-1.0f,  1.0f, -1.0f,
		-1.0f,  1.0f,  1.0f,
		-1.0f, -1.0f,  1.0f,

		1.0f, -1.0f, -1.0f,
		1.0f, -1.0f,  1.0f,
		1.0f,  1.0f,  1.0f,
		1.0f,  1.0f,  1.0f,
		1.0f,  1.0f, -1.0f,
		1.0f, -1.0f, -1.0f,

		-1.0f, -1.0f,  1.0f,
		-1.0f,  1.0f,  1.0f,
		1.0f,  1.0f,  1.0f,
		1.0f,  1.0f,  1.0f,
		1.0f, -1.0f,  1.0f,
		-1.0f, -1.0f,  1.0f,

		-1.0f,  1.0f, -1.0f,
		1.0f,  1.0f, -1.0f,
		1.0f,  1.0f,  1.0f,
		1.0f,  1.0f,  1.0f,
		-1.0f,  1.0f,  1.0f,
		-1.0f,  1.0f, -1.0f,

		-1.0f, -1.0f, -1.0f,
		-1.0f, -1.0f,  1.0f,
		1.0f, -1.0f, -1.0f,
		1.0f, -1.0f, -1.0f,
		-1.0f, -1.0f,  1.0f,
		1.0f, -1.0f,  1.0f
	};

	//setup vao and vbo stuff
	CreateBuffers();

	glBindVertexArray(mVaoID);

		glBindBuffer(GL_ARRAY_BUFFER, mVboIDs[0]);
		glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), skyboxVertices, GL_STATIC_DRAW);
		GL_CHECK_ERRORS;

		glEnableVertexAttribArray(Shader::POSITION_ATTRIBUTE);
		glVertexAttribPointer(Shader::POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), 0);
		GL_CHECK_ERRORS;

	glBindVertexArray(0);

	GL_CHECK_ERRORS;

	mIsInitialized = true;

	PRINT_MESSAGE(".....SkyboxRenderer initialized!");
	PRINT_END_SECTION;
}
void Renderer::LoadMainShader(const Desc & desc)
{
	PRINT_MESSAGE("Initialize Perlin Noise Ocean Renderer Shaders : .....");

	const char * uniformNames[__uniforms_count__] =
	{
		"u_PatchCount",
		"u_MapSize",
		"u_HeightMapTextureSize",
		"u_MaxAmplitude",
		"u_HeightMapSampler",
		"u_PerMapDataSampler",
		"u_SkyboxCubeMapSampler",
		"u_textureSampler",
		"u_NormalMapSampler",
	};


	//setup shader
	mShader.LoadFromFile(GL_VERTEX_SHADER, "shaders/HeightFieldOcean.vs.glsl");

	mShader.LoadFromFile(GL_TESS_CONTROL_SHADER, "shaders/HeightFieldOcean.tcs.glsl");

	if(desc.mNormalMode==ENormalMode::PerVertexNormal)
	{
		std::vector<std::string> shaderSources;
		shaderSources.push_back("#define PER_VERTEX_NORMAL\n");

		std::string csSource;
		Shader::MergeFile(csSource, "shaders/PerlinNoiseOcean.tes.glsl");
		shaderSources.push_back(csSource);
		mShader.LoadFromString(GL_TESS_EVALUATION_SHADER, shaderSources);
	}
	else
	{
		mShader.LoadFromFile(GL_TESS_EVALUATION_SHADER, "shaders/PerlinNoiseOcean.tes.glsl");
	}

	//mShader.LoadFromFile(GL_GEOMETRY_SHADER, "shaders/HeightFieldOcean.gs.glsl");

	std::vector<std::string> lightFsGlsl(2);
	PRINT_MESSAGE("Loading shader file : shaders/DeferredShadingCommon.incl.glsl");
	Shader::MergeFile(lightFsGlsl[0], "shaders/DeferredShadingCommon.incl.glsl");

	PRINT_MESSAGE("Loading shader file : shaders/HeightFieldOcean.deferred.fs.glsl");
	if (desc.mNormalMode == ENormalMode::PerPixelNormal)
	{
		std::string csSource("#define PER_PIXEL_NORMAL\n");
		Shader::MergeFile(csSource, "shaders/HeightFieldOcean.deferred.fs.glsl");
		lightFsGlsl[1] = csSource;
	}
	else
	{
		Shader::MergeFile(lightFsGlsl[1], "shaders/HeightFieldOcean.deferred.fs.glsl");
	}

	mShader.LoadFromString(GL_FRAGMENT_SHADER, lightFsGlsl);


	mShader.CreateAndLinkProgram();
	mShader.Use();

	mShader.AddUniforms(uniformNames, __uniforms_count__);

	//pass values of constant uniforms at initialization
	glUniform2iv(mShader.GetUniform(u_PatchCount), 1, glm::value_ptr(mPatchCount)); GL_CHECK_ERRORS;
	glUniform2iv(mShader.GetUniform(u_MapSize), 1, glm::value_ptr(mMapSize)); GL_CHECK_ERRORS;
	glUniform2iv(mShader.GetUniform(u_HeightMapTextureSize), 1, glm::value_ptr(mHeightMapTextureSize)); GL_CHECK_ERRORS;	
	glUniform1f(mShader.GetUniform(u_MaxAmplitude), mHeightMapCS->GetMaxAmplitude()); GL_CHECK_ERRORS;
	glUniform1i(mShader.GetUniform(u_HeightMapSampler), 0); GL_CHECK_ERRORS;
	glUniform1i(mShader.GetUniform(u_PerMapDataSampler), 1); GL_CHECK_ERRORS;
	glUniform1i(mShader.GetUniform(u_SkyboxCubeMapSampler), 2); GL_CHECK_ERRORS;
	glUniform1i(mShader.GetUniform(u_textureSampler), 3); GL_CHECK_ERRORS;
	glUniform1i(mWireFrameShader.GetUniform(u_NormalMapSampler), 4); GL_CHECK_ERRORS;

	mShader.SetupFrameDataBlockBinding();
	mShader.UnUse();

	GL_CHECK_ERRORS;

	PRINT_MESSAGE(".....done.");
}
int FP_Analysis(struct TASK_SET t,int REPORTING)
{
int i;
float sum=0.0;
float WRT=0.0;		//Worst Case Response Time
int FAILED_RT=0;	//This flag is set if the response time analysis fails

	if(REPORTING==REPORT_ON)
	printf(PRINT_MESSAGE("FIXED PRIORITY"));

	if(basic_schedulability_test(t)==-U_GREATER_1)
	{
		if(REPORTING==REPORT_ON)
		{
		printf("Satisfaction of necessary condition 	 : [%s]\n",FAILED);
		printf("Schedulability				 : [%s]\n",NOT_SCHEDULABLE);
		}
	return -U_GREATER_1;
	}
		
	for(i=0;i<t.total_tasks;i++)
	{
		if(effective_utilization(t,i)==SUCCESS)
		{
			if(REPORTING==REPORT_ON)
			printf("Task %d UB TEST		\t  : [%s]\n",t.task[i].id,PASSED);
		}
		else
		{
			if(REPORTING==REPORT_ON)
			printf("Task %d UB TEST		:[%s]\n",t.task[i].id,FAILED);

				if((WRT=RT_Test(i,t))>0.0)
				{
					if(REPORTING==REPORT_ON)
					{
					printf("RT_Test Task %d		: [%s]\n",t.task[i].id,PASSED);
					printf("WRT(%d)		   	: %f\n",t.task[i].id,WRT);
					}
				}
				else
				{
					if(REPORTING==REPORT_ON)
					printf("RT_Test Task %d		: [%s]\n",t.task[i].id,FAILED);
				FAILED_RT=1;	//we simply set the flag since we want to pinpoint exactly which tasks fail
				}		//At this point unschedulability is confirmed. For efficiency you 
						//may want to directly return
		}

	}

			if(!FAILED_RT)
			{
				if(REPORTING==REPORT_ON)
				{
				printf("Response Time Analysis	          : [%s]\n",PASSED);
				printf("Schedulability (RM/DM)            : [%s]\n",SCHEDULABLE);
				}

			return SUCCESS;
			}
			else	
			{
				if(REPORTING==REPORT_ON)
				{
				printf("Response Time Analysis	          : [%s]\n",FAILED);
				printf("Schedulability (RM/DM)            : [%s]\n",NOT_SCHEDULABLE);
				}

			return -FAILURE;
			}
}
예제 #13
0
void ContinuousBuild::DoBuild(const wxString& fileName)
{
	PRINT_MESSAGE(wxT("DoBuild\n"));
	// Make sure a workspace is opened
	if (!m_mgr->IsWorkspaceOpen()) {
		PRINT_MESSAGE(wxT("No workspace opened!\n"));
		return;
	}
		

	// Filter non source files
	FileExtManager::FileType type = FileExtManager::GetType(fileName);
	switch(type) {
		case FileExtManager::TypeSourceC:
		case FileExtManager::TypeSourceCpp:
		case FileExtManager::TypeResource:
			break;

		default: {
			PRINT_MESSAGE(wxT("Non source file\n"));
			return;
		}
	}

	wxString projectName = m_mgr->GetProjectNameByFile(fileName);
	if(projectName.IsEmpty()) {
		PRINT_MESSAGE(wxT("Project name is empty\n"));
		return;
	}
	
	wxString errMsg;
	ProjectPtr project = m_mgr->GetSolution()->FindProjectByName(projectName, errMsg);
	if(!project){
		PRINT_MESSAGE(wxT("Could not find project for file\n"));
		return;
	}

	// get the selected configuration to be build
	BuildConfigPtr bldConf = m_mgr->GetSolution()->GetProjBuildConf( project->GetName(), wxEmptyString );
	if ( !bldConf ) {
		PRINT_MESSAGE(wxT("Failed to locate build configuration\n"));
		return;
	}

	BuilderPtr builder = m_mgr->GetBuildManager()->GetBuilder( wxT( "GNU makefile for g++/gcc" ) );
	if(!builder){
		PRINT_MESSAGE(wxT("Failed to located builder\n"));
		return;
	}

	// Only normal file builds are supported
	if(bldConf->IsCustomBuild()){
		PRINT_MESSAGE(wxT("Build is custom. Skipping\n"));
		return;
	}

	// get the single file command to use
	wxString cmd      = builder->GetSingleFileCmd(projectName, bldConf->GetName(), fileName);
	WrapInShell(cmd);

	if( m_buildProcess.IsBusy() ) {
		// add the build to the queue
		if (m_files.Index(fileName) == wxNOT_FOUND) {
			m_files.Add(fileName);

			// update the UI
			m_view->AddFile(fileName);
		}
		return;
	}
	
	PRINT_MESSAGE(wxString::Format(wxT("cmd:%s\n"), cmd.c_str()));
	if(!m_buildProcess.Execute(cmd, fileName, project->GetFileName().GetPath(), this))
		return;

	// Set some messages
	m_mgr->SetStatusMessage(wxString::Format(wxT("Compiling %s..."), wxFileName(fileName).GetFullName().c_str()), 0);

	// Add this file to the UI queue
	m_view->AddFile(fileName);
}