light: add "_surface_spotlight" key for making surface lights into spotlights based on the surface normal
This commit is contained in:
parent
1e9a0ac2b3
commit
7f1beca6b4
|
|
@ -1029,7 +1029,7 @@ WriteEntitiesToString(bsp2_t *bsp)
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
static void CreateSurfaceLight(const vec3_t origin, const entity_t *surflight_template)
|
||||
static void CreateSurfaceLight(const vec3_t origin, const vec3_t normal, const entity_t *surflight_template)
|
||||
{
|
||||
entity_t *entity = DuplicateEntity(surflight_template);
|
||||
|
||||
|
|
@ -1038,6 +1038,12 @@ static void CreateSurfaceLight(const vec3_t origin, const entity_t *surflight_te
|
|||
/* don't write to bsp */
|
||||
entity->generated = true;
|
||||
|
||||
/* set spotlight vector based on face normal */
|
||||
if (atoi(ValueForKey(surflight_template, "_surface_spotlight"))) {
|
||||
entity->spotlight = true;
|
||||
VectorCopy(normal, entity->spotvec);
|
||||
}
|
||||
|
||||
num_lights++;
|
||||
}
|
||||
|
||||
|
|
@ -1070,7 +1076,7 @@ static void CreateSurfaceLightOnFaceSubdivision(const bsp2_dface_t *face, const
|
|||
|
||||
VectorMA(midpoint, offset, normal, midpoint);
|
||||
|
||||
CreateSurfaceLight(midpoint, surflight_template);
|
||||
CreateSurfaceLight(midpoint, normal, surflight_template);
|
||||
}
|
||||
|
||||
static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
||||
|
|
|
|||
|
|
@ -264,6 +264,12 @@ Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight
|
|||
up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0).
|
||||
Often easier than the "target" method.
|
||||
|
||||
.IP "\fB""_surface_spotlight"" ""n""\fP"
|
||||
For a surface light template (i.e. a light with "_surface" set), setting this to
|
||||
"1" makes each instance into a spotlight, with the direction of light
|
||||
pointing along the surface normal. In other words, it automatically sets
|
||||
"mangle" on each of the generated lights.
|
||||
|
||||
.IP "\fB""angle"" ""n""\fP"
|
||||
Specifies the angle in degrees for a spotlight cone. Default 40.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue