Use provided invDirection from G3D::Ray instead of calculating it ourselves.
This commit is contained in:
parent
9274f5d546
commit
5160cd4f5c
@ -25,17 +25,18 @@
|
|||||||
#ifndef MANGOS_H_BIH
|
#ifndef MANGOS_H_BIH
|
||||||
#define MANGOS_H_BIH
|
#define MANGOS_H_BIH
|
||||||
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <vector>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <Platform/Define.h>
|
|
||||||
|
|
||||||
#include <G3D/Vector3.h>
|
#include <G3D/Vector3.h>
|
||||||
#include <G3D/Ray.h>
|
#include <G3D/Ray.h>
|
||||||
#include <G3D/AABox.h>
|
#include <G3D/AABox.h>
|
||||||
|
|
||||||
|
#include <Platform/Define.h>
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <limits>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#define MAX_STACK_SIZE 64
|
#define MAX_STACK_SIZE 64
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -187,12 +188,11 @@ class BIH
|
|||||||
{
|
{
|
||||||
float intervalMin = -1.f;
|
float intervalMin = -1.f;
|
||||||
float intervalMax = -1.f;
|
float intervalMax = -1.f;
|
||||||
Vector3 org = r.origin();
|
Vector3 const& org = r.origin();
|
||||||
Vector3 dir = r.direction();
|
Vector3 const& dir = r.direction();
|
||||||
Vector3 invDir;
|
Vector3 const& invDir = r.invDirection();
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
invDir[i] = 1.f / dir[i];
|
|
||||||
if (G3D::fuzzyNe(dir[i], 0.0f))
|
if (G3D::fuzzyNe(dir[i], 0.0f))
|
||||||
{
|
{
|
||||||
float t1 = (bounds.low()[i] - org[i]) * invDir[i];
|
float t1 = (bounds.low()[i] - org[i]) * invDir[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user