Работаем, чтобы попытаться создать базовый класс здесь.
Заголовочный файл
namespace Ogre
{
class Vector3;
class SceneManager;
class Entity;
class Quaternion;
}
class RayCasting
{
public:
bool RayCastFromPoint(
const Ogre::Vector3 &point,
const Ogre::Vector3 &normal,
Ogre::Vector3 &result,
Ogre::SceneManager& scnMgrRef);
private:
void GetMeshInformation(
Ogre::Entity* entity,
Ogre::Vector3* vertices,
size_t &indexCount,
unsigned long* indices,
const Ogre::Vector3& position,
const Ogre::Quaternion& orient,
const Ogre::Vector3& scale
);
};
Исходный файл
#include "RayCasting.h"
#include <OGRE/OgreMath.h>
#include <OgreRay.h>
#include <OgreSceneManager.h>
#include <OgreEntity.h>
#include <OgreSceneNode.h>
#include <OgreNode.h>
#include <OgreMath.h>
#include <OgreSubMesh.h>
#include <OgreSubEntity.h>
#include <OgreMesh.h>
#include <OGRE/OgreVector3.h>
bool RayCasting::RayCastFromPoint(
const Ogre::Vector3 & point,
const Ogre::Vector3 & normal,
Ogre::Vector3 & result,
Ogre::SceneManager& scnMgrRef)
{
// get the entity to check
Ogre::Entity *collEntity = static_cast<Ogre::Entity*>(rayQueryResult[index].movable);
// mesh data to retrieve
size_t indexCount;
Ogre::Vector3* vertices = new Ogre::Vector3();
unsigned long* indices;
// get the mesh information
GetMeshInformation(collEntity, vertices, indexCount, indices,
collEntity->getParentNode()->_getDerivedPosition() // Returns a const Vector3
collEntity->getParentNode()->_getDerivedOrientation(), // Returns a const Vector3
collEntity->getParentNode()->_getDerivedScale()); // Returns a const Vector3
...
}
void RayCasting::GetMeshInformation(
Ogre::Entity * entity,
Ogre::Vector3* vertices,
size_t & indexCount,
unsigned long * indices,
const Ogre::Vector3 & position,
const Ogre::Quaternion & orient,
const Ogre::Vector3 & scale)
{
...
}
... Указывает несущественные подробности реализации.
Задача 1
Оба метода, определенные в RayCasting, выдают ошибку E0147 с указанием
declaration is incompatible with "bool RayCasting::RayCastFromPoint(const Ogre::Vector3 &point, const Ogre::Vector3 &normal, Ogre::Vector3 &result, Ogre::SceneManager &scnMgrRef)" (declared at line 20 of "E:\_PROGRAMMING\GEA-term2\Ogre_Projects\Tutorials2\Ogre3DProjectTemplate\RayCasting.h") Ogre3DProjectTemplate E:\_PROGRAMMING\GEA-term2\Ogre_Projects\Tutorials2\Ogre3DProjectTemplate\RayCasting.cpp 29
`
и
declaration is incompatible with "void RayCasting::GetMeshInformation(Ogre::Entity *entity, Ogre::Vector3 *vertices, size_t &indexCount, unsigned long *indices, const Ogre::Vector3 &position, const Ogre::Quaternion &orient, const Ogre::Vector3 &scale)" (declared at line 27 of "E:\_PROGRAMMING\GEA-term2\Ogre_Projects\Tutorials2\Ogre3DProjectTemplate\RayCasting.h") Ogre3DProjectTemplate E:\_PROGRAMMING\GEA-term2\Ogre_Projects\Tutorials2\Ogre3DProjectTemplate\RayCasting.cpp 140
Задача 2
GetMeshInformation (..., vertices, ...) выдает ошибку E0167 о том, что
cannot convert to incomplete class "const Ogre::Vector3" Ogre3DProjectTemplate E:\_PROGRAMMING\GEA-term2\Ogre_Projects\Tutorials2\Ogre3DProjectTemplate\RayCasting.cpp 91
Задача 3
Более того, строка GetMeshInformation (..., ...-> _ GetDerivedPosition (), ...) генерирует ошибку E0515 с указанием
*"cannot convert to incomplete class const Ogre::Vector3"*, despite the include being present in the Source file. The scale() method also throws this error.
Мой вопрос, поставленный просто:
Что. в аду. происходит.