Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: code/weapon/beam.cpp
- ===================================================================
- --- code/weapon/beam.cpp (Revision 7331)
- +++ code/weapon/beam.cpp (Arbeitskopie)
- @@ -34,6 +34,7 @@
- #include "parse/parselo.h"
- #include "iff_defs/iff_defs.h"
- #include "globalincs/globals.h"
- +#include "graphics/gropengl.h"
- @@ -1568,7 +1569,7 @@
- // add a unique light
- // noise *= 0.1f; // a little less noise here, since we want the beam to generally cast a bright light
- - light_add_point_unique(&near_pt, light_rad * 0.0001f, light_rad, 1.0f, fr, fg, fb, OBJ_INDEX(objp));
- + light_add_point_unique(&near_pt, light_rad * 0.0001f, light_rad,1.0f, fr, fg, fb, OBJ_INDEX(objp));
- }
- // call to add a light source to a large object
- @@ -1609,7 +1610,18 @@
- // add a unique light
- noise *= 0.1f; // a little less noise here, since we want the beam to generally cast a bright light
- - light_add_tube(pt0, pt1, 1.0f, light_rad, 1.0f * noise, fr, fg, fb, OBJ_INDEX(objp));
- +
- + vec3d near_pt, a, b;
- + float dist;
- + vm_vec_dist_to_line(&objp->pos, &bm->last_start, &bm->last_shot, &near_pt, &dist);
- + vm_vec_sub(&a, &bm->last_shot, &bm->last_start);
- + vm_vec_normalize_quick(&a);
- + vm_vec_scale_add(&b, &near_pt, &a, bwi->beam_muzzle_radius * (-3.0f)); // Valathil: Move the light away from the ship somewhat
- +
- + if(dist> light_rad + objp->radius ){
- + return;
- + }
- + light_add_tube(pt0, &b, 1.0f, light_rad, 1.0f * noise, fr, fg, fb, OBJ_INDEX(objp));
- }
- // mark an object as being lit
- @@ -1704,12 +1716,13 @@
- // from a collision
- case 2:
- + // Valathil: Dont render impact lights, handled by tube lighting
- // a few meters from the collision point
- - vm_vec_sub(&dir, &l->bm->last_start, &l->c_point);
- + /*vm_vec_sub(&dir, &l->bm->last_start, &l->c_point);
- vm_vec_normalize_quick(&dir);
- vm_vec_scale_add(&pt, &l->c_point, &dir, bwi->beam_muzzle_radius * 5.0f);
- - beam_add_light_small(l->bm, &Objects[l->objnum], &pt);
- + beam_add_light_small(l->bm, &Objects[l->objnum], &pt);*/
- break;
- }
- }
- Index: code/graphics/gropengllight.cpp
- ===================================================================
- --- code/graphics/gropengllight.cpp (Revision 7331)
- +++ code/graphics/gropengllight.cpp (Arbeitskopie)
- @@ -19,6 +19,7 @@
- #include "graphics/gropenglextension.h"
- #include "graphics/gropengllight.h"
- #include "graphics/gropenglstate.h"
- +#include "graphics/gropenglshader.h"
- #include "graphics/2d.h"
- #include "render/3d.h"
- #include "cmdline/cmdline.h"
- @@ -91,7 +92,7 @@
- switch (FSLight->type) {
- case LT_POINT: {
- // this crap still needs work...
- - GLLight->ConstantAtten = 0.0f;
- + GLLight->ConstantAtten = 1.0f;
- GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb)) * 1.25f;
- GLLight->Specular[0] *= static_point_factor;
- @@ -102,15 +103,35 @@
- }
- case LT_TUBE: {
- +
- + GLLight->ConstantAtten = 1.0f;
- + GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb)) * 1.25f;
- +
- GLLight->Specular[0] *= static_tube_factor;
- GLLight->Specular[1] *= static_tube_factor;
- GLLight->Specular[2] *= static_tube_factor;
- - GLLight->SpotDir[0] = FSLight->vec2.xyz.x * 1.5f;
- - GLLight->SpotDir[1] = FSLight->vec2.xyz.y * 1.5f;
- - GLLight->SpotDir[2] = FSLight->vec2.xyz.z * 1.5f;
- - GLLight->SpotCutOff = 90.0f;
- + GLLight->Position[0] = FSLight->vec2.xyz.x; // Valathil: Use endpoint of tube as light position
- + GLLight->Position[1] = FSLight->vec2.xyz.y;
- + GLLight->Position[2] = FSLight->vec2.xyz.z;
- + GLLight->Position[3] = 1.0f;
- + if( Use_GLSL > 1) {
- +
- + // Valathil: When using shaders pass the beam direction (not normalized IMPORTANT for calculation of tube)
- + vec3d a;
- + vm_vec_sub(&a, &FSLight->vec2, &FSLight->vec);
- + GLLight->SpotDir[0] = a.xyz.x;
- + GLLight->SpotDir[1] = a.xyz.y;
- + GLLight->SpotDir[2] = a.xyz.z;
- + GLLight->SpotCutOff = 90.0f; // Valathil: So shader dectects tube light
- + }
- + else {
- + GLLight->SpotDir[0] = 1.0f; // Valathil: When not using shaders pass a fake spotdir
- + GLLight->SpotDir[1] = 0.0f;
- + GLLight->SpotDir[2] = 0.0f;
- + GLLight->SpotCutOff = 180.0f; //Valathil: Should be a point light not a spot; using tube only for the light sorting
- + }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement