[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - change brush model surface flags based on entity

change brush model surface flags based on entity

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

change brush model surface flags based on entity

Postby qbism » Mon Aug 13, 2012 8:28 pm

Let's say we've got entity->foo. The entity has a brush model. I'd like create a new surface flag, so that " if entity->foo then all surfaces->flag = SURF_FOO". Where in the code can I dig into that with brush models?

What I'm really talking about is entity->alpha. I can't find the spot where a func_wall could access surface flags. I'd like to do it as soon as brush models and/or entities are loaded.

BTW, I've looked briefly at how Makaqu 1.5 does it. I think this is different, it assigns a blend function per entity. But I don't really have a grasp of that, either.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: change brush model surface flags based on entity

Postby mh » Mon Aug 13, 2012 8:45 pm

You'd need to do this at protocol level (although Spike will no doubt suggest CSQC ;) )
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: change brush model surface flags based on entity

Postby Spike » Mon Aug 13, 2012 9:09 pm

I would be hesitant to change model data to follow a *specific* entity that uses that model.

and no, csqc cannot edit actual models. it can spew forth its own polygons, it can generate sketal poses, but cannot hack random fields of random model formats.
it can override blend modes. but then so can ssqc via the .effects field (DP added an EF_ADDITIVE).

If you're talking software rendering, the surface flags are tested in D_DrawSurfaces. Its best to just check s->entity->somecustomfield there instead of some hacked-on flag.

If you really really want to edit the model flags based upon some entity using that model without protocol changes, you'll have to parse the entities lump clientside and match the entity to the model via the entity's model string, then loop through that model's surfaces (for (i = submodel->firstsurface; i < submodel->firstsurface + submodel->surfacecount; i++)submodel->surfaces[i].flags |= SURF_FOO; to constrain the flag to the submodel rather than affecting world too).

But yeah, you're best off with a protocol change. Including for static entities.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: change brush model surface flags based on entity

Postby mh » Mon Aug 13, 2012 10:46 pm

It would be a little bit more complex as each surface would need to remember the last flag it was set to and remove that too.

One nasty way that springs to mind would be to add a SetSurfaceFlags command that takes an entity name (or number) and a flag as params, then stuffcmd it. Of course that won't persist across multiple sessions so you need a way of saving it out and restoring it. Adding a new entity field and setting that through QC, then adding a new protocol message and sending it through SV_WriteEntitiesToClient seems cleanest.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: change brush model surface flags based on entity

Postby qbism » Mon Aug 13, 2012 11:40 pm

Thanks, I see how the protocol change works. Alias models check currententity->foo in D_RasterizeAliasPolySmooth, and choose a different span function (D_PolysetDrawSpans_fooA, D_PolysetDrawSpans_fooB) depending on the value of foo. That's how Makaqu 1.3 handles alpha. So currently I'm looking for a similar way to do it for brush models. These go down a different set of functions for rendering.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: change brush model surface flags based on entity

Postby Spike » Tue Aug 14, 2012 12:24 am

d_edge.c D_DrawSurfaces is where the other flags are checked, looks like s->entity is valid in there.
You'll likely need to take care with the existing flags, or only add it just before the else case.

note that d_drawspans is merely a pointer to either D_DrawSpans16 or 8, depending on how accurate you want perspective correction on textures. You can likely get away with hardcoding it to just D_DrawSpans8.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: change brush model surface flags based on entity

Postby mankrip » Sat Aug 18, 2012 12:04 am

Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: change brush model surface flags based on entity

Postby qbism » Sat Aug 18, 2012 3:33 am

User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: change brush model surface flags based on entity

Postby mankrip » Sat Aug 18, 2012 11:18 am

Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests