2021SC@SDUSC
目录
2.GetBoundingSphere和ComputeBoundingSphere
在前几节的内容中提到了ModelLoaeder类,本节就正式来讲Model类的内容。
Model
与Shader与Texture一样,Model同样在最开始将自身的loader作为友元类,同时我们可以看到所谓的模型(model)就是一系列网格的结合。
namespace Loaders { class ModelLoader; }
/**
* A model is a combinaison of meshes
*/
class Model
{
friend class Loaders::ModelLoader;
public:
/**
* Returns the meshes
*/
const std::vector<Mesh*>& GetMeshes() const;
/**
* Returns the material names
*/
const std::vector<std::string>& GetMaterialNames() const;
/**
* Returns the bounding sphere of the model
*/
const OvRendering::Geometry::BoundingSphere& GetBoundingSphere() const;
private:
Model(const std::string& p_path);
~Model();
void ComputeBoundingSphere();
public:
const std::string path;
private:
std::vector<Mesh*> m_meshes;
std::vector<std::string> m_materialNames;
Geometry::BoundingSphere m_boundingSphere;
};
一个模型对象需要包括以下几个重要信息:

本文聚焦于Overload游戏引擎的Model类,深入探讨其构造与析构过程,以及如何计算和获取碰撞球。Model包含了网格、材质和碰撞球信息。构造函数初始化路径,析构函数负责释放网格资源。重点讲解了GetBoundingSphere和ComputeBoundingSphere函数,用于计算包围所有网格的碰撞球,通过对每个网格的碰撞盒信息进行处理来确定碰撞球的中心和半径。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



