Tachyon (current)  Current Main Branch
Macros | Functions | Variables
sphere.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "tachyon.h"
#include "macros.h"
#include "vector.h"
#include "intersect.h"
#include "util.h"
#include "sphere.h"

Go to the source code of this file.

Macros

#define TACHYON_INTERNAL   1
 
#define SPHERE_PRIVATE
 

Functions

object * newsphere (void *tex, vector ctr, flt rad)
 
static int sphere_bbox (void *obj, vector *min, vector *max)
 
static void sphere_intersect (const sphere *spr, ray *ry)
 
static void sphere_normal (const sphere *spr, const vector *pnt, const ray *incident, vector *N)
 

Variables

static object_methods sphere_methods
 

Macro Definition Documentation

◆ SPHERE_PRIVATE

#define SPHERE_PRIVATE

Definition at line 23 of file sphere.c.

◆ TACHYON_INTERNAL

#define TACHYON_INTERNAL   1

Definition at line 16 of file sphere.c.

Function Documentation

◆ newsphere()

object* newsphere ( void *  tex,
vector  ctr,
flt  rad 
)

Definition at line 33 of file sphere.c.

References sphere_methods.

Referenced by rt_sphere(), and rt_sphere3fv().

◆ sphere_bbox()

static int sphere_bbox ( void *  obj,
vector *  min,
vector *  max 
)
static

Definition at line 47 of file sphere.c.

◆ sphere_intersect()

static void sphere_intersect ( const sphere *  spr,
ray *  ry 
)
static

Definition at line 60 of file sphere.c.

References SQRT, VDOT, and VSUB.

◆ sphere_normal()

static void sphere_normal ( const sphere *  spr,
const vector *  pnt,
const ray *  incident,
vector *  N 
)
static

Definition at line 113 of file sphere.c.

References SQRT, and VDot().

Variable Documentation

◆ sphere_methods

object_methods sphere_methods
static
Initial value:
= {
(void (*)(const void *, void *))(sphere_intersect),
(void (*)(const void *, const void *, const void *, void *))(sphere_normal),
free
}
static int sphere_bbox(void *obj, vector *min, vector *max)
Definition: sphere.c:47
static void sphere_normal(const sphere *spr, const vector *pnt, const ray *incident, vector *N)
Definition: sphere.c:113
static void sphere_intersect(const sphere *spr, ray *ry)
Definition: sphere.c:60

Definition at line 26 of file sphere.c.

Referenced by newsphere().