Updated KRHitInfo to current standard and exposed public header.
This commit is contained in:
@@ -10,3 +10,4 @@ add_sources(triangle3.cpp)
|
||||
add_sources(quaternion.cpp)
|
||||
add_sources(matrix4.cpp)
|
||||
add_sources(aabb.cpp)
|
||||
add_sources(hitinfo.cpp)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// KRHitInfo.cpp
|
||||
// HitInfo.cpp
|
||||
// KREngine
|
||||
//
|
||||
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||
@@ -29,10 +29,11 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
#include "KRHitInfo.h"
|
||||
#include "KRContext.h"
|
||||
#include "public/kraken.h"
|
||||
|
||||
KRHitInfo::KRHitInfo()
|
||||
namespace kraken {
|
||||
|
||||
HitInfo::HitInfo()
|
||||
{
|
||||
m_position = Vector3::Zero();
|
||||
m_normal = Vector3::Zero();
|
||||
@@ -40,7 +41,7 @@ KRHitInfo::KRHitInfo()
|
||||
m_node = NULL;
|
||||
}
|
||||
|
||||
KRHitInfo::KRHitInfo(const Vector3 &position, const Vector3 &normal, const float distance, KRNode *node)
|
||||
HitInfo::HitInfo(const Vector3 &position, const Vector3 &normal, const float distance, KRNode *node)
|
||||
{
|
||||
m_position = position;
|
||||
m_normal = normal;
|
||||
@@ -48,7 +49,7 @@ KRHitInfo::KRHitInfo(const Vector3 &position, const Vector3 &normal, const float
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
KRHitInfo::KRHitInfo(const Vector3 &position, const Vector3 &normal, const float distance)
|
||||
HitInfo::HitInfo(const Vector3 &position, const Vector3 &normal, const float distance)
|
||||
{
|
||||
m_position = position;
|
||||
m_normal = normal;
|
||||
@@ -56,37 +57,37 @@ KRHitInfo::KRHitInfo(const Vector3 &position, const Vector3 &normal, const float
|
||||
m_node = NULL;
|
||||
}
|
||||
|
||||
KRHitInfo::~KRHitInfo()
|
||||
HitInfo::~HitInfo()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool KRHitInfo::didHit() const
|
||||
bool HitInfo::didHit() const
|
||||
{
|
||||
return m_normal != Vector3::Zero();
|
||||
}
|
||||
|
||||
Vector3 KRHitInfo::getPosition() const
|
||||
Vector3 HitInfo::getPosition() const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
Vector3 KRHitInfo::getNormal() const
|
||||
Vector3 HitInfo::getNormal() const
|
||||
{
|
||||
return m_normal;
|
||||
}
|
||||
|
||||
float KRHitInfo::getDistance() const
|
||||
float HitInfo::getDistance() const
|
||||
{
|
||||
return m_distance;
|
||||
}
|
||||
|
||||
KRNode *KRHitInfo::getNode() const
|
||||
KRNode *HitInfo::getNode() const
|
||||
{
|
||||
return m_node;
|
||||
}
|
||||
|
||||
KRHitInfo& KRHitInfo::operator =(const KRHitInfo& b)
|
||||
HitInfo& HitInfo::operator =(const HitInfo& b)
|
||||
{
|
||||
m_position = b.m_position;
|
||||
m_normal = b.m_normal;
|
||||
@@ -94,3 +95,6 @@ KRHitInfo& KRHitInfo::operator =(const KRHitInfo& b)
|
||||
m_node = b.m_node;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
@@ -7,4 +7,5 @@ add_public_header(triangle3.h)
|
||||
add_public_header(quaternion.h)
|
||||
add_public_header(aabb.h)
|
||||
add_public_header(matrix4.h)
|
||||
add_public_header(hitinfo.h)
|
||||
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
|
||||
|
||||
@@ -29,30 +29,30 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
#ifndef KRHITINFO_H
|
||||
#define KRHITINFO_H
|
||||
#ifndef KRAKEN_HITINFO_H
|
||||
#define KRAKEN_HITINFO_H
|
||||
|
||||
#include "public/kraken.h"
|
||||
#include "vector3.h"
|
||||
|
||||
using namespace kraken;
|
||||
namespace kraken {
|
||||
|
||||
class KRNode;
|
||||
|
||||
class KRHitInfo {
|
||||
class HitInfo {
|
||||
public:
|
||||
KRHitInfo();
|
||||
KRHitInfo(const Vector3 &position, const Vector3 &normal, const float distance);
|
||||
KRHitInfo(const Vector3 &position, const Vector3 &normal, const float distance, KRNode *node);
|
||||
~KRHitInfo();
|
||||
|
||||
HitInfo();
|
||||
HitInfo(const Vector3 &position, const Vector3 &normal, const float distance);
|
||||
HitInfo(const Vector3 &position, const Vector3 &normal, const float distance, KRNode *node);
|
||||
~HitInfo();
|
||||
|
||||
Vector3 getPosition() const;
|
||||
Vector3 getNormal() const;
|
||||
float getDistance() const;
|
||||
KRNode *getNode() const;
|
||||
bool didHit() const;
|
||||
|
||||
KRHitInfo& operator =(const KRHitInfo& b);
|
||||
|
||||
|
||||
HitInfo& operator =(const HitInfo& b);
|
||||
|
||||
private:
|
||||
KRNode *m_node;
|
||||
Vector3 m_position;
|
||||
@@ -60,4 +60,6 @@ private:
|
||||
float m_distance;
|
||||
};
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
#endif
|
||||
@@ -9,5 +9,6 @@
|
||||
#include "quaternion.h"
|
||||
#include "aabb.h"
|
||||
#include "triangle3.h"
|
||||
#include "hitinfo.h"
|
||||
|
||||
#endif // KRAKEN_H
|
||||
|
||||
Reference in New Issue
Block a user