env_projectedtexture: Initial implementation, updated map test_dlights.

This commit is contained in:
Marco Cawthorne 2020-11-27 19:23:21 +01:00
parent 2cef5d76ec
commit 1a3dca71ec
6 changed files with 503 additions and 9 deletions

View File

@ -40,15 +40,6 @@
}
// brush 4
{
( 184 -192 192 ) ( 184 -576 192 ) ( -328 -192 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 192 -192 264 ) ( -320 -192 264 ) ( 192 -192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 96 8 ) ( 320 96 0 ) ( 320 -288 8 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -576 -128 ) ( -256 -576 -128 ) ( -768 -192 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 272 -256 256 ) ( 272 -256 264 ) ( 784 -256 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -576 256 ) ( -320 -192 256 ) ( -320 -576 264 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 5
{
( 184 256 192 ) ( 184 -128 192 ) ( -328 256 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 192 256 264 ) ( -320 256 264 ) ( 192 256 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 544 8 ) ( 320 544 0 ) ( 320 160 8 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
@ -56,6 +47,123 @@
( 272 192 256 ) ( 272 192 264 ) ( 784 192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -128 256 ) ( -320 256 256 ) ( -320 -128 264 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 5
{
( 248 -384 -64 ) ( 248 -768 -64 ) ( -264 -384 -64 ) measure/floor [ 1 0 0 0 ] [ -0 -1 -0 -0 ] -0 0.5 0.5 0 0 0
( 256 -384 8 ) ( -256 -384 8 ) ( 256 -384 0 ) measure/floor [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 256 -384 8 ) ( 256 -384 0 ) ( 256 -768 8 ) measure/floor [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -256 -768 -128 ) ( 256 -768 -128 ) ( -256 -384 -128 ) measure/floor [ 1 0 0 0 ] [ -0 -1 -0 -0 ] -0 0.5 0.5 0 0 0
( -256 -768 0 ) ( -256 -768 8 ) ( 256 -768 0 ) measure/floor [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -256 -768 0 ) ( -256 -384 0 ) ( -256 -768 8 ) measure/floor [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 6
{
( 248 -384 192 ) ( 248 -768 192 ) ( -264 -384 192 ) measure/floor [ 1 0 0 0 ] [ -0 -1 -0 -0 ] -0 0.5 0.5 0 0 0
( 256 -384 264 ) ( -256 -384 264 ) ( 256 -384 256 ) measure/floor [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 256 -384 264 ) ( 256 -384 256 ) ( 256 -768 264 ) measure/floor [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -256 -768 128 ) ( 256 -768 128 ) ( -256 -384 128 ) measure/floor [ 1 0 0 0 ] [ -0 -1 -0 -0 ] -0 0.5 0.5 0 0 0
( -256 -768 256 ) ( -256 -768 264 ) ( 256 -768 256 ) measure/floor [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -256 -768 256 ) ( -256 -384 256 ) ( -256 -768 264 ) measure/floor [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 7
{
( 184 -384 192 ) ( 184 -768 192 ) ( -328 -384 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 192 -384 264 ) ( -320 -384 264 ) ( 192 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -256 -384 8 ) ( -256 -384 0 ) ( -256 -768 8 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -768 -128 ) ( -256 -768 -128 ) ( -768 -384 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( -320 -768 256 ) ( -320 -768 264 ) ( 192 -768 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -768 256 ) ( -320 -384 256 ) ( -320 -768 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 8
{
( 760 -384 192 ) ( 760 -768 192 ) ( 248 -384 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 768 -384 264 ) ( 256 -384 264 ) ( 768 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 -384 8 ) ( 320 -384 0 ) ( 320 -768 8 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -192 -768 -128 ) ( 320 -768 -128 ) ( -192 -384 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 256 -768 256 ) ( 256 -768 264 ) ( 768 -768 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 256 -768 256 ) ( 256 -384 256 ) ( 256 -768 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 9
{
( 184 -768 192 ) ( 184 -1152 192 ) ( -328 -768 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 192 -768 264 ) ( -320 -768 264 ) ( 192 -768 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 -480 8 ) ( 320 -480 0 ) ( 320 -864 8 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -1152 -128 ) ( -256 -1152 -128 ) ( -768 -768 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 272 -832 256 ) ( 272 -832 264 ) ( 784 -832 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -1152 256 ) ( -320 -768 256 ) ( -320 -1152 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 10
{
( 184 -192 192 ) ( 184 -576 192 ) ( -328 -192 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 192 -192 264 ) ( -320 -192 264 ) ( 192 -192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 96 8 ) ( 320 96 0 ) ( 320 -288 8 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 272 -320 256 ) ( 272 -320 264 ) ( 784 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -576 256 ) ( -320 -192 256 ) ( -320 -576 264 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -56 -104 128 ) ( 80 -472 128 ) ( 80 -104 128 ) measure/wall64a [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
}
// brush 11
{
( 192 -192 264 ) ( -320 -192 264 ) ( 192 -192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 96 8 ) ( 320 96 0 ) ( 320 -288 8 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -576 -128 ) ( -256 -576 -128 ) ( -768 -192 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 280 -320 256 ) ( 280 -320 264 ) ( 792 -320 256 ) measure/wall128gr [ 1 0 0 240 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 80 -104 128 ) ( 80 -472 128 ) ( -56 -104 128 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 72 -472 192 ) ( 72 -104 -128 ) ( 72 -104 192 ) measure/wall64a [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 12
{
( 192 -192 264 ) ( -320 -192 264 ) ( 192 -192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -576 -128 ) ( -256 -576 -128 ) ( -768 -192 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 272 -320 256 ) ( 272 -320 264 ) ( 784 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -576 256 ) ( -320 -192 256 ) ( -320 -576 264 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 72 -104 192 ) ( 72 -104 -128 ) ( 72 -472 192 ) NULL [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -72 -104 -64 ) ( 64 -472 -64 ) ( -72 -472 -64 ) measure/wall64a [ 1 0 0 16 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
}
// brush 13
{
( 192 -192 264 ) ( -320 -192 264 ) ( 192 -192 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 272 -320 256 ) ( 272 -320 264 ) ( 784 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -576 256 ) ( -320 -192 256 ) ( -320 -576 264 ) measure/wall128gr [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 80 -104 128 ) ( 80 -472 128 ) ( -56 -104 128 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -72 -472 -64 ) ( 64 -472 -64 ) ( -72 -104 -64 ) NULL [ 1 0 0 16 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -64 -472 192 ) ( -64 -104 -128 ) ( -64 -472 -128 ) measure/wall64a [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 14
{
( 184 -320 192 ) ( 184 -704 192 ) ( -328 -320 192 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 192 -320 264 ) ( -320 -320 264 ) ( 192 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 -32 8 ) ( 320 -32 0 ) ( 320 -416 8 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 272 -384 256 ) ( 272 -384 264 ) ( 784 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -704 256 ) ( -320 -320 256 ) ( -320 -704 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -56 -104 128 ) ( 80 -472 128 ) ( 80 -104 128 ) measure/wall64a [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
}
// brush 15
{
( 192 -320 264 ) ( -320 -320 264 ) ( 192 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 320 -32 8 ) ( 320 -32 0 ) ( 320 -416 8 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -704 -128 ) ( -256 -704 -128 ) ( -768 -320 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 272 -384 256 ) ( 272 -384 264 ) ( 784 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 80 -104 128 ) ( 80 -472 128 ) ( -56 -104 128 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( 72 -472 192 ) ( 72 -104 -128 ) ( 72 -104 192 ) measure/wall64a [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
// brush 16
{
( 192 -320 264 ) ( -320 -320 264 ) ( 192 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -768 -704 -128 ) ( -256 -704 -128 ) ( -768 -320 -128 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -1 -0 128 ] -0 0.5 0.5 0 0 0
( 272 -384 256 ) ( 272 -384 264 ) ( 784 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -704 256 ) ( -320 -320 256 ) ( -320 -704 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 72 -104 192 ) ( 72 -104 -128 ) ( 72 -472 192 ) NULL [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -72 -104 -64 ) ( 64 -472 -64 ) ( -72 -472 -64 ) measure/wall64a [ 1 0 0 16 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
}
// brush 17
{
( 192 -320 264 ) ( -320 -320 264 ) ( 192 -320 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 272 -384 256 ) ( 272 -384 264 ) ( 784 -384 256 ) measure/wall128gr [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -320 -704 256 ) ( -320 -320 256 ) ( -320 -704 264 ) measure/wall128gr [ 0 1 0 128 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( 80 -104 128 ) ( 80 -472 128 ) ( -56 -104 128 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -72 -472 -64 ) ( 64 -472 -64 ) ( -72 -104 -64 ) NULL [ 1 0 0 16 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -64 -472 192 ) ( -64 -104 -128 ) ( -64 -472 -128 ) measure/wall64a [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
}
// entity 1
{
@ -164,3 +272,76 @@
"classname" "env_cubemap"
"origin" "0 0 0"
}
// entity 15
{
"classname" "env_projectedtexture"
"origin" "-64.000000 -576.000000 24.000000"
"texturename" "textures/skies/smudge/bg"
"lightcolor" "255 255 255 1024"
"parentname" "trainy"
}
// entity 16
{
"classname" "prop_dynamic"
"origin" "192.000000 -576.000000 32.000000"
"model" "models/logos/visions.vvm"
"avelocity" "0 90 0"
}
// entity 17
{
"classname" "point_message"
"origin" "0.000000 -576.000000 24.000000"
"message" "env_projectedtexture room"
}
// entity 18
{
"classname" "func_train"
"target" "stop1"
"spawnflags" "8"
"targetname" "trainy"
// brush 0
{
( -56 -568 8 ) ( -56 -592 8 ) ( -80 -568 8 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 48 ] -0 0.5 0.5 0 0 0
( -48 -560 8 ) ( -72 -560 8 ) ( -48 -560 0 ) NULL [ 1 0 0 32 ] [ -0 -0 -1 16 ] -0 0.5 0.5 0 0 0
( -48 -560 8 ) ( -48 -560 0 ) ( -48 -584 8 ) NULL [ 0 1 0 0 ] [ -0 -0 -1 16 ] -0 0.5 0.5 0 0 0
( -80 -592 0 ) ( -56 -592 0 ) ( -80 -568 0 ) NULL [ 1 0 0 48 ] [ -0 -1 -0 48 ] -0 0.5 0.5 0 0 0
( -80 -592 0 ) ( -80 -592 8 ) ( -56 -592 0 ) NULL [ 1 0 0 48 ] [ -0 -0 -1 16 ] -0 0.5 0.5 0 0 0
( -80 -592 0 ) ( -80 -568 0 ) ( -80 -592 8 ) NULL [ 0 1 0 16 ] [ -0 -0 -1 16 ] -0 0.5 0.5 0 0 0
}
// brush 1
{
( -56 -560 16 ) ( -56 -592 16 ) ( -72 -560 16 ) common/origin [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -56 -568 16 ) ( -72 -568 16 ) ( -56 -568 -8 ) common/origin [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -56 -560 16 ) ( -56 -560 -8 ) ( -56 -592 16 ) common/origin [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -72 -592 -8 ) ( -56 -592 -8 ) ( -72 -560 -8 ) common/origin [ 1 0 0 0 ] [ -0 -1 -0 0 ] -0 0.5 0.5 0 0 0
( -72 -584 -8 ) ( -72 -584 16 ) ( -56 -584 -8 ) common/origin [ 1 0 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
( -72 -592 -8 ) ( -72 -560 -8 ) ( -72 -592 16 ) common/origin [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
}
// entity 19
{
"classname" "path_corner"
"origin" "-128.000000 -576.000000 0.000000"
"targetname" "stop1"
"target" "stop2"
"speed" "100"
}
// entity 20
{
"classname" "path_corner"
"origin" "64.000000 -576.000000 0.000000"
"target" "stop1"
"targetname" "stop2"
}
// entity 21
{
"classname" "env_projectedtexture"
"origin" "40.000000 -504.000000 24.000000"
"parentname" "trainy"
}
// entity 22
{
"classname" "env_projectedtexture"
"origin" "40.000000 -648.000000 24.000000"
"parentname" "trainy"
}

View File

@ -854,6 +854,13 @@ CSQC_Ent_Update(float new)
}
dl.ReceiveEntity(readfloat());
break;
case ENT_PROJECTEDTEXTURE:
env_projectedtexture ept = (env_projectedtexture)self;
if (new) {
spawnfunc_env_projectedtexture();
}
ept.ReceiveEntity(readfloat());
break;
case ENT_ENVLASER:
env_laser l = (env_laser)self;
if (new) {

View File

@ -6,6 +6,7 @@
shared/decals.cpp
shared/spraylogo.cpp
shared/func_friction.cpp
shared/env_projectedtexture.cpp
shared/light_dynamic.cpp
shared/trigger_gravity.cpp
shared/info_particle_system.cpp

View File

@ -0,0 +1,304 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED env_projectedtexture (1 0 0) (-8 -8 -8) (8 8 8)
"targetname" Name
"target" Name of an entity in the map that light will point at.
"_light" Color of the spotlight in RGB255 format.
"brightness" Intensity of the spotlight.
"_inner_cone" Angles of the inner spotlight beam. 0 = omnidirectional.
"_cone" Angles of the outer spotlight beam. 0 = omnidirectional.
"distance" Distance that light is allowed to cast, in inches.
"spotlight_radius" Radius of the resulting spotlight that's cast at a wall.
"style" Select one of the hard-coded lightstyles.
"start_active" Override for if the entity should start on or off.
Dynamic light entity. Can be parented to things, it even has some inputs that
may be interesting.
The 'start_active' is a Nuclide specific one. There is no way in Source engine
games to tell the entity to start inactive as far as I can tell.
Trivia:
This entity was introduced in Half-Life 2 (2004).
*/
enumflags
{
PRTEXFL_CHANGED_ORIGIN,
PRTEXFL_CHANGED_ANGLES,
PRTEXFL_CHANGED_LIGHT,
PRTEXFL_CHANGED_INTENSITY,
PRTEXFL_CHANGED_STYLE,
PRTEXFL_CHANGED_STATE,
PRTEXFL_CHANGED_TEXTURE,
PRTEXFL_CHANGED_FOV
};
#ifdef CLIENT
class env_projectedtexture
#else
class env_projectedtexture:CBaseTrigger
#endif
{
vector m_vecLight;
float m_flIntensity;
float m_flInnerCone;
float m_flCone;
float m_flDistance;
float m_flRadius;
float m_flStyle;
string m_strTextureName;
float m_flFOV;
int m_iState;
void(void) env_projectedtexture;
#ifdef CLIENT
virtual void(float) ReceiveEntity;
virtual float(void) predraw;
#else
int m_iStartActive;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual float(entity, float) SendEntity;
virtual void(string, string) SpawnKey;
virtual void(entity, string, string) Input;
virtual void(void) ParentUpdate;
#endif
};
#ifdef CLIENT
float
env_projectedtexture::predraw(void)
{
if (!m_iState) {
return PREDRAW_NEXT;
}
/* TODO: We need to handle the second cone light */
float p = dynamiclight_add(origin, 512, m_vecLight, m_flStyle, m_strTextureName);
dynamiclight_set(p, LFIELD_ANGLES, angles);
dynamiclight_set(p, LFIELD_FLAGS, LFLAG_NORMALMODE | LFLAG_REALTIMEMODE | LFLAG_SHADOWMAP);
if (!m_flStyle)
dynamiclight_set(p, LFIELD_STYLESTRING, "z");
addentity(this);
return PREDRAW_NEXT;
}
void
env_projectedtexture::ReceiveEntity(float flFlags)
{
if (flFlags & PRTEXFL_CHANGED_ORIGIN) {
origin[0] = readcoord();
origin[1] = readcoord();
origin[2] = readcoord();
setorigin(this, origin);
}
if (flFlags & PRTEXFL_CHANGED_ANGLES) {
angles[0] = readfloat();
angles[1] = readfloat();
angles[2] = readfloat();
}
if (flFlags & PRTEXFL_CHANGED_LIGHT) {
m_vecLight[0] = readbyte() / 255;
m_vecLight[1] = readbyte() / 255;
m_vecLight[2] = readbyte() / 255;
}
if (flFlags & PRTEXFL_CHANGED_INTENSITY)
m_flIntensity = readfloat();
if (flFlags & PRTEXFL_CHANGED_STYLE)
m_flStyle = readbyte();
if (flFlags & PRTEXFL_CHANGED_STATE)
m_iState = readbyte();
if (flFlags & PRTEXFL_CHANGED_TEXTURE)
m_strTextureName = readstring();
if (flFlags & PRTEXFL_CHANGED_FOV)
m_flFOV = readfloat();
classname = "env_projectedtexture";
}
#else
void
env_projectedtexture::ParentUpdate(void)
{
if (net_origin != origin) {
net_origin = origin;
SendFlags |= PRTEXFL_CHANGED_ORIGIN;
}
if (net_angles != angles) {
net_angles = angles;
SendFlags |= PRTEXFL_CHANGED_ANGLES;
}
if (m_parent) {
entity p = find(world, ::targetname, m_parent);
if (p) {
CBaseEntity t = (CBaseEntity)p;
vector ofs = m_oldOrigin - t.m_oldOrigin;
SetOrigin(p.origin + ofs);
}
}
}
void
env_projectedtexture::Trigger(entity act, int state)
{
switch (state) {
case TRIG_OFF:
m_iState = 0;
break;
case TRIG_ON:
m_iState = 1;
break;
default:
m_iState = 1 - m_iState;
}
SendFlags |= PRTEXFL_CHANGED_STATE;
}
float
env_projectedtexture::SendEntity(entity ePVSEnt, float flFlags)
{
WriteByte(MSG_ENTITY, ENT_PROJECTEDTEXTURE);
WriteFloat(MSG_ENTITY, flFlags);
if (flFlags & PRTEXFL_CHANGED_ORIGIN) {
WriteCoord(MSG_ENTITY, origin[0]);
WriteCoord(MSG_ENTITY, origin[1]);
WriteCoord(MSG_ENTITY, origin[2]);
}
if (flFlags & PRTEXFL_CHANGED_ANGLES) {
WriteFloat(MSG_ENTITY, angles[0]);
WriteFloat(MSG_ENTITY, angles[1]);
WriteFloat(MSG_ENTITY, angles[2]);
}
if (flFlags & PRTEXFL_CHANGED_LIGHT) {
WriteByte(MSG_ENTITY, m_vecLight[0]);
WriteByte(MSG_ENTITY, m_vecLight[1]);
WriteByte(MSG_ENTITY, m_vecLight[2]);
}
if (flFlags & PRTEXFL_CHANGED_INTENSITY)
WriteFloat(MSG_ENTITY, m_flIntensity);
if (flFlags & PRTEXFL_CHANGED_STYLE)
WriteByte(MSG_ENTITY, m_flStyle);
if (flFlags & PRTEXFL_CHANGED_STATE)
WriteByte(MSG_ENTITY, m_iState);
if (flFlags & PRTEXFL_CHANGED_TEXTURE)
WriteString(MSG_ENTITY, m_strTextureName);
if (flFlags & PRTEXFL_CHANGED_FOV)
WriteFloat(MSG_ENTITY, m_flFOV);
return TRUE;
}
void
env_projectedtexture::Input(entity eAct, string strInput, string strData)
{
switch (strInput) {
case "Color":
m_vecLight = stov(strData);
SendFlags |= PRTEXFL_CHANGED_LIGHT;
break;
case "brightness":
m_flIntensity = stof(strData);
SendFlags |= PRTEXFL_CHANGED_INTENSITY;
break;
case "style":
m_flStyle = stof(strData);
SendFlags |= PRTEXFL_CHANGED_STYLE;
break;
case "TurnOn":
Trigger(eAct, TRIG_ON);
break;
case "TurnOff":
Trigger(eAct, TRIG_OFF);
break;
case "Toggle":
Trigger(eAct, TRIG_TOGGLE);
break;
default:
CBaseTrigger::Input(eAct, strInput, strData);
}
}
void
env_projectedtexture::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "lightcolor":
tokenize(strValue);
m_vecLight[0] = stof(argv(0));
m_vecLight[1] = stof(argv(1));
m_vecLight[2] = stof(argv(2));
m_flIntensity = stof(argv(3));
break;
case "style":
m_flStyle = stof(strValue);
break;
case "texturename":
m_strTextureName = strValue;
break;
case "lightfov":
m_flFOV = stof(strValue);
break;
/* out-of-spec */
case "start_active":
m_iStartActive = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_projectedtexture::Respawn(void)
{
SetSolid(SOLID_NOT);
SetSize([-16,-16,-16], [16,16,16]);
SetOrigin(m_oldOrigin);
SetAngles(m_oldAngle);
m_iState = (m_iStartActive == 1) ? 1 : 0;
}
#endif
void
env_projectedtexture::env_projectedtexture(void)
{
#ifdef CLIENT
drawmask = MASK_ENGINE;
#else
m_vecLight = [255,255,255];
m_flIntensity = 512;
m_iStartActive = 1;
m_strTextureName = "textures/flashlight";
m_flFOV = 90;
CBaseTrigger::CBaseTrigger();
#endif
}

View File

@ -21,6 +21,7 @@ enum
ENT_PLAYER,
ENT_AMBIENTSOUND,
ENT_DLIGHT,
ENT_PROJECTEDTEXTURE,
ENT_ENVLASER,
ENT_PARTSYSTEM,
ENT_SPRITE,