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(); }
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 }
void TGLProgram::SetUniformInteger(const char* name, const PLint value) { glUniform1i(FindUniform(name), value); }
void TGLProgram::SetUniformMatrix3x3f(const char* name, const TMatrix3x3f& value) { glUniformMatrix3fv(FindUniform(name), 1, GL_FALSE, value.ToGLmatrix()); }
void TGLProgram::SetUniformFloat(const char* name, const PLfloat value) { glUniform1f(FindUniform(name), value); }
void TGLProgram::SetUniformVector4f(const char* name, const TVertex4f& value) { glUniform4fv(FindUniform(name), 1, value.ToGLfloat()); }