| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "BsRTTIType.h"
- #include "BsCoreApplication.h"
- #include "BsMesh.h"
- #include "BsSkeleton.h"
- #include "BsMeshManager.h"
- #include "BsCoreThread.h"
- namespace BansheeEngine
- {
- /** @cond RTTI */
- /** @addtogroup RTTI-Impl-Core
- * @{
- */
- class MeshRTTI : public RTTIType<Mesh, MeshBase, MeshRTTI>
- {
- BS_BEGIN_RTTI_MEMBERS
- BS_RTTI_MEMBER_REFLPTR(mVertexDesc, 0)
- BS_RTTI_MEMBER_PLAIN(mIndexType, 1)
- BS_RTTI_MEMBER_PLAIN(mUsage, 2)
- BS_RTTI_MEMBER_REFLPTR(mSkeleton, 4)
- BS_END_RTTI_MEMBERS
- SPtr<MeshData> getMeshData(Mesh* obj)
- {
- SPtr<MeshData> meshData = obj->allocateSubresourceBuffer(0);
- obj->readSubresource(gCoreAccessor(), 0, meshData);
- gCoreAccessor().submitToCoreThread(true);
- return meshData;
- }
- void setMeshData(Mesh* obj, SPtr<MeshData> meshData)
- {
- obj->mCPUData = meshData;
- }
- public:
- MeshRTTI()
- :mInitMembers(this)
- {
- addReflectablePtrField("mMeshData", 3, &MeshRTTI::getMeshData, &MeshRTTI::setMeshData);
- }
- void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
- {
- Mesh* mesh = static_cast<Mesh*>(obj);
- mesh->initialize();
- }
- SPtr<IReflectable> newRTTIObject() override
- {
- return MeshManager::instance().createEmpty();
- }
- const String& getRTTIName() override
- {
- static String name = "Mesh";
- return name;
- }
- UINT32 getRTTIId() override
- {
- return TID_Mesh;
- }
- };
- /** @} */
- /** @endcond */
- }
|