| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- //********************************** 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 "BsMorphShapes.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_RTTI_MEMBER_REFLPTR(mMorphShapes, 5)
- 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 Mesh::createEmpty();
- }
- const String& getRTTIName() override
- {
- static String name = "Mesh";
- return name;
- }
- UINT32 getRTTIId() override
- {
- return TID_Mesh;
- }
- };
- /** @} */
- /** @endcond */
- }
|