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

Go to the source code of this file.

Defines

#define PLANE_PRIVATE

Functions

objectnewplane (void *tex, vector ctr, vector norm)
static int plane_bbox (void *obj, vector *min, vector *max)
static void plane_intersect (plane *pln, ray *ry)
static void plane_normal (plane *pln, vector *pnt, ray *incident, vector *N)

Variables

static object_methods plane_methods

Define Documentation

#define PLANE_PRIVATE

Definition at line 71 of file plane.cpp.


Function Documentation

object* newplane ( void *  tex,
vector  ctr,
vector  norm 
)

Definition at line 81 of file plane.cpp.

References plane_methods, rt_getmem(), VDot(), and VNorm().

Referenced by rt_plane().

                                                       {
  plane * p;
  
  p=(plane *) rt_getmem(sizeof(plane));
  memset(p, 0, sizeof(plane));
  p->methods = &plane_methods;

  p->tex = (texture *)tex;
  p->norm = norm;
  VNorm(&p->norm);
  p->d = -VDot(&ctr, &p->norm);

  return (object *) p;
}
static int plane_bbox ( void *  obj,
vector min,
vector max 
) [static]

Definition at line 96 of file plane.cpp.

                                                              {
  return 0;
}
static void plane_intersect ( plane *  pln,
ray ry 
) [static]

Definition at line 100 of file plane.cpp.

References add_intersection(), ray::d, ray::o, and VDot().

                                                   {
  flt t,td;
   
  t=-(pln->d + VDot(&pln->norm, &ry->o));
  td=VDot(&pln->norm, &ry->d); 
  if (td != 0.0) {
    t /= td;
    if (t > 0.0)
      add_intersection(t,(object *) pln, ry);
  }
}
static void plane_normal ( plane *  pln,
vector pnt,
ray incident,
vector N 
) [static]

Definition at line 112 of file plane.cpp.

                                                                                 {
  *N=pln->norm;
}

Variable Documentation

Initial value:
 {
  (void (*)(void *, void *))(plane_intersect),
  (void (*)(void *, void *, void *, void *))(plane_normal),
  plane_bbox, 
  free 
}

Definition at line 74 of file plane.cpp.

Referenced by newplane().


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