implement actor uniforms
This commit is contained in:
parent
d4d379c476
commit
fcf4c9d07e
5 changed files with 177 additions and 0 deletions
|
|
@ -137,6 +137,17 @@ void FHWModelRenderer::SetInterpolation(double inter)
|
|||
void FHWModelRenderer::SetMaterial(FGameTexture *skin, bool clampNoFilter, FTranslationID translation, AActor * act)
|
||||
{
|
||||
state.SetMaterial(skin, UF_Skin, 0, clampNoFilter ? CLAMP_NOFILTER : CLAMP_NONE, translation, -1, act ? act->GetClass() : nullptr);
|
||||
|
||||
int shader = state.getShaderIndex();
|
||||
|
||||
if(shader >= FIRST_USER_SHADER && act && (act != lastAct || shader != lastShader))
|
||||
{ // only re-bind uniforms if the actor or the shader have changed
|
||||
usershaders[shader - FIRST_USER_SHADER].BindActorFields(act);
|
||||
}
|
||||
|
||||
lastAct = act;
|
||||
lastShader = shader;
|
||||
|
||||
state.SetLightIndex(modellightindex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ class FHWModelRenderer : public FModelRenderer
|
|||
int boneIndexBase = -1;
|
||||
HWDrawInfo *di;
|
||||
FRenderState &state;
|
||||
|
||||
AActor * lastAct = nullptr;
|
||||
int lastShader = 0;
|
||||
public:
|
||||
FHWModelRenderer(HWDrawInfo *d, FRenderState &st, int mli) : modellightindex(mli), di(d), state(st)
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -241,6 +241,16 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, clampmode, translation, OverrideShader, actor ? actor->GetClass() : nullptr);
|
||||
else if (!modelframe) state.EnableTexture(false);
|
||||
|
||||
if (actor && texture)
|
||||
{
|
||||
int binding = state.getShaderIndex();
|
||||
|
||||
if(binding >= FIRST_USER_SHADER)
|
||||
{
|
||||
usershaders[binding - FIRST_USER_SHADER].BindActorFields(actor);
|
||||
}
|
||||
}
|
||||
|
||||
//SetColor(lightlevel, rel, Colormap, trans);
|
||||
|
||||
unsigned int iter = lightlist ? lightlist->Size() : 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue