Platform: Added example model into test_dlights.

This commit is contained in:
Marco Cawthorne 2020-11-21 16:07:35 +01:00
parent 11d52abec3
commit 9245ae809b
17 changed files with 9134 additions and 12 deletions

View File

@ -171,7 +171,7 @@ varying vec3 lightvector;
/* take existing specular map into account to appoint a new glossy light */
#ifdef SPECULAR
vec3 halfdir = normalize(normalize(eyevector) + nl);
float spec = pow(max(dot(halfdir, normal_f), 0.0), FTE_SPECULAR_EXPONENT * gloss) * float(SPECMUL);
float spec = pow(max(dot(halfdir, normal_f), 0.0), gloss);
diff += l_lightcolourscale.z * spec * specrgb;
#endif

View File

@ -33,6 +33,23 @@ varying mat3 invsurface;
#ifdef VERTEX_SHADER
#include "sys/skeletal.h"
#ifdef CHROME
/* Rotate Light Vector */
vec3 rlv(vec3 axis, vec3 origin, vec3 lightpoint)
{
vec3 offs;
vec3 result;
offs[0] = lightpoint[0] - origin[0];
offs[1] = lightpoint[1] - origin[1];
offs[2] = lightpoint[2] - origin[2];
result[0] = dot(offs[0], axis[0]);
result[1] = dot(offs[1], axis[1]);
result[2] = dot(offs[2], axis[2]);
return result;
}
#endif
void main ()
{
vec3 n, s, t, w;
@ -41,7 +58,20 @@ varying mat3 invsurface;
n = normalize(n);
s = normalize(s);
t = normalize(t);
#ifdef CHROME
vec3 rorg = rlv(vec3(0,0,0), w, e_eyepos);
vec3 viewc = normalize(e_eyepos - w);
float d = dot(n, viewc);
vec3 reflected;
reflected.x = n.x * 2.0 * d - viewc.x;
reflected.y = n.y * 2.0 * d - viewc.y;
reflected.z = n.z * 2.0 * d - viewc.z;
tex_c.x = 0.5 + reflected.y * 0.5;
tex_c.y = 0.5 - reflected.z * 0.5;
#else
tex_c = v_texcoord;
#endif
/* normalmap */
invsurface = mat3(s, t, n);
@ -72,7 +102,6 @@ varying mat3 invsurface;
void main ()
{
vec4 fb_f = texture2D(s_fullbright, tex_c);
vec3 new_e_light_dir = vec3(cos(e_time), sin(e_time), 0);
vec3 light;
#if r_skipDiffuse==0

View File

@ -65,8 +65,7 @@
{
"classname" "info_player_deathmatch"
}
// entity 5
// entity 3
{
"classname" "func_button"
"target" "foobar2"
@ -80,7 +79,7 @@
( 48 -80 64 ) ( 48 -40 64 ) ( 48 -80 72 ) next/rusty7 [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
}
// entity 6
// entity 4
{
"classname" "func_button"
"target" "foobar1"
@ -94,24 +93,26 @@
( 48 112 64 ) ( 48 152 64 ) ( 48 112 72 ) next/rusty7 [ 0 1 0 0 ] [ -0 -0 -1 0 ] -0 0.5 0.5 0 0 0
}
}
// entity 5
{
"classname" "point_message"
"origin" "-160.000000 128.000000 32.000000"
"message" "White dynamic light with no style pattern."
}
// entity 6
{
"classname" "dynamic_light"
"origin" "-192.000000 128.000000 64.000000"
"_light" "255 255 255"
"brightness" "250"
}
// entity 7
{
"classname" "point_message"
"origin" "-160.000000 -64.000000 32.000000"
"message" "Small blinking yellow dynamic light."
}
// entity 8
{
"classname" "dynamic_light"
"origin" "-192.000000 -64.000000 64.000000"
@ -119,12 +120,13 @@
"_light" "255 255 128"
"brightness" "150"
}
// entity 9
{
"classname" "point_message"
"origin" "120.000000 128.000000 32.000000"
"message" "Toggable white flickering dynamic light."
}
// entity 10
{
"classname" "dynamic_light"
"origin" "192.000000 128.000000 64.000000"
@ -133,12 +135,13 @@
"_light" "255 255 255"
"brightness" "250"
}
// entity 11
{
"classname" "point_message"
"origin" "120.000000 -64.000000 32.000000"
"message" "Toggable red slow pulsing dynamic light."
}
// entity 12
{
"classname" "dynamic_light"
"origin" "192.000000 -128.000000 64.000000"
@ -147,3 +150,16 @@
"_light" "255 0 0"
"brightness" "250"
}
// entity 13
{
"classname" "prop_dynamic"
"origin" "160.000000 0.000000 0.000000"
"model" "models/logos/visions.vvm"
"angles" "0 -90 0"
"avelocity" "0 90 0"
}
// entity 14
{
"classname" "env_cubemap"
"origin" "0 0 0"
}

Binary file not shown.

View File

@ -0,0 +1,4 @@
output visions.vvm
materialprefix models/logos/
scale 0.1
scene visions.smd

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,6 @@
// Vera Visions Material
{
program vertexlit_specular#CHROME
diffusemap models/logos/visions_chrome.ktx
fullbrightmap models/logos/visions_chrome.ktx
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
// Vera Visions Material
{
diffusemap models/logos/visions_eye.ktx
normalmap models/logos/visions_eye_n.tga
{
program vertexlit_specular
}
{
clampmap models/logos/visions_eye.tga
blendFunc add
rgbGen wave sin 1 0.2 1 .8
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,9 @@
// Vera Visions Material
{
{
clampmap models/logos/visions_glow.ktx
blendFunc add
rgbGen wave sin 1 0.2 1 .8
tcMod rotate 50
}
}

View File

@ -32,9 +32,11 @@ class prop_dynamic:CBaseEntity
virtual void(void) Init;
virtual void(string, string) SpawnKey;
virtual float(void) predraw;
};
void prop_dynamic::SpawnKey(string strField, string strKey)
void
prop_dynamic::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "modelscale":
@ -43,12 +45,22 @@ void prop_dynamic::SpawnKey(string strField, string strKey)
case "angle":
angles[1] = stof(strKey);
break;
case "avelocity":
avelocity = stov(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
float
prop_dynamic::predraw(void)
{
angles += avelocity * frametime;
return CBaseEntity::predraw();
}
void prop_dynamic::Init(void)
void
prop_dynamic::Init(void)
{
CBaseEntity::Init();
@ -61,7 +73,9 @@ void prop_dynamic::Init(void)
drawmask = MASK_ENGINE;
}
void prop_dynamic::prop_dynamic(void)
void
prop_dynamic::prop_dynamic(void)
{
scale = 1.0f;
Init();
}