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