Shadowrun: Awakened 29 September 2011 - Build 871
Functions
vector.cpp File Reference
#include "machine.h"
#include "types.h"
#include "macros.h"
Include dependency graph for vector.cpp:

Go to the source code of this file.

Functions

void ColorAccum (color *a, color *b)
void ColorAddS (color *a, color *b, flt s)
void ColorScale (color *a, flt s)
vector Raypnt (ray *a, flt t)
void VAdd (vector *a, vector *b, vector *c)
void VAddS (flt a, vector *A, vector *B, vector *C)
void VCross (vector *a, vector *b, vector *c)
flt VDot (vector *a, vector *b)
flt VLength (vector *a)
void VNorm (vector *a)
void VScale (vector *a, flt s)
void VSub (vector *a, vector *b, vector *c)

Function Documentation

void ColorAccum ( color a,
color b 
)

Definition at line 133 of file vector.cpp.

References color::b, color::g, and color::r.

Referenced by shader().

                                      {
  a->r += b->r;
  a->g += b->g;
  a->b += b->b;
}
void ColorAddS ( color a,
color b,
flt  s 
)

Definition at line 127 of file vector.cpp.

References color::b, color::g, color::r, and test::s.

Referenced by shader().

                                            {
  a->r += b->r * s;
  a->g += b->g * s;
  a->b += b->b * s;
}
void ColorScale ( color a,
flt  s 
)

Definition at line 139 of file vector.cpp.

References color::b, color::g, color::r, and test::s.

Referenced by shade_reflection(), shade_transmission(), and shader().

                                  {
  a->r *= s;
  a->g *= s;
  a->b *= s;
}
vector Raypnt ( ray a,
flt  t 
)

Definition at line 111 of file vector.cpp.

References ray::d, ray::o, vector::x, vector::y, and vector::z.

Referenced by camray(), grid_intersect(), ring_intersect(), shade_reflection(), and shade_transmission().

                              {
  vector temp;

  temp.x=a->o.x + (a->d.x * t);
  temp.y=a->o.y + (a->d.y * t);
  temp.z=a->o.z + (a->d.z * t);

  return temp;
}
void VAdd ( vector a,
vector b,
vector c 
)

Definition at line 93 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by shade_phong(), and tri_bbox().

                                              {
  c->x = (a->x + b->x);
  c->y = (a->y + b->y);
  c->z = (a->z + b->z);
}
void VAddS ( flt  a,
vector A,
vector B,
vector C 
)

Definition at line 105 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by shade_reflection().

                                                      {
  C->x = (a * A->x) + B->x;
  C->y = (a * A->y) + B->y;
  C->z = (a * A->z) + B->z;
}
void VCross ( vector a,
vector b,
vector c 
)

Definition at line 72 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by cylinder_intersect(), fcylinder_intersect(), and rt_camerasetup().

                                                {
  c->x = (a->y * b->z) - (a->z * b->y);
  c->y = (a->z * b->x) - (a->x * b->z);
  c->z = (a->x * b->y) - (a->y * b->x);
}
flt VDot ( vector a,
vector b 
)

Definition at line 68 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by cylinder_normal(), light_normal(), newplane(), plane_intersect(), quadric_normal(), ring_intersect(), ring_normal(), shade_phong(), sphere_normal(), and tri_normal().

                               {
  return (a->x*b->x + a->y*b->y + a->z*b->z);
}
flt VLength ( vector a)

Definition at line 78 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by newstri(), and newtri().

                        {
  return (flt) sqrt((a->x * a->x) + (a->y * a->y) + (a->z * a->z));
}
void VNorm ( vector a)

Definition at line 82 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by box_normal(), cylinder_intersect(), cylinder_normal(), ext_volume_texture(), fcylinder_intersect(), light_normal(), newplane(), quadric_intersect(), quadric_normal(), ring_normal(), rt_camerasetup(), shade_phong(), sphere_normal(), stri_normal(), trace(), and tri_normal().

                       {
  flt len;

  len=sqrt((a->x * a->x) + (a->y * a->y) + (a->z * a->z));
  if (len != 0.0) {
    a->x /= len;
    a->y /= len;
    a->z /= len;
  }
}
void VScale ( vector a,
flt  s 
)

Definition at line 121 of file vector.cpp.

References test::s, vector::x, vector::y, and vector::z.

Referenced by grid_intersect(), and shade_phong().

                               {
  a->x *= s;
  a->y *= s;
  a->z *= s;
}
void VSub ( vector a,
vector b,
vector c 
)

Definition at line 99 of file vector.cpp.

References vector::x, vector::y, and vector::z.

Referenced by box_normal(), camray(), cylinder_normal(), engrid_cell(), light_normal(), newgrid(), newstri(), newtri(), and sphere_normal().

                                              {
  c->x = (a->x - b->x);
  c->y = (a->y - b->y);
  c->z = (a->z - b->z);
}

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net