NSRenderableEntity: Support for scrolling textures (requires shader
overrides for now, stay tuned) with variable speeds. Improvements to func_conveyor, other rendering fix involving alphamasking textures.
This commit is contained in:
parent
623754ec5a
commit
c920e4c3e8
|
@ -51,7 +51,13 @@ varying mat3 invsurface;
|
|||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
|
||||
#ifdef SCROLL
|
||||
/* HACK: func_conveyor needs us to scroll this surface! */
|
||||
if (e_glowmod.g == 0.5)
|
||||
tex_c[0] += (e_time * (e_glowmod.b * 1024.0)) * -0.01;
|
||||
#endif
|
||||
|
||||
#ifdef REFLECTCUBE
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
|
@ -128,8 +134,9 @@ varying mat3 invsurface;
|
|||
|
||||
/* get the alphatesting out of the way first */
|
||||
#ifdef MASK
|
||||
/* terrible hack, CSQC sets this to mark surface as an entity */
|
||||
if (e_glowmod == vec3(1.0, 0.0, 1.0))
|
||||
/* HACK: terrible hack, CSQC sets this to mark surface as an entity
|
||||
only entities are alphatested - ever */
|
||||
if (e_glowmod.r == 0.5)
|
||||
if (diffuse_f.a < 0.6) {
|
||||
discard;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ STUB!
|
|||
This entity was introduced in Half-Life (1998).
|
||||
*/
|
||||
|
||||
#define SF_CONVEYOR_VISUAL 1
|
||||
#define SF_CONVEYOR_VISUAL 1
|
||||
#define SF_CONVEYOR_NOTSOLID 2
|
||||
|
||||
class func_conveyor:NSRenderableEntity
|
||||
|
@ -43,6 +43,7 @@ class func_conveyor:NSRenderableEntity
|
|||
virtual void(void) touch;
|
||||
virtual void(void) SetMovementDirection;
|
||||
virtual void(entity, string, string) Input;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -84,20 +85,39 @@ func_conveyor::SetMovementDirection(void)
|
|||
void
|
||||
func_conveyor::touch(void)
|
||||
{
|
||||
other.basevelocity = m_vecMoveDir * (m_flSpeed * -0.2f);
|
||||
if (spawnflags & SF_CONVEYOR_VISUAL)
|
||||
return;
|
||||
|
||||
other.basevelocity = m_vecMoveDir * (m_flSpeed * -0.2);
|
||||
}
|
||||
|
||||
/* TODO: Handle state? */
|
||||
void
|
||||
func_conveyor::Trigger(entity act, int state)
|
||||
{
|
||||
switch (state) {
|
||||
case TRIG_ON:
|
||||
m_flSpeed = fabs(m_flSpeed);
|
||||
break;
|
||||
case TRIG_OFF:
|
||||
m_flSpeed = -fabs(m_flSpeed);
|
||||
break;
|
||||
default:
|
||||
m_flSpeed = -m_flSpeed;
|
||||
break;
|
||||
}
|
||||
|
||||
/* changes direction */
|
||||
m_flSpeed = -m_flSpeed;
|
||||
glowmod[1] = 0.5f;
|
||||
glowmod[2] = m_flSpeed / 1024;
|
||||
SetSendFlags(BASEFL_CHANGED_RENDERCOLOR);
|
||||
}
|
||||
|
||||
void
|
||||
func_conveyor::Respawn(void)
|
||||
{
|
||||
if (!m_flSpeed)
|
||||
m_flSpeed = 100;
|
||||
|
||||
m_vecMoveDir = [0,0,0];
|
||||
angles = GetSpawnAngles();
|
||||
|
||||
|
@ -106,9 +126,7 @@ func_conveyor::Respawn(void)
|
|||
SetMovetype(MOVETYPE_NONE);
|
||||
SetSolid(SOLID_BSP);
|
||||
|
||||
/* TODO: Apply some effect flag the engine handles? */
|
||||
if (!(spawnflags & SF_CONVEYOR_VISUAL)) {
|
||||
}
|
||||
Trigger(this, TRIG_ON);
|
||||
|
||||
if (spawnflags & SF_CONVEYOR_NOTSOLID) {
|
||||
SetSolid(SOLID_NOT);
|
||||
|
@ -133,9 +151,21 @@ func_conveyor::Input(entity eAct, string strInput, string strData)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_conveyor::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "speed":
|
||||
m_flSpeed = stof(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_conveyor::func_conveyor(void)
|
||||
{
|
||||
m_flSpeed = 100;
|
||||
super::NSRenderableEntity();
|
||||
}
|
||||
|
|
|
@ -101,7 +101,8 @@ NSRenderableEntity::SendEntity(entity ePEnt, float fChanged)
|
|||
/* let's not waste networking power on certain render-modes where they would
|
||||
* not apply anyway. this seems sensible enough. */
|
||||
if (m_iRenderMode == RM_NORMAL || m_iRenderMode == RM_TRIGGER) {
|
||||
fChanged &= ~BASEFL_CHANGED_RENDERCOLOR;
|
||||
if (!glowmod) /* FIXME: Get rid of this, network this hack on its own. */
|
||||
fChanged &= ~BASEFL_CHANGED_RENDERCOLOR;
|
||||
fChanged &= ~BASEFL_CHANGED_RENDERAMT;
|
||||
}
|
||||
#endif
|
||||
|
@ -172,6 +173,9 @@ NSRenderableEntity::SendEntity(entity ePEnt, float fChanged)
|
|||
WriteFloat(MSG_ENTITY, m_vecRenderColor[0]);
|
||||
WriteFloat(MSG_ENTITY, m_vecRenderColor[1]);
|
||||
WriteFloat(MSG_ENTITY, m_vecRenderColor[2]);
|
||||
WriteFloat(MSG_ENTITY, glowmod[0]);
|
||||
WriteFloat(MSG_ENTITY, glowmod[1]);
|
||||
WriteFloat(MSG_ENTITY, glowmod[2]);
|
||||
}
|
||||
if (fChanged & BASEFL_CHANGED_RENDERAMT) {
|
||||
WriteFloat(MSG_ENTITY, m_flRenderAmt);
|
||||
|
@ -203,7 +207,7 @@ NSRenderableEntity::RenderFXPass(void)
|
|||
vecPlayer = pSeat->m_vecPredictedOrigin;
|
||||
|
||||
/* HACK: this tells our GLSL to render this masked */
|
||||
glowmod = [1.0,0.0,1.0];
|
||||
//glowmod = [1.0,0.0,1.0];
|
||||
colormod = m_vecRenderColor;
|
||||
alpha = m_flRenderAmt;
|
||||
|
||||
|
@ -310,6 +314,13 @@ NSRenderableEntity::RenderFXPass(void)
|
|||
drawflags = 7;
|
||||
abslight = 128;
|
||||
}
|
||||
|
||||
/* HACK: This marks this entity as alphatested in platform's defaultwall.glsl */
|
||||
if (m_iRenderMode != RM_NORMAL) {
|
||||
glowmod[0] = 0.5f;
|
||||
} else {
|
||||
glowmod[0] = 1.0f;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
|
@ -387,6 +398,9 @@ NSRenderableEntity::ReceiveEntity(float flChanged)
|
|||
m_vecRenderColor[0] = readfloat();
|
||||
m_vecRenderColor[1] = readfloat();
|
||||
m_vecRenderColor[2] = readfloat();
|
||||
glowmod[0] = readfloat();
|
||||
glowmod[1] = readfloat();
|
||||
glowmod[2] = readfloat();
|
||||
}
|
||||
if (flChanged & BASEFL_CHANGED_RENDERAMT) {
|
||||
m_flRenderAmt = readfloat();
|
||||
|
|
Loading…
Reference in New Issue