gem5/splash2/codes/apps/raytrace/bbox.C
Sanchayan Maity 0f4b39775c Fix splash2 benchmark
During the last commit of splash2 benchmark it seems before committing
when we ran "make clean", it effectively undid what the patch at below
link did
http://www.capsl.udel.edu/splash/Download.html

Fix this since without this it is not possible to build the arcane
splash2 benchmark.
2017-04-26 21:33:02 +05:30

101 lines
2.6 KiB
C

/*************************************************************************/
/* */
/* Copyright (c) 1994 Stanford University */
/* */
/* All rights reserved. */
/* */
/* Permission is given to use, copy, and modify this software for any */
/* non-commercial purpose as long as this copyright notice is not */
/* removed. All other uses, including redistribution in whole or in */
/* part, are forbidden without prior written permission. */
/* */
/* This software is provided with absolutely no warranty and no */
/* support. */
/* */
/*************************************************************************/
/*
* NAME
* bbox.c
*
* DESCRIPTION
* This file contains routines that read, inquire, and normalize bounding
* boxes.
*/
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* InquireBoundBoxValues - return min and max bound values for each coordinate axis
*
* SYNOPSIS
* VOID InquireBoundBoxValues(pbb, minx, miny, minz, maxx, maxy, maxz)
* BBOX *pbb; // Ptr to bounding box.
* REAL *minx, *miny, *minz; // Near planes.
* REAL *maxx, *maxy, *maxz; // Far planes.
*
* RETURNS
* Nothing.
*/
VOID InquireBoundBoxValues(BBOX *pbb, REAL *minx, REAL *miny, REAL *minz, REAL *maxx, REAL *maxy, REAL *maxz)
{
*minx = pbb->dnear[0];
*miny = pbb->dnear[1];
*minz = pbb->dnear[2];
*maxx = pbb->dfar[0];
*maxy = pbb->dfar[1];
*maxz = pbb->dfar[2];
}
/*
* NAME
* NormalizeBoundBox - normalize bounding box given a normalization matrix
*
* SYNOPSIS
* VOID NormalizeBoundBox(bv, mat)
* BBOX *pbb; // Ptr to bounding box.
* MATRIX mat; // Normalization matrix.
*
* RETURNS
* Nothing.
*/
VOID NormalizeBoundBox(BBOX *pbb, MATRIX mat)
{
POINT tmp;
/* dnear and dfar are only vectors of length 3 */
tmp[0] = pbb->dnear[0];
tmp[1] = pbb->dnear[1];
tmp[2] = pbb->dnear[2];
tmp[3] = 1.0;
VecMatMult(tmp, mat, tmp);
pbb->dnear[0] = tmp[0];
pbb->dnear[1] = tmp[1];
pbb->dnear[2] = tmp[2];
tmp[0] = pbb->dfar[0];
tmp[1] = pbb->dfar[1];
tmp[2] = pbb->dfar[2];
tmp[3] = 1.0;
VecMatMult(tmp, mat, tmp);
pbb->dfar[0] = tmp[0];
pbb->dfar[1] = tmp[1];
pbb->dfar[2] = tmp[2];
}