【Overload游戏引擎】源码分析之十:OvRendering函数库(八)

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

2021SC@SDUSC

目录

Model

1.构造与析构

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::Bound
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值