예제 #1
0
	void DebugGrid::Draw(GLProgram& glProgram, Renderer& renderer)
	{
        UNUSED(renderer)
        g_MVPMatrix->PushMatrix();
        glProgram.SetUniform("emissive", 1.0);
		glProgram.SetUniform("color", GetColor());

		glProgram.SetUniform("hasDiffuseMap", false);
		glProgram.SetUniform("hasNormalMap", false);
		glProgram.SetUniform("hasSpecularMap", false);
		glProgram.SetUniform("hasEmissiveMap", false);

		g_MVPMatrix->Translate(0.0f, -1.0f, 0.0f);

		m_vbo->Draw(glProgram);
        g_MVPMatrix->PopMatrix();
	}
예제 #2
0
	void Lights::ApplyLights(GLProgram& glProgram)
	{
		const int PROGRAM_ID = glProgram.GetProgramID();

		const int LIGHT_POS_LOC = glGetUniformLocation(PROGRAM_ID, "lightPositions");
		const int LIGHT_COLOR_LOC = glGetUniformLocation(PROGRAM_ID, "lightColors");
		const int LIGHT_DIR_LOC = glGetUniformLocation(PROGRAM_ID, "lightDirs");
		const int LIGHT_RADIUS_LOC = glGetUniformLocation(PROGRAM_ID, "lightradius");
		const int LIGHT_INNER_LOC = glGetUniformLocation(PROGRAM_ID, "lightInnerCone");
		const int LIGHT_OUTER_LOC = glGetUniformLocation(PROGRAM_ID, "lightOuterCone");
		const int LIGHT_STARTENDATTEN_LOC = glGetUniformLocation(PROGRAM_ID, "lightAttenStartEnd");

		glProgram.SetUniform("numLights", m_numLights);

		if (LIGHT_POS_LOC >= 0 && !m_pos.empty())
		{
			glUniform3fv(LIGHT_POS_LOC, m_numLights, &m_pos[0].x_);
		}
		if (LIGHT_COLOR_LOC >= 0 && !m_color.empty())
		{
			glUniform3fv(LIGHT_COLOR_LOC, m_numLights, &m_color[0].x_);
		}
		if (LIGHT_DIR_LOC >= 0 && !m_dir.empty())
		{
			glUniform3fv(LIGHT_DIR_LOC, m_numLights, &m_dir[0].x_);
		}
		if (LIGHT_RADIUS_LOC >= 0 && !m_radius.empty())
		{
			glUniform1fv(LIGHT_RADIUS_LOC, m_numLights, &m_radius[0]);
		}
		if (LIGHT_INNER_LOC >= 0 && !m_angleInnerCone.empty())
		{
			glUniform1fv(LIGHT_INNER_LOC, m_numLights, &m_angleInnerCone[0]);
		}
		if (LIGHT_OUTER_LOC >= 0 && !m_angleOuterCone.empty())
		{
			glUniform1fv(LIGHT_OUTER_LOC, m_numLights, &m_angleOuterCone[0]);
		}
		if(LIGHT_STARTENDATTEN_LOC >= 0 && !startAndEndAtten_.empty())
		{
			glUniform2fv(LIGHT_STARTENDATTEN_LOC, numLights_, &startAndEndAtten_[0]);
		}
	}