예제 #1
0
파일: ITexture.cpp 프로젝트: fjz13/Medusa
void ITexture::Apply()
{
	if (!mSamplerName.IsEmpty())
	{
		auto pass = RenderingContext::Instance().ProgramRenderPass();
		if (pass != nullptr)
		{
			ShaderUniform* sampler = pass->FindUniform(mSamplerName);
			if (sampler != nullptr)
			{
				sampler->Invalidate();
				sampler->Set((int)mSamplerState->TextureUnit() - (int)GraphicsTextureUnits::Texture0);
			}
			else
			{
				//Log::LogErrorFormat("Cannot find sampler by name:{}",mSamplerName.c_str());
			}
		}

	}

	RenderStateMachine::Instance().Push(mSamplerState);
	RenderStateMachine::Instance().Push(mPixelStoreState);

	Upload();
}
예제 #2
0
void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool transpose)
{
#ifdef SORT_UNIFORMS
	BL_Uniform *uni= FindUniform(location);
	if (uni) {
		memcpy(uni->getData(), param, size);
		uni->SetData(location, type, transpose);
	}
	else {
		uni = new BL_Uniform(size);
		memcpy(uni->getData(), param, size);
		uni->SetData(location, type, transpose);
		mUniforms.push_back(uni);
	}
	mDirty = true;
#endif
}
예제 #3
0
void TGLProgram::SetUniformInteger(const char* name, const PLint value)
{
	glUniform1i(FindUniform(name), value);
}
예제 #4
0
void TGLProgram::SetUniformMatrix3x3f(const char* name, const TMatrix3x3f& value)
{
	glUniformMatrix3fv(FindUniform(name), 1, GL_FALSE, value.ToGLmatrix());
}
예제 #5
0
void TGLProgram::SetUniformFloat(const char* name, const PLfloat value)
{
	glUniform1f(FindUniform(name), value);
}
예제 #6
0
void TGLProgram::SetUniformVector4f(const char* name, const TVertex4f& value)
{
	glUniform4fv(FindUniform(name), 1, value.ToGLfloat());
}