Skip to content

Commit

Permalink
Set sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhonnyg committed Nov 20, 2024
1 parent 9a1ec35 commit 00e10b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions defold-rive/include/defold/defold_render.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace dmRender
const dmVMath::Matrix4& GetViewProjectionMatrix(HRenderContext render_context);
HMaterial NewMaterial(HRenderContext render_context, dmGraphics::HVertexProgram vertex_program, dmGraphics::HFragmentProgram fragment_program);
void SetMaterialTags(HMaterial material, uint32_t tag_count, const dmhash_t* tags);
bool SetMaterialSampler(HMaterial material, dmhash_t name_hash, uint32_t unit, dmGraphics::TextureWrap u_wrap, dmGraphics::TextureWrap v_wrap, dmGraphics::TextureFilter min_filter, dmGraphics::TextureFilter mag_filter, float max_anisotropy);
}

#endif
5 changes: 5 additions & 0 deletions defold-rive/src/private/renderer_private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ namespace dmRive
{
renderer->m_BlitMaterial = dmRender::NewMaterial(render_context, renderer->m_BlitVs, renderer->m_BlitFs);

if (!dmRender::SetMaterialSampler(renderer->m_BlitMaterial, dmHashString64("texture_sampler"), 0, dmGraphics::TEXTURE_WRAP_CLAMP_TO_EDGE, dmGraphics::TEXTURE_WRAP_CLAMP_TO_EDGE, dmGraphics::TEXTURE_FILTER_LINEAR, dmGraphics::TEXTURE_FILTER_LINEAR, 1.0))
{
dmLogError("Failed to set material sampler");
}

dmhash_t dummy_tag = dmHashString64("rive");
dmRender::SetMaterialTags(renderer->m_BlitMaterial, 1, &dummy_tag);
}
Expand Down

0 comments on commit 00e10b2

Please sign in to comment.