UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bspslicer.cpp File Reference
#include "bspslicer.h"
#include "../ports/system.h"
#include "../common/common.h"
#include "../shared/images.h"

Go to the source code of this file.

Macros

#define DEPTH   3
 
#define IMAGE_BUFFER_SET_BLACK(buffer, offset)   do {int i; for (i = 0; i < DEPTH; i++) {buffer[offset + i] = 0xFF; } } while(0);
 

Functions

static bool SL_CreatePNGFile (const char *filename, unsigned char *buffer, int width, int height)
 
static void SL_Bresenham (int x0, int y0, int x1, int y1, int width, int height, bool rotated, unsigned char *outputBuffer)
 
static float SL_DistanceToIntersection (const vec3_t origin, const vec3_t vector, const vec3_t planeOrigin, const vec3_t planeNormal)
 
static bool SL_VectorIntersectPlane (const vec3_t origin, const vec3_t vector, const vec3_t planeOrigin, const vec3_t planeNormal, vec3_t intersectPoint)
 
static void SL_SliceTheWorld (const TR_TILE_TYPE *tile, const vec3_t mins, const vec3_t maxs, float stepsize, int scale, bool singleFile, bool multipleContour)
 slice the world in Z planes going from min_z to max_z by stepsize... More...
 
void SL_BSPSlice (const TR_TILE_TYPE *model, float thickness, int scale, bool singleFile, bool multipleContour)
 

Macro Definition Documentation

#define DEPTH   3

Definition at line 11 of file bspslicer.cpp.

Referenced by SL_Bresenham(), and SL_SliceTheWorld().

#define IMAGE_BUFFER_SET_BLACK (   buffer,
  offset 
)    do {int i; for (i = 0; i < DEPTH; i++) {buffer[offset + i] = 0xFF; } } while(0);

Definition at line 26 of file bspslicer.cpp.

Referenced by SL_Bresenham().

Function Documentation

static void SL_Bresenham ( int  x0,
int  y0,
int  x1,
int  y1,
int  width,
int  height,
bool  rotated,
unsigned char *  outputBuffer 
)
static

Definition at line 28 of file bspslicer.cpp.

References DEPTH, and IMAGE_BUFFER_SET_BLACK.

Referenced by SL_SliceTheWorld().

void SL_BSPSlice ( const TR_TILE_TYPE *  model,
float  thickness,
int  scale,
bool  singleFile,
bool  multipleContour 
)
Parameters
[in]modelThe tile-info about the bsp-file we want to slice
[in]thicknessthe thickness of the brushes to render to the 2d map
[in]scaleThe scale of the png as passed via -s param. eg. 4 means: 1/4 or 1 pixels = 4 mapunits
[in]singleFilePut everything in one file. If false, create one file per level. As given by the -c param or the config default
[in]multipleContourAlso draw all contours below the current slice. As given by the -m param or the config default
Todo:
remove these values once the mins/maxs calculation works

Definition at line 315 of file bspslicer.cpp.

References AddPointToBounds(), dBspModel_t::dbmBox, i, MAX_WORLD_WIDTH, AABB::maxs, AABB::mins, PATHFINDING_HEIGHT, SL_SliceTheWorld(), and UNIT_HEIGHT.

Referenced by main().

static bool SL_CreatePNGFile ( const char *  filename,
unsigned char *  buffer,
int  width,
int  height 
)
static

Definition at line 13 of file bspslicer.cpp.

References f, FILE_WRITE, FS_OpenFile(), and R_WritePNG().

Referenced by SL_SliceTheWorld().

static float SL_DistanceToIntersection ( const vec3_t  origin,
const vec3_t  vector,
const vec3_t  planeOrigin,
const vec3_t  planeNormal 
)
static
Note
the "vector" parameter should be NORMALIZED!!!

Definition at line 107 of file bspslicer.cpp.

References DotProduct.

Referenced by SL_VectorIntersectPlane().

static void SL_SliceTheWorld ( const TR_TILE_TYPE *  tile,
const vec3_t  mins,
const vec3_t  maxs,
float  stepsize,
int  scale,
bool  singleFile,
bool  multipleContour 
)
static
static bool SL_VectorIntersectPlane ( const vec3_t  origin,
const vec3_t  vector,
const vec3_t  planeOrigin,
const vec3_t  planeNormal,
vec3_t  intersectPoint 
)
static
Returns
true or false if vector intersects a plane...

Definition at line 123 of file bspslicer.cpp.

References SL_DistanceToIntersection(), VectorAdd, and VectorScale.

Referenced by SL_SliceTheWorld().